Commit 99d1b118 authored by sunpoet's avatar sunpoet
Browse files

- 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/
parent 594286d1
......@@ -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
......
# 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>
SHA256 (Safe-Isa-1.000002.tar.gz) = 74f3fbbc296183a7cacada11304073a67a4beca4fd77aa2eff89af6fbc23591e
SIZE (Safe-Isa-1.000002.tar.gz) = 3543
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/
%%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
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment