Skip to content

Commit

Permalink
using lvalue method for accessing location
Browse files Browse the repository at this point in the history
  • Loading branch information
FROGGS committed Aug 29, 2012
1 parent d6d1711 commit f609d94
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/Bailador/App.pm
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,15 @@ use Template::Mojo;

class Bailador::App {
has %.routes = { GET => [], 'POST' => [] };
has $.location is rw;
my $_location;
has Bailador::Context $.context = Bailador::Context.new;
has Template::Mojo $!template; # type object

method request { $.context.request }
method response { $.context.response }
method location is rw { return-rw $_location }
method template(Str $tmpl, @params) {
$!template.new(slurp "$!location/views/$tmpl").render(|@params);
$!template.new(slurp "$_location/views/$tmpl").render(|@params);
}

my $current = Bailador::App.new;
Expand Down

0 comments on commit f609d94

Please sign in to comment.