Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re^4: extract tag content from VLC webserver via XML::Rules

by vagabonding electron (Hermit)
on Jun 25, 2013 at 18:19 UTC ( #1040644=note: print w/ replies, xml ) Need Help??


in reply to Re^3: extract tag content from VLC webserver via XML::Rules
in thread extract tag content from VLC webserver via XML::Rules

Just change the line

$nowplaying = $_[1]->{_content}

to

$nowplaying .= $_[1]->{_content}

You just missed the contatenation sign. :-)

Update: Another way could be to populate a data structure with this content, e.g. push @array,$_[1]->{_content} if ... where @array is declared outside the parser.

Update 2:After some thoughts: in fact your version works for me in the presented example too. However I reckon that you have more than one xml in your real script so that the content is lost if you have <info name="now_playing"/> somewhere later (though you should get a warning "Use of uninitialized value" - both in original and contatenation versions (in your OP you have not "use warnings" on).


Comment on Re^4: extract tag content from VLC webserver via XML::Rules
Select or Download Code
Re^5: extract tag content from VLC webserver via XML::Rules
by mcoblentz (Scribe) on Jun 26, 2013 at 15:38 UTC
    I'm fairly new to Perl also and had a question very similar to yours - I was attempting to extract certain tags and values out of an atom feed. The discussion thread, with several examples provided, can be found here:

    http://perlmonks.org/?node_id=1039168

    I recommend the example posted by POJ as it allows you to extract values based on the tag using Rules. Very handy.

    Matt

Re^5: extract tag content from VLC webserver via XML::Rules
by rainforest1155 (Initiate) on Jun 27, 2013 at 11:13 UTC
    Adding the contatenation sign did the trick, thanks!

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (5)
As of 2014-12-28 22:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (183 votes), past polls