<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>&nbsp;$files : Stashed = $c-&gt;model('ImagesDB::Files')-&gt;search({user =&gt; $id});<br> <br><span style="font-weight: bold;"><br></span>use base 'Catalyst::Controller::BindLex'<br>...<br>sub list : Local {<br>&nbsp;my ($self, $c, $id) = @_;<br>&nbsp;#my $files;<br>&nbsp;#if (defined($id)) {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; my $files : Stashed = $c-&gt;model('ImagesDB::Files')-&gt;search({user =&gt; $id});<br> &nbsp;#}<br>&nbsp;#else {<br>&nbsp;#&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; my $files : Stashed = $c-&gt;model('ImagesDB::Files');<br>&nbsp;#}<br>&nbsp;$c-&gt;stash-&gt;{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>&nbsp;&nbsp;$files = ...</div><div>} else {</div><div>&nbsp;&nbsp;$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.&nbsp;</div></body></html>