Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages

  
 
  

home | help
SPOPS::Tool::DBI::DataUsercContributed Perl DocSPOPS::Tool::DBI::Datasource(3)

NAME
       SPOPS::Tool::DBI::Datasource -- Embed the parameters for	a DBI handle
       in object configuration

SYNOPSIS
	my $spops = {
	  myobject => {
	    class      => 'My::Object',
	    rules_from => [ 'SPOPS::Tool::DBI::Datasource' ],
	    dbi_config => { dsn	=> 'DBI:mysql:test',
			    username =>	'kool',
			    password =>	'andthegang' },
	    ...
	  },
	};
	SPOPS::Initialize->process({ config => $spops });
	my $object = My::Object->fetch(	'celebrate' );

DESCRIPTION
       This rule allows	you to embed the DBI connection	information in your
       object rather than using	the strategies described elsewhere. This is
       very handy for creating simple, one-off scripts,	but you	should still
       use the subclassing strategy from SPOPS::Manual::Cookbook if you	will
       have multiple objects using the same datasource.

       You can specify the following items in the configuration:

       o   "dsn": The DBI DSN, or the first entry in the normal	DBI "connect"
	   call.

       o   "username": Username	to connect with

       o   "password": Password	to connect with

       o   "trace": Trace level	to use (0-5, see DBI for what the levels mean)

METHODS
       behavior_factory( $class	)

       Generates a behavior to generate	the datasource retrieval code during
       the 'manipulate_configuration' phase.

       datasource_access( $class )

       Generates the 'global_datasource_handle()' method that retrieves	an
       opened database handle if it exists or creates one otherwise.

BUGS
       None known.

TO DO
       Nothing known.

SEE ALSO
       SPOPS::Manual::CodeGeneration

       SPOPS::DBI

COPYRIGHT
       Copyright (c) 2001-2004 intes.net, inc..	All rights reserved.

       This library is free software; you can redistribute it and/or modify it
       under the same terms as Perl itself.

AUTHORS
       Chris Winters <chris@cwinters.com>

       Thanks to jeffa on PerlMonks
       (http://www.perlmonks.org/index.pl?node_id=18800) for suggesting	this!

perl v5.32.0			  2004-06-02   SPOPS::Tool::DBI::Datasource(3)

NAME | SYNOPSIS | DESCRIPTION | METHODS | BUGS | TO DO | SEE ALSO | COPYRIGHT | AUTHORS

Want to link to this manual page? Use this URL:
<https://www.freebsd.org/cgi/man.cgi?query=SPOPS::Tool::DBI::Datasource&sektion=3&manpath=FreeBSD+12.2-RELEASE+and+Ports>

home | help