On 11/10/2011 21:38, 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.



#!/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");
print RAW
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");
RAW->format_name("RAW");

You must

  use IO::Handle;

at the start of your program to make the 'form_name' method available.

But beware that your program is less than ideal in several other ways as
well, and you need to use 'write' instead of 'print' for your format to
have any effect.

Rob

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to