[Parseperl-discuss] Good way to determine if a certain bareword is used?
Brought to you by:
adamkennedy
From: Torsten S. <kaf...@gm...> - 2006-10-11 22:35:00
|
Aloha, I recently started using PPI to begin work on a module that finds out which version of Gtk2/gtk+ a given bunch of code requires. To do that, I need to know if, for example, the bareword "Gtk2::Gdk::DisplayManager" is used anywhere. Here's what I came up with: $document->find_any(sub { $_[1]->isa ("PPI::Statement") and $_[1]->find_any(sub { $_[1]->isa ("PPI::Token::Word") and $_[1] eq "Gtk2::Gdk::DisplayManager" }) }); Is this a good way to express the requirements? Is it correct? Is there a better way? -- Keep up the great work! -Torsten |