rendering web page with HTML in a variable, no templates or layouts
Hi there, Sorry if I didn't find this in the docs, is there a way with Dancer to have it render a web page using HTML stored in a variable and not use any templating or layouts? thanks, Leandro
Hi! You may return HTML-data from your route: $ cat lib/test.pm package test; use Dancer ':syntax'; our $VERSION = '0.1'; get '/' => sub { return "<html><body>Some data</body></html>\n"; }; true; $ ./bin/app.pl --environment=production --daemon
Dancer 1.3051 server 17817 listening on http://0.0.0.0:3000 == Entering the production dance floor ... $ telnet localhost 3000 Trying 127.0.0.1... Connected to localhost. Escape character is '^]'. GET / HTTP/1.0 Host: localhost
HTTP/1.0 200 OK Content-Length: 35 Content-Type: text/html; charset=utf-8 X-Powered-By: Perl Dancer 1.3051 <html><body>Some data</body></html> Connection closed by foreign host. $ 24.06.2011 14:32, Leandro Hermida ?????:
Hi there,
Sorry if I didn't find this in the docs, is there a way with Dancer to have it render a web page using HTML stored in a variable and not use any templating or layouts?
thanks, Leandro
_______________________________________________ Dancer-users mailing list Dancer-users@perldancer.org http://www.backup-manager.org/cgi-bin/listinfo/dancer-users Best regards, Maxim Nikolenko
Hi, thanks that was easy! :) On Fri, Jun 24, 2011 at 12:46 PM, Maxim Nikolenko <root@zbsd.ru> wrote:
** Hi!
You may return HTML-data from your route:
$ cat lib/test.pm package test; use Dancer ':syntax';
our $VERSION = '0.1';
get '/' => sub { return "<html><body>Some data</body></html>\n"; };
true; $ ./bin/app.pl --environment=production --daemon
Dancer 1.3051 server 17817 listening on http://0.0.0.0:3000 == Entering the production dance floor ... $ telnet localhost 3000 Trying 127.0.0.1... Connected to localhost. Escape character is '^]'. GET / HTTP/1.0 Host: localhost
HTTP/1.0 200 OK Content-Length: 35 Content-Type: text/html; charset=utf-8 X-Powered-By: Perl Dancer 1.3051
<html><body>Some data</body></html> Connection closed by foreign host. $
24.06.2011 14:32, Leandro Hermida пишет:
Hi there,
Sorry if I didn't find this in the docs, is there a way with Dancer to have it render a web page using HTML stored in a variable and not use any templating or layouts?
thanks, Leandro
_______________________________________________ Dancer-users mailing listDancer-users@perldancer.orghttp://www.backup-manager.org/cgi-bin/listinfo/dancer-users
Best regards, Maxim Nikolenko
_______________________________________________ Dancer-users mailing list Dancer-users@perldancer.org http://www.backup-manager.org/cgi-bin/listinfo/dancer-users
participants (2)
-
Leandro Hermida -
Maxim Nikolenko