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 */
#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;
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});
*{$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;';
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};");
}
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 {
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;