Pass/Access Object Attributes to/from another Class
Posted
by
Namuna
on Stack Overflow
See other posts from Stack Overflow
or by Namuna
Published on 2012-08-31T16:17:10Z
Indexed on
2012/08/31
21:38 UTC
Read the original article
Hit count: 108
perl
Issue: Unable to access parent object attributes
Verification.pm: (Parent class)
package Verification;
use Verification::Proid;
sub Proid
{
my $self = shift;
print Dumper($self);
my $result = Verification::Proid->validate($self);
return $result;
}
Dumper result
$VAR1 = bless( {
'event_name' => 'validate',
'Verification_Type' => 'Proid',
'Verification_Value' => 'ecmetric',
'xml_request' => bless( do{\(my $o = 148410616)}, 'XML::LibXML::Document' ),
'Verification_Options' => [
{
'2' => 'UNIX'
}
],
'Verification_ID' => '3'
}, 'Verification' );
Proid.pm: (Child class)
package Verification::Proid;
our @ISA = qw(Verification);
sub validate
{
my $self = shift;
print Dumper($self);
my $result;
foreach my $validation_type ( @$self->{Verification_Options} )
{
do stuff...
}
}
Dumper result
$VAR1 = 'Verification::Proid';
What am I doing wrong that the child class isn't properly getting all the attributes from the object passed to it?
Thank you!
© Stack Overflow or respective owner