Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
sub resize { my $img=shift; my $size=shift; my $geometry; if ( orientation($img)=="portrait" ){ $geometry="x" . $size; } else { $geometry=$size; } print "RESIZE: Geometry is $geometry, received $size, and it s +hould be $sizes{$size}, pic is $img<BR>"; $img->Resize(geometry=>$geometry); return $img; }
Is rather troubling $pic itself changes the size, it seems that sub resize() received a reference instead of a value, but try as I might I couldn't copy the thing properly, including creating a new object and assigning.my $tmppic=resize($pic,$sizes{$size}); and: $ret=$tmppic->Write("jpeg:$dest"); my $tmpheight=$pic->Get('columns'); print "Orig: $tmpheight . Write to $tmppic $dest returned $ret +<BR>";
I'm sure I'm missing something awfully basic here. Anyone feel like slapping me with some clue?
Thanks,
Nir.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Object passed by reference or value?
by Juerd (Abbot) on Jun 01, 2003 at 14:59 UTC |