Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't call method "is_success" on unblessed reference #121

Open
morebrackets opened this issue Jan 30, 2020 · 1 comment
Open

Can't call method "is_success" on unblessed reference #121

morebrackets opened this issue Jan 30, 2020 · 1 comment

Comments

@morebrackets
Copy link

Code:

use strict;
use Furl;
my $furl = Furl::HTTP->new(
    agent   => '',
    timeout => 3,
);
my $res = $furl->get('https://en.wikipedia.org/');
die $res->status_line unless $res->is_success;
print $res->content;

Error:

Can't call method "is_success" on unblessed reference

@merrilymeredith
Copy link

Furl::HTTP's request does not return an object, it returns a list of simple values. It's the class used inside Furl to make HTTP requests. They can look a bit similar if you've got both doc pages up.

If you're looking for an object, you probably just want Furl->new, rather than Furl::HTTP->new, otherwise if you did intend to use Furl::HTTP, this is everything it returns:

my ($protocol_minor_version, $status_code, $status_message, $response_headers, $response_body)
  = $furlhttp->get('https://somesite.com');

This interface is very "do it yourself."

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants