I have this text and when I do:
print STDERR (Mojo::DOM->new($args->{'body'})->at('iframe'));
output:
<iframe allowfullscreen="" frameborder="0" height="360" scrolling="no"
src="http://localhost:8000/embed/static/clips/2012/12/17/28210/test-rush" width="480">
</iframe>`
It is just printing the first iframe
in the body. Why is it not printing the other iframes and can I put all iframes in an array?
According to
Mojo::Dom
documentation. Theat
function only finds the first element matching. So it should only return 1. I thinkfind
is what you are after, as it returns a collection that matchesprints your iframes:
EDIT:
You can iterate over each iframe with
each
function ofMojo::Collection
:my $collection = $dom->find('iframe');
You can add an @ to loop over it like an array: