Dave posted a good link with a straightforward example for DBIx::Class, have you checked this out?
http://search.cpan.org/~abraxxa/DBIx-Class-0.08195/lib/DBIx/Class/Manual/Example.<http://search.cpan.org/~abraxxa/DBIx-Class-0.08195/lib/DBIx/Class/Manual/Example.pod> pod<http://search.cpan.org/~abraxxa/DBIx-Class-0.08195/lib/DBIx/Class/Manual/Example.pod> It's really pretty sweet. One of the nice things about the Catalyst setup is that you don't have to do the schema part by hand, as the example shows: http://search.cpan.org/~abraxxa/DBIx-Class-0.08195/lib/DBIx/Class/Manual/Example.pod#Set_up_DBIx::Class::Schema Instead, Catalyst gives your app its own XXX_create.pl script to handle that for you, once you have your tables and fields set up. On Fri, Jul 29, 2011 at 10:07 PM, Rajeev Prasad <rp.ne...@yahoo.com> wrote: > Hello Adam, > > thank you. I am totally new to DB access using perl. 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. > > 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) anything > similar in DBIx case. (like) use DBIx::Class; ... etc. > > hence the confusion. > > I am so new with using perl with DBI, I have no code yet written (sorry). > > Hence I was looking for something simple. which fetches data from tables, > uses it and then stores some data into tables. as cgi script. > > thank you. > Rajeev > > ------------------------------ > *From:* Adam Sjøgren <a...@koldfront.dk> > *To:* dbix-class@lists.scsys.co.uk > *Sent:* Friday, July 29, 2011 3:41 PM > *Subject:* [Dbix-class] Re: using as normal perl module > > On Thu, 28 Jul 2011 14:52:35 -0700 (PDT), Rajeev wrote: > > > all the examples i see are of using the module in a webapp (built with > > catalyst). I am only trying to use it in my cgi perl programe, but > > finding very less documentation. can someone please refer a URL or > > small script which stores and retrieves data from a table using this > > module plz. > > I recently used DBIx::Class in a very simple command-line script that > reads files from the filesystem and stuffs them into the database. > > I looked roughly like this: > > #!/usr/bin/perl > > use strict; > use warnings; > use utf8; > use File::Slurp qw(slurp); > > use MessageID::DB; > > my $schema=MessageID::DB->connect('dbi:Pg:dbname=message-id', 'USER', > 'PASSWD', { AutoCommit=>1, pg_enable_utf8=>1 }); > > my $transaction=sub { > while(my $filename=<>) { > chomp $filename; > my $article=slurp($filename); > my $message_id=extract_message_id($article, $filename); > $schema->resultset('Article')->create({ message_id=>$message_id, > article=>$article }); > } > }; > > $schema->txn_do($transaction); > > It is trivial, but you asked for something that doesn't use Catalyst and > is small (I left out the helper-sub and the error-checking) :-) > > Maybe if you show what you have tried and describe what you wanted, it > is easier to get help. > > > Best regards, > > Adam > > -- > "Good car to drive after a war" Adam Sjøgren > a...@koldfront.dk > > _______________________________________________ > List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class > IRC: irc.perl.org#dbix-class > SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/ > Searchable Archive: > http://www.grokbase.com/group/dbix-class@lists.scsys.co.uk > > > > _______________________________________________ > List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class > IRC: irc.perl.org#dbix-class > SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/ > Searchable Archive: > http://www.grokbase.com/group/dbix-class@lists.scsys.co.uk > -- "Don't just accept the benefits of civilization -- add to it. Extend it. Preserve it." -- Jeff Greason
_______________________________________________ List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class IRC: irc.perl.org#dbix-class SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/ Searchable Archive: http://www.grokbase.com/group/dbix-class@lists.scsys.co.uk