[Catalyst] newbie - syntax error

Dermot paikkos at googlemail.com
Fri Feb 22 15:22:57 GMT 2008


On 22/02/2008, Ash Berlin <ash_cpan at firemirror.com> wrote:
>
> Hi,
>
>
> I hope my first question isn't too dumb.
>
> In the routine below I want to test if the method is being called with an
> additional parameters. So if the uri is ~/list/2
> return only the files with user=3Did. If no parameter is called (~/list)
> return all files. The functions works as it is but obviously I can not
> recall all files.
>
> Without the comments the list function returns a syntax error. In fact I
> can also get the same error is I do:
>
> my $files;
>  $files : Stashed =3D $c->model('ImagesDB::Files')->search({user =3D> $id=
});
>
>
> use base 'Catalyst::Controller::BindLex'
> ...
> sub list : Local {
>  my ($self, $c, $id) =3D @_;
>  #my $files;
>  #if (defined($id)) {
>         my $files : Stashed =3D $c->model('ImagesDB::Files')->search({user
> =3D> $id});
>  #}
>  #else {
>  #      my $files : Stashed =3D $c->model('ImagesDB::Files');
>  #}
>  $c->stash->{template} =3D 'files/list.tt2';
> }
>
>
> my $files : Stashed;
>
> if (...) {
>   $files =3D ...
> } else {
>   $files =3D ....
> }
>
> BindLex cant cope when you declare the same variable ($files) multiple
> times in different scopes.
>


Phew thanks. I'll try and remember that.
Dp.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/catalyst/attachments/20080222/3d084=
807/attachment.htm


More information about the Catalyst mailing list