bliako has asked for the wisdom of the Perl Monks concerning the following question:
Greetings patient Monks,
I create a module which inherits from Furl. I want to enhance it with a few own variables. However, it does not work with Furl. Furl->new() returns something like Furl=REF(0x1bfd858) and its dump shows that its data is enclosed in an array(ref) like so: bless(do{\(my $o = bless({....
Usually, this works for me:
package XYZ; use strict; use warnings; our $VERSION = 1; use parent 'LWP::UserAgent'; sub new { my $class = $_[0]; my $self = $class->SUPER::new(); bless($self, $class); # rebless to our own class # setting some own data in self: $self->{'debug'} = 1; $self->{'ABC'} = 42; return $self }
LWP::UserAgent's new() returns LWP::UserAgent=HASH(0x5643905a0d68) (and its dump is like bless({...). That is a hashref where I add my own variables, as in the above code. Buf Furl's new() returns Furl=REF(0x1bfd858) which stubbornly refuses to be accessed.
How can I add my own data in my own module inheriting from Furl?
many thanks, bliako
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Inheritance problem: Not a HASH ref
by Corion (Patriarch) on Feb 25, 2019 at 18:31 UTC | |
by bliako (Abbot) on Feb 25, 2019 at 18:39 UTC | |
by NetWallah (Canon) on Feb 25, 2019 at 19:17 UTC | |
by bliako (Abbot) on Feb 26, 2019 at 13:16 UTC | |
by bliako (Abbot) on Feb 26, 2019 at 14:03 UTC | |
by tobyink (Canon) on Feb 26, 2019 at 17:08 UTC | |
| |
by bliako (Abbot) on Feb 25, 2019 at 19:40 UTC | |
by stevieb (Canon) on Feb 25, 2019 at 23:28 UTC | |
|
Re: Inheritance problem: Not a HASH ref
by haukex (Archbishop) on Feb 25, 2019 at 19:00 UTC | |
by bliako (Abbot) on Feb 26, 2019 at 13:30 UTC | |
|
Re: Inheritance problem: Not a HASH ref
by roboticus (Chancellor) on Feb 26, 2019 at 13:30 UTC | |
by bliako (Abbot) on Feb 26, 2019 at 13:44 UTC | |
by roboticus (Chancellor) on Feb 26, 2019 at 21:08 UTC | |
by bliako (Abbot) on Feb 26, 2019 at 21:29 UTC |