sub new {
- my ($class) = @_;
- my $self->{offset} = $_[2] || 0;
- $self->{declarator} = $_[1];
+ my ($class,$decl,$offset) = @_;
+ my $self = {};
+ $self->{offset} = $offset || 0;
+ $self->{declarator} = $decl;
bless($self,$class);
}
}
Devel::Declare::shadow_sub($name, $sub);
+
+ return $sub;
}
=head1 CODE
use B::Hooks::EndOfScope;
use Data::Dumper;
-#doesnt actualy 'parse' a block, just detects the start.
+# doesnt actualy 'parse' a block, just detects the start.
sub new {
my ($parser) = @_;
}
}
-
sub inject_before {
my ($self,$code) = @_;
}
sub code { inject_begin(@_); };
-#inject code into start of block
+# inject code into start of block
sub inject_begin {
my ($self, $code) = @_;
$self->{parser}->line($l);
}
-#injects code after the end of the block
+# injects code after the end of the block
sub inject_after {
my ($self, $code) = @_;
$code =~ s/\n/\ /g;
no strict 'refs';
$name = $self->{parser}->package."::$name" if $name;
$self->{name} = $name;
- $self->{parser}->shadow($name);
+ return $self->{parser}->shadow($name);
}
+sub execute {
+ my ($self) = @_;
+}
-#set end of scope code
+# set end of scope code
# !! B:H:EOS won't allow you to inject code into the block
sub terminate {
my ($self) = @_;