Help on DBIx::Class

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • rajiv07
    New Member
    • Jun 2007
    • 141

    #1

    Help on DBIx::Class

    Hi to all

    I have some problem to use DBIx::Class

    [CODE=perl]package My::Schema;
    use base qw/DBIx::Class::Sc hema::Loader/;

    __PACKAGE__->loader_options (
    debug => 1,
    );
    __PACKAGE__->connection('db i:mysql:music:l ocalhost','root ','');

    1;
    [/CODE]
    I have set my DBIx::Class using the above code and i have a perl script to get some value from albuminfo table .It is my testing stage only so please help on this. my perl script

    [CODE=perl]#!/usr/bin/perl
    use My::Schema;

    my $schema = My::Schema->connect("dbi:m ysql:music:loca lhost", "root", "");

    my $album = $schema->resultset('alb uminfo')->find(14);

    if ($album) {
    print "Found ", $album->title, ", The ID = ", $album->albumid, "n";
    } else {
    print "Can't find album.n";
    }
    [/CODE]

    But it gives some error

    The Error

    Code:
    Base class package "DBIx::Class::Schema::Loader" is empty.
        (Perhaps you need to 'use' the module which defines that package first.)
     at C:/Perl/lib/My/Schema.pm line 2
    BEGIN failed--compilation aborted at C:/Perl/lib/My/Schema.pm line 2.
    Compilation failed in require at C:\DOCUME~1\INDIAM~1.COM\LOCALS~1\Temp\loc546.tmp line 2.
    BEGIN failed--compilation aborted at C:\DOCUME~1\INDIAM~1.COM\LOCALS~1\Temp\loc546.tmp line 2.

    Regards
    Rajiv
    Last edited by eWish; Apr 7 '08, 03:50 AM. Reason: Please use code tags for data as well
  • numberwhun
    Recognized Expert Moderator Specialist
    • May 2007
    • 3467

    #2
    Originally posted by rajiv07
    Hi to all

    I have some problem to use DBIx::Class

    [CODE=perl]package My::Schema;
    use base qw/DBIx::Class::Sc hema::Loader/;

    __PACKAGE__->loader_options (
    debug => 1,
    );
    __PACKAGE__->connection('db i:mysql:music:l ocalhost','root ','');

    1;
    [/CODE]
    I have set my DBIx::Class using the above code and i have a perl script to get some value from albuminfo table .It is my testing stage only so please help on this. my perl script

    [CODE=perl]#!/usr/bin/perl
    use My::Schema;

    my $schema = My::Schema->connect("dbi:m ysql:music:loca lhost", "root", "");

    my $album = $schema->resultset('alb uminfo')->find(14);

    if ($album) {
    print "Found ", $album->title, ", The ID = ", $album->albumid, "n";
    } else {
    print "Can't find album.n";
    }
    [/CODE]

    But it gives some error

    The Error

    Code:
    Base class package "DBIx::Class::Schema::Loader" is empty.
        (Perhaps you need to 'use' the module which defines that package first.)
     at C:/Perl/lib/My/Schema.pm line 2
    BEGIN failed--compilation aborted at C:/Perl/lib/My/Schema.pm line 2.
    Compilation failed in require at C:\DOCUME~1\INDIAM~1.COM\LOCALS~1\Temp\loc546.tmp line 2.
    BEGIN failed--compilation aborted at C:\DOCUME~1\INDIAM~1.COM\LOCALS~1\Temp\loc546.tmp line 2.

    Regards
    Rajiv

    Sorry, I don't know the answer but hopefully one of our experts will be able to assist you.

    My appologies for the delay in getting an answer to your question.

    Regards,

    Jeff

    Comment

    Working...