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

NAME

FWS::V2::Session - Framework Sites version 2 session related methods

VERSION

Version 1.13091122

SYNOPSIS

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

    $fws->saveFormValue( 'thisThing' );

DESCRIPTION

FWS version 2 session methods are used to manipulate how a session is maintained, authenticated, and initiated.

METHODS

formArray

Return a list of all the available form values passed.

    #
    # get the array
    #
    my @formArray = $fws->formArray();

formValue

Get or set a form value. If the value was not set, it will always return an empty string, never undefined.

    #
    # set the form value
    #
    $fws->formValue( 'myVar', 'This is what its set to' );

    #
    # get the form value and pass it to the html rendering
    #
    $valueHash{html} .= $fws->formValue( 'myVar' );

fwsGUID

Retrieve the GUID for the fws site. If it does not yet exist, make a new one.

    print $fws->fwsGUID();

setFormValues

Gather the passed form values, and from it set the language formValue and the session formValue.

    #
    # get the array
    #
    $fws->setFormValues();

setSession

Set the session for a FWS web based page rendering.

    #
    # Set the session
    #
    $fws->setSession();

setSiteFriendly

Determine the site friendly url and set it.

    #
    # Set the site friendly URL
    #
    $fws->setSiteFriendly();

language

Get or set the current language. If no language is currently set, the first entry in language will be used. If languageArray has not be set, then 'EN' will be used. The language can be set by being passed as a form value with the name 'fws_lang'.

    #
    # set the language
    #
    $fws->language( 'FR' );

    #
    # get the language
    #
    $valueHash{html} .= 'The current language is: ' . $fws->language() . '<br />';    

languageArray

Set the languages the site will use. The first one in the list will be considered default. If languageArray is not set it will just contain 'EN'.

    #
    # set the languages available
    #
    $fws->languageArray( 'EN', 'FR', 'SP' );

processLogin

Process the web action for logins

    #
    # Run login
    #
    $fws->processLogin();

adminLogOut

Log out FWS admin user

    #
    # Log out currently logged in admin user
    #
    $fws->adminLogOut();

userLogOut

Log out FWS site user

    #
    # Log out currently logged in site user
    #
    $fws->userLogOut();

cryptPassword

Crypt password passing the crypt mmethod you would like to use. Set $fws->{FWSCrypt} to set method. Current default is perl crypt.

Current Methods: crypt: Perl default crypt

Example: # # Log out currently logged in site user # my $cryptedPass = $fws->cryptPassword( 'thePasswordYourCrypting' );

saveFormValue

Mark a formValue to remain persistant with the session. The return of this function will be the current saveWithSessionHash.

    #
    # This should go in a 'init' element or located int he go.pl file
    # at any point it can be referenced via formValue
    #
    $fws->saveFormValue( 'myCity' );

saveSession

Commit the current session to the sessions table. This is only needed if you need to cmmit the session before you perform a 302 redirect or if yuor immitating the pringPage() method with a custom one. Not the session does actually do anything if its values have not chagned from its innital load from the session table.

    #
    # This should go in a 'init' element or located int he go.pl file
    # at any point it can be referenced via formValue
    #
    $fws->saveSession();

setSiteValues

Set default values derived from the site settings for a site. This will also set the formValue 'p' to the homeGUID if no 'p' value is currently set.

    #
    # currently rendered site
    #
    $fws->setSiteValues();

    #
    # set site values for some other site
    #
    $fws->setSiteValues( 'othersite' );

siteValue

Get or save a siteValue for the session.

    #
    # save something
    #
    $fws->siteValue( 'something', 'this is something' );

    #
    # get something
    #
    my $something = $fws->siteValue( 'something' );

userValue

Get an admin user value. This is used mostly for security flags and is only used to get values FWS has set.

    #
    # is the admin user a developer?
    #
    my $isDeveloper = $fws->userValue( 'isDeveloper' );

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::Session

You can also look for information at:

LICENSE AND COPYRIGHT

Copyright 2013 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.