-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6a9ca09
commit 2617e98
Showing
7 changed files
with
229 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#!/usr/bin/perl | ||
use Dancer; | ||
use Data::Dump qw/pp/; | ||
|
||
set logger => 'console'; | ||
set log => 'debug'; | ||
set show_errors => 1; | ||
|
||
|
||
set engines => { | ||
template_toolkit => | ||
{ | ||
start_tag => '[%', | ||
stop_tag => '%]' | ||
} | ||
}; | ||
set template => 'template_toolkit'; | ||
|
||
get '/' => sub { | ||
my $ra_shopping_list = params->{item}; | ||
return template 'write-it-on-my-forehead' => { | ||
shopping_list => $ra_shopping_list , | ||
req_headers => pp(request->headers), | ||
}; | ||
}; | ||
|
||
|
||
|
||
Dancer->dance; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<h1>Shopping List on Forehead</h1> | ||
<form action="/" method="get"> | ||
|
||
Remember to buy: <input type="text" name="item" /> | ||
<input type="submit" value="Submit" /> | ||
<br/> | ||
<br/> | ||
|
||
<b> Don't forget </b><br/> | ||
[% FOREACH item in shopping_list %] | ||
<input type="text" name="item" value="[% item %]" readonly/> <br/> | ||
[% END %] | ||
</form> | ||
|
||
|
||
|
||
|
||
<b> Headers: </b> <pre> [% req_headers %] </pre> | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#!/usr/bin/perl | ||
use Dancer; | ||
use Data::Dump qw/pp/; | ||
|
||
set logger => 'console'; | ||
set log => 'debug'; | ||
set show_errors => 1; | ||
|
||
|
||
set engines => { | ||
template_toolkit => | ||
{ | ||
start_tag => '[%', | ||
stop_tag => '%]' | ||
} | ||
}; | ||
set template => 'template_toolkit'; | ||
|
||
get '/' => sub { | ||
my $ra_shopping_list = params->{item}; | ||
return template 'write-it-on-my-forehead' => { | ||
shopping_list => $ra_shopping_list , | ||
req_headers => pp(request->headers), | ||
}; | ||
}; | ||
|
||
|
||
|
||
Dancer->dance; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#!/usr/bin/perl | ||
use Dancer; | ||
use Data::Dump qw/pp/; | ||
|
||
set logger => 'console'; | ||
set log => 'debug'; | ||
set show_errors => 1; | ||
set session => 'Simple'; | ||
|
||
|
||
set engines => { | ||
template_toolkit => | ||
{ | ||
start_tag => '[%', | ||
stop_tag => '%]' | ||
} | ||
}; | ||
set template => 'template_toolkit'; | ||
|
||
get '/' => sub { | ||
debug ('Storing: '.pp(params->{item})); | ||
my $one_item = params->{item}; | ||
my @items; | ||
if (defined( session('shopping_list') )) { | ||
@items = @{session('shopping_list') }; | ||
} | ||
push @items, $one_item if $one_item; | ||
session shopping_list => \@items; | ||
|
||
|
||
return template 'remember' => { | ||
list => \@items , | ||
req_headers => pp(request->headers), | ||
}; | ||
|
||
}; | ||
|
||
|
||
|
||
Dancer->dance; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<h1>Shopping List in Memory</h1> | ||
<form action="/" method="get"> | ||
|
||
Remember to buy: <input type="text" name="item" /> | ||
<input type="submit" value="Submit" /> | ||
|
||
</form> | ||
|
||
<br/> | ||
<br/> | ||
|
||
<b> Don't forget </b><br/> | ||
<ul> | ||
[% FOREACH item in list %] | ||
<li>[% item %]</li> | ||
[% END %] | ||
</ul> | ||
|
||
|
||
<br/> | ||
<br/> | ||
<br/> | ||
<br/> | ||
|
||
<b> Headers: </b> <pre> [% req_headers %] </pre> | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<h1>Shopping List on Forehead</h1> | ||
<form action="/" method="get"> | ||
|
||
Remember to buy: <input type="text" name="item" /> | ||
<input type="submit" value="Submit" /> | ||
<br/> | ||
<br/> | ||
|
||
<b> Don't forget </b><br/> | ||
[% FOREACH item in shopping_list %] | ||
<input type="text" name="item" value="[% item %]" readonly/> <br/> | ||
[% END %] | ||
</form> | ||
|
||
|
||
|
||
|
||
<b> Headers: </b> <pre> [% req_headers %] </pre> | ||
|
||
|
||
|