Hi wise fellow monks.
In one of my projects, I implemented a subclass of HTTP::Requests to add extra attributes and methods to it. Basically as this:
package My::HTTPRequest ; use base qw/HTTP::Request/ ; sub new{ my ($class) = shift ; my $self = $class->SUPER::new(@_) ; $self->{'myA'} = undef ; return bless $self, $class ; } sub myM{ my ($self) = @_ ; ... } ... 1;
Everything is fine appart this problem: I got another module that produce standard HTTP::Requests objects and I want to turn those into my My::HTTPRequests. Basically, what I want to have is this:
my $httpr = AnotherModule::f() ; # $httpr is a plain HTTP::Request object my $ownHttpr = transform($httpr) ; # $ownHttpr should be an instance of My::HTTPRequest with all the prop +erties of $httpr .
According to you, what is the best way to implement the function transform ?
-- Nice photos of naked perl sources here !
In reply to How to turn an object in my own subclass by jeteve
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |