Date: Mon, 30 Jul 2012 19:22:49 +0000 (UTC) From: Sunpoet Po-Chuan Hsieh <sunpoet@FreeBSD.org> To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r301743 - in head/devel: . p5-Safe-Isa Message-ID: <201207301922.q6UJMn4W029851@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: sunpoet Date: Mon Jul 30 19:22:48 2012 New Revision: 301743 URL: http://svn.freebsd.org/changeset/ports/301743 Log: - Add p5-Safe-Isa 1.000002 Since Perl allows us to provide a subroutine reference or a method name to the -> operator when used as a method call, and a subroutine doesn't require the invocant to actually be an object, we can create safe versions of isa, can and friends by using a subroutine reference that only tries to call the method if it's used on an object. e.g. my $isa_Foo = $maybe_an_object->$_call_if_object(isa => 'Foo'); Note that we don't handle trying class names, because many things are valid class names that you might not want to treat as one (like say "Matt") - the is_module_name function from Module::Runtime is a good way to check for something you might be able to call methods on if you want to do that. WWW: http://search.cpan.org/dist/Safe-Isa/ Added: head/devel/p5-Safe-Isa/ head/devel/p5-Safe-Isa/Makefile (contents, props changed) head/devel/p5-Safe-Isa/distinfo (contents, props changed) head/devel/p5-Safe-Isa/pkg-descr (contents, props changed) head/devel/p5-Safe-Isa/pkg-plist (contents, props changed) Modified: head/devel/Makefile Modified: head/devel/Makefile ============================================================================== --- head/devel/Makefile Mon Jul 30 19:19:07 2012 (r301742) +++ head/devel/Makefile Mon Jul 30 19:22:48 2012 (r301743) @@ -2434,6 +2434,7 @@ SUBDIR += p5-SVN-Simple SUBDIR += p5-SVN-Statistics SUBDIR += p5-SVN-Web + SUBDIR += p5-Safe-Isa SUBDIR += p5-Scalar-Defer SUBDIR += p5-Scalar-Listify SUBDIR += p5-Scalar-String Added: head/devel/p5-Safe-Isa/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/devel/p5-Safe-Isa/Makefile Mon Jul 30 19:22:48 2012 (r301743) @@ -0,0 +1,28 @@ +# New ports collection makefile for: p5-Safe-Isa +# Date created: 2012-07-30 +# Whom: Sunpoet Po-Chuan Hsieh <sunpoet@FreeBSD.org> +# +# $FreeBSD$ +# + +PORTNAME= Safe-Isa +PORTVERSION= 1.000.002 +CATEGORIES= devel perl5 +MASTER_SITES= CPAN +PKGNAMEPREFIX= p5- +DISTNAME= ${PORTNAME}-${PORTVERSION:R}${PORTVERSION:E} + +MAINTAINER= sunpoet@FreeBSD.org +COMMENT= Call isa, can, does and DOES safely on things that may not be objects + +LICENSE= ART10 GPLv1 +LICENSE_COMB= dual + +PERL_CONFIGURE= yes + +MAN3= Safe::Isa.3 + +post-patch: + @${REINPLACE_CMD} -e '/NAME/ s|Safe-Isa|Safe::Isa|' ${WRKSRC}/Makefile.PL + +.include <bsd.port.mk> Added: head/devel/p5-Safe-Isa/distinfo ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/devel/p5-Safe-Isa/distinfo Mon Jul 30 19:22:48 2012 (r301743) @@ -0,0 +1,2 @@ +SHA256 (Safe-Isa-1.000002.tar.gz) = 74f3fbbc296183a7cacada11304073a67a4beca4fd77aa2eff89af6fbc23591e +SIZE (Safe-Isa-1.000002.tar.gz) = 3543 Added: head/devel/p5-Safe-Isa/pkg-descr ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/devel/p5-Safe-Isa/pkg-descr Mon Jul 30 19:22:48 2012 (r301743) @@ -0,0 +1,14 @@ +Since Perl allows us to provide a subroutine reference or a method name to the +-> operator when used as a method call, and a subroutine doesn't require the +invocant to actually be an object, we can create safe versions of isa, can and +friends by using a subroutine reference that only tries to call the method if +it's used on an object. + +e.g. my $isa_Foo = $maybe_an_object->$_call_if_object(isa => 'Foo'); + +Note that we don't handle trying class names, because many things are valid +class names that you might not want to treat as one (like say "Matt") - the +is_module_name function from Module::Runtime is a good way to check for +something you might be able to call methods on if you want to do that. + +WWW: http://search.cpan.org/dist/Safe-Isa/ Added: head/devel/p5-Safe-Isa/pkg-plist ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/devel/p5-Safe-Isa/pkg-plist Mon Jul 30 19:22:48 2012 (r301743) @@ -0,0 +1,5 @@ +%%SITE_PERL%%/Safe/Isa.pm +%%SITE_PERL%%/%%PERL_ARCH%%/auto/Safe/Isa/.packlist +@dirrm %%SITE_PERL%%/%%PERL_ARCH%%/auto/Safe/Isa +@dirrmtry %%SITE_PERL%%/%%PERL_ARCH%%/auto/Safe +@dirrmtry %%SITE_PERL%%/Safe
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201207301922.q6UJMn4W029851>