Thread Hilfe bei LWP::UserAgent (17 answers)
Opened by jogi at 2007-08-07 14:38

jogi
 2007-08-07 21:12
#97737 #97737
User since
2007-07-25
55 Artikel
BenutzerIn
[default_avatar]
Ich kann keinen Header hinzufügen. Mein Code ergiebt:

Code: (dl )
1
2
3
4
5
6
7
8
9
10
11
12
E:\perl>perl mech.pl
Bareword "Accept" not allowed while "strict subs" in use at mech.pl line 8.
Execution of mech.pl aborted due to compilation errors (#1)
(F) With "strict subs" in use, a bareword is only allowed as a
subroutine identifier, in curly brackets or to the left of the "=>"
symbol. Perhaps you need to predeclare a subroutine?

Uncaught exception from user code:
Bareword "Accept" not allowed while "strict subs" in use at mech.pl line
8.
Execution of mech.pl aborted due to compilation errors.
at mech.pl line 17


Code (perl): (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#!/usr/bin/perl -w
use strict;
use diagnostics;
use Data::Dumper;
use WWW::Mechanize;

my $mech = WWW::Mechanize->new;
$mech->add_header( Accept-Language => 'de');
$mech->get('http://www.rapidshare.com/files/47486343/PowerOptions.pdf');

$mech->submit_form(
    button    => 'dl.start',
);

print $mech->content;

print "Drin!\n" if $mech->content =~ /blablabla/;


Ich möchte die Deutschsprachige Version der Seite bekommen. Was stimmt denn mit meinem Code nicht?

View full thread Hilfe bei LWP::UserAgent