Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: how to add a PPI:Statement to a document?

by Anonymous Monk
on Dec 29, 2007 at 11:39 UTC ( #659467=note: print w/replies, xml ) Need Help??


in reply to how to add a PPI:Statement to a document?

Watch carefully
$Document = PPI::Document->new(\'print "Hello World!\n"'); $lastVar->insert_after( $Document );

Replies are listed 'Best First'.
Re^2: how to add a PPI:Statement to a document?
by Anonymous Monk on Jan 02, 2008 at 07:20 UTC
    $Document = PPI::Document->new(\'print "Hello World!\n"'); $lastVar->insert_after( $Document->find_first('Statement') );
    A little more verbose, but much clearer in intent.
      In fact, you also should just throw away the other document immediately.
      $lastVar->insert_after( PPI::Document->new('print "Hello World!\n")->f +ind_first('Statement') );

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://659467]
help
Chatterbox?
[Lady_Aleena]: I wish I could think of a simple script to find out what modules my modules use (if any and including my other modules) and whicch of my modules use my modules (if any).
[LanX]: inspect %INC ?
[Lady_Aleena]: LanX, for every module I've written?
[huck]: Lady_Aleena see Re: pl script in webserver and/or Re: pl script in webserver for what they use
[Lady_Aleena]: Wouldn't I have to run the modules somehow to get their %INC?
[huck]: the first one works just fine from the command line but requires editing
[huck]: but neither will handle autoloads

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (9)
As of 2017-05-27 00:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?