Bill Weinman > bw-lib-1.4 > BW::Jumptable

Download:
bw-lib-1.4.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Module Version: 1.3.1   Source  

NAME ^

BW::Jumptable - Jump table support for BW::*

SYNOPSIS ^

  use BW::Jumptable;
  my $errstr;
  my $jumptable = {
    create => \&create,
    retrieve => \&retrieve,
    update => \&update,
    delete => \&delete
  }
  my $jt = BW::Jumptable->new( jumptable => $jumptable );
  $jt->jump($q->{action});
  error($errstr) if (($errstr = $jt->error));

METHODS ^

new( jumptable => $hashref )

Creates a new BW::Jumptable object and initializes the jump table. The jumptable property is required. Returns the blessed object handle, or undef if it cannot properly initialize.

jump( $action )

Execute a jump. Calls the function referenced in jumptable by the key that matches $action. Returns the value returned by the function, or FAILURE for an error condition. Sets the object error message (see the error() method) for error conditions.

error

Returns and clears the object error message.

AUTHOR ^

Written by Bill Weinman <http://bw.org/>.

COPYRIGHT ^

Copyright (c) 1995-2010 The BearHeart Group, LLC

HISTORY ^

    2010-02-02 bw 1.3.1 -- first CPAN version - some cleanup and documenting
    2007-07-16 bw       -- bugfix - method jump() assumed that the target 
                           never returned. 
    2007-02-22 bw       -- initial release.
syntax highlighting: