1 |
package Frey; |
package Frey; |
2 |
use Moose; |
use Moose; |
3 |
|
|
4 |
|
our $VERSION = "0.15"; |
5 |
|
|
6 |
has 'debug' => ( |
has 'debug' => ( |
7 |
is => 'rw', |
is => 'rw', |
8 |
isa => 'Bool', |
isa => 'Bool', |
20 |
The Norse god who dispenses peace, good weather, prosperity, and bountiful |
The Norse god who dispenses peace, good weather, prosperity, and bountiful |
21 |
crops; the brother of Freya. |
crops; the brother of Freya. |
22 |
|
|
23 |
=cut |
Basically you write L<Moose> classes which become deirectly callable from |
24 |
|
the web using REST API |
|
use Data::Dump qw/dump/; |
|
|
use File::Find; |
|
25 |
|
|
26 |
has 'classes' => ( |
=cut |
|
is => 'ro', |
|
|
# isa => 'HashRef[Str]', |
|
|
default => sub { |
|
|
my $self = shift; |
|
|
# FIXME there must be better way to do this in Moose style |
|
|
my $classes; |
|
|
finddepth({ no_chdir => 1, wanted => sub { |
|
|
return unless s/\.pm$//; |
|
|
my @a = split(m!/!,$_); |
|
|
warn ">> $_ ",dump( @a ) if $self->debug; |
|
|
my $package = join('::', @a[ 1 .. $#a ]); |
|
|
warn "## $package\n"; |
|
|
push @$classes, { $package => "$_.pm" }; |
|
|
} }, 'lib'); |
|
|
warn "## classes = ",dump( $classes ) if $self->debug; |
|
|
$classes; |
|
|
}, |
|
|
lazy => 1, |
|
|
); |
|
27 |
|
|
28 |
1; |
1; |