> -----Original Message-----
> From: Lakka Sami [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, August 22, 2001 8:51 AM
> To: [EMAIL PROTECTED]
> Subject: OOP & Perl. References to methods
>
>
> Hi,
>
> I'm having problems with OOP and Perl. I have an class
> named DXFobject and an other class that puts these objects
> in an array ( like push @AoO, [dxfInstance] ).
> Now I want to access a objects method thru reference (before
> I put them into an array ) :
>
> func(\$dxfInstance);
>
> sub func
> {
> $ref_to_obj = \$_[0];
>
> @array = $$ref_to_obj->get_data();
> }
>
> but Perl says that it can't call method get_data() on an
> unblessed reference. What should I do?
Yikes, you have to many refs and derefs going on there.
Assuming $dxfInstance is the blessed reference, you should use:
func($dxfInstance);
sub func
{
$ref = $_[0]; # or just $ref = shift;
@array = $ref->get_data();
}
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]