From: Florian Ragwitz Date: Fri, 7 Nov 2008 06:51:47 +0000 (+0000) Subject: Add strip_indent to Ctx::Simple. X-Git-Tag: 0.005000~29 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=c0f4fa586c8c82e33e0fadd8550207a1bddcdee3;p=p5sagit%2FDevel-Declare.git Add strip_indent to Ctx::Simple. --- diff --git a/lib/Devel/Declare/Context/Simple.pm b/lib/Devel/Declare/Context/Simple.pm index 174e072..afbcaf4 100644 --- a/lib/Devel/Declare/Context/Simple.pm +++ b/lib/Devel/Declare/Context/Simple.pm @@ -68,6 +68,21 @@ sub strip_name { return; } +sub strip_ident { + my $self = shift; + $self->skipspace; + if (my $len = Devel::Declare::toke_scan_ident( $self->offset )) { + my $linestr = $self->get_linestr(); + my $ident = substr( $linestr, $self->offset, $len ); + substr( $linestr, $self->offset, $len ) = ''; + $self->set_linestr($linestr); + return $ident; + } + + $self->skipspace; + return; +} + sub strip_proto { my $self = shift; $self->skipspace;