[ale] perl and environment stuff

Mike Kachline mkachline at gmail.com
Wed Dec 27 22:28:43 EST 2006


On 12/26/06, Mike Fletcher <fletch at phydeaux.org> wrote:


>
> > open (FILEOUT, ">>$filetowrite") || die "Crud! $filetowrite puked $!\n";
> > print FILEOUT "$stuff\n";
> > close FILEOUT;
> >
> >
> > Suggestions on where to look?
> >






Something else is wrong then; append mode (">>") is append mode and
> nothing in the environment should change that.
>
>
> I'd look at anything else that may be manipulating the file (maybe
> something's calling lpadmin that you're not aware of, and the two of you
> are bumping heads).  Also consider adding in extra debugging prints,
> such as dumping the size of $filetowrite from a stat() call before and
> after your opens.  If all else fails, use strace (possibly with -f to
> follow forks) to record what sequence of system calls are being made in
> the two different environments and see what's different between the two.
>
>
> (And stylistic aside: the three argument form of open is preferred these
> days, presuming you're using a recent enough Perl that it works.  So
> you'd want:
>
> open( FILEOUT, ">>", $filetowrite ) or die "Append to '$filewrite'
> failed: $!\n";
>
> instead of the two argument form.  Also another minor nit, it's slightly
> more efficient to call
>
> print FILEOUT $stuff, "\n";
>
> with two arguments, as that'll avoid creating a temporary copy of $stuff
> and the newline and passing that to print.)
>
>
>
>
> _______________________________________________
> Ale mailing list
> Ale at ale.org
> http://www.ale.org/mailman/listinfo/ale
>



-- 
Mike Kachline
mkachline at gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...




More information about the Ale mailing list