Thread Forum abschicken mit WWW::Mechanize (34 answers)
Opened by jogi at 2007-10-11 21:33

jogi
 2007-10-11 23:19
#100707 #100707
User since
2007-07-25
55 Artikel
BenutzerIn
[default_avatar]
Ich hab schon wieder ein Problem.

Code (perl): (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/usr/bin/perl -w
use strict;
use diagnostics;
use Data::Dumper;
use WWW::Mechanize;

my $mech = WWW::Mechanize->new;

$mech->proxy(['http', 'ftp'], '81.29.249.17:3128');

$mech->add_header( 'accept-language' => 'de');

$mech->get("http://www.rapidshare.com/files/47486343/PowerOptions.pdf");

$mech->click_button( number => "2" );

my $content = $mech->content;

if ( $content =~ /\(\w+\s\w+\s(.*)\s\w+\)/i ) {
        print "warte $1 Minute(n).";
}
 
elsif ( $content =~ /Kein Premium-User/i ) {
        print "Kein Premium-User.\n";
}
elsif ( $content =~ /Zu viele Benutzer laden gerade Dateien runter/i ) {
        print "Zu viele Benutzer laden gerade Dateien runter."
}
else { print "Unknown error"; }


Die Proxy-Zeile produziert folgende Fehlermeldung.

Quote
E:\perl>perl proxy3.pl
Use of uninitialized value in hash element at C:/Perl/lib/LWP/Protocol.pm line
55 (#1)
(W uninitialized) An undefined value was used as if it were already
defined. It was interpreted as a "" or a 0, but maybe it was a mistake.
To suppress this warning assign a defined value to your variables.

To help you figure out what was undefined, perl tells you what operation
you used the undefined value in. Note, however, that perl optimizes your
program and the operation displayed in the warning may not necessarily
appear literally in your program. For example, "that $foo" is
usually optimized into "that " . $foo, and the warning will refer to
the concatenation (.) operator, even though there is no . in your
program.

Use of uninitialized value in pattern match (m//) at
C:/Perl/lib/LWP/Protocol.pm line 58 (#1)
Use of uninitialized value in concatenation (.) or string at
C:/Perl/lib/LWP/Protocol.pm line 38 (#1)
Use of uninitialized value in string eq at C:/Perl/lib/LWP/UserAgent.pm line
195 (#1)

Can't call method "find_input" on an undefined value at
C:/Perl/site/lib/WWW/Mechanize.pm line 1586 (#2)
(F) You used the syntax of a method call, but the slot filled by the
object reference or package name contains an undefined value. Something
like this will reproduce the error:

$BADREF = undef;
process $BADREF 1,2,3;
$BADREF->process(1,2,3);

Uncaught exception from user code:
Can't call method "find_input" on an undefined value at C:/Perl/site/lib
/WWW/Mechanize.pm line 1586.
at C:/Perl/site/lib/WWW/Mechanize.pm line 1586
WWW::Mechanize::click_button('WWW::Mechanize=HASH(0x1f6efb8)', 'number',
2) called at proxy3.pl line 17


Kann mir bitte jemand sagen was hier falsch läuft? Wenn ich die Proxy Zeile auskommentiere dann geht's.

Gruß,
jogi

View full thread Forum abschicken mit WWW::Mechanize