FWS::V2::File - Framework Sites version 2 text and image file methods
Version 0.004
use FWS::V2; my $fws = FWS::V2->new(); # # retrieve a reference to an array of data we asked for # my $fileArrayRef = $fws->fileArray( directory =>"/home/directory" );
Framework Sites version 2 file writing, reading and manipulation methods.
Create all of the derived images from a file upload based on its schema definition
my %dataHashToUpdate = $fws->dataHash(guid=>'someGUIDThatHasImagesToUpdate'); $fws->createSizedImages(%dataHashToUpdate);
If the data hash might not be correct because it is actually stored in a different table you can pass the field name you wish to update
$fws->createSizedImages(guid=>'someGUID',image_1=>'/someImage/image.jpg');
Return a directory listing into a FWS hash array reference.
# # retrieve a reference to an array of data we asked for # my $fileArray = $fws->fileArray( directory =>"/home/directory" ); # # loop though the array printing the files we found # for my $i (0 .. $#$fileArray) { print $fileArray->[$i]{"file"}. "\n"; }
Retrive a file and convert it into a base 64 encoded binary.
# # Get the file # my $base64String = $fws->getEncodedBinary($someFileWeWantToConvert);
MIME encode a directory ready for a FWS export.
# # Get the file # my $packedFileString = $fws->packDirectory($someDirectory);
Decode a base 64 encoded string and save it as its file.
# # Save the file # $fws->saveEncodedBinary($someFileWeWantToSave,$theBase64EcodedString);
Extract the version from a FWS plugin. If no version is labeled or exists it will return 0.0000.
# # The version line in FWS plugins will look like this: # # our $VERSION = '0.0001'; # my $version = $fws->getPluginVersion($somePluginFile);
Make a new directory with built in safety mechanics. If the directory is not under the filePath or fileSecurePath then nothing will be created.
$fws->makeDir( $self->{'filePath'}.'/thisNewDir' );
Run init scripts for a site. This can only be used after setSiteValues() or setSiteFiendly() is called.
$fws->runInit();
Run a FWS element script. This should not be used outside of the FWS core. There is no recursion or security checking and should not be used inside of elements to perfent possible recursion. Only use this if you are absolutly sure of the script content and its safety.
%valueHash = $fws->runScript('scriptName',%valueHash);
Save an image with a unique width or height. The file will be converted to extensions graphic type of the fileName passed. Source, fileName and either width or height is required.
# # convert this png, to a jpg that is 110x110 # $fws->saveImage( sourceFile=>'/somefile.png', fileName=>'/theNewFile.jpg', width=>'110', height=>'110');
Decrypt data if a site has the proper configuration
my $decryptedData = $fws->FWSDecrypt('alsdkjfalkj230948lkjxldkfj');
Encrypt data if a site has the proper configuration
my $encryptedData = $fws->FWSEncrypt('encrypt this stuff');
Append something to the FWS.log file if FWSLogLevel is set to 1 which is default.
# # Soemthing is happening # $fws->FWSLog("this is happening\nthis is a new log line");
If a multi line string is passed it will break it up in to more than one log entries.
Append something to the SQL.log file if SQLLogLevel is set to 1 or 2. Level 1 will log anything that updates a database record, and level 2 will log everything. In good practice this should not be used, as all SQL statements are ran via the runSQL method which applies SQLLog.
# # Soemthing is happening # $fws->SQLLog($theSQLStatement);
Nate Lewis, <nlewis at gnetworks.com>
<nlewis at gnetworks.com>
Please report any bugs or feature requests to bug-fws-v2 at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=FWS-V2. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
bug-fws-v2 at rt.cpan.org
You can find documentation for this module with the perldoc command.
perldoc FWS::V2::File
You can also look for information at:
RT: CPAN's request tracker (report bugs here)
http://rt.cpan.org/NoAuth/Bugs.html?Dist=FWS-V2
AnnoCPAN: Annotated CPAN documentation
http://annocpan.org/dist/FWS-V2
CPAN Ratings
http://cpanratings.perl.org/d/FWS-V2
Search CPAN
http://search.cpan.org/dist/FWS-V2/
Copyright 2012 Nate Lewis.
This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.
See http://dev.perl.org/licenses/ for more information.
To install FWS::V2, copy and paste the appropriate command in to your terminal.
cpanm
cpanm FWS::V2
CPAN shell
perl -MCPAN -e shell install FWS::V2
For more information on module installation, please visit the detailed CPAN module installation guide.