Hey group,

A trifle stuck trying to modify the original object in a subclassed function like so:


For instance (simple example):

my $gd_obj = new GD::Image(100,100);

my $new_gd = $gd_obj->foo();

sub GD::Image::foo {
   my $objgd = shift;
   return $objgd->copyRotate90();
}

Works like a charm, now what I'd like to do is make it so that if you call it in void context:

$gd_obj->foo();
instead of
my $new_gd = $gd_obj->foo();

that it modifies $gd_obj instead of returning the copy:

sub GD::Image::foo {
   my $objgd = shift;
   my $new_img = $objgd->copyRotate90();
   return $new_image if defined wantarray;
   # do what to modify original $gd_obj since !defined wantarray ???
}

I've tried modifying $objgd and ${$objgd} but to no avail, any ideas?

TIA

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




Reply via email to