Hi All,

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.

I started reading following manual :

*https://metacpan.org/pod/Dancer2::Manual
<https://metacpan.org/pod/Dancer2::Manual>*

I installed Dancer2, placked up it and opened web page from localhost.
Everything is OK until here.

There is following info at manual:

*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.*
It is clear for following example




*get '/test1/:name' => sub {    return "Hi there " . params->{name};};*
because it returns a string and when I write *http://localhost:5000/test1/kadir
<http://localhost:5000/test1/kadir> *to browser I see  *Hi there kadir*
which is the string I expect to see

But next example is as follow:





*get '/test2/:name' => sub {    "Hey ".param('name').", welcome here!";};*
It does not return anything. Because there is no *return* keyword
*.*
Despite this I see   *Hi there kadir  *when I write
*http://localhost:5000/test2/kadir <http://localhost:5000/test2/kadir>*
But above red background colored sentence says that it must return a value
*?*

Next example is stranger





*:get '/test3/:name' => sub {    "Hello there, " . defined
param('name')                    ? param('name')                    :
"whoever you are!";};*

Again there is no *return* keyword. When I write
*http://localhost:5000/test3/kadir
<http://localhost:5000/test3/kadir> *I see only kadir. But at test2
example, I saw all words despite there is no return keyword. So what is
rule?
*-- *

*Kadir BeyazlıComputer Engineer*
*GSM : +90 535 821 50 00*
_______________________________________________
dancer-users mailing list
[email protected]
http://lists.preshweb.co.uk/mailman/listinfo/dancer-users

Reply via email to