in reply to Re: Syntax question when using Class::DBI
in thread Syntax question when using Class::DBI

fooble syntax OK Your problem's elsewhere.
Scratches head ... Really, I'm not crazy:

gonzo:: more foo.pl #!/usr/local/bin/perl my $columnname = 'id'; print $rowobj->$columnname; gonzo:: perl -c foo.pl syntax error at foo.pl line 4, near "$columnname;" foo.pl had compilation errors.
OK, how about that fact that I'm running an ancient perl 5.005. That would explain our different results.

And the solution for 5.005 is staring at me in another NOOBs question:

my $columnname = 'id'; print $rowobj->{$columnname};
Cheers

-------------------------------------
Nothing is too wonderful to be true
-- Michael Faraday

Replies are listed 'Best First'.
Re^3: Syntax question when using Class::DBI
by Corion (Patriarch) on Dec 09, 2004 at 08:18 UTC

    Be aware that Class::DBI lazy-loads the columns, so as soon as you start using the Essential feature for columns, you might find $rowobj->{$columnname} empty even though there is a value in the column. Using the get method should make sure that your object gets filled with data.