mirror of
https://git.FreeBSD.org/ports.git
synced 2025-01-14 07:43:06 +00:00
- 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/
This commit is contained in:
parent
f742136b23
commit
e03aa71b33
Notes:
svn2git
2021-03-31 03:12:20 +00:00
svn path=/head/; revision=301743
@ -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
|
||||
|
28
devel/p5-Safe-Isa/Makefile
Normal file
28
devel/p5-Safe-Isa/Makefile
Normal file
@ -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>
|
2
devel/p5-Safe-Isa/distinfo
Normal file
2
devel/p5-Safe-Isa/distinfo
Normal file
@ -0,0 +1,2 @@
|
||||
SHA256 (Safe-Isa-1.000002.tar.gz) = 74f3fbbc296183a7cacada11304073a67a4beca4fd77aa2eff89af6fbc23591e
|
||||
SIZE (Safe-Isa-1.000002.tar.gz) = 3543
|
14
devel/p5-Safe-Isa/pkg-descr
Normal file
14
devel/p5-Safe-Isa/pkg-descr
Normal file
@ -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/
|
5
devel/p5-Safe-Isa/pkg-plist
Normal file
5
devel/p5-Safe-Isa/pkg-plist
Normal file
@ -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
|
Loading…
Reference in New Issue
Block a user