ok so here is what I did and it is now working.

one thing I do not fully understand is the diff between 
my $svsel = select; select OUT ; $|=1;
and
select (select(OUT), $| = 1 ) [0] );

the second line works while the first does not and
from my understanding I am selecting OUT and never re-selecting the 
original filehandle?

thanks!

Here is the working code.

## Set pragmas

        use strict;
        use MIME::Lite;

## Set and edit variables

        my $foreigntapes="/usr/local/log/foreign_tapes.log";
        delete $ENV{'IFS'};
        local $ENV{'PATH'} = 
"/usr/epoch/bin:/usr/epoch/EB/bin:/usr/bin:/usr/sbin:/bin:/sbin";
        #print $ENV{'PATH'},"\n";

## Traverse through array and play with data

        open (OUT, ">$foreigntapes") || die "could not open file:$!";
        my @ftapes = grep s/^barcode=//, `evmvol -w label_state=3`;
        select( (select(OUT), $|=1 ) [0] );
        print OUT "@ftapes";
        if ( -s OUT )   {
                        my $msg = MIME::Lite->new(
                        From    => 'EDM01 <[EMAIL PROTECTED]>',
                        To      => 'Derek Smith <[EMAIL PROTECTED]>',
                        Subject => "Foreign Tapes Found, now attmepting to 
label",
                        Data    => "@ftapes" );
                        $msg->send;
 
                        foreach (@ftapes) {
                           print $_;
                           #`evmlabel -l st_9840_acs_0 -t 9840S -b$_` 
                        }
        } else {
                my $foo="/tmp/ftapes_runfile";
                open (RUNFILE, ">$foo") || die "could not open runfile: 
$!;"
        }
        close (RUNFILE);


Derek B. Smith
OhioHealth IT
UNIX / TSM / EDM Teams
614-566-4145





"Wiggins d Anconia" <[EMAIL PROTECTED]>
06/08/2004 11:06 AM

 
        To:     [EMAIL PROTECTED], [EMAIL PROTECTED]
        cc: 
        Subject:        RE: if -s clause


Please bottom post....

> 
> ok I can take some blame!  : )  I made some changes and I am still not 
> getting the print message.
> 

You made *some* changes, but you still haven't listened to what Bob and
I have said, and made the changes we have pointed out specifically. That
is becoming tedious.

I would suggest going back through the e-mails and re-reading every
single statement made and see why your script still does not match what
we have suggested.

http://www.catb.org/~esr/faqs/smart-questions.html

http://danconia.org

> 
> ## Set pragmas
> 
>         use strict;
> 
>         my $foreigntapes="/usr/local/log/foreign_tapes.log";
>         delete $ENV{'IFS'};
>         local $ENV{'PATH'} = 
> "/usr/epoch/bin:/usr/epoch/EB/bin:/usr/bin:/usr/sbin:/bin:/sbin";
> 
>         open (OUT, ">$foreigntapes") || die "could not open file:$!";
>         my @ftapes = grep s/^barcode=//, `evmvol -w label_state=1`;
>         my $svsel = select; select OUT; $| = 1;
>         print OUT "@ftapes";
>                if ( -s OUT ) {
>                              print "file is greater than 0 bytes \n";
>                        }
> 
> 



Reply via email to