Ambrosia::DataProvider - a container for data sources. (Singleton)
version 0.010
use Ambrosia::DataProvider; my $confDS = { DBI => [ { engine_name => 'DB::mysql', source_name => 'Employee', engine_params => 'database=EmployeeDB;host=localhost;', user => 'test', password => 'test', additional_params => { AutoCommit => 0, RaiseError => 1, LongTruncOk => 1 }, additional_action => sub { my $dbh = shift; $dbh->do('SET NAMES utf8')}, }, #........ ], IO => [ { engine_name => 'IO::CGI', source_name => 'cgi', engine_params => { header_params => { '-Pragma' => 'no-cache', '-Cache_Control' => 'no-cache, must-revalidate, no-store' } } } ], }; instance Ambrosia::Storage(application_name => $confDS); Ambrosia::DataProvider::assign 'application_name';
Ambrosia::DataProvider is a container for data sources. (Singleton)
For more information see:
Static subrutine. Creates a singleton container.
instance('storage_name' => $config_data) Structure of config data: config = { DRIVER_TYPE => [ engine_name => 'ENGINE_FOR_DRIVER_TYPE', source_name => 'UNIQ_NAME_FOR_SOURCE_DATA', engine_params => 'PARAMS_FOR_ENGINE', %ANY_ADDITIONAL_PARAMS_FOR_DRIVER_TYPE ] }
Static subrutine. Assigns a current process to a named data source from container. assign('storage_name')
Static subrutine. Returns container assigned to current process. storage() storage('storage_name')
Method. Adds or changes a data source into container. storage()->add_source($config_data)
Method. Returns a driver from container by driver type and source name. storage()->driver($driverType, $sourceName)
Ambrosia::core::ClassFactory Ambrosia::Assert
Not tested.
Please report bugs relevant to Ambrosia to <knm[at]cpan.org>.
Ambrosia
Copyright (C) 2010-2012 Nickolay Kuritsyn. All rights reserved.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
Nikolay Kuritsyn (knm[at]cpan.org)
To install Ambrosia, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Ambrosia
CPAN shell
perl -MCPAN -e shell install Ambrosia
For more information on module installation, please visit the detailed CPAN module installation guide.