Stupid Perl/Apache Question

Ben Scott dragonhawk at gmail.com
Thu Dec 7 17:05:27 EST 2006


On 12/7/06, Brian Chabot <brian at datasquire.net> wrote:
> ... we must have changed something... as the error is identical.

  Huh?  :)

> That goes before $mech->get right?

  Yup.

> ...and from the docs, is it:
> $mech->credentials ("username" => "password");
> $mech->credentials ("username","password");
> ...or does it matter?

  It doesn't matter.  They're both variants of the same thing.
Remember, this is Perl, where there are 50 different ways to do
anything.  Sometimes that's useful, sometimes less so.

>> http://search.cpan.org/dist/WWW-Mechanize/lib/WWW/Mechanize/Cookbook.pod
>> spells it out pretty clearly.
>
> Not really.  (See above)

  Well, it's clear what one is *supposed* to do.  It just doesn't work.  ;-)

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

  Damn.

  "Illegal seek" is odd to see here.  I'm no expert, but I don't think
one *can* do a seek() on a socket.  That explains why it's illegal, of
course, but then the question is, how the hell did a call to seek()
get involved at all?

  Have you confirmed that the URL and credentials you are attempting
to use work in a regular browser?  Does the browser do anything
strange when you try that?

  Are you doing anything funky in the context around the call to $mech->get()?

  Have you tried reducing it to a simple test case, i.e., a script
with just a few short lines to instantiate the UA, set the
credentials, and attempt to get the resource?

  You mentioned this used to work on an old machine.  Can you try the
code on a third machine, to see if maybe something's just borked on
this one system?

  Distribution and release?  Did Perl and all the modules you are
using come with the distribution, or did you have to build some of
them yourself, or use third-party packages?

> If I had my way, I wouldn't need to use Mech at all.  I'd be accessing
> the db directly and using PHP or just bash scripting with curl, too.
> The job's requirements are where I need to scrape in perl...

system qq("curl $url -o $outfile"); # valid Perl code  ;-)

-- Ben


More information about the gnhlug-discuss mailing list