Obsessor - methodcall dispatcher/forwarder
use Class::Maker::Examples::Obsessor; use Verify; use Class::Maker::Examples::User; # binding to a class (a clean object is created) { my $user = Obsessor->new( target => 'User' ); $user->email( 'murat.uenalan@gmx.de' ); $user->firstname( 'Murat' ); $user->lastname( 'Murat' ); #$user->blabla(); print Dumper $user; } # binding to existing object { my $user = Obsessor->new( target => new User( firstname => 'Murat', lastname => 'Uenalan' ) ); $user->email( 'murat.uenalan@gmx.de' ); $user->firstname( 'Murat' ); #$user->blabla(); print Dumper $user; }
package Verify::Type;
our $positivliste = new Verify::Type( desc => 'test access right', pass => { exists_in => { firstname => 1, lastname => 1, email => 1 } }, fail => { exists_in => [qw(blabla)] } );
package main;
{ my $accesstester = new Bouncer( ); push @{ $accesstester->tests }, new Bouncer::Test( field => 'method', type => 'positivliste' ); my $user = Obsessor->new(); # CAVE: target is an Class::Maker::Examples::Obsessor method (the only one) $user->Obsessor::target( new User( firstname => 'Murat', lastname => 'Uenalan' ) ); push @{ $user->bouncers }, $accesstester; # bouncer won't reject email, firstname or lastname, because they're in the pass-list $user->email( 'muenalan@cpan.org' ); $user->firstname( 'Murat' ); $user->lastname( 'Murat' ); # bouncer rejects 'blabla' because it's in fail-list $user->blabla(); print Dumper $user; }
Class::Maker::Examples::Obsessor has nothing to do with a http-server. But, in the very principle it behaves like it. It serves a target class/object and has all might about it. This can be used i.e. to restrict/log/bench/forward/obscure/cache/.. the access to the target. After you plug a target to an Class::Maker::Examples::Obsessor, the resulting object behaves like the original target in terms of methodcalls. But a ref()-call would reveal the object beeing an Class::Maker::Examples::Obsessor in real. Also caller() would be influenced (unfortunately).
None by default.
Murat Ünalan, <muenalan@cpan.org>
perl(1).
1 POD Error
The following errors were encountered while parsing the POD:
Non-ASCII character seen before =encoding in 'Ünalan,'. Assuming CP1252
To install Auth, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Auth
CPAN shell
perl -MCPAN -e shell install Auth
For more information on module installation, please visit the detailed CPAN module installation guide.