Date: Sat, 9 Mar 2013 18:18:56 +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: r313741 - in head/devel: . p5-lexical-underscore Message-ID: <201303091818.r29IIuCB056216@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: sunpoet Date: Sat Mar 9 18:18:56 2013 New Revision: 313741 URL: http://svnweb.freebsd.org/changeset/ports/313741 Log: - Add p5-lexical-underscore 0.001 Starting with Perl 5.10, it is possible to create a lexical version of the Perl default variable $_. Certain Perl constructs like the given keyword automatically use a lexical $_ rather than the global $_. It is occasionallly useful for a sub to be able to access its caller's $_ variable regardless of whether it was lexical or not. The (_) sub prototype is the official way to do so, however there are sometimes disadvantages to this; in particular it can only appear as the final required argument in a prototype, and there is no way of the sub differentiating between an explicitly passed argument and $_. The lexical::underscore function returns a scalar reference to either a lexical $_ variable somewhere up the call stack (using PadWalker magic), or to the global $_ if there was no lexical version. Wrapping lexical::underscore in ${ ... } dereferences the scalar reference, allowing you to access (and even assign to) it. WWW: http://search.cpan.org/dist/lexical-underscore/ Added: head/devel/p5-lexical-underscore/ head/devel/p5-lexical-underscore/Makefile (contents, props changed) head/devel/p5-lexical-underscore/distinfo (contents, props changed) head/devel/p5-lexical-underscore/pkg-descr (contents, props changed) head/devel/p5-lexical-underscore/pkg-plist (contents, props changed) Modified: head/devel/Makefile Modified: head/devel/Makefile ============================================================================== --- head/devel/Makefile Sat Mar 9 18:09:24 2013 (r313740) +++ head/devel/Makefile Sat Mar 9 18:18:56 2013 (r313741) @@ -2951,6 +2951,7 @@ SUBDIR += p5-iCal-Parser SUBDIR += p5-indirect SUBDIR += p5-latest + SUBDIR += p5-lexical-underscore SUBDIR += p5-lib-abs SUBDIR += p5-libalarm SUBDIR += p5-libxml-enno Added: head/devel/p5-lexical-underscore/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/devel/p5-lexical-underscore/Makefile Sat Mar 9 18:18:56 2013 (r313741) @@ -0,0 +1,24 @@ +# Created by: Sunpoet Po-Chuan Hsieh <sunpoet@FreeBSD.org> +# $FreeBSD$ + +PORTNAME= lexical-underscore +PORTVERSION= 0.001 +CATEGORIES= devel perl5 +MASTER_SITES= CPAN +MASTER_SITE_SUBDIR= CPAN:TOBYINK +PKGNAMEPREFIX= p5- + +MAINTAINER= sunpoet@FreeBSD.org +COMMENT= Access lexical underscore of your caller + +LICENSE= ART10 GPLv1 +LICENSE_COMB= dual + +BUILD_DEPENDS= p5-PadWalker>=0:${PORTSDIR}/devel/p5-PadWalker +RUN_DEPENDS:= ${BUILD_DEPENDS} + +PERL_CONFIGURE= yes + +MAN3= lexical::underscore.3 + +.include <bsd.port.mk> Added: head/devel/p5-lexical-underscore/distinfo ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/devel/p5-lexical-underscore/distinfo Sat Mar 9 18:18:56 2013 (r313741) @@ -0,0 +1,2 @@ +SHA256 (lexical-underscore-0.001.tar.gz) = 327eca5d652627a2eda655e8c3806bf5c42af90aad56ea60cff10360548b40ed +SIZE (lexical-underscore-0.001.tar.gz) = 49391 Added: head/devel/p5-lexical-underscore/pkg-descr ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/devel/p5-lexical-underscore/pkg-descr Sat Mar 9 18:18:56 2013 (r313741) @@ -0,0 +1,19 @@ +Starting with Perl 5.10, it is possible to create a lexical version of the Perl +default variable $_. Certain Perl constructs like the given keyword +automatically use a lexical $_ rather than the global $_. + +It is occasionallly useful for a sub to be able to access its caller's $_ +variable regardless of whether it was lexical or not. The (_) sub prototype is +the official way to do so, however there are sometimes disadvantages to this; in +particular it can only appear as the final required argument in a prototype, and +there is no way of the sub differentiating between an explicitly passed argument +and $_. + +The lexical::underscore function returns a scalar reference to either a lexical +$_ variable somewhere up the call stack (using PadWalker magic), or to the +global $_ if there was no lexical version. + +Wrapping lexical::underscore in ${ ... } dereferences the scalar reference, +allowing you to access (and even assign to) it. + +WWW: http://search.cpan.org/dist/lexical-underscore/ Added: head/devel/p5-lexical-underscore/pkg-plist ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/devel/p5-lexical-underscore/pkg-plist Sat Mar 9 18:18:56 2013 (r313741) @@ -0,0 +1,5 @@ +%%SITE_PERL%%/lexical/underscore.pm +%%SITE_PERL%%/%%PERL_ARCH%%/auto/lexical/underscore/.packlist +@dirrmtry %%SITE_PERL%%/%%PERL_ARCH%%/auto/lexical/underscore +@dirrm %%SITE_PERL%%/%%PERL_ARCH%%/auto/lexical +@dirrmtry %%SITE_PERL%%/lexical
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201303091818.r29IIuCB056216>