Re: [Parseperl-discuss] Good way to determine if a certain bareword is used?
Brought to you by:
adamkennedy
From: Torsten S. <kaf...@gm...> - 2006-10-12 16:08:12
|
On Thu, 2006-10-12 at 12:53 +1000, Adam Kennedy wrote: > If you are just looking for the word, then the top part isn't necesary. > > Just this will be enough. > > $document->find_any( sub { > $_[1]->isa('PPI::Token::Word') > and > $_[1] eq 'Gtk2::Gdk::DisplayManager' > } ); > > I'm not entirely sure why you have the PPI::Statement phrase there, but > if you've been copying code from Perl::Critic that might be some sort of > an optimisation hack? Hmm, I don't know how it happened anymore, but for some reason my early testing seemed to suggest that find_any doesn't "recurse into" statements. Anyway, thanks to you, Dan, and Chris for the help. Works perfectly. -- Bye, -Torsten |