[email protected] wrote:
$hashref->{'users_reference'} does nox exist. I had problems with undef
variables in a hash. I generally put a "scalar" in front of my variables,
this fixes the "undef value in hash"-problem
e.g.
->find_or_create({
...
users_reference => scalar $hashref->{'users_reference'},
...
});
There is no difference between
{
users_reference => $hashref->{'users_reference'},
}
and
{
users_reference => scalar $hashref->{'users_reference'},
}
$hashref->{'users_reference'} is already a scalar. Either way, you will
get the value of $hashref->{'users_reference'}, or undef if the key
doesn't exist.
You're confusing this case with calling a subroutine that could return
an empty list:
{
users_reference => $cgi->param('users_reference'),
}
versus
{
users_reference => scalar $cgi->param('users_reference'),
}
The former snippet will not do the right thing if
$cgi->param('users_reference') returns zero values or more than one
value. scalar() forces it to return a single value.
Ronald
_______________________________________________
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/[email protected]