Further to my previous answer, and remembering this question, here's an alternative approach:
my @products = $ua->get( $target )->res->dom->find('.product')->each; if( @products ){ # parse products here, print things etc }else{ warn "No products found"; # or don't bother with the else to be sile +nt. }
See also Mojo::Collection and it's size method.
In reply to Re: safe navigation in perl?
by marto
in thread safe navigation in perl?
by morgon
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |