Ing. Branislav Gerzo <[EMAIL PROTECTED]> asked:
> hm question is, why die; produces error, and when is no die; 
> in that snippet everything is OK? (I hope:)

Read my lips: die without argument list (as used in your code)
will show the error that occured during the last eval() that was
executed by your code. See the section on die in the perlfunc 
manpage.

Off the top of my head I'd say that when parsing the links on
the page you requested, WWW::Mechanize creates an URI object for
each link that is found. The URI class is subclassed by the URI
request scheme (i.e. URI::http, URI::nttp, ... ) and the needed
subclass is loaded dynamically by URI.pm:

    # scheme not yet known, look for internal or
    # preloaded (with 'use') implementation
    $ic = "URI::$scheme";  # default location

    # turn scheme into a valid perl identifier by a simple tranformation...
    $ic =~ s/\+/_P/g;
    $ic =~ s/\./_O/g;
    $ic =~ s/\-/_/g;


    no strict 'refs';
    # check we actually have one for the scheme:
    unless (@{"${ic}::ISA"}) {
        # Try to load it
        eval "require $ic";
        die $@ if $@ && $@ !~ /Can\'t locate.*in [EMAIL PROTECTED]/;
        return unless @{"${ic}::ISA"};
    }

What happens is that your page has javascript: links embedded.

URI.pm tries to load URI::javascript, but it's not there. Since
URI.pm considers this a non-fatal error, it does not die. However,
the $@ variable remains set. When you die() later in your code,
you are shown that message.

So, is this a bug in WWW::Mechanize? Well, the WWW::Mechanize
FAQ has the following to say on JavaScript:

"JavaScript is entirely client-based, and WWW::Mechanize is a client
that doesn't understand JavaScript."

HTH,
Thomas

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to