The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

String::Prettify - subs to cleanup a filename and or garble for human eyes

SYNOPSIS

   use String::Prettify

   print prettify('Johny & Mary Jacobs #3rd');

   my $ugly   = '/home/This Here235#$%@%/!!great-superfuper skatingVideo132.mov';
   my $pretty = prettify_filename($ugly);
   rename( $ugly, $pretty );

DESCRTIPTION

I was tired of turning things like '/var/www/dms/doc/Clients_ALTERNATe/Universal Title LLC/Vendors/2005/Invoices/JOE RAGANS COFFEE/092705-JOE RAGANS COFFEE-031003.pdf' into '092705 JOE RAGANS COFFEE 031003'

When would you want to use this?

Imagine you are using cgi to show files. The client selects a file. You want to title the output html page after the file. And maybe, just maybe- the file selected is a directory. Well, then a location called '/home/username/public_html/art/_grand_juryFinals' could be turned into 'Grand Jury Finals' on the fly.

   my $title = prettify('/home/username/public_html/art/_grand_juryFinals');
   # 'Grand Jury Finals'

SUBS

Are exported on use.

prettify()

Argument is string Returns prettified.

prettify_filename()

Argument is path argument Returns prettified. The extension and location is unchanged (if present). If you provide a path with slashes etx, we don't change any of that. We jsut return a cleaner filename. This is useful if you have a directory with stupid filenames like: !!great-superfuper skatingVideo132.mov And you want to clean them up.

   my $ugly   = '/home/This Here235#$%@%/!!great-superfuper skatingVideo132.mov';
   my $pretty = prettify_filename($ugly);
   rename( $ugly, $pretty );

The location remains the same.

REQUIREMENTS

None.

CAVEATS

In development. If you have suggestions, please notify the AUTHOR.

AUTHOR

Leo Charre leocharre at cpan dot org