DBIx::Roles::RaiseError - change defaults to C<< RaiseError => 1 >>


DBIx-Roles documentation Contained in the DBIx-Roles distribution.

Index


Code Index:

NAME

Top

DBIx::Roles::RaiseError - change defaults to RaiseError => 1

DESCRIPTION

Top

The role replaces the (arguably) most used pair of attributes

   { RaiseError => 1, PrintError => 0 }

to DBI-> connect() with the role syntax

   use DBIx::Roles qw(MyRole1 MyRole2 ... RaiseError);

just for beautification sake.

SYNOPSIS

Top

     use DBIx::Roles qw(RaiseError);

SEE ALSO

Top

DBI, DBIx::Roles

COPYRIGHT

Top

AUTHOR

Top

Dmitry Karasik <dk@catpipe.net>


DBIx-Roles documentation Contained in the DBIx-Roles distribution.

# $Id: RaiseError.pm,v 1.2 2006/01/23 21:40:39 dk Exp $

package DBIx::Roles::RaiseError;

use strict;
use DBIx::Roles;
use vars qw($VERSION);

$VERSION = '1.00';

sub rewrite
{
	my ( $self, $storage, $method, $parameters) = @_;
	if ( $method eq 'connect') {
		$parameters->[3]->{PrintError} = 0 unless exists $parameters->[3]->{PrintError};
		$parameters->[3]->{RaiseError} = 1 unless exists $parameters->[3]->{RaiseError};
	}
	return $self-> super( $method, $parameters);
}

1;

__DATA__