NAME

App::PPBuild::Session - Session object used by App::PPBuild to record run counts and variables.

DESCRIPTION

App::PPBuild is capable of using sessions. This object takes care of loading and saving run counts for tasks, and tracking variables that need to be preserved.

METHODS

new()

Create a new App::PPBuild object. Takes 2 arguments, a PPBuild object, and either a session hash, or a session yaml file.

App::PPBuild->new( $ppbuild, { ran => {...}, variables => {...} };
App::PPBuild->new( $ppbuild, 'session.yaml' };
file()

Set or retrieve the session file name. Does not effect the session variables or run counts.

loaded()

Accessor for the loaded hash which contains the values the session variables had in the session file.

current()

Accessor for the current session variables hash.

current_variable()

Get the current value of a session variable. If the value has not been initialized it will be.

loaded_variable()

Get the value of a variable as it was stored in the session.

initialized()

Check if a variable has been initialized. Also used to mark a variable as initialized.

Check:

$self->initialized( 'var' );

Set:

$self->initialized( 'var', 1 );

Unset:

$self->initialized( 'var', undef );
init_variable()

Used to initialize a variable, takes a variable name, and a default value if no other is found. Default is optional. Value is first obtained from the environment, if that si not set then from the session, if that is not set then from the default passed in.

set_ran()

Set the run counts for the tasks in the associated PPBuild object.

$self->ran(
    TASK_NAME  => 5,
    TASK_NAME2 => 2,
);
ran()

Find the run count for a specific task. First argument is task name.

ppbuild()

Get/Set the associated PPBuild object.

load()

Load a session yaml file or hash.

save()

Save the session, takes a filename. If no name is provided the loaded one will be used.

AUTHOR

Chad Granum <exodist7@gmail.com>

COPYRIGHT

Copyright 2009 Chad Granum

licensed under the GPL version 3. You should have received a copy of the GNU General Public License along with this. If not, see <http://www.gnu.org/licenses/>.