in reply to safe navigation in perl?
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.
|
|---|