CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
Search Posts SEARCH
Who's Online WHO'S
Log in LOG

Home: Perl Programming Help: Beginner:
access array in class method


New User

Jul 26, 2008, 4:42 AM

Post #1 of 1 (921 views)
access array in class method Can't Post

Hi all,

Please help me to find the problem. :)

I have docTopGens class:

package docTopGens;

use wt_w;

sub new


my($self) = {};

my($type, @array) = @_;

my $self->{'topGenArray'} = \@array;

my $temp = ref($self->{'topGenArray'});

bless($self, $type);



here $temp = 'ARRAY';

the problem is that in the following method '$self->{'topGenArray'}' contains nothing and $temp =";

sub get_wt


my $doc_g = $_[1];

my $TopGenArray = $self->{'topGenArray'};

my $temp = ref($self->{'topGenArray'});

my $size = @{$TopGenArray};

for($i=0; $i<$size; $i++)


$wt_w = $topGenArray->[$i];

$id = $wt_w->getDocID();

if($doc_g eq $id)


return $wt_w->getPG_D();



return 0;


the question is how can I access '$self->{'topGenArray'}'
in 'get_wt' function. outside this class the code looks as following:

topGen = new docTopGens @TopGensArray;

my $wt = $topGen->get_wt($Doc_g);



Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives