Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: Problem with PPI HereDoc's

by Khen1950fx (Canon)
on Nov 21, 2011 at 03:29 UTC ( #939129=note: print w/ replies, xml ) Need Help??


in reply to Problem with PPI HereDoc's

You need to create a new PPI::Document object for each here-doc. I say that because I tried calling two here-docs, but PPI would only give me one. Also, I couldn't replicate your output. How did you replace 'Something' with 'else'? I would modify the docs like this:

#!/usr/bin/perl use strict; use warnings; use PPI; use PPI::Dumper; my $data; ($data = <<'ENDOFSQL') =~ s/Something/else/; Something ENDOFSQL my($Document) = PPI::Document->new(\$data); my $Dumper = PPI::Dumper->new($Document); $Dumper->print;


Comment on Re: Problem with PPI HereDoc's
Download Code
Re^2: Problem with PPI HereDoc's
by clueless newbie (Hermit) on Nov 21, 2011 at 12:13 UTC

    Hi, Khen1950fx,

    Thank you for replying.

    I think

    push @NewHereDoc_a,PPI::Document->new(\( $HereDoc_o->content() ."\n" ."/* $Comment_S\n" # Comment .join('',$HereDoc_o->heredoc()) # ... origina +l commented out ."*/\n" # .$NewText_s # ... replace +ment ."\n" .$HereDoc_o->terminator() ));

    should create a new PPI::Document object for each of the HereDocs that I want to update.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://939129]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (11)
As of 2015-07-03 09:25 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (51 votes), past polls