Author image Leo Charre
and 1 contributors

NAME

LEOCHARRE::BogusFile - make file of x size with junk data

SYNOPSIS

   use LEOCHARRE::BogusFile ':all';
   
   my $size_in_k = make_bogus_file('./t/00.tmp');
   make_bogus_file('./t/01.tmp','100')
      or die("can't make 100k file"); 
   
   make_bogus_file('./t/01.tmp','1.24M')
      or die("can't make 100k file"); 

SUBS

Not exported by default.

make_bogus_file()

Arg is path to new file. If already on disk, warns and returns undef. Optional arg is size in k for file. If no size is passed, will make a filesize under $LEOCHARRE::BogusFile::MAXLENGTH

arg2bytes()

Arg is size such as.. 100, 1M, 12.4M, 100k, 100K, etc. Returns what it resolves to in bytes. Throws exception if not a size amount.

$MAXLENGTH

This is the max chars to put in file, also max k in file. Default value is 100000, which is about 100k.

AUTHOR

Leo Charre leocharre at cpan dot org

LICENSE

This package is free software; you can redistribute it and/or modify it under the same terms as Perl itself, i.e., under the terms of the "Artistic License" or the "GNU General Public License".

DISCLAIMER

This package is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

See the "GNU General Public License" for more details.