Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: Problem in parsing XML file using XMl::Twig

by Roger (Parson)
on Aug 16, 2005 at 21:48 UTC ( #484258=note: print w/replies, xml ) Need Help??


in reply to Problem in parsing XML file using XMl::Twig

What do you think $$titlename will interpolate as? It will give you the pid of the process + the text 'titlename'.

Replies are listed 'Best First'.
Re^2: Problem in parsing XML file using XMl::Twig
by davidrw (Prior) on Aug 16, 2005 at 21:57 UTC
    Actually it looks like $$titlename will dereference the scalar instead:
    perl -wle 'use strict; my $bar = 3; my $foo = \$bar; print "$$foo"' # outputs: 3
    But OP probably doesn't want to use $titlename as a scalar ref .. so the line qq[Title[\@Name="$$titlename"]] => should probably be:
    qq[Title[\@Name="$$titlename"]] =>

    to OP: use strict; and use warnings; would have caught this saying something like Can't use string ("MyTitleString") as a SCALAR ref while "strict refs" in use at foo.pl line 1234.
      I am sorry! That was a typo created when I copied the code and pasted it in Perl Monks editor. It is one $. And still the problem exists...
      But I realized that I am doing 'new' in a loop and that's why I am loosing the data.
      Can someone suggest me how to correct it?
      Is there a way to create new Xml::Twig and set the handler later?
      Thanks!
        Is there a way to create new Xml::Twig and set the handler later?
        Looking at the POD (i haven't actually tried it) for XML::Twig it looks like you can use the setTwigHandlers ($handlers) method (note there are several set*Handler*() methods).

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (6)
As of 2022-12-05 11:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?