in reply to limit output filesize
I ran this as a test:
This is AIX 5.1 on a JFS2 file system. I won't be able to speak for others
Update:
as an aside $|++ did nothing for this
You could also keep tabs on your output size as well, if it is all under your control.
the output was as follows (abridged):#!/usr/bin/perl use warnings; use strict; my $file_base = "output"; open( FILE, ">$file_base" ) or die "Unable to open $file_base for writ +ing!\n$!\n"; for (1..100) { print FILE "0" x 1024; print "File Size: ".(stat($file_base))[7]."\n"; last if (stat($file_base))[7] > 50000; } close FILE or die "Error closing $file_base\n$!\n";
So it stopped close to, but not at, 50k because while the file is open, only full blocks are written. You may want to keep that in mind and make sure the cutoff is at the highest blocksize that is less than your threshold.File Size: 0 File Size: 0 File Size: 0 File Size: 0 File Size: 4096 File Size: 4096 File Size: 4096 File Size: 4096 ... File Size: 49152 File Size: 49152 File Size: 49152 File Size: 53248
This is AIX 5.1 on a JFS2 file system. I won't be able to speak for others
Update:
as an aside $|++ did nothing for this
You could also keep tabs on your output size as well, if it is all under your control.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: limit output filesize
by rogue90 (Novice) on Jul 08, 2005 at 19:12 UTC | |
by bart (Canon) on Jul 08, 2005 at 19:28 UTC | |
by rogue90 (Novice) on Jul 08, 2005 at 19:45 UTC | |
by rogue90 (Novice) on Jul 08, 2005 at 19:37 UTC |
In Section
Seekers of Perl Wisdom