FAQ
this question is kind of dumb, but it just does not work for me

my $artist= cd::M::CDBI::Artist->search(name=>$c->req->param(myartist));

on the template, if i choose to submit the form with the field named "myartist", it works fine. But if I use the onchange event for that same field, a select box (or text box), it says that:

[Tue Nov 8 17:28:40 2005] [catalyst] [error] Caught exception "Can't use string
("name") as a HASH ref while "strict refs" in use at C:/Perl/site/lib/Class/DBI
.pm line 1091."




---------------------------------
Yahoo! FareChase - Search multiple travel sites in one click.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.rawmode.org/pipermail/catalyst/attachments/20051108/7a8d2dd9/attachment.htm

Search Discussions

  • Roland Moriz at Nov 8, 2005 at 11:58 pm
    Hello Will,

    Will Smith schrieb:
    this question is kind of dumb, but it just does not work for me

    my $artist= cd::M::CDBI::Artist->search(name=>$c->req->param(myartist));

    on the template, if i choose to submit the form with the field named
    "myartist", it works fine. But if I use the onchange event for that same
    field, a select box (or text box), it says that:

    [Tue Nov 8 17:28:40 2005] [catalyst] [error] Caught exception "Can't
    use string
    ("name") as a HASH ref while "strict refs" in use at
    C:/Perl/site/lib/Class/DBI
    .pm line 1091."
    try to debug it like that way:

    use Data::Dumper;

    sub youraction : .... {
    my (... $c ... ) @_;

    my $log = $c->log();
    my $myartist = $c->req->param('myartist');

    $log->debug( Dumper($myartist) );

    [...]

    }

    You should see the content of $myartist in the log. I guess the reason
    of your problem is that param myartist has no value...

    (Check the Data::Dumper and Catalyst::Log manual:

    http://search.cpan.org/~ilyam/Data-Dumper-2.121/Dumper.pm
    http://search.cpan.org/~mramberg/Catalyst-5.33/lib/Catalyst/Log.pm
    )


    Another hint: search() from Class::DBI may return more than one result.

    So beside your current problem try:

    my $artist3 = Music::Artist->search( name => 'Polysics' )->first;

    you'll only get the first result. if you want to process more results
    you'll have to put it into an array and/or loop the result ... (as
    described in the Class::DBI manual)


    Mit freundlichen Gruessen,
    with best regards,

    Roland Moriz

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupcatalyst @
categoriescatalyst, perl
postedNov 8, '05 at 11:32p
activeNov 8, '05 at 11:58p
posts2
users2
websitecatalystframework.org
irc#catalyst

2 users in discussion

Will Smith: 1 post Roland Moriz: 1 post

People

Translate

site design / logo © 2022 Grokbase