Stupid Perl/Apache Question

Ben Scott dragonhawk at gmail.com
Thu Dec 7 16:06:27 EST 2006


On 12/7/06, Brian Chabot <brian at datasquire.net> wrote:
> $auth = MIME::Base64::encode("$adminuser:$adminpass") || die "Error: $!\n";
> $mech->add_header (Authorization=>"Basic $auth") || die "Error: $!\n";

  You need to do this:

$mech->credentials ("username" => "password");

> Yet I keep seeing this error when I run the script from the browser:
> Error GETing https://path/to/me/called/script: Can't connect to
> host.domain.tld:443 (Illegal seek) at /var/www/cgi-bin/myscript.cgi line
> 168, referer: http://host.domain.tld/cgi-bin/myscript.cgi

  "Illegal seek"?  That's very strange.  Hmmmm... um, try the method
above first.  Maybe we'll get lucky and that will work.  :)

> The documentation for Mechanize could be a lot better.

http://search.cpan.org/dist/WWW-Mechanize/lib/WWW/Mechanize/Cookbook.pod

spells it out pretty clearly.

  That said, I was actually working with a very similar problem last
night.  I was trying to write a script to suck all the video files off
my TiVo, and kept having problems.  Now, the Tivo embedded webserver
is a bit odd, so some shenanigans were expected.  The problem I had
was getting decent diagnostics in the situation.  I ended up just
calling out to "curl" to do the actual download.

-- Ben


More information about the gnhlug-discuss mailing list