I was looking at the Mail::Sendmail module from CPAN and I did not find anything that showed printing a body. How do I print a body of text data from a variable? The highlighted code is not working but I was playing with it to get this message with the scaler $ftapes listed.
thank you! ## Set pragmas use strict; use Mail::Sendmail; ## 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=1`; print OUT "@ftapes"; if ( -s OUT ) { my %mailman = ( From => 'EDM01 <[EMAIL PROTECTED]>', To => 'Derek Smith <[EMAIL PROTECTED]>', Subject => "Foreign Tapes Found, now attmepting to label" ); sendmail (%mailman) or die $Mail::Sendmail::error; print %mailman <<EO_SIG; EDM foreign tapes were found, \n, print OUT "@ftapes" EO_SIG; foreach (@ftapes) { print $_; #`evmlabel -l st_9840_acs_0 -t 9840S -b$_` } close (OUT); } else { my $foo="/tmp/ftapes_runfile"; open (RUNFILE, ">$foo") || die "could not open runfile: $!;" #exit 0; } close (RUNFILE); Derek B. Smith OhioHealth IT UNIX / TSM / EDM Teams "Charles K. Clarkson" <[EMAIL PROTECTED]> 06/02/2004 09:19 AM To: <[EMAIL PROTECTED]>, <[EMAIL PROTECTED]> cc: Subject: RE: using Mail::Sendmail [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> wrote: : All, : : I am getting these errors... any ideas? : : Global symbol "%mail" requires explicit package name at : foreign_tape_ck.pl line. : Bareword "EO_SIG" not allowed while "strict subs" in use at : foreign_tape_ck.pl . foreign_tape_ck.pl had compilation errors. [snip] : if ( -s OUT ) { : my %mailman = ( From => 'EDM01 <[EMAIL PROTECTED]>', : To => 'Derek Smith <[EMAIL PROTECTED]>', : Subject => "Foreign Tapes Found" ); : sendmail (%mail) or die $Mail::Sendmail::error; : print %mailman <<EO_SIG : EDM foreign tapes were found now attempting to label : EO_SIG; : foreach $_ (@ftapes) { : print $_; : #`evmlabel -l st_9840_acs_0 -t 9840S -b$_` : } : close (OUT); : } Let's rewrite this with some indentation. Doesn't this seem a little easier to read? Try adding white space to your scripts and separate lines that do different things. if ( -s OUT ) { my %mailman = ( From => 'EDM01 <[EMAIL PROTECTED]>', To => 'Derek Smith <[EMAIL PROTECTED]>', Subject => 'Foreign Tapes Found', ); sendmail( %mail ) or die $Mail::Sendmail::error; print %mailman <<EO_SIG EDM foreign tapes were found now attempting to label EO_SIG; foreach $_ (@ftapes) { print $_; #`evmlabel -l st_9840_acs_0 -t 9840S -b$_`; } close OUT; } Your errors are on the following lines: sendmail (%mail) or die $Mail::Sendmail::error; print %mailman <<EO_SIG EDM foreign tapes were found now attempting to label EO_SIG; %mail has not been defined. You probably want %mailman. Why use a HERE doc for a single line? sendmail( %mailman ) or die $Mail::Sendmail::error; print %mailman, "\nEDM foreign tapes were found now attempting to label\n"; The foreach would be better written as this. Though I don't think perl will complain. foreach ( @ftapes ) { print $_; #`evmlabel -l st_9840_acs_0 -t 9840S -b$_` } HTH, Charles K. Clarkson -- Mobile Homes Specialist 254 968-8328