[Dbix-class] not able to list any records from database

Rajeev Prasad rp.neuli at yahoo.com
Thu Sep 1 21:52:11 GMT 2011

but when i put search item as 'test12' I get error:
$ get-data-from-db.pl
Use of uninitialized value in concatenation (.) or string at ./get-data-fro=
m-db.pl line 23.
user is:

here is the code again, i think i have defined every variable.....
use strict;
use warnings;
use lib '../testdb';
use Mysqltestdb::Schema;
my ($schema, $user, $users_rs, $userid);
my (@newusers, @oldusers);
$schema =3D Mysqltestdb::Schema->connect("dbi:mysql:dbname=3Dmysqltestdb:lo=
calhost:3306", 'root', 'mysql5');
$users_rs =3D $schema->resultset('Testdbuser')->search(
=A0=A0=A0 { 'userid' =3D> 'test12' },=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 ## WHERE
=A0=A0=A0 { =

=A0=A0=A0=A0=A0 select=A0=A0 =3D> [ qw/userid password/ ],=A0=A0=A0=A0=A0=
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 ## SELECT
=A0=A0=A0=A0=A0 as=A0=A0=A0=A0=A0=A0 =3D> [ qw/uid pass/ ],
=A0=A0=A0 }
=A0 );
=A0 =

while ($user =3D $users_rs->next ()){
=A0print "user is:" . $user->userid . "\n";

From: Brian E. Lozier <brian at massassi.com>
To: Rajeev Prasad <rp.neuli at yahoo.com>; DBIx::Class user and developer list=
 <dbix-class at lists.scsys.co.uk>
Sent: Thursday, September 1, 2011 4:46 PM
Subject: Re: [Dbix-class] not able to list any records from database

On Thu, Sep 1, 2011 at 2:40 PM, Rajeev Prasad <rp.neuli at yahoo.com> wrote: =

follwoing code is not printing anything...???? can anyone help plz?
>use strict;
>use warnings;
>use lib '../testdb';
>use Mysqltestdb::Schema;
>my ($schema, $user, $users_rs);
>my (@newusers, @oldusers);
>$schema =3D Mysqltestdb::Schema->connect("dbi:mysql:dbname=3Dmysqltestdb:l=
ocalhost:3306", 'root', 'mysql5');
>$users_rs =3D $schema->resultset('Testdbuser')->search(=A0=A0=A0 { 'userid=
' =3D> 'test' },=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 ## WHERE=A0=A0=A0 { =A0=A0=A0=A0=A0 se=
lect=A0=A0 =3D> [ qw/userid password/ ],=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=
=A0=A0=A0=A0=A0=A0=A0 ## SELECT=A0=A0=A0=A0=A0 as=A0=A0=A0=A0=A0=A0 =3D> [ =
qw/uid pass/ ],=A0=A0=A0 }=A0 );=A0 while ($user =3D $users_rs->next ()){=
=A0print "user is:" . $user->uid . "\n";=A0};
>database users:
>SQL query: SELECT * FROM `testdbusers` LIMIT 0, 30 ; Rows: 6 =

>userid =

>password =

>test12 pass =

>user1 pass1 =

>user2 pass2 =

>test45 pass =

>te1234 pass =

>te4567 pass =

You're searching for userid =3D 'test' but you have no user 'test' in your =
results.{ 'userid' =3D> 'test' },=A0
>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.c=
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/dbix-class/attachments/20110901/ca5=

More information about the DBIx-Class mailing list