[ADAMK - Sat Sep 3 06:07:14 2005]:
Show quoted text> ->variables isn't smart enough about the following snippit.
>
> my ($foo, $bar) = ...;
>
> It needs to be enhanced to support it.
The following code works... It's a patch for PPI::Statement::Variable
sub variables {
my $self = shift;
# Get the children we care about
my @schild = grep { $_->significant } $self->children;
shift @schild if isa($schild[0], 'PPI::Token::Label');
# If the second child is a symbol, return its name
if ( isa($schild[1], 'PPI::Token::Symbol') ) {
return $schild[1]->canonical;
}
# If it's a list, return as a list
if ( ref($schild[1]) eq 'PPI::Structure::List' ) {
my @array = grep{$_->significant}$schild[1]->children;
my $symbols = $array[0]->find('PPI::Token::Symbol') or return ();
return map { $_->canonical } @$symbols;
}
# erm... this is unexpected
();
}
Regards,
Renee Baecker