Codebase list libobject-declare-perl / 174e7eb
version 0.12 ☻ 唐鳳 ☺ authored 17 years ago Shlomi Fish committed 8 years ago
4 changed file(s) with 31 addition(s) and 13 deletion(s). Raw diff Collapse all Expand all
0 [Changes for 0.12 - 2006-07-20]
1
2 * The "isn't" keyword in 0.11 broke Test::More, and I can't find a
3 way to reconcile them, so it's now sadly retracted.
4
05 [Changes for 0.11 - 2006-07-20]
16
27 * Support the prefix ! operator on declarations, so negated ones
38 such as "!is global" or "!global is $x" now work.
9 Requested by: Jesse Vincent
10
11 * Also introduce the "isn't" negated copula.
412 Requested by: Jesse Vincent
513
614 [Changes for 0.10 - 2006-07-20]
1010 requires:
1111 Sub::Override: 0
1212 perl: 5.6.0
13 version: 0.11
13 version: 0.12
1313 -----BEGIN PGP SIGNED MESSAGE-----
1414 Hash: SHA1
1515
16 SHA1 04d9070dfa5588fad73af35209f6981a1a7647d9 Changes
16 SHA1 acf44ea5eae790ea140800e3cab3203b1a4cda2d Changes
1717 SHA1 40d1ebae7cdb431253e1241b0155b5ca3e7e40e7 MANIFEST
18 SHA1 90e9bfcb16bc34dc9dfa48d35a50a97e5dbb90f3 META.yml
18 SHA1 caa15ea366908ec46f4e1cd9eff5f2cc5f72fdc3 META.yml
1919 SHA1 1a54f68d0117308f14369bc50a72cf299e59b7f0 Makefile.PL
2020 SHA1 87b77c5515a7605baab399d52e448479e129ee5b README
2121 SHA1 017bedfcba1e0c72b36301e6ef21b8712b84d175 inc/Module/Install.pm
3131 SHA1 a9037004a2c3096d77169a16da95743eeb813539 inc/Test/Builder/Module.pm
3232 SHA1 45d0149fee8d12082d0aa00fd9202f4b29126824 inc/Test/More.pm
3333 SHA1 e3ccbc21f5ea44e5e64f3d3d19a8850804d5c012 inc/ok.pm
34 SHA1 d7dc6a1040a16a0b8ac1bae86f4b73a330cd9874 lib/Object/Declare.pm
34 SHA1 720b559953d2754a722fc2a8e36e6afc88e51f42 lib/Object/Declare.pm
3535 SHA1 c17d1ce7fd8cd197cb9c57113cd6c671a7fd34b4 t/01-basic.t
3636 -----BEGIN PGP SIGNATURE-----
3737 Version: GnuPG v1.4.3 (Darwin)
3838
39 iD8DBQFEwFb9tLPdNzw1AaARAhKeAJ49GlqAijchYJCX3ufC/orHyVHOvQCdHW4n
40 6g+3HVNZfYVMKEOd1mnhpjs=
41 =G3js
39 iD8DBQFEwFs4tLPdNzw1AaARAp7hAJ4oMEG9mlDIRIe/5cjvKKC4HIU22wCcCUhn
40 g9WKYnbjsl9vrwvIq7D/5KQ=
41 =sWqE
4242 -----END PGP SIGNATURE-----
33 use strict;
44 use warnings;
55
6 $Object::Declare::VERSION = '0.11';
6 $Object::Declare::VERSION = '0.12';
77
88 use Sub::Override;
99
1414
1515 my $mapping = $args{mapping} or return;
1616 my $declarator = $args{declarator} || ['declare'];
17 my $copula = $args{copula} || ['is', 'are', 'isn::t'];
17 my $copula = $args{copula} || ['is', 'are'];
1818
1919 # Both declarator and copula can contain more than one entries;
2020 # normalize into an arrayref if we only have on entry.
6161 # Establish prototypes (same as "use subs") so Sub::Override can work
6262 {
6363 no strict 'refs';
64 *{"$from\::$_"} = \&{"$from\::$_"} for keys %$mapping;
65 *{"UNIVERSAL::$_"} = \&{"UNIVERSAL::$_"} for keys %$copula;
66 *{"$_\::AUTOLOAD"} = \&{"$_\::AUTOLOAD"} for keys %$copula;
64 _predeclare(
65 (map { "$from\::$_" } keys %$mapping),
66 (map { ("UNIVERSAL::$_", "$_\::AUTOLOAD") } keys %$copula),
67 );
68 }
69 }
70
71 # Same as "use sub". All is fair if you predeclare.
72 sub _predeclare {
73 no strict 'refs';
74 no warnings 'redefine';
75 foreach my $sym (@_) {
76 *$sym = \&$sym;
6777 }
6878 }
6979
8696 # Sub::Override cannot handle empty symbol slots. This is normally
8797 # redundant (&import already did that), but we do it here anyway to
8898 # guard against runtime deletion of symbol table entries.
89 *$sym = \&$sym;
99 _predeclare($sym);
90100
91101 # Now replace the symbol for real.
92102 $override->replace($sym => $code);