[Dbix-class] Re: using as normal perl module
Adam Sjøgren
asjo at koldfront.dk
Fri Jul 29 22:27:12 GMT 2011
On Fri, 29 Jul 2011 15:07:28 -0700 (PDT), Rajeev wrote:
> I have looked at perl DBI and DBIx::Class. I can get up to speed on
> DBI comparatively easily i guess. (But), i want to start and stick to
> DBIx::Class, as i want to eventually use Catalyst. Catalyst prefers
> DBIx::Class, so wanted to start from it.
You can use many different object relational mappers with Catalyst -
many use DBIx::Class, but I don't think the Catalyst project, as it
were, prefers any specific one.
> when i saw CPAN for both I understood DBI methods easily and clearly compared to DBIx.
> use DBI; $dbh = DBI->connect($dsn, $user, $password, { RaiseError => 1, AutoCommit => 0 });
> where as in comparison i do not see (even in your example below)
You don't? There is an almost identical connect line in my example!
> anything similar in DBIx case. (like) use DBIx::Class; ... etc.
In the MessageID/DB.pm and MessageID/DB/Article.pm there are such lines,
but I didn't show those, as I (mis)understood from your question that
your problem was how to use DBIx::Class in a simple script rather than
within a framework such as Catalyst, not that the actual composition of
the schema modules was the problem.
> Hence I was looking for something simple. which fetches data from
> tables, uses it and then stores some data into tables. as cgi script.
Did you take a look at the documentation? I think the SYNOPSIS looks
fairly straightforward to start from?
* https://metacpan.org/module/DBIx::Class
Give it a try and post some code, then I'm sure people will pile on to
help you.
Best regards,
Adam
P.S. This is the line I was referring to above:
> my $schema=MessageID::DB->connect('dbi:Pg:dbname=message-id',
> USER', 'PASSWD', { AutoCommit=>1, pg_enable_utf8=>1 });
--
"Good car to drive after a war" Adam Sjøgren
asjo at koldfront.dk
More information about the DBIx-Class
mailing list