develooper Front page | perl.perl5.porters | Postings from September 2011

Format - Perl 5.14.1

Thread Next
From:
Scott
Date:
September 12, 2011 12:42
Subject:
Format - Perl 5.14.1
Message ID:
4E6E6090.5030609@gmail.com
I have some old code that uses Format to create reports.  In the code I 
declare some variables, declare the Formats and then have two subs
that could be called that set the variables and select the different 
formats and call write.  This all worked until I tried it with perl 
5.12-5.14.  The variables
are being set in the subs, but when write is called they are all undef.

Here is part of the code,

#===================== Formats for print_ticket()&  print_html() =======================#

#=======================================================================================#

my ($catg, $proj, $Proc, $srvs, $Service, $notes, $Note, $fh);

my ($prj_notes, $Output, $scodes, $inst, $out_notes, $DtRcvd, $RushInd, $DncMethod, $SplitType, $TsCode);

my ($e_ship_dt, $w_ship_dt, $a_ship_dt, $desc, $po_num, $terms, $sales_rep);

my ($exp, $qnum, $ifilenm, $wdir, $cname, $dir, $Input, $Ship, $Bill, $BillNotes, $Status);

format LP_TOP =

                                                                                        Page @|

                                                                                             $%

                           PROJECT PROCESSING REQUEST

                           ~~~~~~~~~~~~~~~~~~~~~~~~~~

                           @|||||||||||||||||||||||||

                           $cname

        BUSINESS UNIT: @<<<<<<<<<                     RUSH INDICATOR: @<<<<<<<<<<<<<<<<<<<<<<<<<

                       $exp->{territory},                            $RushInd

            CLIENT ID: @<<<<<                         PROJECT NUMBER: @<<<<<<

                       $exp->{client_id},                            $qnum

              ACRONYM: @<<                           SUBMITTED TO DP: @<<<<<<<<<<

                       uc($exp->{acronym}),                          $time{'H:mm:ss am'}

             SALESREP: @<<<<<                             ACTUAL CSR: @<<<<<

                       $sales_rep,                                   $exp->{csr}

         ASSIGNED CSR: @<<<<<<<<<<<<<<<<           WORKING SHIP DATE: @<<<<<<<<<

                       $exp->{assign},                               $w_ship_dt

        DATE RECEIVED: @<<<<<<<<<                   ACTUAL SHIP DATE: @<<<<<<<<<

                       $DtRcvd,                                      $a_ship_dt

         TYPE OF FILE: @<<<<<<<<<<<<<<<<<<<<<<<<            SERVICES: @<<<<<<<<

                       $exp->{file_type},                            $Proc

         PROJECT TYPE: @<<<<<<<<<<<<<<<<                       TERMS: @<<<<<<<<<<<<<<

                       $proj->{$exp->{prj_type}},                    $terms

                  PO#: @<<<<<<<<<<<<<<<<                 CREDIT CARD: @<

                       $po_num,                                      $exp->{pay_cd}

            REFERENCE: @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<   SERVICE DESC: @<<<<<<<<<<<<<<<<<<<<

                       $desc,                                        $catg->{$exp->{catid}}

       TIMESHEET CODE: @<<<<<<<<<<<<<<<<

                       $TsCode

========================================================================================

.


These variables are set in the sub and then,

     $~ = "LP_TOP";

      write;


is executed, but the variables are not set when the format is filled in. 
The only value
that is printed is the value of '$time{'H:mm:ss am'}'. Something had to 
change and I can't
find out what or I'm glazing over it. Any help would be much appreciated.

Thanks,

Scott






Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About