Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked

Re: Dancer not displaying Template

by CountZero (Bishop)
on Sep 21, 2013 at 18:57 UTC ( #1055146=note: print w/replies, xml ) Need Help??

in reply to Dancer not displaying Template

From the Dancer docs about the template function:
Returns the response of processing the given template with the given parameters
In other words, whatever the sub returns goes to the client's browser, which is not necessarily what was returned by template. Hence in your first example you indeed see a webpage and in the second example you "see" the value of the while loop once it ends. As that is unlikely to be a properly formed web-page there is nothing to see. So put the call to template at the very end of the sub.

And don't forget to pass @filelist to the template function (read the docs on how to do this).


A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James

My blog: Imperial Deltronics

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1055146]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (3)
As of 2018-03-22 02:43 GMT
Find Nodes?
    Voting Booth?
    When I think of a mole I think of:

    Results (272 votes). Check out past polls.