Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re^2: XML::Simple help

by mirod (Canon)
on Mar 08, 2005 at 07:16 UTC ( [id://437437]=note: print w/replies, xml ) Need Help??


in reply to Re: XML::Simple help
in thread XML::Simple help

A couple of comments:

  • in a handler you can use $_ as an alias for $_[1]
  • unless speed is a big concern, you should really use the proper methods to access attributes, and write $_->att( 'code') instead of $_->{'att'}->{'code'} and $_->set_att( code => $value) instead of $_->{'att'}->{'code'}= $value: there is no guaranty that the attributes will always be in a simple hash, nor than the methods only read or assign to the att hash (they do at the moment, but is very likely to change).

With those changes, the handler code becomes:

sub{    $hash->{$_->att('code')}=$_->att->( 'name'); }

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (5)
As of 2024-04-18 01:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found