How to get an array to work with oops concepts in Perl
- by superstar
Hello guys,
I need some help regarding the arrays in Perl
This is the constructor i have.
sub new {
my $class = shift;
my @includeobjects = ();
my @excludeobjects = ();
my $Packet = {
_PacketName => shift,
_Platform => shift,
_Version => shift,
@_IncludePath => @includeobjects,
};
bless $Packet, $class;
return $Packet;
}
sub SetPacketName {
my ( $Packet, $PacketName ) = @_;
$Packet->{_PacketName} = $PacketName if defined($PacketName);
return $Packet->{_PacketName};
}
sub SetIncludePath {
my ( $Packet, @IncludePath ) = @_;
$Packet->{@_IncludePath} = @IncludePath;
return $Packet->{@_IncludePath};
}
sub GetPacketName {
my( $Packet ) = @_;
return $Packet->{_PacketName};
}
sub GetIncludePath {
my( $Packet ) = @_;
return $Packet->{@_IncludePath};
}
The get and set methods work fine for PacketName. But since IncludePath is an array, I could not get it work. The declaration is what i am not able to get right
Any suggestions please...