summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2011-02-22 00:52:51 -0600
committerJesse Luehrs <doy@tozt.net>2011-02-22 00:52:51 -0600
commitaba1aabb2489c25080c89c35449db9c34a61bb55 (patch)
tree22cafdb5e9d38e9ca1c5d10c8dec92a654e46e14
parent9d5db6dc0c4e555efded044df1308461ade8a212 (diff)
downloadnarwhal-aba1aabb2489c25080c89c35449db9c34a61bb55.tar.gz
narwhal-aba1aabb2489c25080c89c35449db9c34a61bb55.zip
new ox syntax
-rw-r--r--lib/Narwhal.pm64
1 files changed, 41 insertions, 23 deletions
diff --git a/lib/Narwhal.pm b/lib/Narwhal.pm
index b78e514..121cd2c 100644
--- a/lib/Narwhal.pm
+++ b/lib/Narwhal.pm
@@ -4,36 +4,54 @@ use OX;
with 'OX::Role::WithAppRoot';
has kioku_dsn => (
- traits => ['OX::Config'],
- is => 'ro',
- isa => 'Str',
- default => 'dbi:SQLite:narwhal.db',
+ is => 'ro',
+ isa => 'Str',
+ value => 'dbi:SQLite:narwhal.db',
);
-config kioku_extra_args => sub { { create => 1 } };
-config template_root => sub {
- shift->param('app_root')->subdir('root', 'templates')
-}, (app_root => depends_on('/app_root'));
+has kioku_extra_args => (
+ is => 'ro',
+ isa => 'HashRef',
+ block => sub { { create => 1 } },
+);
+
+has template_root => (
+ is => 'ro',
+ isa => 'Str',
+ block => sub { shift->param('app_root')->subdir('root', 'templates') },
+ dependencies => ['app_root'],
+);
-component Redirect => 'Narwhal::Component::Redirect';
+has redirect => (
+ is => 'ro',
+ isa => 'Narwhal::Component::Redirect',
+);
-component Wiki => 'Narwhal::Component::Wiki', (
- kioku => depends_on('/Component/Kioku'),
- tt => depends_on('/Component/TT'),
+has wiki => (
+ is => 'ro',
+ isa => 'Narwhal::Component::Wiki',
+ dependencies => ['kioku', 'tt'],
);
-component WikiEdit => 'Narwhal::Component::Wiki::Edit', (
- kioku => depends_on('/Component/Kioku'),
- tt => depends_on('/Component/TT'),
+has wiki_edit => (
+ is => 'ro',
+ isa => 'Narwhal::Component::Wiki::Edit',
+ dependencies => ['kioku', 'tt'],
);
-component TT => 'OX::View::TT', (
- template_root => depends_on('/Config/template_root'),
+has tt => (
+ is => 'ro',
+ isa => 'OX::View::TT',
+ dependencies => ['template_root'],
);
-component Kioku => 'Narwhal::Component::Model', (
- dsn => depends_on('/Config/kioku_dsn'),
- extra_args => depends_on('/Config/kioku_extra_args'),
+has kioku => (
+ is => 'ro',
+ isa => 'Narwhal::Component::Model',
+ dependencies => {
+ dsn => 'kioku_dsn',
+ extra_args => 'kioku_extra_args',
+ },
);
router ['Narwhal::RouteBuilder::HTTPMethod'], as {
@@ -54,9 +72,9 @@ router ['Narwhal::RouteBuilder::HTTPMethod'], as {
page_name => { isa => 'Str' },
);
}, (
- redirect => depends_on('/Component/Redirect'),
- wiki => depends_on('/Component/Wiki'),
- edit => depends_on('/Component/WikiEdit'),
+ redirect => depends_on('redirect'),
+ wiki => depends_on('wiki'),
+ edit => depends_on('wiki_edit'),
);
no OX;