Chris Stinemetz wrote:
I am currently just trying to build my table structure for this program.
I am getting the following error:
Any help in resolution or advice is greatly appreciated.
$ ./heh.pl
Can't locate object method "format_name" via package "RAW" (perhaps
you forgot to load "RAW"?) at ./heh.pl line 39,<$fh> line 4288257.
Have you read the format man page:
perldoc perlform
#!/usr/bin/perl
use warnings;
use strict;
use POSIX;
# require "heh_lib.pl";
# my $filepath =
sprintf("/omp/omp-data/logs/OMPROP1/%s.APX",strftime("%y%m%d%H",localtime));
my $filepath = ("/tmp/110923.APX"); # for testing
my $runTime =
sprintf("/home/cstinemetz/programs/%s.txt",strftime("%y%m%d%H%M",localtime));
my $fileDate = strftime("%y%m%d%H%",localtime);
open my $fh, '<', $filepath or die "ERROR opening $filepath: $!";
open my $out, '>', $runTime or die "ERROR opening $runTime: $!";
while(<$fh>) {
print if /,HEH/;
}
# my $timeStamp = localtime;#&getDateTime(my $time,0);
format RAW_HEADER =
^>>>>>> HR 17-21 HEH Report @<<<<<<<<<<<<<<<<<<
my $rptType # my $timeStamp
Cell CDM1 CDM2 CDM3 TFU1 TFU2 CCU
CBR1 CBR2 CBR3 CBR4 CBR5 CBR6 EVM TXAMP
CTRM
--------- -------- -------- --------- --------- -------- ---------
-------- -------- -------- -------- -------- -------- --------
-------- --------
.
format RAW =
@<<<<<<<< @||||||| @||||||| @||||||| @||||||| @|||||||| @|||||||
@|||||||| @||||||| @||||||| @||||||| @||||||| @||||||| @|||||||
@||||||| @|||||||
#$cell,$cdm1,$cdm2,$cdm3,$tfu1,$tfu2,$ccu,$cbr1,$cbr2,$cbr3,$cbr4,$cbr5,$cbr6,$evm,$txamp,$ctrm
.
my $rptType = "HEH";
RAW->format_name("RAW_HEADER");
A format name is not an object so you can't use it like one.
print RAW
A format name is not a filehandle so you can't use it like one.
sprintf("%10s\t%10s\t%10s\t%10s\t%10s\t%10s\t%10s\t%10s\t%10s\t%10s\t%10s\t%10s\t%10s\t%10s\t%10s\t%10s\n","Date","Cell","CDM1","CDM2","CDM3","TFU1",
"TFU2","CCU","CBR1","CBR2","CBR3","CBR4","CBR5","CBR6","EVM","TXAMP","CTRM");
That would look cleaner as:
print RAW join( "\t", map sprintf( '%10s', $_ ), qw/ Date Cell CDM1 CDM2
CDM3 TFU1 TFU2 CCU CBR1 CBR2 CBR3 CBR4 CBR5 CBR6 EVM TXAMP CTRM / ), "\n";
RAW->format_name("RAW");
Again, you can't use a format name as an object.
John
--
Any intelligent fool can make things bigger and
more complex... It takes a touch of genius -
and a lot of courage to move in the opposite
direction. -- Albert Einstein
--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/