<div dir="ltr"><div><div>Hi All,<br><br></div>I am novice at Dancer, I am sure my question is very easy for you but I decided to ask because I failed at the beginning of my study.<br><br></div>I started reading following manual :<br clear="all"><div><div><div><br><i><a href="https://metacpan.org/pod/Dancer2::Manual">https://metacpan.org/pod/Dancer2::Manual</a></i><br><br></div><div>I installed Dancer2, placked up it and opened web page from localhost.<br></div><div>Everything is OK until here.<br><br></div><div>There is following info at manual:<i><br></i><p><span style="background-color:rgb(255,255,0)"><i>The code block given to the route handler has to return a string which will be used as the content to render to the client.</i></span></p>It is clear for following example <br><br><i>get '/test1/:name' => sub {<br>    return "Hi there " . params->{name};<br>};<br></i><br>because it returns a string and when I write <i><a href="http://localhost:5000/test1/kadir">http://localhost:5000/test1/kadir</a> </i>to browser I see  <i>Hi there kadir</i> which is the string I expect to see<br><br></div><div>But next example is as follow:<br><br><i>get '/test2/:name' => sub {<br>    "Hey ".param('name').", welcome here!";<br>};<br><br></i></div><div>It does not return anything. Because there is no <i>return</i> keyword<i>.<br></i></div><div>Despite this I see   <i>Hi there kadir  </i>when I write <i><a href="http://localhost:5000/test2/kadir">http://localhost:5000/test2/kadir</a><br></i></div><div>But above red background colored sentence says that it must return a value<i>?<br></i></div><div><i><br></i></div><div>Next example is stranger<i>:<br><br>get '/test3/:name' => sub {<br>    "Hello there, " . defined param('name')<br>                    ? param('name')<br>                    : "whoever you are!";<br>};</i><i><br></i></div><div><i><br></i></div><div>Again there is no <i>return</i> keyword. When I write  <i><a href="http://localhost:5000/test3/kadir">http://localhost:5000/test3/kadir</a> </i>I see only kadir. But at test2 example, I saw all words despite there is no return keyword. So what is rule?<i><br></i></div><div><i>-- </i><br><div class="gmail_signature"><div dir="ltr"><div><b><i>Kadir Beyazlı<br>Computer Engineer</i></b></div><div><b><i>GSM : +90 535 821 50 00</i></b><br></div></div></div>
</div></div></div></div>