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

Ronald J Kimball rkimball at pangeamedia.com
Thu Sep 1 22:12:42 GMT 2011


On Thu, Sep 1, 2011 at 5:52 PM, Rajeev Prasad <rp.neuli at yahoo.com> wrote:

> thx.
>
> 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-from-db.pl line 23.
> user is:
> here is the code again, i think i have defined every variable.....
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D
> #!/usr/bin/perl
> 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:localhost:33=
06",
> 'root', 'mysql5');
> $users_rs =3D $schema->resultset('Testdbuser')->search(
>     { 'userid' =3D> 'test12' },                                ## WHERE
>
>     {
>       select   =3D> [ qw/userid password/ ],                   ## SELECT
>       as       =3D> [ qw/uid pass/ ],
>     }
>   );
>
> while ($user =3D $users_rs->next ()){
>  print "user is:" . $user->userid . "\n";
>  };
>
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
>
>

You've selected "userid" as "uid", but you're still trying to access it as
$user->userid.

Ronald
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/dbix-class/attachments/20110901/8c2=
4ffef/attachment-0001.htm


More information about the DBIx-Class mailing list