<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On 22 Feb 2008, at 14:47, Dermot wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite">Hi,<br><br>I hope my first question isn't too dumb. <br><br>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<br>return only the files with user=id. If no parameter is called (~/list) return all files. The functions works as it is but obviously I can not recall all files.<br> <br>Without the comments the list function returns a syntax error. In fact I can also get the same error is I do:<br><br>my $files;<br> $files : Stashed = $c->model('ImagesDB::Files')->search({user => $id});<br> <br><span style="font-weight: bold;"><br></span>use base 'Catalyst::Controller::BindLex'<br>...<br>sub list : Local {<br> my ($self, $c, $id) = @_;<br> #my $files;<br> #if (defined($id)) {<br> my $files : Stashed = $c->model('ImagesDB::Files')->search({user => $id});<br> #}<br> #else {<br> # my $files : Stashed = $c->model('ImagesDB::Files');<br> #}<br> $c->stash->{template} = 'files/list.tt2';<br>}<br><br><br>Can anyone give me a pointer? Thanx.<br>Dp.<br><br></blockquote></div><br><div>my $files : Stashed;</div><div><br class="webkit-block-placeholder"></div><div>if (...) {</div><div> $files = ...</div><div>} else {</div><div> $files = ....</div><div>}</div><div><br class="webkit-block-placeholder"></div><div>BindLex cant cope when you declare the same variable ($files) multiple times in different scopes. </div></body></html>