This is not one of my stronger areas, but my initial guess is that you haven't given us enough information. What sort of object is $webcrawler ? Have you tried stepping through with the debugger to find out why that sub in HTTP::Response is getting an undefined $base? Shouldn't you be assigning something to $url_name before using as an arg to  $webcrawler->get ?

While not being able to answer your real question, I'll point out that your grep regex should probably be like this:

my $exts = join( "|", qw/pdf doc ps txt/; @links = grep( !/\.(?:$exts)$/, @links );
The difference is in the period being treated as a literal period (your version treats it as a wildcard), and having the the set of alternative extension strings match only at the end of a link string (your version only matchs $ext3 (.txt) at the end of the string, and the others can match anywhere in the string).

(updated to fix grammar)


In reply to Re: Strange error from Response.pm by graff
in thread Strange error from Response.pm by lampros21_7

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.