--- trunk/lib/Frey/Manual.pod 2008/12/03 21:26:29 704 +++ trunk/lib/Frey/Manual.pod 2009/01/06 13:20:39 941 @@ -2,10 +2,178 @@ This page describes how to use and develop with L +=head1 Developer parts + +=head2 Moose classes + +All Moose classes have simple introspection API which use +L to show class and it's pod (using L). + +Example of valid REST URL is + + http://localhost:16001/Frey + +which will show L class introspection. + +You can also add method invocation and optional parameters to C +constructor like this: + + http://localhost:16001/Frey::Pod/as_markup?class=Frey + +this is same using L from perl as + + Frey::Pod->new( class => 'Frey' )->as_markup; + +Forms to enter required parameters will be generated automatically, +allowing you to explore your data while you are making interface for it. + +=head2 Database + +FIXME broken if not noted in C + +For database objects we support L and when your objects are created +C<< with 'Frey::Collection' >> they will have basic CRUD functionality +implemented by L. + +=head1 User parts + +=head2 Pipes + +See L for now. + +=head1 Designing user interaction flows + +Frey is all about creating Moose classes as your interaction with pages. +Each page is instance of class with some parameters received with post or +get request. + +If you want to access those parameters in your object, you have to define +attributes for it using L + +You can also generate result in three different forms: + + +=over 20 + +=item as_markup + +HTML content + +=item as_sponge + +Tabular output + +FIXME link to description + +=item as_data + +Any perl hash structure + +=back + + +=head2 No html templates + +Frey doesn't have html templates. Since your methods are part of REST URIs, +it doesn't make sense to separate html from object itself, which represent +web page. L provides role which has a bunch of helpful things +when creating html. + +Basically, if html you are generating in readable code semantically correct +to you, it the right track. + +You don't even have to create initial entry form as L, +which will start your L classes, will call L +for help and generate initial form for you. If this magic is wrong, +just define C<< sub render_pipe { 'radio' } >> to force rending of +C attribute as radio buttons. + +=head2 Easy skeletons + +Creating files is mess, so L will +create class and test skeleton for you. + +If I did it right, it should read similar to human language, like Smalltalk. + +L is careful to provide enough magic to build skeletons just of files +which contain some specific logic to your aplication, so it's not massive code +generation as in Java... + +To make things simple, there are few conventions (with nod to Ruby on Rails) +which will help you get started: + + +=head2 HTML markup convetion + +HTML markup should be enclosed in C< qq| > and C< | > quotes. There is also +funny but very readable convention of multi line html when you have to +intermix conditions: + + my $html + = qq|

First

| + . ( $is_second ? qq|

Second

| : '' ) + . qq|

Third

| + ; + +This will be checked and reported at some point. Ideally, I would like to +write just + + my $html + = qq|

First

| + . $is_second ? qq|

Second

| : '' + . qq|

Third

| + ; + +which is valid perl syntax but doesn't work as expected. + + +=head2 Smalltalk like refactoring + +Frey is heavily influenced by Smalltalk, up to the point of syntax. Coding +Frey code should be like playing with L. And you might end up with +result which might surprise you. + +Refactoring tools are not new in perl. We have L, L and C +so what more do we want? + +If you look closely into Smalltalk development work-flow, you really need +ability to rename class or method without any additional effort. For that, +we use L which allows code modifications at source +level with just few clicks. + +=head2 Default values + +When L tries to create instance of class (usually because of web +request) it tried to read default values from C files in C and +if it doesn't find all of required values it will invoke L to +create end-user html form with missing fields. + + +=head1 Examples + +To help you get started, here are few implemented flows in Frey: + +=over 20 + +=item L + +Simple interaction with C + +=item L + +Gather data, display selection form with checkboxes + +=item L + +Display a huge amount of icons with single HTTP request + +=back + + =head1 Command-line integration One of key points is that L runs under your user. This means it has -access to your termnial, and ssh keys, so beware! +access to your terminal, and ssh keys, so beware! =head1 Install @@ -42,7 +210,7 @@ =head2 bin/dev.sh -Recommeded way to start development L server since it will restart it +Recommended way to start development L server since it will restart it automatically and kill running instance if existing. =head2 bin/check-syntax.sh @@ -51,7 +219,12 @@ =head2 bin/grep-iselect.sh -Helper using C to quickly grep, select result and jump to C +Helper using C to quickly grep, select result and jump to C. + +You can also pass grep params for context etc, like this: + + ./bin/grep-iselect.sh something -C 3 + ./bin/grep-iselect.sh something -A 10 -B 3 =head2 bin/log.sh @@ -65,7 +238,7 @@ =head2 bin/clean-var.sh Cleanup C directory which gets a lot of dumps. Most of useful data -is held forever because I belive that trends are most interesting way to +is held forever because I believe that trends are most interesting way to look at data. =cut