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::Session - Framework Sites version 2 session related methods

VERSION

Version 0.003

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');

getFormValues

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

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

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');

saveFormValue

Mark a formValue to remain persistant with the session.

        #
        # 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');

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 or set a admin user value. This is used mostly for security flags and should only be used to get values FWS has set, never to change or set them.

        #
        # is the admin user a developer?
        #
        my $isDeveloper = $fws->siteValue('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 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.