Re: [Parseperl-discuss] Good way to determine if a certain bareword is used?
Brought to you by:
adamkennedy
From: Chris D. <ch...@cl...> - 2006-10-12 01:18:49
|
Hi Torsten, It's easier than that, I think: $document->find_any(sub { $_[1]->isa('PPI::Token::Word') and $_[1] eq 'Gtk2::Gdk::DisplayManager' }); Chris On Oct 11, 2006, at 5:34 PM, Torsten Schoenfeld wrote: > 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 > > > ---------------------------------------------------------------------- > --- > Using Tomcat but need to do more? Need to support web services, > security? > Get stuff done quickly with pre-integrated technology to make your > job easier > Download IBM WebSphere Application Server v.1.0.1 based on Apache > Geronimo > http://sel.as-us.falkag.net/sel? > cmd=lnk&kid=120709&bid=263057&dat=121642 > _______________________________________________ > Parseperl-discuss mailing list > Par...@li... > https://lists.sourceforge.net/lists/listinfo/parseperl-discuss > -- Chris Dolan, Software Developer, Clotho Advanced Media Inc. 608-294-7900, fax 294-7025, 1435 E Main St, Madison WI 53703 vCard: http://www.chrisdolan.net/ChrisDolan.vcf Clotho Advanced Media, Inc. - Creators of MediaLandscape Software (http://www.media-landscape.com/) and partners in the revolutionary Croquet project (http://www.opencroquet.org/) |