in reply to Re^5: Help Getting WWW::Mechanize Link reference array to output to STD_OUT.
in thread Help Getting WWW::Mechanize Link reference array to output to STD_OUT.

So I took your suggestions here, and first off, thanks for the help, I also have been able to progress forward, kinda.

I have changed how I create the Mechanize object to provide autocheck and to show_progress both set to true. It provided me with some other insight that I have worked through and resolved.

However, I have hit the same problem, I have even tried dereferencing the array created, to know avail. I still receive the error of the array or variable being unintialized. I have attempted this by attempting to print it via the previous loop, and by providing this line taken from your code.

my $temp1 = $mech->find_all_links( text_regex => qr/Server-/i ); my @temp2 = shift $temp1; print "@temp2\n";
Perhaps I am just missing something super obvious, since I appear to be in the correct scope, and I am trying to use the one created, even though it appears not feasibly possible. Any other suggestions?

  • Comment on Re^6: Help Getting WWW::Mechanize Link reference array to output to STD_OUT.
  • Download Code

Replies are listed 'Best First'.
Re^7: Help Getting WWW::Mechanize Link reference array to output to STD_OUT.
by Anonymous Monk on Jul 05, 2012 at 16:30 UTC

    Any other suggestions?

    Study my code closer and employ Basic debugging checklist item 4 ( Dumper )

    That part of your original code was right (just like mine). I add  no warnings ... in mine, because the CSS links I'm selecting don't have text/name attributes (returns undef), which warnings will issue a warning for. If the links you're selecting also don't have some attributes, they'll be undef, and you'll get warnings when you try to print them. If you don't it, either disable the warnings (in smallest possible scope) or code-around it

    my $value = $link->$member; defined $value and print "$value\n";

    If it is something else, you'll have to Dumper-up a minimal demonstration , maybe return value of find_all_links or $mech itself ( How do I post a question effectively? )

      I will indeed look closer at your code and post an update later with results and questions if new ones arise. Thanks for your help!

      Update: I figured out the problem, it turns out the site I have been using is not HTML based despite the strong appearance of it being HTML based. I confirmed this by using my same script as written straight with perlmonks here. It returned the content I would expect from perlmonks, but the other site I have been using does not. I have emailed the site administrator to confirm this hypothesis, as well as to see if they have an alternative to what I am originally trying to do. Thank you for the help, it was much appreciated.