Satoshi Azuma > Nephia > Nephia::Context

Download:
Nephia-0.87.tar.gz

Dependencies

Annotate this POD

Website

View/Report Bugs
Source  

NAME ^

Nephia::Context - Context Class for Nephia

DESCRIPTION ^

HASHREF plus alpha

SYNOPSIS ^

    my $context = Nephia::Context->new( foo => 'bar', hoge => [qw/fuga piyo/] );
    $context->get('foo');           ### 'bar'
    $context->get('hoge');          ### ['fuga', 'piyo'];
    $context->set(fizzbuzz => sub { 
        my $x = ''; 
        $x .= 'fizz' if ! $x % 3; 
        $x .= 'buzz' if ! $x % 5; 
        $x .= $_[0] unless $x; 
        return $x;
    });
    $context->delete('hoge');
    $context->get('hoge')           ### undef
    $context->get('fizzbuzz')->(12) ### 'fizz'

METHODS ^

new

    my $context = Nephia::Context->new( %items );

Instantiate Nephia::Context. Then, store specified items.

get

    my $item = $context->get( $name );

Fetch specified item that stored.

set

    $context->set( $name => $value );

Store specified item.

delete

    $context->delete( $name );

Delete a specified item.

AUTHOR ^

ytnobody <ytnobody@gmail.com>

syntax highlighting: