String::Prettify - subs to cleanup a filename and or garble for human eyes
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 );
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'
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'
Are exported on use.
Argument is string Returns prettified.
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.
None.
In development. If you have suggestions, please notify the AUTHOR.
Leo Charre leocharre at cpan dot org
To install String::Prettify, copy and paste the appropriate command in to your terminal.
cpanm
cpanm String::Prettify
CPAN shell
perl -MCPAN -e shell install String::Prettify
For more information on module installation, please visit the detailed CPAN module installation guide.