Skip to content
This repository was archived by the owner on May 17, 2024. It is now read-only.

Can't locate object method "prepare" #19

Open
bert2002 opened this issue Aug 15, 2017 · 2 comments
Open

Can't locate object method "prepare" #19

bert2002 opened this issue Aug 15, 2017 · 2 comments

Comments

@bert2002
Copy link

Hi,

just trying to use your package, but getting following problem:

Can't locate object method "prepare" via package "0" (perhaps you forgot to load "0"?) at /usr/local/share/perl/5.18.2/Mojo/UserAgent.pm line 306.

Ubuntu 14.04
Mojolicous: 7.40
PubNub::PubSub: 1.0.1 (github version)

Any idea why this is happening?

Thanks

bert

@tofurky
Copy link
Contributor

tofurky commented Nov 26, 2017

i actually have overridden the __ua sub because of this. it needs a Mojo::UserAgent::CookieJar->new. here is what the changed sub i'm using looks like:

sub PubNub::PubSub::__ua {
    my $self = shift;

    return $self->{ua} if exists $self->{ua};

    my $ua = Mojo::UserAgent->new;
    $ua->max_redirects(3);
    $ua->inactivity_timeout($self->{timeout});
    $ua->proxy->detect; # env proxy
    $ua->cookie_jar(Mojo::UserAgent::CookieJar->new);
    $ua->max_connections(100);
    $self->{ua} = $ua;

    return $ua;
}

@tofurky
Copy link
Contributor

tofurky commented Mar 1, 2019

i opened a pr to address this: #23

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

No branches or pull requests

2 participants