Murat Ünalan > Class-Maker-Examples > Trustee

Download:
Class-Maker-Examples-0.01_02.tar.gz

Dependencies

Annotate this POD

Module Version: 0.002   Source  

NAME ^

Trustee - An persistance storage specialized on objects

SYNOPSIS ^

        use class::examples::User;

        use Object::Bouncer;

        use Data::Dumper;

                # not visible, but default tiewith is Apache::Session::MySQL

        my $schatzmeister = new Object::Trustee();

                # here an alternative

        my $schatzmeister = new Object::Trustee(

                tiewith => 'Apache::Session::File',

                args => { Directory => 'c:/temp/sessiondata', LockDirectory   => 'c:/temp/sessiondata/locks' }

        );

        print 'Session-ID: ', $schatzmeister->id, "\n\n";

        my %gruppe = (

                toni => new User( firstname => 'toni', email => 'toni@wrong' ),

                eva => new User( firstname => 'eva', email => 'eva@any.de' ),

                maren => new User( firstname => 'maren' )

                );

        print "\n", 'Users:';

        print Dumper \%gruppe;

        $schatzmeister->store( %gruppe );

                # bouncer let filled email fields in....

        my $emailtester = new Object::Bouncer( );

        $emailtester->addtest(

                new Object::Bouncer::Test( field => 'email', type => 'true' ),
        );

        my $list = $schatzmeister->retrieve( $emailtester );

                # now, bouncer only leaves <valid> emails in...

        print "\n\nUsers with email field filled:";

        my $emailchecker = new Object::Bouncer( );

        $emailchecker->addtest(

                new Object::Bouncer::Test( field => 'email', type => 'email' ),
        );

        print Dumper $list;

        my $list = $schatzmeister->retrieve( $emailchecker );

        print "\n\nUsers with valid email:";

        print Dumper $list;

DESCRIPTION ^

A Trustee keeps files for other people about other people. This files can be modified / requested. On the backend the trustee object uses Apache::Sesssion tied hashes. Object::Bouncer's objects are utilized when retrieving selectivly (i.e.filtering).

EXPORT

None by default.

PREREQUISITES ^

        - Apache::Session::* to keep state.
        - Object::Bouncer to retrieve selectivly

AUTHOR ^

Murat Uenalan, murat.uenalan@gmx.de

SEE ALSO ^

Verify, perl

syntax highlighting: