1 |
package Frey; |
package Frey; |
2 |
use Moose; |
use Moose; |
3 |
|
|
4 |
|
our $VERSION = "0.16"; |
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 |
25 |
|
|
26 |
use Data::Dump qw/dump/; |
=head1 INTROSPECTION |
|
use File::Find; |
|
27 |
|
|
28 |
has 'classes' => ( |
Secondary goal is to have introspection. |
29 |
is => 'ro', |
|
30 |
# isa => 'HashRef[Str]', |
=head2 Database |
31 |
default => sub { |
|
32 |
my $self = shift; |
For database objects we support L<Fey> and when your objects are created |
33 |
# FIXME there must be better way to do this in Moose style |
C<< with 'Frey::Collection' >> they will have basic CRUD functionality |
34 |
my $classes; |
implemented by L<Frey::ObjectBrowser>. |
35 |
finddepth({ no_chdir => 1, wanted => sub { |
|
36 |
return unless s/\.pm$//; |
=cut |
|
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, |
|
|
); |
|
37 |
|
|
38 |
1; |
1; |