Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: Get a list attributes from a given tag in Mojo::DOM

by Corion (Patriarch)
on Jun 13, 2024 at 10:37 UTC ( [id://11159946]=note: print w/replies, xml ) Need Help??


in reply to SOLVED: Get a list attributes from a given tag in Mojo::DOM

See Mojo::DOM->attr.

my $hash = $dom->attr; say $_ for keys $hash->%*; # for Perl since 5.36 say $_ for keys %$hash; # for all versions of Perl

Replies are listed 'Best First'.
Re^2: Get a list attributes from a given tag in Mojo::DOM
by igoryonya (Pilgrim) on Jun 13, 2024 at 10:50 UTC
    Ye, I got rusty. Forgot about hashref :)
    Is $dom supposed to be?:
    my $dom = Mojo::DOM->new($data)
    from my example?

      The "main" DOM for the whole document is my $dom = Mojo::DOM->new($data);. Then you likely want to ->find() some element in it, which again is a Mojo::DOM object. I'm sure the linked documentation tells you more about the usage.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (3)
As of 2026-01-17 06:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What's your view on AI coding assistants?





    Results (121 votes). Check out past polls.

    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.