version 0.12
☻ 唐鳳 ☺ authored 17 years ago
Shlomi Fish committed 8 years ago
|
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 |
|
0 | 5 |
[Changes for 0.11 - 2006-07-20]
|
1 | 6 |
|
2 | 7 |
* Support the prefix ! operator on declarations, so negated ones
|
3 | 8 |
such as "!is global" or "!global is $x" now work.
|
|
9 |
Requested by: Jesse Vincent
|
|
10 |
|
|
11 |
* Also introduce the "isn't" negated copula.
|
4 | 12 |
Requested by: Jesse Vincent
|
5 | 13 |
|
6 | 14 |
[Changes for 0.10 - 2006-07-20]
|
10 | 10 |
requires:
|
11 | 11 |
Sub::Override: 0
|
12 | 12 |
perl: 5.6.0
|
13 | |
version: 0.11
|
|
13 |
version: 0.12
|
13 | 13 |
-----BEGIN PGP SIGNED MESSAGE-----
|
14 | 14 |
Hash: SHA1
|
15 | 15 |
|
16 | |
SHA1 04d9070dfa5588fad73af35209f6981a1a7647d9 Changes
|
|
16 |
SHA1 acf44ea5eae790ea140800e3cab3203b1a4cda2d Changes
|
17 | 17 |
SHA1 40d1ebae7cdb431253e1241b0155b5ca3e7e40e7 MANIFEST
|
18 | |
SHA1 90e9bfcb16bc34dc9dfa48d35a50a97e5dbb90f3 META.yml
|
|
18 |
SHA1 caa15ea366908ec46f4e1cd9eff5f2cc5f72fdc3 META.yml
|
19 | 19 |
SHA1 1a54f68d0117308f14369bc50a72cf299e59b7f0 Makefile.PL
|
20 | 20 |
SHA1 87b77c5515a7605baab399d52e448479e129ee5b README
|
21 | 21 |
SHA1 017bedfcba1e0c72b36301e6ef21b8712b84d175 inc/Module/Install.pm
|
|
31 | 31 |
SHA1 a9037004a2c3096d77169a16da95743eeb813539 inc/Test/Builder/Module.pm
|
32 | 32 |
SHA1 45d0149fee8d12082d0aa00fd9202f4b29126824 inc/Test/More.pm
|
33 | 33 |
SHA1 e3ccbc21f5ea44e5e64f3d3d19a8850804d5c012 inc/ok.pm
|
34 | |
SHA1 d7dc6a1040a16a0b8ac1bae86f4b73a330cd9874 lib/Object/Declare.pm
|
|
34 |
SHA1 720b559953d2754a722fc2a8e36e6afc88e51f42 lib/Object/Declare.pm
|
35 | 35 |
SHA1 c17d1ce7fd8cd197cb9c57113cd6c671a7fd34b4 t/01-basic.t
|
36 | 36 |
-----BEGIN PGP SIGNATURE-----
|
37 | 37 |
Version: GnuPG v1.4.3 (Darwin)
|
38 | 38 |
|
39 | |
iD8DBQFEwFb9tLPdNzw1AaARAhKeAJ49GlqAijchYJCX3ufC/orHyVHOvQCdHW4n
|
40 | |
6g+3HVNZfYVMKEOd1mnhpjs=
|
41 | |
=G3js
|
|
39 |
iD8DBQFEwFs4tLPdNzw1AaARAp7hAJ4oMEG9mlDIRIe/5cjvKKC4HIU22wCcCUhn
|
|
40 |
g9WKYnbjsl9vrwvIq7D/5KQ=
|
|
41 |
=sWqE
|
42 | 42 |
-----END PGP SIGNATURE-----
|
3 | 3 |
use strict;
|
4 | 4 |
use warnings;
|
5 | 5 |
|
6 | |
$Object::Declare::VERSION = '0.11';
|
|
6 |
$Object::Declare::VERSION = '0.12';
|
7 | 7 |
|
8 | 8 |
use Sub::Override;
|
9 | 9 |
|
|
14 | 14 |
|
15 | 15 |
my $mapping = $args{mapping} or return;
|
16 | 16 |
my $declarator = $args{declarator} || ['declare'];
|
17 | |
my $copula = $args{copula} || ['is', 'are', 'isn::t'];
|
|
17 |
my $copula = $args{copula} || ['is', 'are'];
|
18 | 18 |
|
19 | 19 |
# Both declarator and copula can contain more than one entries;
|
20 | 20 |
# normalize into an arrayref if we only have on entry.
|
|
61 | 61 |
# Establish prototypes (same as "use subs") so Sub::Override can work
|
62 | 62 |
{
|
63 | 63 |
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;
|
67 | 77 |
}
|
68 | 78 |
}
|
69 | 79 |
|
|
86 | 96 |
# Sub::Override cannot handle empty symbol slots. This is normally
|
87 | 97 |
# redundant (&import already did that), but we do it here anyway to
|
88 | 98 |
# guard against runtime deletion of symbol table entries.
|
89 | |
*$sym = \&$sym;
|
|
99 |
_predeclare($sym);
|
90 | 100 |
|
91 | 101 |
# Now replace the symbol for real.
|
92 | 102 |
$override->replace($sym => $code);
|