NAME

Object::Bouncer - Observes/Inspects other objects if they fullfil a list of tests

SYNOPSIS

  use Object::Bouncer;

	if( A->inspect( B ) )
	{
		print "B is ok";
	}
	else
	{
		print "A rejects B";
	}

DESCRIPTION

A bouncer in front of a disco makes decisions. He inspects other persons if they meet the criteria/expectations to be accepted to enter the party or not. The criteria are instructed by the boss. This is also how Object::Bouncer works. Object::Bouncer heavily relies on the Verify module.

EXPORT

None by default.

EXAMPLE

use Object::Bouncer;

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

push @{ $tuersteher->tests },

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

	new Object::Bouncer::Test( field => 'registered', type => 'not_null' ),

	new Object::Bouncer::Test( field => 'firstname', type => 'word' ),

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

my $user = new User( email => 'hiho@test.de', registered => 1 );

if( $tuersteher->inspect( $user ) )
{
	print "User is ok";
}
else
{
	::carp "rejects User because of unsufficient field:", $@;
}

None by default.

PREREQUISITES

Verify

AUTHOR

Murat Uenalan, muenalan@cpan.org

SEE ALSO

Verify, perl