1 |
package Frey; |
package Frey; |
2 |
use Moose; |
use Moose; |
3 |
|
|
4 |
|
our $VERSION = "0.23"; |
5 |
|
|
6 |
|
use Data::Dump qw//; |
7 |
|
sub dump { |
8 |
|
my ($self,$data) = @_; |
9 |
|
Data::Dump::dump( $data ); |
10 |
|
} |
11 |
|
|
12 |
has 'debug' => ( |
has 'debug' => ( |
13 |
is => 'rw', |
is => 'rw', |
14 |
isa => 'Int', |
isa => 'Int', |
15 |
default => 1, |
default => 0, |
16 |
); |
); |
17 |
|
|
18 |
=head1 NAME |
=head1 NAME |
21 |
|
|
22 |
=head1 DESCRIPTION |
=head1 DESCRIPTION |
23 |
|
|
24 |
n. Mythology. |
n. Mythology. |
25 |
|
|
26 |
The Norse god who dispenses peace, good weather, prosperity, and bountiful |
The Norse god who dispenses peace, good weather, prosperity, and bountiful |
27 |
crops; the brother of Freya. |
crops; the brother of Freya. |
28 |
|
|
29 |
=cut |
Basically you write L<Moose> classes which become deirectly callable from |
30 |
|
the Firefox using REST API. for gentle intoduction see L<Frey::Manual>. |
31 |
|
|
32 |
use Data::Dump qw/dump/; |
This is just brief overview of concepts so you might check if they suite you |
33 |
use File::Find; |
before you get into details. |
34 |
|
|
35 |
has 'classes' => ( |
=head1 Developer parts |
36 |
is => 'ro', |
|
37 |
# isa => 'HashRef[Str]', |
=head2 Moose classes |
38 |
default => sub { |
|
39 |
my $self = shift; |
All Moose classes have simple introspection API which use |
40 |
# FIXME there must be better way to do this in Moose style |
L<Frey::Introspect> to show class and it's pod (using L<Frey::Pod>). |
41 |
my $classes; |
|
42 |
finddepth({ no_chdir => 1, wanted => sub { |
Example of valid REST URL is |
43 |
return unless s/\.pm$//; |
|
44 |
my @a = split(m!/!,$_); |
http://localhost:16001/Frey |
45 |
if ( $#a != 2 ) { |
|
46 |
warn "SKIP $_ [$#a]" if $self->debug; |
which will show L<Frey> class introspection. |
47 |
return; |
|
48 |
} |
You can also add method invocation and optonal parametars to C<new> |
49 |
warn ">> $_ ",dump( @a ) if $self->debug; |
constructor like this: |
50 |
my $package = "$a[1]::$a[2]"; |
|
51 |
warn "## $package\n"; |
http://localhost:16001/Frey::Pod/as_markup?class=Frey |
52 |
push @$classes, $package; |
|
53 |
} }, 'lib'); |
this is same using L<Frey::Pod> from perl as |
54 |
warn "## classes = ",dump( $classes ) if $self->debug; |
|
55 |
$classes; |
Frey::Pod->new( class => 'Frey' )->as_markup; |
56 |
}, |
|
57 |
lazy => 1, |
Forms to enter required parameters will be generated automatically, |
58 |
); |
allowing you to explore your data while you are making interface for it. |
59 |
|
|
60 |
|
=head2 Database |
61 |
|
|
62 |
|
FIXME broken if not noted in C<TODO> |
63 |
|
|
64 |
|
For database objects we support L<Fey> and when your objects are created |
65 |
|
C<< with 'Frey::Collection' >> they will have basic CRUD functionality |
66 |
|
implemented by L<Frey::ObjectBrowser>. |
67 |
|
|
68 |
|
=head1 User parts |
69 |
|
|
70 |
|
=head2 Pipes |
71 |
|
|
72 |
|
See L<Frey::Pipe> for now. |
73 |
|
|
74 |
|
=head1 SEE ALSO |
75 |
|
|
76 |
|
L<Frey::Manual> |
77 |
|
|
78 |
|
=cut |
79 |
|
|
80 |
1; |
1; |