Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

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).

CountZero

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


Comment on Re: Dancer not displaying Template
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1055146]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (10)
As of 2014-07-25 21:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (175 votes), past polls