[Bast-commits] r3555 - in trunk/Devel-Declare: . lib/Devel t
matthewt at dev.catalyst.perl.org
matthewt at dev.catalyst.perl.org
Sun Jul 1 20:58:16 GMT 2007
Author: matthewt
Date: 2007-07-01 20:58:15 +0100 (Sun, 01 Jul 2007)
New Revision: 3555
Modified:
trunk/Devel-Declare/Declare.xs
trunk/Devel-Declare/lib/Devel/Declare.pm
trunk/Devel-Declare/t/pack.t
trunk/Devel-Declare/t/proto.t
trunk/Devel-Declare/t/simple.t
Log:
split usepack and namepack
Modified: trunk/Devel-Declare/Declare.xs
===================================================================
--- trunk/Devel-Declare/Declare.xs 2007-07-01 18:42:26 UTC (rev 3554)
+++ trunk/Devel-Declare/Declare.xs 2007-07-01 19:58:15 UTC (rev 3555)
@@ -51,7 +51,7 @@
HV* is_declarator_pack_hash;
SV** is_declarator_flag_ref;
int dd_flags;
- char* cb_args[5];
+ char* cb_args[6];
dSP; /* define stack pointer for later call stuff */
char* retstr;
STRLEN n_a; /* for POPpx */
@@ -185,9 +185,10 @@
#endif
cb_args[0] = HvNAME(stash);
cb_args[1] = GvNAME(kGVOP_gv);
- cb_args[2] = found_name;
- cb_args[3] = found_proto;
- cb_args[4] = NULL;
+ cb_args[2] = HvNAME(PL_curstash);
+ cb_args[3] = found_name;
+ cb_args[4] = found_proto;
+ cb_args[5] = NULL;
if (len && found_proto)
in_declare = 2;
Modified: trunk/Devel-Declare/lib/Devel/Declare.pm
===================================================================
--- trunk/Devel-Declare/lib/Devel/Declare.pm 2007-07-01 18:42:26 UTC (rev 3554)
+++ trunk/Devel-Declare/lib/Devel/Declare.pm 2007-07-01 19:58:15 UTC (rev 3555)
@@ -67,14 +67,14 @@
my $temp_save;
sub init_declare {
- my ($pack, $use, $name, $proto) = @_;
+ my ($usepack, $use, $inpack, $name, $proto) = @_;
my ($name_h, $XX_h, $extra_code)
- = $declarator_handlers{$pack}{$use}->(
- $pack, $use, $name, $proto, defined(wantarray)
+ = $declarator_handlers{$usepack}{$use}->(
+ $usepack, $use, $inpack, $name, $proto, defined(wantarray)
);
($temp_name, $temp_save) = ([], []);
if ($name) {
- $name = "${pack}::${name}" unless $name =~ /::/;
+ $name = "${inpack}::${name}" unless $name =~ /::/;
push(@$temp_name, $name);
no strict 'refs';
push(@$temp_save, \&{$name});
@@ -83,12 +83,12 @@
*{$name} = $name_h;
}
if ($XX_h) {
- push(@$temp_name, "${pack}::X");
+ push(@$temp_name, "${inpack}::X");
no strict 'refs';
- push(@$temp_save, \&{"${pack}::X"});
+ push(@$temp_save, \&{"${inpack}::X"});
no warnings 'redefine';
no warnings 'prototype';
- *{"${pack}::X"} = $XX_h;
+ *{"${inpack}::X"} = $XX_h;
}
if (defined wantarray) {
return $extra_code || '0;';
Modified: trunk/Devel-Declare/t/pack.t
===================================================================
--- trunk/Devel-Declare/t/pack.t 2007-07-01 18:42:26 UTC (rev 3554)
+++ trunk/Devel-Declare/t/pack.t 2007-07-01 19:58:15 UTC (rev 3555)
@@ -5,7 +5,7 @@
sub class { $_[0]->(); }
sub handle_class {
- my ($pack, $use, $name, $proto, $is_block) = @_;
+ my ($usepack, $use, $inpack, $name, $proto, $is_block) = @_;
return (sub (&) { shift; }, undef, "package ${name};");
}
Modified: trunk/Devel-Declare/t/proto.t
===================================================================
--- trunk/Devel-Declare/t/proto.t 2007-07-01 18:42:26 UTC (rev 3554)
+++ trunk/Devel-Declare/t/proto.t 2007-07-01 19:58:15 UTC (rev 3555)
@@ -7,7 +7,7 @@
sub X { "what?" }
sub handle_fun {
- my ($pack, $use, $name, $proto) = @_;
+ my ($usepack, $use, $inpack, $name, $proto) = @_;
my $XX = sub (&) {
my $cr = $_[0];
return sub {
Modified: trunk/Devel-Declare/t/simple.t
===================================================================
--- trunk/Devel-Declare/t/simple.t 2007-07-01 18:42:26 UTC (rev 3554)
+++ trunk/Devel-Declare/t/simple.t 2007-07-01 19:58:15 UTC (rev 3555)
@@ -3,14 +3,14 @@
use Test::More 'no_plan';
sub method {
- my ($pack, $name, $sub) = @_;
+ my ($usepack, $name, $inpack, $sub) = @_;
no strict 'refs';
- *{"${pack}::${name}"} = $sub;
+ *{"${inpack}::${name}"} = $sub;
}
sub handle_method {
- my ($pack, $use, $name) = @_;
- return sub (&) { ($pack, $name, $_[0]); };
+ my ($usepack, $use, $inpack, $name) = @_;
+ return sub (&) { ($usepack, $name, $inpack, $_[0]); };
}
use Devel::Declare 'method' => \&handle_method;
More information about the Bast-commits
mailing list