in reply to Re^2: undefined value as filehandle from Curl.pm
in thread undefined value as filehandle from Curl.pm
First, this *is* your code, and you're not checking whether the file opened successfully for read. Second, why are you breaking encapsulation by modifying the innards of the object?
Also, where are you getting the examples for calling setopt()? Everything I've found takes a reference, which you're not passing in.
Here's an example from Net::Curl::Easy:
$self->setopt( CURLOPT_FILE, \$self->{body} ); $self->setopt( CURLOPT_HEADERDATA, \$self->{head} );
I don't see any direct use examples for CURLOPT_READDATA.
I'm not in a position to test at the moment, so this is just a very wild guess, but first, ensure you handle opens correctly, then try the code as-is. If it still fails, try changing $lwpcurl->{agent}->setopt( CURLOPT_READDATA, $fh ); to $lwpcurl->{agent}->setopt( CURLOPT_FILE, $fh );. If that still doesn't work, try <c>$lwpcurl->{agent}->setopt( CURLOPT_FILE, \$fh );. All that said, I really, really don't think that modifying the agent like that was intended by the developers (I could be wrong though).
Can you please post a link to where you're taking your examples from, or what you're basing your code on?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: undefined value as filehandle from Curl.pm
by wanderedinn (Sexton) on Jun 28, 2016 at 16:14 UTC | |
by stevieb (Canon) on Jun 28, 2016 at 16:21 UTC | |
by wanderedinn (Sexton) on Jun 28, 2016 at 16:29 UTC | |
|
Re^4: undefined value as filehandle from Curl.pm
by wanderedinn (Sexton) on Jun 28, 2016 at 19:17 UTC |