The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

FWS::V2::Format - Framework Sites version 2 text and html formatting

VERSION

Version 0.003

SYNOPSIS

        use FWS::V2;
        
        my $fws = FWS::V2->new();

        my $tempPassword = $fws->createPassword( lowLength => 6, highLength => 8);

        my $newGUID = $fws->createGUID();

DESCRIPTION

Framework Sites version 2 methods that use or manipulate text either for rendering or default population.

METHODS

createGUID

Return a non repeatable Globally Unique Identifier to be used to populate the guid field that is default on all FWS tables.

        #
        # retrieve a guid to use with a new record
        #
        my $guid = $fws->createGUID();

In version 2 all GUID's have a prefix, if not specified it will be set to 'd'. There should be no reason to use another prefix, but if you wish you can add it as the only parameter it will be used. In newer versions of FWS the prefix will eventually be deprecated and is only still present for compatibility.

createPassword

Return a random password or text key that can be used for temp password or unique configurable small strings.

        #
        # retrieve a password that is 6-8 characters long and does not contain commonly mistaken letters
        #
        my $tempPassword = $fws->createPassword(
                                        composition     => "abcedef1234567890",
                                        lowLength       => 6,
                                        highLength      => 8);

If no composition is given, a vocal friendly list will be used: qwertyupasdfghjkzxcvbnmQWERTYUPASDFGHJKZXCVBNM23456789

dateTime

Return the date time in a given format. By passing epochTime, SQLTime you can do a time conversion from that date/time to what ever format is set to. If you do not pass epoch or SQL time the server time will be used.

        #
        # get the current Date in SQL format
        #
        my $currentDate = $fws->dateTime(format=>'date');
        
        #
        # convert SQL formated date time to a human form
        #
        my $humanDate = $fws->dateTime(SQLTime=>'2012-10-12 10:09:33',format=>'date');

By passing monthMod you can adjust the month forward or backwards by the given number of months

        #
        # 3 months from today (negative numbers are ok)
        #
        my $threeMonths = $fws->dateTime(format=>'date',monthMod=>3);

Possible Parameters:

  • format

    Format type to return. This is the only required field

  • epochTime

    epoch time which could be created with time()

  • monthMod

    modify the current month ahead or behind. (Note: If your current day is 31st, and you mod to a month that has less than 31 days it will move to the highest day of that month)

  • dateSeperator

    This will default to '-', but can be changed to anything. (Note: Do not use this if you are returing SQLTime format)

  • GMTOffset

    Time zone modifier. Example: EST would be -5

  • SQLTime

    Use an SQL time format as the incomming date and time.

The following types of formats are valid:

  • date

    mm-dd-yyyy

  • time

    hh:mmAM XXX

  • fancyDate

    weekdayName, monthName dd[st|nd|rd] of yyyy

  • cookie

    cookie compatible date/time

  • apache

    apache web server compatible date/time

  • number

    yyyymmddhhmmss

  • dateTime

    mm-dd-yyyy hh:mmAM XXX

  • dateTimeFull

    mm-dd-yyyy hh:mm:ss XXX

  • SQL

    yyyy-mm-dd hh:mm:ss

  • epoch

    Standard epoch number

  • yearFirstDate

    yyyy-mm-dd

justFileName

Return just the file name when given a full file path

        my $fileName = $fws->justFileName('/this/is/not/going/to/be/here/justTheFileName.jpg');

jqueryEnable

Add FWS core distribution jQuery modules and corresponding CSS files to the CSS and JS cached files. These are located in the /fws/jquery directory. The naming convention for jQuery files are normalized and only the module name and version is required.

        #
        # if the module you were loadings file name is:
        # jquery-WHATEVERTHEMODULEIS-1.1.1.min.js
        # it would be loaded via jqueryEnable as follows:
        #
        $fws->jqueryEnable('WHATEVERTHEMODULEIS-1.1.1');

This method ensures jQuery files are only loaded once, and the act of any jQuery module being enabled will auto-activate the core jQuery library. They will be loaded in the order they were called from any element in the rendering process.

AUTHOR

Nate Lewis, <nlewis at gnetworks.com>

BUGS

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.

SUPPORT

You can find documentation for this module with the perldoc command.

    perldoc FWS::V2::Format

You can also look for information at:

LICENSE AND COPYRIGHT

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.