Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Can't locate object method

by ITmajor (Beadle)
on Jul 28, 2008 at 21:31 UTC ( #700667=perlquestion: print w/replies, xml ) Need Help??

ITmajor has asked for the wisdom of the Perl Monks concerning the following question:

When I run my code I get this error "Can't locate object method 'fetchrow_array' via package 'IO::File' at line 81 <_GEN_0> line 10." What am I doing wrong?
my $fh = IO::File->new_tmpfile or die "Unable to make new temp file: $ +!"; foreach $line (<FILE>) { ~~~~~blah blah~~~~~~ } my $data = GD::Graph::Data->new(); $data->read(file => ‘$fh’, delimiter => '\t'); $data = $data -> copy(wanted => [0, 1, 2 print <$fh>; while (my @row = $fh->fetchrow_array()) <------line 81 { $data ->add_point($row); } my $graph = GD::Graph::points->new(); $graph->set( x_label => 'Time/Date', y_label => 'Latency Count', title => "Latency Graph between $center1 and $center2", ) or warn $graph->error; my $image = $graph->plot($data) or die $graph->error; open(IMAGE, ">graph.png") or die "Not able to open image file\n"; + binmode IMAGE; print IMAGE $image->png or die "Problem writing to image file\n";

Replies are listed 'Best First'.
Re: Can't locate object method
by gaal (Parson) on Jul 28, 2008 at 21:43 UTC
    $fh is an IO::File instance. It does not have a fetchrow_array method. Are you looking for <$fh> and split? Or for DBI?

    Also, two lines above this, you appear to have a syntax error.

Re: Can't locate object method
by olus (Curate) on Jul 28, 2008 at 21:40 UTC

    I'm familiar with fetchrow_array from DBI. I went to look at IO::File documentation and there was no reference to that method. The way you put it, it looks like you are trying to read rows from a database. Did you write this code from scratch or is it some copy paste of some come code that would do something similar to what you are looking for?

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://700667]
Approved by olus
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (3)
As of 2022-09-25 14:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I prefer my indexes to start at:




    Results (116 votes). Check out past polls.

    Notices?