Jifty

        1
⚁
    2
2007/04/01




             3
2007/04/01
⚁




                 3
2007/04/01
⚁
    
YAPC::Asia

⚁




                   3
2007/04/01
⚁
    
YAPC::Asia

⚁
    :
             !
⚁


                       3
<@ij1iao>
JIT





                 4
<@ij1iao>
JIT





                 4
<@ij1iao>
JIT





                 4
5
⚁




    5
⚁
    ?
⚁




        5
⚁
             ?
⚁
    :
   !
⚁


                 5






    6






    7






    7






    8
9
⚁




    9
⚁
⚁




    9
⚁
⚁
    ,
   !
⚁


             9
Pick!




        10
Pick!


“   ”




                10
Pick!




        11
Pick!




        11
Pick!




        12
Pick!




        12
Pick!




        13
Pick!




        13
Pick!




        14
...




      15
...   !




          16
17
Jifty




        18
Jifty




        18
Jifty


  
=




        18
Jifty


  
=

  
=



        18
Jifty
=
JFDI




               19
Jifty
=
JFDI

Just
F*cking
Do
It




                     19
Jifty
=
JFDI

Just
F*cking
Do
It
       
JFDI



                     19
Jifty
=
JFDI

Just
F*cking
Do
It
       
JFDI
         
Doxory!


                     19
20
• $
cpan




           20
• $
cpan
• cpan>
notest
install
Jifty




                               20
• $
cpan
• cpan>
notest
install
Jifty
               “notest”
       .




                                   20
21
•   $
jifty
app
‐‐name
Doxory




                                21
•   $
jifty
app
‐‐name
Doxory
•   Creating
new
application
Doxory
    Creating
directory
lib
    Creating
directory
lib/Do...
22
bin/jifty




            22
bin/jifty
etc/config.yml




                 22
bin/jifty
etc/config.yml
Makefile.PL


                 22
23
• $
jifty
server




                   23
• $
jifty
server
• INFO
‐
You
can
connect
to
your
server
at
  






http://localhost:8888/




                          ...
!




    24
!

          
Doxory.
    

(Users)
     ?




                       24
25
• $
cd
Doxory




                25
• $
cd
Doxory
• $
jifty
model
‐‐name
User




                              25
• $
cd
Doxory
• $
jifty
model
‐‐name
User
• Writing
file
t/00‐model‐User.t
 Writing
file
lib/Doxory/Model/User.pm




    ...
• $
cd
Doxory
• $
jifty
model
‐‐name
User
• Writing
file
t/00‐model‐User.t
 Writing
file
lib/Doxory/Model/User.pm

• $
vim...
•   package
Doxory::Model::User;
•   use
Jifty::DBI::Schema;
•   

•   use
Doxory::Record
schema
{
•   





•   

•   };
...
•   package
Doxory::Model::User;
•   use
Jifty::DBI::Schema;
•   

•   use
Doxory::Record
schema
{
•   

•   column
name
=...
28
•   $
jifty
schema
‐‐setup




                             28
•   $
jifty
schema
‐‐setup
•   INFO
‐
Generating
SQL
for
application
Doxory...
    INFO
‐
Using
Doxory::Model::User
    IN...
•   $
jifty
schema
‐‐setup
•   INFO
‐
Generating
SQL
for
application
Doxory...
    INFO
‐
Using
Doxory::Model::User
    IN...
•   $
jifty
schema
‐‐setup
•   INFO
‐
Generating
SQL
for
application
Doxory...
    INFO
‐
Using
Doxory::Model::User
    IN...
•   $
jifty
schema
‐‐setup
•   INFO
‐
Generating
SQL
for
application
Doxory...
    INFO
‐
Using
Doxory::Model::User
    IN...
29
29
30
30
31
31
32
32
33
AudreyT




          33
AudreyT




          33
34

(Choice)
   .




                 34
35
$
jifty
model
‐‐name
Choice




                              35
$
jifty
model
‐‐name
Choice
Writing
file
t/00‐model‐Choice.t
Writing
file
lib/Doxory/Model/Choice.pm




                 ...
$
jifty
model
‐‐name
Choice
Writing
file
t/00‐model‐Choice.t
Writing
file
lib/Doxory/Model/Choice.pm

$
vim
lib/Doxory/Mod...
•   package
Doxory::Model::Choice;
•   use
Jifty::DBI::Schema;
•   use
Doxory::Record
schema
{
•   

•   column
name
=>
• ...
37
•   $
jifty
schema
‐‐drop‐database
‐‐setup




                                             37
•   $
jifty
schema
‐‐drop‐database
‐‐setup
•   INFO
‐
Generating
SQL
for
application
Doxory...
    INFO
‐
Using
Doxory::Mo...
•   $
jifty
schema
‐‐drop‐database
‐‐setup
•   INFO
‐
Generating
SQL
for
application
Doxory...
    INFO
‐
Using
Doxory::Mo...
38
38
39
39
40
40
41
41
42
42
43
!
...       ?




              43
✍   44
45
•$
vim
etc/config.yml



                        45
•$
vim
etc/config.yml
                        .




                            45
•‐‐‐
•framework:
•

Plugins:
•



‐
SkeletonApp:
{}
•



‐
REST:
{}
•



‐
Halo:
{}
•



‐
ErrorTemplates:
{}
•



‐
Compr...
•‐‐‐
•framework:
•

Plugins:
•



‐
SkeletonApp:
{}
•



‐
REST:
{}
•



‐
Halo:
{}
•



‐
ErrorTemplates:
{}
•



‐
Compr...
•‐‐‐
•framework:
•

Plugins:
•



‐
SkeletonApp:
{}
•



‐
REST:
{}
•



‐
Halo:
{}
•



‐
ErrorTemplates:
{}
•



‐
Compr...
48
•$
vim
lib/Doxory/Model/User.pm



                                  48
•$
vim
lib/Doxory/Model/User.pm
                  
User.pm
   
mixin.




                                        48
•   package
Doxory::Model::User;
•   use
Jifty::DBI::Schema;
•   use
Doxory::Record
schema
{
•   

•   column
name
=>
•   ...
•   package
Doxory::Model::User;
•   use
Jifty::DBI::Schema;
•   use
Doxory::Record
schema
{
•   

•   column
name
=>
•   ...
51
51
52
52
53
From: Doxory <>
Date: April 3, 2007 5:43:07 PM JST
To: jesse@bestpractical.com
Subject:           Doxory!


  (           ...
From: Doxory <>
Date: April 3, 2007 5:43:07 PM JST
To: jesse@bestpractical.com
Subject:           Doxory!


  (           ...
54
54
55
...
(    ?)




          55
❁
    56
57
•$
vim
lib/Doxory/Dispatcher.pm



                                  57
•$
vim
lib/Doxory/Dispatcher.pm
   Dispatcher
       
(View).




                                  57
58
•   package
Doxory::Dispatcher;
    use
Jifty::Dispatcher
‐base;




                                   58
•   package
Doxory::Dispatcher;
    use
Jifty::Dispatcher
‐base;
•
    before
'*'
=>
run
{
    



if
(Jifty‐>web‐>current...
•   package
Doxory::Dispatcher;
    use
Jifty::Dispatcher
‐base;
•
    before
'*'
=>
run
{
    



if
(Jifty‐>web‐>current...
•   package
Doxory::Dispatcher;
    use
Jifty::Dispatcher
‐base;
•
    before
'*'
=>
run
{
    



if
(Jifty‐>web‐>current...
•   package
Doxory::Dispatcher;
    use
Jifty::Dispatcher
‐base;
•
    before
'*'
=>
run
{
    



if
(Jifty‐>web‐>current...
•   package
Doxory::Dispatcher;
    use
Jifty::Dispatcher
‐base;
•
    before
'*'
=>
run
{
    



if
(Jifty‐>web‐>current...
•   package
Doxory::Dispatcher;
    use
Jifty::Dispatcher
‐base;
•
    before
'*'
=>
run
{
    



if
(Jifty‐>web‐>current...
59

“/”
   .




            59
60
•$
vim
lib/Doxory/View.pm



                            60
•$
vim
lib/Doxory/View.pm        



                              TT2
     !
                            
Mason
        !...
61
•   package
Doxory::View;
    use
Jifty::View::Declare
‐base;




                                      61
•   package
Doxory::View;
    use
Jifty::View::Declare
‐base;
•
    template
'/'
=>
page
{
    



h1
{
'Ask
a
question!'
...
•   package
Doxory::View;
    use
Jifty::View::Declare
‐base;
•
    template
'/'
=>
page
{
    



h1
{
'Ask
a
question!'
...
•   package
Doxory::View;
    use
Jifty::View::Declare
‐base;
•
    template
'/'
=>
page
{
    



h1
{
'Ask
a
question!'
...
•   package
Doxory::View;
    use
Jifty::View::Declare
‐base;
•
    template
'/'
=>
page
{
    



h1
{
'Ask
a
question!'
...
•   package
Doxory::View;
    use
Jifty::View::Declare
‐base;
•
    template
'/'
=>
page
{
    



h1
{
'Ask
a
question!'
...
•   package
Doxory::View;
    use
Jifty::View::Declare
‐base;
•
    template
'/'
=>
page
{
    



h1
{
'Ask
a
question!'
...
•   package
Doxory::View;
    use
Jifty::View::Declare
‐base;
•
    template
'/'
=>
page
{
    



h1
{
'Ask
a
question!'
...
•   package
Doxory::View;
    use
Jifty::View::Declare
‐base;
•
    template
'/'
=>
page
{
    



h1
{
'Ask
a
question!'
...
•   package
Doxory::View;
    use
Jifty::View::Declare
‐base;
•
    template
'/'
=>
page
{
    



h1
{
'Ask
a
question!'
...
62
62
63
column
a
=>




label
is
'On
the
one
hand',




render
as
'textarea',




is
mandatory;




                              ...
64
64
65

“choices”
   .




                  65
•$
vim
lib/Doxory/View.pm



                            66
67
•   package
Doxory::View;
    use
Jifty::View::Declare
‐base;




                                      67
•   package
Doxory::View;
    use
Jifty::View::Declare
‐base;

•   template
'/'
=>
page
{
...
};
    private
template
new_...
•   package
Doxory::View;
    use
Jifty::View::Declare
‐base;

•   template
'/'
=>
page
{
...
};
    private
template
new_...
•   package
Doxory::View;
    use
Jifty::View::Declare
‐base;

•   template
'/'
=>
page
{
...
};
    private
template
new_...
•   package
Doxory::View;
    use
Jifty::View::Declare
‐base;

•   template
'/'
=>
page
{
...
};
    private
template
new_...
•   package
Doxory::View;
    use
Jifty::View::Declare
‐base;

•   template
'/'
=>
page
{
...
};
    private
template
new_...
68
...
   ?





            68
☑   69
70
• $
jifty
model
‐‐name
Vote




                              70
• $
jifty
model
‐‐name
Vote
• Writing
file
t/00‐model‐Vote.t
 Writing
file
lib/Doxory/Model/Vote.pm




                  ...
• $
jifty
model
‐‐name
Vote
• Writing
file
t/00‐model‐Vote.t
 Writing
file
lib/Doxory/Model/Vote.pm

• $
vim
lib/Doxory/Mo...
•   package
Doxory::Model::Vote;
•   use
Jifty::DBI::Schema;

•   use
Doxory::Record
schema
{
•   

•   column
choice
=>
•...
72
72
73

“pick”
   .




               73
•$
vim
lib/Doxory/Dispatcher.pm



                                  74
•$
vim
lib/Doxory/Dispatcher.pm
                     
/pick
      .




                                      74
•   package
Doxory::Dispatcher;
    use
Jifty::Dispatcher
‐base;
•
    before
'*'
=>
run
{
    



if
(Jifty‐>web‐>current...
•   package
Doxory::Dispatcher;
•   ...
•   on
pick
=>
run
{
•   



my
$choices
=
Doxory::Model::ChoiceCollection‐>new;
•...
•   package
Doxory::Dispatcher;
•   ...
•   on
pick
=>
run
{
•   



my
$choices
=
Doxory::Model::ChoiceCollection‐>new;
•...
•$
vim
lib/Doxory/View.pm



                            77
78
•   package
Doxory::View;




                            78
•   package
Doxory::View;
•   use
Jifty::View::Declare
‐base;

    template
''
=>
page
{
...
};
    private
template
choic...
•   package
Doxory::View;
•   use
Jifty::View::Declare
‐base;

    template
''
=>
page
{
...
};
    private
template
choic...
•   package
Doxory::View;
•   use
Jifty::View::Declare
‐base;

    template
''
=>
page
{
...
};
    private
template
choic...
•   package
Doxory::View;
•   use
Jifty::View::Declare
‐base;

    template
''
=>
page
{
...
};
    private
template
choic...
•   package
Doxory::View;
•   use
Jifty::View::Declare
‐base;

    template
''
=>
page
{
...
};
    private
template
choic...
•   package
Doxory::View;
•   use
Jifty::View::Declare
‐base;

    template
''
=>
page
{
...
};
    private
template
choic...
•   package
Doxory::View;
•   use
Jifty::View::Declare
‐base;

    template
''
=>
page
{
...
};
    private
template
choic...
•   package
Doxory::View;
•   use
Jifty::View::Declare
‐base;

    template
''
=>
page
{
...
};
    private
template
choic...
•   package
Doxory::View;
•   use
Jifty::View::Declare
‐base;

    template
''
=>
page
{
...
};
    private
template
choic...
•   package
Doxory::View;
•   use
Jifty::View::Declare
‐base;

    template
''
=>
page
{
...
};
    private
template
choic...
79
•   package
Doxory::View;
    use
Jifty::View::Declare
‐base;

    template
''
=>
page
{
...
};
    private
template
new_c...
•   package
Doxory::View;
    use
Jifty::View::Declare
‐base;

    template
''
=>
page
{
...
};
    private
template
new_c...
•   package
Doxory::View;
    use
Jifty::View::Declare
‐base;

    template
''
=>
page
{
...
};
    private
template
new_c...
•   package
Doxory::View;
    use
Jifty::View::Declare
‐base;

    template
''
=>
page
{
...
};
    private
template
new_c...
•   package
Doxory::View;
    use
Jifty::View::Declare
‐base;

    template
''
=>
page
{
...
};
    private
template
new_c...
80
81
81
82

choices
       ,
            .




                    82
•$
vim
lib/Doxory/Model/Choice.pm



                                    83
•   package
Doxory::Model::Choice;
•   use
Jifty::DBI::Schema;
•   use
Doxory::Record
schema
{
...
}

•   sub
in_favor_of_...
•$
vim
lib/Doxory/View.pm



                            85
86
86
•   package
Doxory::View;
    use
Jifty::View::Declare
‐base;
    ...




                                      86
•   package
Doxory::View;
    use
Jifty::View::Declare
‐base;
    ...
•   template
choices
=>
page
{
    



h1
{
'My
Choi...
•   package
Doxory::View;
    use
Jifty::View::Declare
‐base;
    ...
•   template
choices
=>
page
{
    



h1
{
'My
Choi...
•   package
Doxory::View;
    use
Jifty::View::Declare
‐base;
    ...
•   template
choices
=>
page
{
    



h1
{
'My
Choi...
•   package
Doxory::View;
    use
Jifty::View::Declare
‐base;
    ...
•   template
choices
=>
page
{
    



h1
{
'My
Choi...
•   package
Doxory::View;
    use
Jifty::View::Declare
‐base;
    ...
•   template
choices
=>
page
{
    



h1
{
'My
Choi...
•   package
Doxory::View;
    use
Jifty::View::Declare
‐base;
    ...
•   template
choices
=>
page
{
    



h1
{
'My
Choi...
•   package
Doxory::View;
    use
Jifty::View::Declare
‐base;
    ...
•   template
choices
=>
page
{
    



h1
{
'My
Choi...
•   package
Doxory::View;
    use
Jifty::View::Declare
‐base;
    ...
•   template
choices
=>
page
{
    



h1
{
'My
Choi...
87
:
   .
☺




           87
!




    88
!
lib/Doxory/Model/User.pm




                           88
!
lib/Doxory/Model/User.pm
lib/Doxory/Model/Choice.pm




                             88
!
lib/Doxory/Model/User.pm
lib/Doxory/Model/Choice.pm
lib/Doxory/Model/Vote.pm




                             88
!
lib/Doxory/Model/User.pm
lib/Doxory/Model/Choice.pm
lib/Doxory/Model/Vote.pm
lib/Doxory/Dispatcher.pm



               ...
!
lib/Doxory/Model/User.pm
lib/Doxory/Model/Choice.pm
lib/Doxory/Model/Vote.pm
lib/Doxory/Dispatcher.pm
lib/Doxory/View.pm...
!
lib/Doxory/Model/User.pm
lib/Doxory/Model/Choice.pm
lib/Doxory/Model/Vote.pm
lib/Doxory/Dispatcher.pm
lib/Doxory/View.pm...
☈   89
90
☈   Doxory





              90
☈   Doxory

☈


              90
☈   Doxory

☈
☈   ...


              90
Doxory





          91
Doxory


☈     !




              91
Doxory


☈     !
☈



              91
Doxory


☈         !
☈
☈   vim
lib/Doxory/Model/Choice.pm



                                     91
92
• package
Doxory::Model::Choice;




                                   92
• package
Doxory::Model::Choice;
• use
Regexp::Common
'profanity_us';




                                       92
• package
Doxory::Model::Choice;
• use
Regexp::Common
'profanity_us';
• sub
validate_name
{
  


my
($self,
$name)
=
@_;

...
• package
Doxory::Model::Choice;
• use
Regexp::Common
'profanity_us';
• sub
validate_name
{
  


my
($self,
$name)
=
@_;
•...
• package
Doxory::Model::Choice;
• use
Regexp::Common
'profanity_us';
• sub
validate_name
{
  


my
($self,
$name)
=
@_;
•...
93

(Validator)




               94

(Validator)

☈




                   94

(Validator)

☈
☈


                   94

(Validator)

☈
☈
☈        !


                   94
• package
Doxory::Model::Choice;
  use
Regexp::Common
'profanity_us';

• sub
canonicalize_name
{
• 


my
($self,
$name)
=
...
96

(Canonicalizer)




                   97

(Canonicalizer)

☈   
Model





                           97

(Canonicalizer)

☈   
Model

☈       
(Autocompleter)





                            97

(Canonicalizer)

☈   
Model

☈       
(Autocompleter)

☈         :
      
Doxory


                            97
98
•$
vim
lib/Doxory/Dispatcher.pm



                                  99
•$
vim
lib/Doxory/Dispatcher.pm
                                  .




                                      99
•   package
Doxory::Dispatcher;
    use
Jifty::Dispatcher
‐base;
•
    before
'*'
=>
run
{
    



if
(Jifty‐>web‐>current...
•   package
Doxory::Dispatcher;
    use
Jifty::Dispatcher
‐base;
•
    before
'*'
=>
run
{
    



if
(Jifty‐>web‐>current...
•$
vim
lib/Doxory/Model/*.pm



                               102
•$
vim
lib/Doxory/Model/*.pm
                  
label,
hints
   .




                                       102
•   package
Doxory::Model::Choice;
•   use
Jifty::DBI::Schema;
•   use
Doxory::Record
schema
{
•   

•   column
name
=>
• ...
package
Doxory::Model::User;
use
Jifty::DBI::Schema;


use
Doxory::Record
schema
{


column
name
=>




label
is
_('Userna...
•   package
Doxory::Model::Vote;
•   use
Jifty::DBI::Schema;

•   use
Doxory::Record
schema
{
•   

•   column
choice
=>
•...
•$
vim
lib/Doxory/View.pm



                            106
•$
vim
lib/Doxory/View.pm
                            .




                                106
•   package
Doxory::View;
    use
Jifty::View::Declare
‐base;

    template
'/'
=>
page
{
    



h1
{
_('Ask
a
question!'...
108
•   $
jifty
po
‐‐language
zh_tw




                                  108
.
•   $
jifty
po
‐‐language
zh_tw




                                      108
.
•   $
jifty
po
‐‐language
zh_tw
•   INFO
‐
Extracting
messages
from
'lib/Doxory/Dispatcher.pm'
    INFO
‐
Extracting
mes...
.
•   $
jifty
po
‐‐language
zh_tw
•   INFO
‐
Extracting
messages
from
'lib/Doxory/Dispatcher.pm'
    INFO
‐
Extracting
mes...
.
•   $
jifty
po
‐‐language
zh_tw
•   INFO
‐
Extracting
messages
from
'lib/Doxory/Dispatcher.pm'
    INFO
‐
Extracting
mes...
msgid
""
msgstr
""
"Content‐Type:
text/plain;

charset=CHARSET
"

                                   •   #:
lib/Doxory/Mod...
msgid
""
msgstr
""
"Content‐Type:
text/plain;

charset=UTF‐8
"

                                   •   #:
lib/Doxory/Model...
111
...




      111
112
• $
b2g.pl
‐p
‐u
share/po/zh_tw.po
>
share/po/zh_cn.po




                                                         112

Encode::HanConvert
      .

• $
b2g.pl
‐p
‐u
share/po/zh_tw.po
>
share/po/zh_cn.po




                                  ...

Encode::HanConvert
      .

• $
b2g.pl
‐p
‐u
share/po/zh_tw.po
>
share/po/zh_cn.po
• $
vim
etc/config.yml




           ...

Encode::HanConvert
         .

• $
b2g.pl
‐p
‐u
share/po/zh_tw.po
>
share/po/zh_cn.po
• $
vim
etc/config.yml
            ...
•‐‐‐
•framework:
•

L10N:
•



PoDir:
share/po


•
                       113
•‐‐‐
•framework:
•

L10N:
•



PoDir:
share/po
•



Lang:
zh‐cn

•
                       114
115
!
国际




         115
116
117

HTTP





         117

HTTP

Module::Install




                  117

HTTP

Module::Install
       
PAR



                  117

(Halo)




          118

(Halo)




          118

(Halo)




          118

(Halo)



...   !


                118
Halo




       119
Halo

SQL





              119
Halo

SQL

SQL





              119
Halo

SQL

SQL





              119
Halo

SQL

SQL





              119

(DevelMode)




               120

(DevelMode)

Module::Refresh




                       120

(DevelMode)

Module::Refresh
Log4Perl




                       120

(DevelMode)

Module::Refresh
Log4Perl




                       120
121
Lighttpd
/
Apache




                    121
Lighttpd
/
Apache
CSS::Squish




                    121
Lighttpd
/
Apache
CSS::Squish

JavaScript::Squish



                      121
...




      122
...


I18N





               122
...


I18N


Session



                 122
...

  
I18N

  
Session

(Event)



                   122
✈
    123
124
✈ Wiki
UI





             124
✈ Wiki
UI

✈            ,




                  124
✈ Wiki
UI

✈             ,

✈        ,
        ,
MTV...


                              124
125
✈ Wifty




          125
✈ Wifty
✈ CommitBit



              125
✈ Wifty
✈ CommitBit
✈ BabelBee


              125
✈ Ping

✈ Wifty
✈ CommitBit
✈ BabelBee


                        125
✈ Ping

✈ Wifty
              ✈ Chat
✈ CommitBit
✈ BabelBee


                        125
✈ Ping

✈ Wifty
              ✈ Chat
✈ CommitBit
              ✈ Clock
✈ BabelBee


                        125
✈ Ping

✈ Wifty
              ✈ Chat
✈ CommitBit
              ✈ Clock
✈ BabelBee
              ✈ Doxory!
                ...

Jifty




         126

Jifty

✈ cpan
Jifty




                        126

Jifty

✈ cpan
Jifty
✈ http://svn.jifty.org/svn/jifty.org


                                       126

Jifty

✈ cpan
Jifty
✈ http://svn.jifty.org/svn/jifty.org
✈ http://jifty.org/

                                       126
127
✈ Jifty::Manual::Tutorial




                            127
✈ Jifty::Manual::Tutorial
✈ irc.freenode.net
#jifty


                            127
✈ Jifty::Manual::Tutorial
✈ irc.freenode.net
#jifty
✈ jifty‐devel@lists.jifty.org

                                127
fin.
      128
Bonus Slides

               129
☺
    130
Anatomy
of
a
Jifty
App




                         131
Anatomy
of
a
Jifty
App

☺ Model
:
Columns




                         131
Anatomy
of
a
Jifty
App

☺ Model
:
Columns
☺ Action
:
Parameters



                         131
Anatomy
of
a
Jifty
App

☺ Model
:
Columns
☺ Action
:
Parameters
☺ Template
:
Fragments

                         131
More
Components




                  132
More
Components

☺ Dispatcher




                   132
More
Components

☺ Dispatcher
☺ ClassLoader



                   132
More
Components

☺ Dispatcher
☺ ClassLoader
☺ Continuations

                   132
䷗
    133
Jifty::DBI




             134
Jifty::DBI

∅ CREATE
TABLE




                   134
Jifty::DBI

∅ CREATE
TABLE
∅ ALTER
TABLE



                   134
Jifty::DBI

∅ CREATE
TABLE
∅ ALTER
TABLE
∅ CREATE
FOREIGN
KEY


                       134
Object
Relational
Mapper




                           135
Object
Relational
Mapper

 ∅ SELECT



                           135
Object
Relational
Mapper

 ∅ SELECT
 ∅ INSERT


                           135
Object
Relational
Mapper

 ∅ SELECT   ∅ UPDATE
 ∅ INSERT


                           135
Object
Relational
Mapper

 ∅ SELECT   ∅ UPDATE
 ∅ INSERT   ∅ DELETE


                           135
Jifty::DBI::Handle




                     136
Jifty::DBI::Handle

䷗ SQLite



                       136
Jifty::DBI::Handle

䷗ SQLite
䷗ Postgres


                       136
Jifty::DBI::Handle

䷗ SQLite     ䷗ MySQL
䷗ Postgres


                       136
Jifty::DBI::Handle

䷗ SQLite     ䷗ MySQL
䷗ Postgres   ䷗ Oracle


                        136
Jifty::DBI::Collection




                         137
Jifty::DBI::Collection

䷗ Joins
and
Limits




                         137
Jifty::DBI::Collection

䷗ Joins
and
Limits
䷗ Paging
=
Data::Page



                         137
Jifty::DBI::Collection

䷗ Joins
and
Limits
䷗ Paging
=
Data::Page
䷗ Caching
=
Memcached


                         137
Jifty::DBI::Schema




                     138
Jifty::DBI::Schema

䷗ Declarative
Columns




                        138
Jifty::DBI::Schema

䷗ Declarative
Columns
䷗ Remember
our
Doxory?



                         138
Jifty::DBI::Schema

䷗ Declarative
Columns
䷗ Remember
our
Doxory?
䷗ Time
for
0.0.2!


                         138
139
•   package
Doxory::Model::Comment;
    use
Jifty::DBI::Schema;
    use
Doxory::Record
schema
{

    since
'0.0.2';




  ...
•   package
Doxory::Model::Comment;
    use
Jifty::DBI::Schema;
    use
Doxory::Record
schema
{

    since
'0.0.2';
•
    ...
•   package
Doxory::Model::Comment;
    use
Jifty::DBI::Schema;
    use
Doxory::Record
schema
{

    since
'0.0.2';
•
    ...
•   package
Doxory::Model::Comment;
    use
Jifty::DBI::Schema;
    use
Doxory::Record
schema
{

    since
'0.0.2';
•
    ...
•   package
Doxory::Model::Comment;
    use
Jifty::DBI::Schema;
    use
Doxory::Record
schema
{

    since
'0.0.2';
•
    ...
Database
Upgrade




                   140
Database
Upgrade

䷗ Used
to
be
painful




                       140
Database
Upgrade

䷗ Used
to
be
painful
䷗ Not
anymore



                       140
Database
Upgrade

䷗ Used
to
be
painful
䷗ Not
anymore
䷗ Jifty
fixed
it!


                       140
141
• $
vim
etc/config.yml




                         141
• $
vim
etc/config.yml
• (Set
version
to
0.0.2)




                           141
• $
vim
etc/config.yml
• (Set
version
to
0.0.2)
• $
jifty
server




                           141
• $
vim
etc/config.yml
• (Set
version
to
0.0.2)
• $
jifty
server
• Application
schema
version
in
database
(v0.0.1)

  does...
• $
vim
etc/config.yml
• (Set
version
to
0.0.2)
• $
jifty
server
• Application
schema
version
in
database
(v0.0.1)

    do...
• $
vim
etc/config.yml
• (Set
version
to
0.0.2)
• $
jifty
server
• Application
schema
version
in
database
(v0.0.1)

  does...
• $
vim
etc/config.yml
• (Set
version
to
0.0.2)
• $
jifty
server
• Application
schema
version
in
database
(v0.0.1)

    do...
• $
vim
etc/config.yml
• (Set
version
to
0.0.2)
• $
jifty
server
• Application
schema
version
in
database
(v0.0.1)

    do...
142
• column
tags
=>
  


since
'0.0.3',
  


refers
to
Doxory::Model::TagCollection
by
'User';




                          ...
• column
tags
=>
    


since
'0.0.3',
    


refers
to
Doxory::Model::TagCollection
by
'User';
•
    column
mood
=>
    
...
• column
tags
=>
    


since
'0.0.3',
    


refers
to
Doxory::Model::TagCollection
by
'User';
•
    column
mood
=>
    
...
143
• $
vim
etc/config.yml




                         143
• $
vim
etc/config.yml
• (Set
version
to
0.0.5)




                           143
• $
vim
etc/config.yml
• (Set
version
to
0.0.5)
•
  $
jifty
schema
‐‐setup




                           143
• $
vim
etc/config.yml
• (Set
version
to
0.0.5)
•
  $
jifty
schema
‐‐setup
• Jifty
version
0.605070
up
to
date.
  INFO
‐
G...
• $
vim
etc/config.yml
• (Set
version
to
0.0.5)
•
  $
jifty
schema
‐‐setup
• Jifty
version
0.605070
up
to
date.
    INFO
‐...
• $
vim
etc/config.yml
• (Set
version
to
0.0.5)
•
  $
jifty
schema
‐‐setup
• Jifty
version
0.605070
up
to
date.
    INFO
‐...
⇛
    144
Action
=
APIs




                145
Action
=
APIs
⇛ Method
Calls




                     145
Action
=
APIs
⇛ Method
Calls
⇛ Typed
named
arguments



                          145
Action
=
APIs
⇛ Method
Calls
⇛ Typed
named
arguments
⇛ Returns
results
or
errors

                              145
Action
≠
URLs




                146
Action
≠
URLs
⇛ Many
actions
on
one
page




                             146
Action
≠
URLs
⇛ Many
actions
on
one
page
⇛ Called
with
web
forms



                             146
Action
≠
URLs
⇛ Many
actions
on
one
page
⇛ Called
with
web
forms
⇛ Sounds
like
RPC?

                             146
Action
=
RPC




               147
Action
=
RPC
⇛ Web
form
encoding




                      147
Action
=
RPC
⇛ Web
form
encoding
⇛ XML/YAML
encoding



                      147
Action
=
RPC
⇛ Web
form
encoding
⇛ XML/YAML
encoding
⇛ Web
services
for
free!

                           147
Model
⇛
Action




                 148
Model
⇛
Action
⇛ Doxory::Action::CreateUser




                               148
Model
⇛
Action
⇛ Doxory::Action::CreateUser
⇛ Doxory::Action::SearchUser



                               148
Model
⇛
Action
⇛ Doxory::Action::CreateUser
⇛ Doxory::Action::SearchUser
⇛ Doxory::Action::UpdateUser


                  ...
Model
⇛
Action
⇛ Doxory::Action::CreateUser
⇛ Doxory::Action::SearchUser
⇛ Doxory::Action::UpdateUser
⇛ Doxory::Action::De...
Make
your
own
Actions




                        149
150
• package
Hello::Action::SayHi;
  use
Jifty::Param::Schema;
  use
Jifty::Action
schema
{
  

  param
name
=>
  


label
is...
• package
Hello::Action::SayHi;
    use
Jifty::Param::Schema;
    use
Jifty::Action
schema
{
    

    param
name
=>
    
...
151
•   <%init>
    my
$action
=
Jifty‐>web‐>new_action(
    



class
=>
'SayHi'
    );
    </%init>




                    ...
•   <%init>
    my
$action
=
Jifty‐>web‐>new_action(
    



class
=>
'SayHi'
    );
    </%init>
•
    <&|/_elements/wrap...
•   <%init>
    my
$action
=
Jifty‐>web‐>new_action(
    



class
=>
'SayHi'
    );
    </%init>
•
    <&|/_elements/wrap...
•   <%init>
    my
$action
=
Jifty‐>web‐>new_action(
    



class
=>
'SayHi'
    );
    </%init>
•
    <&|/_elements/wrap...
152
• $
curl

  

http://localhost:8888/__jifty/webservices/yaml?
  

J:A‐1=SayHi;J:A:F‐name‐1=Jesse




                     ...
• $
curl

    

http://localhost:8888/__jifty/webservices/yaml?
    

J:A‐1=SayHi;J:A:F‐name‐1=Jesse
•
    1:
!!perl/hash:...
☸   153
Jifty::Dispatcher



                    154
Dispatcher
=
Kernel




                      155
Dispatcher
=
Kernel
☸ Simple




                       155
Dispatcher
=
Kernel
☸ Simple
☸ Declarative



                       155
Dispatcher
=
Kernel
☸ Simple
☸ Declarative
☸ Encapsulates
view
logic

                            155
Three
Stages




               156
Three
Stages
☸ Before:
Sets
up
state




                          156
Three
Stages
☸ Before:
Sets
up
state
☸ On:
Shows
your
pages



                          156
Three
Stages
☸ Before:
Sets
up
state
☸ On:
Shows
your
pages
☸ After:
Cleans
up
state

                           156
Jifty::ClassLoader



                     157
Scaffolding
Bad




                  158
Scaffolding
Bad
☸ Ugly




                     158
Scaffolding
Bad
☸ Ugly
☸ Redundant



                     158
Scaffolding
Bad
☸ Ugly
☸ Redundant
☸ Fragile

                     158
Scaffolding
Bad
☸ Ugly      ☸ Annoying
☸ Redundant
☸ Fragile

                         158
Scaffolding
Bad
☸ Ugly      ☸ Annoying
☸ Redundant ☸ Redundant
☸ Fragile

                          158
Scaffolding
Bad
☸ Ugly      ☸ Annoying
☸ Redundant ☸ Redundant
☸ Fragile   ☸ Redundant

                          158
Why
Empty
Classes?




                     159
Why
Empty
Classes?
☸ Jifty::ClassLoader




                       159
Why
Empty
Classes?
☸ Jifty::ClassLoader
☸ Auto‐creates
classes



                         159
Why
Empty
Classes?
☸ Jifty::ClassLoader
☸ Auto‐creates
classes
☸ Never
writes
them
to
disk

                              159
Auto‐created
Classes





                        160
Auto‐created
Classes

☸ Doxory




                           160
Auto‐created
Classes

☸ Doxory
☸ Doxory::Record




                           160
Auto‐created
Classes

☸ Doxory
☸ Doxory::Record
☸ Doxory::Collection




                           160
Auto‐created
Classes

☸ Doxory
☸ Doxory::Record
☸ Doxory::Collection
☸ Doxory::Bootstrap




                           160
Auto‐created
Classes

☸ Doxory
☸ Doxory::Record
☸ Doxory::Collection
☸ Doxory::Bootstrap
☸ Doxory::Upgrade




           ...
Auto‐created
Classes

☸ Doxory
☸ Doxory::Record
☸ Doxory::Collection
☸ Doxory::Bootstrap
☸ Doxory::Upgrade
☸ Doxory::Dispa...
Auto‐created
Classes

☸ Doxory
☸ Doxory::Record
☸ Doxory::Collection
☸ Doxory::Bootstrap
☸ Doxory::Upgrade
☸ Doxory::Dispa...
Auto‐created
Classes

☸ Doxory                ☸ Doxory::Model::UserCollecti
                          on
☸ Doxory::Record
...
Auto‐created
Classes

☸ Doxory                ☸ Doxory::Model::UserCollecti
                          on
☸ Doxory::Record
...
Auto‐created
Classes

☸ Doxory                ☸ Doxory::Model::UserCollecti
                          on
☸ Doxory::Record
...
Jifty
Jifty
Jifty
Jifty
Jifty
Jifty
Jifty
Jifty
Jifty
Jifty
Jifty
Jifty
Jifty
Jifty
Jifty
Jifty
Jifty
Jifty
Jifty
Jifty
Jifty
Jifty
Jifty
Jifty
Jifty
Jifty
Jifty
Jifty
Jifty
Jifty
Jifty
Jifty
Jifty
Jifty
Jifty
Jifty
Jifty
Jifty
Upcoming SlideShare
Loading in...5
×

Jifty

2,372

Published on

Jifty by Audrey Tang in OSDC.tw 2007

Published in: Technology, Art & Photos
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
2,372
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
61
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Transcript of "Jifty"

  1. 1. Jifty 1
  2. 2. ⚁ 2
  3. 3. 2007/04/01 3
  4. 4. 2007/04/01 ⚁ 3
  5. 5. 2007/04/01 ⚁ 
YAPC::Asia
 ⚁ 3
  6. 6. 2007/04/01 ⚁ 
YAPC::Asia
 ⚁ :
 ! ⚁ 3
  7. 7. <@ij1iao>
JIT
 4
  8. 8. <@ij1iao>
JIT
 4
  9. 9. <@ij1iao>
JIT
 4
  10. 10. 5
  11. 11. ⚁ 5
  12. 12. ⚁ ? ⚁ 5
  13. 13. ⚁ ? ⚁ :
 ! ⚁ 5
  14. 14. 
 6
  15. 15. 
 7
  16. 16. 
 7
  17. 17. 
 8
  18. 18. 9
  19. 19. ⚁ 9
  20. 20. ⚁ ⚁ 9
  21. 21. ⚁ ⚁ ,
 ! ⚁ 9
  22. 22. Pick! 10
  23. 23. Pick! “ ” 10
  24. 24. Pick! 11
  25. 25. Pick! 11
  26. 26. Pick! 12
  27. 27. Pick! 12
  28. 28. Pick! 13
  29. 29. Pick! 13
  30. 30. Pick! 14
  31. 31. ... 15
  32. 32. ... ! 16
  33. 33. 17
  34. 34. Jifty 18
  35. 35. Jifty 18
  36. 36. Jifty 
=
 18
  37. 37. Jifty 
=
 
=
 18
  38. 38. Jifty
=
JFDI 19
  39. 39. Jifty
=
JFDI Just
F*cking
Do
It 19
  40. 40. Jifty
=
JFDI Just
F*cking
Do
It 
JFDI 19
  41. 41. Jifty
=
JFDI Just
F*cking
Do
It 
JFDI 
Doxory! 19
  42. 42. 20
  43. 43. • $
cpan 20
  44. 44. • $
cpan • cpan>
notest
install
Jifty 20
  45. 45. • $
cpan • cpan>
notest
install
Jifty “notest”
 . 20
  46. 46. 21
  47. 47. • $
jifty
app
‐‐name
Doxory 21
  48. 48. • $
jifty
app
‐‐name
Doxory • Creating
new
application
Doxory Creating
directory
lib Creating
directory
lib/Doxory Creating
directory
bin Creating
directory
etc Creating
directory
doc Creating
directory
log Creating
directory
var Creating
directory
var/mason Creating
directory
share Creating
directory
share/po Creating
directory
share/web Creating
directory
share/web/templates Creating
directory
share/web/static Creating
directory
lib/Doxory/Model Creating
directory
lib/Doxory/Action Creating
directory
t Creating
configuration
file
Doxory/etc/config.yml 21
  49. 49. 22
  50. 50. bin/jifty 22
  51. 51. bin/jifty etc/config.yml 22
  52. 52. bin/jifty etc/config.yml Makefile.PL 22
  53. 53. 23
  54. 54. • $
jifty
server 23
  55. 55. • $
jifty
server • INFO
‐
You
can
connect
to
your
server
at 






http://localhost:8888/ 23
  56. 56. ! 24
  57. 57. ! 
Doxory. 

(Users)
 ? 24
  58. 58. 25
  59. 59. • $
cd
Doxory 25
  60. 60. • $
cd
Doxory • $
jifty
model
‐‐name
User 25
  61. 61. • $
cd
Doxory • $
jifty
model
‐‐name
User • Writing
file
t/00‐model‐User.t Writing
file
lib/Doxory/Model/User.pm 25
  62. 62. • $
cd
Doxory • $
jifty
model
‐‐name
User • Writing
file
t/00‐model‐User.t Writing
file
lib/Doxory/Model/User.pm • $
vim
lib/Doxory/Model/User.pm 25
  63. 63. • package
Doxory::Model::User; • use
Jifty::DBI::Schema; • 
 • use
Doxory::Record
schema
{ • 
 • 
 • }; 26
  64. 64. • package
Doxory::Model::User; • use
Jifty::DBI::Schema; • 
 • use
Doxory::Record
schema
{ • 
 • column
name
=> • 



label
is
'Username', • 



hints
is
'Other
people
see
this
when
you
ask
questions.', • 



is
distinct, • 



is
mandatory; • 
 • column
email
=> • 



label
is
'Email', • 



hints
is
'We
will
not
sell
it
to
anybody.
Honest.', • 



default
is
'', • 



is
distinct, • 



is
immutable; • 
 • }; 27
  65. 65. 28
  66. 66. • $
jifty
schema
‐‐setup 28
  67. 67. • $
jifty
schema
‐‐setup • INFO
‐
Generating
SQL
for
application
Doxory... INFO
‐
Using
Doxory::Model::User INFO
‐
Using
Jifty::Model::Session INFO
‐
Using
Jifty::Model::Metadata INFO
‐
Set
up
version
v0.0.1,
jifty
version
0.701170 28
  68. 68. • $
jifty
schema
‐‐setup • INFO
‐
Generating
SQL
for
application
Doxory... INFO
‐
Using
Doxory::Model::User INFO
‐
Using
Jifty::Model::Session INFO
‐
Using
Jifty::Model::Metadata INFO
‐
Set
up
version
v0.0.1,
jifty
version
0.701170 • $
jifty
server
& 28
  69. 69. • $
jifty
schema
‐‐setup • INFO
‐
Generating
SQL
for
application
Doxory... INFO
‐
Using
Doxory::Model::User INFO
‐
Using
Jifty::Model::Session INFO
‐
Using
Jifty::Model::Metadata INFO
‐
Set
up
version
v0.0.1,
jifty
version
0.701170 • $
jifty
server
& • INFO
‐
You
can
connect
to
your
server
at 






http://localhost:8888/ 28
  70. 70. • $
jifty
schema
‐‐setup • INFO
‐
Generating
SQL
for
application
Doxory... INFO
‐
Using
Doxory::Model::User INFO
‐
Using
Jifty::Model::Session INFO
‐
Using
Jifty::Model::Metadata INFO
‐
Set
up
version
v0.0.1,
jifty
version
0.701170 • $
jifty
server
& • INFO
‐
You
can
connect
to
your
server
at 






http://localhost:8888/ • $
open
http://localhost:8888/ 28
  71. 71. 29
  72. 72. 29
  73. 73. 30
  74. 74. 30
  75. 75. 31
  76. 76. 31
  77. 77. 32
  78. 78. 32
  79. 79. 33
  80. 80. AudreyT 33
  81. 81. AudreyT 33
  82. 82. 34
  83. 83. 
(Choice)
 . 34
  84. 84. 35
  85. 85. $
jifty
model
‐‐name
Choice 35
  86. 86. $
jifty
model
‐‐name
Choice Writing
file
t/00‐model‐Choice.t Writing
file
lib/Doxory/Model/Choice.pm 35
  87. 87. $
jifty
model
‐‐name
Choice Writing
file
t/00‐model‐Choice.t Writing
file
lib/Doxory/Model/Choice.pm $
vim
lib/Doxory/Model/Choice.pm 35
  88. 88. • package
Doxory::Model::Choice; • use
Jifty::DBI::Schema; • use
Doxory::Record
schema
{ • 
 • column
name
=> • 



label
is
'I
need
help
deciding...', • 



render
as
'textarea'; • 
 • column
a
=> • 



label
is
'On
the
one
hand', • 



render
as
'textarea',
is
mandatory; • column
b
=> • 



label
is
'On
the
other
hand', • 



render
as
'textarea',
is
mandatory; • column
asked_by
=> • 



label
is
'Asked
by', • 



default
is
defer
{
Jifty‐>web‐>current_user‐>id
}, • 



references
Doxory::Model::User; • 
 • }; 36
  89. 89. 37
  90. 90. • $
jifty
schema
‐‐drop‐database
‐‐setup 37
  91. 91. • $
jifty
schema
‐‐drop‐database
‐‐setup • INFO
‐
Generating
SQL
for
application
Doxory... INFO
‐
Using
Doxory::Model::User INFO
‐
Using
Doxory::Model::Choice INFO
‐
Using
Jifty::Model::Session INFO
‐
Using
Jifty::Model::Metadata INFO
‐
Set
up
version
v0.0.1,
jifty
version
0.701170 37
  92. 92. • $
jifty
schema
‐‐drop‐database
‐‐setup • INFO
‐
Generating
SQL
for
application
Doxory... INFO
‐
Using
Doxory::Model::User INFO
‐
Using
Doxory::Model::Choice INFO
‐
Using
Jifty::Model::Session INFO
‐
Using
Jifty::Model::Metadata INFO
‐
Set
up
version
v0.0.1,
jifty
version
0.701170 • $
open
http://localhost:8888/ 37
  93. 93. 38
  94. 94. 38
  95. 95. 39
  96. 96. 39
  97. 97. 40
  98. 98. 40
  99. 99. 41
  100. 100. 41
  101. 101. 42
  102. 102. 42
  103. 103. 43
  104. 104. ! ... ? 43
  105. 105. ✍ 44
  106. 106. 45
  107. 107. •$
vim
etc/config.yml 45
  108. 108. •$
vim
etc/config.yml . 45
  109. 109. •‐‐‐ •framework: •

Plugins: •



‐
SkeletonApp:
{} •



‐
REST:
{} •



‐
Halo:
{} •



‐
ErrorTemplates:
{} •



‐
CompressedCSSandJS:
{} •
 •
 • 46
  110. 110. •‐‐‐ •framework: •

Plugins: •



‐
SkeletonApp:
{} •



‐
REST:
{} •



‐
Halo:
{} •



‐
ErrorTemplates:
{} •



‐
CompressedCSSandJS:
{} •



‐
Authentication::Password:
{} •

SkipAccessControl:
1 • 47
  111. 111. •‐‐‐ •framework: •

Plugins: •



‐
SkeletonApp:
{} •



‐
REST:
{} •



‐
Halo:
{} •



‐
ErrorTemplates:
{} •



‐
CompressedCSSandJS:
{} •



‐
Authentication::Password:
{} •

SkipAccessControl:
1 • 
(ACL). 47
  112. 112. 48
  113. 113. •$
vim
lib/Doxory/Model/User.pm 48
  114. 114. •$
vim
lib/Doxory/Model/User.pm 
User.pm
 
mixin. 48
  115. 115. • package
Doxory::Model::User; • use
Jifty::DBI::Schema; • use
Doxory::Record
schema
{ • 
 • column
name
=> • 



label
is
'Username', • 



hints
is
'Other
people
see
this
when
you
ask
questions.', • 



is
distinct, • 



is
mandatory; • 
 • column
email
=> • 



label
is
'Email', • 



hints
is
'We
will
not
sell
it
to
anybody.
Honest.', • 



default
is
'', • 



is
distinct, • 



is
immutable;
 • }; • 49
  116. 116. • package
Doxory::Model::User; • use
Jifty::DBI::Schema; • use
Doxory::Record
schema
{ • 
 • column
name
=> • 



label
is
'Username', • 



hints
is
'Other
people
see
this
when
you
ask
questions.', • 



is
distinct, • 



is
mandatory; • 
 • column
email
=> • 



label
is
'Email', • 



hints
is
'We
will
not
sell
it
to
anybody.
Honest.', • 



default
is
'', • 



is
distinct, • 



is
immutable;
 • }; • use
Jifty::Plugin::User::Mixin::Model::User; • use
Jifty::Plugin::Authentication::Password::Mixin::Model::User; 50
  117. 117. 51
  118. 118. 51
  119. 119. 52
  120. 120. 52
  121. 121. 53
  122. 122. From: Doxory <> Date: April 3, 2007 5:43:07 PM JST To: jesse@bestpractical.com Subject: Doxory! ( ) Doxory . , : http://127.0.0.1:8888/let/jesse%40bestpractical.com/confirm_email/78f28e934cf6c058 53
  123. 123. From: Doxory <> Date: April 3, 2007 5:43:07 PM JST To: jesse@bestpractical.com Subject: Doxory! ( ) Doxory . , : http://127.0.0.1:8888/let/jesse%40bestpractical.com/confirm_email/78f28e934cf6c058 53
  124. 124. 54
  125. 125. 54
  126. 126. 55
  127. 127. ... ( ?) 55
  128. 128. ❁ 56
  129. 129. 57
  130. 130. •$
vim
lib/Doxory/Dispatcher.pm 57
  131. 131. •$
vim
lib/Doxory/Dispatcher.pm Dispatcher
 
(View). 57
  132. 132. 58
  133. 133. • package
Doxory::Dispatcher; use
Jifty::Dispatcher
‐base; 58
  134. 134. • package
Doxory::Dispatcher; use
Jifty::Dispatcher
‐base; • before
'*'
=>
run
{ 



if
(Jifty‐>web‐>current_user‐>id)
{ 58
  135. 135. • package
Doxory::Dispatcher; use
Jifty::Dispatcher
‐base; • before
'*'
=>
run
{ 



if
(Jifty‐>web‐>current_user‐>id)
{ • 







my
$top
=
Jifty‐>web‐>navigation; 







$top‐>child(
'Choices'
=>
url
=>
'/choices'
); 58
  136. 136. • package
Doxory::Dispatcher; use
Jifty::Dispatcher
‐base; • before
'*'
=>
run
{ 



if
(Jifty‐>web‐>current_user‐>id)
{ • 







my
$top
=
Jifty‐>web‐>navigation; 







$top‐>child(
'Choices'
=>
url
=>
'/choices'
); • 



} 58
  137. 137. • package
Doxory::Dispatcher; use
Jifty::Dispatcher
‐base; • before
'*'
=>
run
{ 



if
(Jifty‐>web‐>current_user‐>id)
{ • 







my
$top
=
Jifty‐>web‐>navigation; 







$top‐>child(
'Choices'
=>
url
=>
'/choices'
); • 



} • 



elsif
($1
!~
/^login|^signup/)
{ 







tangent
'login'; 



} }; 58
  138. 138. • package
Doxory::Dispatcher; use
Jifty::Dispatcher
‐base; • before
'*'
=>
run
{ 



if
(Jifty‐>web‐>current_user‐>id)
{ • 







my
$top
=
Jifty‐>web‐>navigation; 







$top‐>child(
'Choices'
=>
url
=>
'/choices'
); • 



} • 



elsif
($1
!~
/^login|^signup/)
{ 







tangent
'login'; 



} }; • #
on
'/'







=>
show
'/'; 58
  139. 139. • package
Doxory::Dispatcher; use
Jifty::Dispatcher
‐base; • before
'*'
=>
run
{ 



if
(Jifty‐>web‐>current_user‐>id)
{ • 







my
$top
=
Jifty‐>web‐>navigation; 







$top‐>child(
'Choices'
=>
url
=>
'/choices'
); • 



} • 



elsif
($1
!~
/^login|^signup/)
{ 







tangent
'login'; 



} }; • #
on
'/'







=>
show
'/'; • #
on
'/choices'
=>
show
'choices'; 58
  140. 140. 59
  141. 141. 
“/”
 . 59
  142. 142. 60
  143. 143. •$
vim
lib/Doxory/View.pm 60
  144. 144. •$
vim
lib/Doxory/View.pm 


 TT2
 ! 
Mason
 ! 60
  145. 145. 61
  146. 146. • package
Doxory::View; use
Jifty::View::Declare
‐base; 61
  147. 147. • package
Doxory::View; use
Jifty::View::Declare
‐base; • template
'/'
=>
page
{ 



h1
{
'Ask
a
question!'
} 61
  148. 148. • package
Doxory::View; use
Jifty::View::Declare
‐base; • template
'/'
=>
page
{ 



h1
{
'Ask
a
question!'
} • 



show
'new_choice'; 61
  149. 149. • package
Doxory::View; use
Jifty::View::Declare
‐base; • template
'/'
=>
page
{ 



h1
{
'Ask
a
question!'
} • 



show
'new_choice'; • }; 61
  150. 150. • package
Doxory::View; use
Jifty::View::Declare
‐base; • template
'/'
=>
page
{ 



h1
{
'Ask
a
question!'
} • 



show
'new_choice'; • }; • private
template
new_choice
=>
sub
{ 



div
{
form
{ 61
  151. 151. • package
Doxory::View; use
Jifty::View::Declare
‐base; • template
'/'
=>
page
{ 



h1
{
'Ask
a
question!'
} • 



show
'new_choice'; • }; • private
template
new_choice
=>
sub
{ 



div
{
form
{ • 







my
$action
=
new_action(
class
=>
'CreateChoice'
); 61
  152. 152. • package
Doxory::View; use
Jifty::View::Declare
‐base; • template
'/'
=>
page
{ 



h1
{
'Ask
a
question!'
} • 



show
'new_choice'; • }; • private
template
new_choice
=>
sub
{ 



div
{
form
{ • 







my
$action
=
new_action(
class
=>
'CreateChoice'
); • 







render_action(
$action
=>
['name',
'a',
'b']
); 61
  153. 153. • package
Doxory::View; use
Jifty::View::Declare
‐base; • template
'/'
=>
page
{ 



h1
{
'Ask
a
question!'
} • 



show
'new_choice'; • }; • private
template
new_choice
=>
sub
{ 



div
{
form
{ • 







my
$action
=
new_action(
class
=>
'CreateChoice'
); • 







render_action(
$action
=>
['name',
'a',
'b']
); • 







form_submit(
label
=>
'Ask
the
Crowd!'
); 61
  154. 154. • package
Doxory::View; use
Jifty::View::Declare
‐base; • template
'/'
=>
page
{ 



h1
{
'Ask
a
question!'
} • 



show
'new_choice'; • }; • private
template
new_choice
=>
sub
{ 



div
{
form
{ • 







my
$action
=
new_action(
class
=>
'CreateChoice'
); • 







render_action(
$action
=>
['name',
'a',
'b']
); • 







form_submit(
label
=>
'Ask
the
Crowd!'
); • 



}
} 61
  155. 155. • package
Doxory::View; use
Jifty::View::Declare
‐base; • template
'/'
=>
page
{ 



h1
{
'Ask
a
question!'
} • 



show
'new_choice'; • }; • private
template
new_choice
=>
sub
{ 



div
{
form
{ • 







my
$action
=
new_action(
class
=>
'CreateChoice'
); • 







render_action(
$action
=>
['name',
'a',
'b']
); • 







form_submit(
label
=>
'Ask
the
Crowd!'
); • 



}
} • }; 61
  156. 156. 62
  157. 157. 62
  158. 158. 63
  159. 159. column
a
=> 



label
is
'On
the
one
hand', 



render
as
'textarea', 



is
mandatory; 63
  160. 160. 64
  161. 161. 64
  162. 162. 65
  163. 163. 
“choices”
 . 65
  164. 164. •$
vim
lib/Doxory/View.pm 66
  165. 165. 67
  166. 166. • package
Doxory::View; use
Jifty::View::Declare
‐base; 67
  167. 167. • package
Doxory::View; use
Jifty::View::Declare
‐base; • template
'/'
=>
page
{
...
}; private
template
new_choice
=>
sub
{
...
}; 67
  168. 168. • package
Doxory::View; use
Jifty::View::Declare
‐base; • template
'/'
=>
page
{
...
}; private
template
new_choice
=>
sub
{
...
}; • template
choices
=>
page
{ 67
  169. 169. • package
Doxory::View; use
Jifty::View::Declare
‐base; • template
'/'
=>
page
{
...
}; private
template
new_choice
=>
sub
{
...
}; • template
choices
=>
page
{ • 



h1
{
'My
Choices'
} 



dl
{ 67
  170. 170. • package
Doxory::View; use
Jifty::View::Declare
‐base; • template
'/'
=>
page
{
...
}; private
template
new_choice
=>
sub
{
...
}; • template
choices
=>
page
{ • 



h1
{
'My
Choices'
} 



dl
{ • 







my
$choices
=
Doxory::Model::ChoiceCollection‐>new; 







$choices‐>limit( 











column
=>
'asked_by', 











value

=>
Jifty‐>web‐>current_user‐>id, 







); 67
  171. 171. • package
Doxory::View; use
Jifty::View::Declare
‐base; • template
'/'
=>
page
{
...
}; private
template
new_choice
=>
sub
{
...
}; • template
choices
=>
page
{ • 



h1
{
'My
Choices'
} 



dl
{ • 







my
$choices
=
Doxory::Model::ChoiceCollection‐>new; 







$choices‐>limit( 











column
=>
'asked_by', 











value

=>
Jifty‐>web‐>current_user‐>id, 







); • 







while
(my
$c
=
$choices‐>next)
{ 











dt
{
$c‐>name,
'
(',
$c‐>asked_by‐>name,
')'
} 











dd
{
b
{
$c‐>a
}
em
{
'vs'
}
b
{
$c‐>b
}
} 







} 



} }; 67
  172. 172. 68
  173. 173. ...
 ?
 68
  174. 174. ☑ 69
  175. 175. 70
  176. 176. • $
jifty
model
‐‐name
Vote 70
  177. 177. • $
jifty
model
‐‐name
Vote • Writing
file
t/00‐model‐Vote.t Writing
file
lib/Doxory/Model/Vote.pm 70
  178. 178. • $
jifty
model
‐‐name
Vote • Writing
file
t/00‐model‐Vote.t Writing
file
lib/Doxory/Model/Vote.pm • $
vim
lib/Doxory/Model/Vote.pm 70
  179. 179. • package
Doxory::Model::Vote; • use
Jifty::DBI::Schema; • use
Doxory::Record
schema
{ • 
 • column
choice
=> • 



references
Doxory::Model::Choice; • 
 • column
voter
=> • 



references
Doxory::Model::User; • column
suggestion
=> • 



valid
are
qw(
a
b
skip
); • column
comments
=> • 



label
is
'Comments?', • 



render
as
'textarea’; • 
 • }; 71
  180. 180. 72
  181. 181. 72
  182. 182. 73
  183. 183. 
“pick”
 . 73
  184. 184. •$
vim
lib/Doxory/Dispatcher.pm 74
  185. 185. •$
vim
lib/Doxory/Dispatcher.pm 
/pick
 . 74
  186. 186. • package
Doxory::Dispatcher; use
Jifty::Dispatcher
‐base; • before
'*'
=>
run
{ 



if
(Jifty‐>web‐>current_user‐>id)
{ • 







my
$top
=
Jifty‐>web‐>navigation; • 







$top‐>child(
'Pick!'
=>
url
=>
'/pick'
); • 







$top‐>child(
'Choices'
=>
url
=>
'/choices'
); • 



} • 



elsif
($1
!~
/^login|^signup/)
{ • 







tangent
'login'; 



} • }; • on
'/'
=>
show
'new_choice'; 75
  187. 187. • package
Doxory::Dispatcher; • ... • on
pick
=>
run
{ • 



my
$choices
=
Doxory::Model::ChoiceCollection‐>new; • 



my
$votes


=
$choices‐>join( • 







type



=>
'left', • 







alias1

=>
'main',

column1
=>
'id', • 







table2

=>
'votes',
column2
=>
'choice', • 



);

 • 



$choices‐>limit( • 







leftjoin
=>
$votes,
column

=>
'voter', • 







value



=>
Jifty‐>web‐>current_user‐>id, • 



);

 • 



$choices‐>limit( • 







alias



=>
$votes,
column

=>
'voter', • 







operator
=>
'IS',


value


=>
'NULL', • 



); • 



if
(my
$c
=
$choices‐>first)
{ • 







set
choice
=>
$c; • 



}


 • 



else
{ • 







show
'nothing_to_pick'; • 



}


 • }; 76
  188. 188. • package
Doxory::Dispatcher; • ... • on
pick
=>
run
{ • 



my
$choices
=
Doxory::Model::ChoiceCollection‐>new; • 



my
$votes


=
$choices‐>join( • 







type



=>
'left', • 







alias1

=>
'main',

column1
=>
'id', • 







table2

=>
'votes',
column2
=>
'choice', • 



);

 • 



$choices‐>limit( • 







leftjoin
=>
$votes,
column

=>
'voter', • 







value



=>
Jifty‐>web‐>current_user‐>id, • 



);

 • 



$choices‐>limit( • 







alias



=>
$votes,
column

=>
'voter', • 







operator
=>
'IS',


value


=>
'NULL', • 



); • 



if
(my
$c
=
$choices‐>first)
{ • 







set
choice
=>
$c; • 



}


 “ ” • 



else
{ • 







show
'nothing_to_pick'; • 



}


 • }; 76
  189. 189. •$
vim
lib/Doxory/View.pm 77
  190. 190. 78
  191. 191. • package
Doxory::View; 78
  192. 192. • package
Doxory::View; • use
Jifty::View::Declare
‐base; template
''
=>
page
{
...
}; private
template
choices
=>
sub
{
...
}; 78
  193. 193. • package
Doxory::View; • use
Jifty::View::Declare
‐base; template
''
=>
page
{
...
}; private
template
choices
=>
sub
{
...
}; • template
pick
=>
page
{ 78
  194. 194. • package
Doxory::View; • use
Jifty::View::Declare
‐base; template
''
=>
page
{
...
}; private
template
choices
=>
sub
{
...
}; • template
pick
=>
page
{ • 



my
$choice
=
get('choice'); 78
  195. 195. • package
Doxory::View; • use
Jifty::View::Declare
‐base; template
''
=>
page
{
...
}; private
template
choices
=>
sub
{
...
}; • template
pick
=>
page
{ • 



my
$choice
=
get('choice'); • 



my
$action
=
new_action(
class
=>
'CreateVote'
); 78
  196. 196. • package
Doxory::View; • use
Jifty::View::Declare
‐base; template
''
=>
page
{
...
}; private
template
choices
=>
sub
{
...
}; • template
pick
=>
page
{ • 



my
$choice
=
get('choice'); • 



my
$action
=
new_action(
class
=>
'CreateVote'
); • 



my
$redir

=
new_action( 







class




=>
"Jifty::Action::Redirect", 







arguments
=>
{
url
=>
'/pick'
}, 



); 78
  197. 197. • package
Doxory::View; • use
Jifty::View::Declare
‐base; template
''
=>
page
{
...
}; private
template
choices
=>
sub
{
...
}; • template
pick
=>
page
{ • 



my
$choice
=
get('choice'); • 



my
$action
=
new_action(
class
=>
'CreateVote'
); • 



my
$redir

=
new_action( 







class




=>
"Jifty::Action::Redirect", 







arguments
=>
{
url
=>
'/pick'
}, 



); • 



my
%args


=
( 







choice
=>
$choice‐>id, 







voter

=>
Jifty‐>web‐>current_user‐>id, 



); 78
  198. 198. • package
Doxory::View; • use
Jifty::View::Declare
‐base; template
''
=>
page
{
...
}; private
template
choices
=>
sub
{
...
}; • template
pick
=>
page
{ • 



my
$choice
=
get('choice'); • 



my
$action
=
new_action(
class
=>
'CreateVote'
); • 



my
$redir

=
new_action( 







class




=>
"Jifty::Action::Redirect", 







arguments
=>
{
url
=>
'/pick'
}, 



); • 



my
%args


=
( 







choice
=>
$choice‐>id, 







voter

=>
Jifty‐>web‐>current_user‐>id, 



); • 



h1
{
$choice‐>asked_by‐>name,
':
',
$choice‐>name
} 78
  199. 199. • package
Doxory::View; • use
Jifty::View::Declare
‐base; template
''
=>
page
{
...
}; private
template
choices
=>
sub
{
...
}; • template
pick
=>
page
{ • 



my
$choice
=
get('choice'); • 



my
$action
=
new_action(
class
=>
'CreateVote'
); • 



my
$redir

=
new_action( 







class




=>
"Jifty::Action::Redirect", 







arguments
=>
{
url
=>
'/pick'
}, 



); • 



my
%args


=
( 







choice
=>
$choice‐>id, 







voter

=>
Jifty‐>web‐>current_user‐>id, 



); • 



h1
{
$choice‐>asked_by‐>name,
':
',
$choice‐>name
} • 



div
{
form
{ 78
  200. 200. • package
Doxory::View; • use
Jifty::View::Declare
‐base; template
''
=>
page
{
...
}; private
template
choices
=>
sub
{
...
}; • template
pick
=>
page
{ • 



my
$choice
=
get('choice'); • 



my
$action
=
new_action(
class
=>
'CreateVote'
); • 



my
$redir

=
new_action( 







class




=>
"Jifty::Action::Redirect", 







arguments
=>
{
url
=>
'/pick'
}, 



); • 



my
%args


=
( 







choice
=>
$choice‐>id, 







voter

=>
Jifty‐>web‐>current_user‐>id, 



); • 



h1
{
$choice‐>asked_by‐>name,
':
',
$choice‐>name
} • 



div
{
form
{ • 







my
($x,
$y)
=
map
{
$action‐>button( 











submit





=>
[
$action,
$redir
], 











label






=>
$choice‐>$_, 











arguments


=>
{
suggestion
=>
$_,
%args
}, 







)
}
((rand
>
0.5)
?
('a',
'b')
:
('b',
'a')); 78
  201. 201. • package
Doxory::View; • use
Jifty::View::Declare
‐base; template
''
=>
page
{
...
}; private
template
choices
=>
sub
{
...
}; • template
pick
=>
page
{ • 



my
$choice
=
get('choice'); • 



my
$action
=
new_action(
class
=>
'CreateVote'
); • 



my
$redir

=
new_action( 







class




=>
"Jifty::Action::Redirect", 







arguments
=>
{
url
=>
'/pick'
}, 



); • 



my
%args


=
( 







choice
=>
$choice‐>id, 







voter

=>
Jifty‐>web‐>current_user‐>id, 



); • 



h1
{
$choice‐>asked_by‐>name,
':
',
$choice‐>name
} • 



div
{
form
{ • 







my
($x,
$y)
=
map
{
$action‐>button( 











submit





=>
[
$action,
$redir
], 











label






=>
$choice‐>$_, 











arguments


=>
{
suggestion
=>
$_,
%args
}, 







)
}
((rand
>
0.5)
?
('a',
'b')
:
('b',
'a')); • 







span
{
$x
}
em
{
'or'
}
span
{
$y
}
em
{
'or'
}
span
{ 











$action‐>button( 















submit





=>
[
$action,
$redir
], 















label






=>
'None
of
the
above', 















arguments


=>
{
suggestion
=>
'skip',
%args
}, 











); 







} 







p
{
render_param(
$action
=>
'comments'
)
} 



}
} }; 78
  202. 202. 79
  203. 203. • package
Doxory::View; use
Jifty::View::Declare
‐base; template
''
=>
page
{
...
}; private
template
new_choice
=>
sub
{
...
}; template
choices
=>
page
{
...
}; template
pick
=>
page
{
...
}; 79
  204. 204. • package
Doxory::View; use
Jifty::View::Declare
‐base; template
''
=>
page
{
...
}; private
template
new_choice
=>
sub
{
...
}; template
choices
=>
page
{
...
}; template
pick
=>
page
{
...
}; • template
nothing_to_pick
=>
page
{ 



h1
{
"There's
nothing
for
you
to
pick."
} 79
  205. 205. • package
Doxory::View; use
Jifty::View::Declare
‐base; template
''
=>
page
{
...
}; private
template
new_choice
=>
sub
{
...
}; template
choices
=>
page
{
...
}; template
pick
=>
page
{
...
}; • template
nothing_to_pick
=>
page
{ 



h1
{
"There's
nothing
for
you
to
pick."
} • 



p
{
"No
one
you
know
is
angsting
about
anything. 








Everybody
knows
where
they're
going
to
dinner, 








what
to
do
on
their
next
date
and
whether
to 








drop
that
class.

You
have
such
lovely
and 








well
adjusted
friends."
} 79
  206. 206. • package
Doxory::View; use
Jifty::View::Declare
‐base; template
''
=>
page
{
...
}; private
template
new_choice
=>
sub
{
...
}; template
choices
=>
page
{
...
}; template
pick
=>
page
{
...
}; • template
nothing_to_pick
=>
page
{ 



h1
{
"There's
nothing
for
you
to
pick."
} • 



p
{
"No
one
you
know
is
angsting
about
anything. 








Everybody
knows
where
they're
going
to
dinner, 








what
to
do
on
their
next
date
and
whether
to 








drop
that
class.

You
have
such
lovely
and 








well
adjusted
friends."
} • 



h2
{
"Maybe
it's
time
to
ask
for
some
advice..."
}; 79
  207. 207. • package
Doxory::View; use
Jifty::View::Declare
‐base; template
''
=>
page
{
...
}; private
template
new_choice
=>
sub
{
...
}; template
choices
=>
page
{
...
}; template
pick
=>
page
{
...
}; • template
nothing_to_pick
=>
page
{ 



h1
{
"There's
nothing
for
you
to
pick."
} • 



p
{
"No
one
you
know
is
angsting
about
anything. 








Everybody
knows
where
they're
going
to
dinner, 








what
to
do
on
their
next
date
and
whether
to 








drop
that
class.

You
have
such
lovely
and 








well
adjusted
friends."
} • 



h2
{
"Maybe
it's
time
to
ask
for
some
advice..."
}; • 



show
'new_choice'; }; 79
  208. 208. 80
  209. 209. 81
  210. 210. 81
  211. 211. 82
  212. 212. 
choices
 , . 82
  213. 213. •$
vim
lib/Doxory/Model/Choice.pm 83
  214. 214. • package
Doxory::Model::Choice; • use
Jifty::DBI::Schema; • use
Doxory::Record
schema
{
...
} • sub
in_favor_of_a
{ • 



my
$self
=
shift; • 



$self‐>in_favor_of('a'); • } • sub
in_favor_of_b
{ • 



my
$self
=
shift; • 



$self‐>in_favor_of('b'); • } • sub
in_favor_of
{ • 



my
($self,
$x)
=
@_; • 



my
$votes
=
Doxory::Model::VoteCollection‐>new; • 



$votes‐>limit(column
=>
'choice',




value
=>
$self‐>id); • 



$votes‐>limit(column
=>
'suggestion',
value
=>
$x); • 



return
$votes; • } • 84
  215. 215. •$
vim
lib/Doxory/View.pm 85
  216. 216. 86
  217. 217. 86
  218. 218. • package
Doxory::View; use
Jifty::View::Declare
‐base; ... 86
  219. 219. • package
Doxory::View; use
Jifty::View::Declare
‐base; ... • template
choices
=>
page
{ 



h1
{
'My
Choices'
} 86
  220. 220. • package
Doxory::View; use
Jifty::View::Declare
‐base; ... • template
choices
=>
page
{ 



h1
{
'My
Choices'
} • 



dl
{ 86
  221. 221. • package
Doxory::View; use
Jifty::View::Declare
‐base; ... • template
choices
=>
page
{ 



h1
{
'My
Choices'
} • 



dl
{ • 







my
$choices
=
Doxory::Model::ChoiceCollection‐>new; 







$choices‐>limit( 











column
=>
'asked_by', 











value

=>
Jifty‐>web‐>current_user‐>id, 







); 86
  222. 222. • package
Doxory::View; use
Jifty::View::Declare
‐base; ... • template
choices
=>
page
{ 



h1
{
'My
Choices'
} • 



dl
{ • 







my
$choices
=
Doxory::Model::ChoiceCollection‐>new; 







$choices‐>limit( 











column
=>
'asked_by', 











value

=>
Jifty‐>web‐>current_user‐>id, 







); • 







while
(my
$c
=
$choices‐>next)
{ 











dt
{
$c‐>name,
'
(',
$c‐>asked_by‐>name,
')'
} 











dd
{ 86
  223. 223. • package
Doxory::View; use
Jifty::View::Declare
‐base; ... • template
choices
=>
page
{ 



h1
{
'My
Choices'
} • 



dl
{ • 







my
$choices
=
Doxory::Model::ChoiceCollection‐>new; 







$choices‐>limit( 











column
=>
'asked_by', 











value

=>
Jifty‐>web‐>current_user‐>id, 







); • 







while
(my
$c
=
$choices‐>next)
{ 











dt
{
$c‐>name,
'
(',
$c‐>asked_by‐>name,
')'
} 











dd
{ • 















b
{
$c‐>a,
'
(',
$c‐>in_favor_of_a‐>count,
')'
} 86
  224. 224. • package
Doxory::View; use
Jifty::View::Declare
‐base; ... • template
choices
=>
page
{ 



h1
{
'My
Choices'
} • 



dl
{ • 







my
$choices
=
Doxory::Model::ChoiceCollection‐>new; 







$choices‐>limit( 











column
=>
'asked_by', 











value

=>
Jifty‐>web‐>current_user‐>id, 







); • 







while
(my
$c
=
$choices‐>next)
{ 











dt
{
$c‐>name,
'
(',
$c‐>asked_by‐>name,
')'
} 











dd
{ • 















b
{
$c‐>a,
'
(',
$c‐>in_favor_of_a‐>count,
')'
} • 















em
{
'vs'
} 86
  225. 225. • package
Doxory::View; use
Jifty::View::Declare
‐base; ... • template
choices
=>
page
{ 



h1
{
'My
Choices'
} • 



dl
{ • 







my
$choices
=
Doxory::Model::ChoiceCollection‐>new; 







$choices‐>limit( 











column
=>
'asked_by', 











value

=>
Jifty‐>web‐>current_user‐>id, 







); • 







while
(my
$c
=
$choices‐>next)
{ 











dt
{
$c‐>name,
'
(',
$c‐>asked_by‐>name,
')'
} 











dd
{ • 















b
{
$c‐>a,
'
(',
$c‐>in_favor_of_a‐>count,
')'
} • 















em
{
'vs'
} • 















b
{
$c‐>b,
'
(',
$c‐>in_favor_of_b‐>count,
')'
} 86
  226. 226. • package
Doxory::View; use
Jifty::View::Declare
‐base; ... • template
choices
=>
page
{ 



h1
{
'My
Choices'
} • 



dl
{ • 







my
$choices
=
Doxory::Model::ChoiceCollection‐>new; 







$choices‐>limit( 











column
=>
'asked_by', 











value

=>
Jifty‐>web‐>current_user‐>id, 







); • 







while
(my
$c
=
$choices‐>next)
{ 











dt
{
$c‐>name,
'
(',
$c‐>asked_by‐>name,
')'
} 











dd
{ • 















b
{
$c‐>a,
'
(',
$c‐>in_favor_of_a‐>count,
')'
} • 















em
{
'vs'
} • 















b
{
$c‐>b,
'
(',
$c‐>in_favor_of_b‐>count,
')'
} • 











} 







} 



} }; 86
  227. 227. 87
  228. 228. :
 .
☺ 87
  229. 229. ! 88
  230. 230. ! lib/Doxory/Model/User.pm 88
  231. 231. ! lib/Doxory/Model/User.pm lib/Doxory/Model/Choice.pm 88
  232. 232. ! lib/Doxory/Model/User.pm lib/Doxory/Model/Choice.pm lib/Doxory/Model/Vote.pm 88
  233. 233. ! lib/Doxory/Model/User.pm lib/Doxory/Model/Choice.pm lib/Doxory/Model/Vote.pm lib/Doxory/Dispatcher.pm 88
  234. 234. ! lib/Doxory/Model/User.pm lib/Doxory/Model/Choice.pm lib/Doxory/Model/Vote.pm lib/Doxory/Dispatcher.pm lib/Doxory/View.pm 88
  235. 235. ! lib/Doxory/Model/User.pm lib/Doxory/Model/Choice.pm lib/Doxory/Model/Vote.pm lib/Doxory/Dispatcher.pm lib/Doxory/View.pm 88
  236. 236. ☈ 89
  237. 237. 90
  238. 238. ☈ Doxory
 90
  239. 239. ☈ Doxory
 ☈ 90
  240. 240. ☈ Doxory
 ☈ ☈ ... 90
  241. 241. Doxory
 91
  242. 242. Doxory
 ☈ ! 91
  243. 243. Doxory
 ☈ ! ☈ 91
  244. 244. Doxory
 ☈ ! ☈ ☈ vim
lib/Doxory/Model/Choice.pm 91
  245. 245. 92
  246. 246. • package
Doxory::Model::Choice; 92
  247. 247. • package
Doxory::Model::Choice; • use
Regexp::Common
'profanity_us'; 92
  248. 248. • package
Doxory::Model::Choice; • use
Regexp::Common
'profanity_us'; • sub
validate_name
{ 


my
($self,
$name)
=
@_; 92
  249. 249. • package
Doxory::Model::Choice; • use
Regexp::Common
'profanity_us'; • sub
validate_name
{ 


my
($self,
$name)
=
@_; • 


if
($name
=~
/$RE{profanity}/i)
{ 






return
( 










0,
'Would
you
speak
like
that
'. 













'in
front
of
your
mother?
*cough*' 






); 


} 92
  250. 250. • package
Doxory::Model::Choice; • use
Regexp::Common
'profanity_us'; • sub
validate_name
{ 


my
($self,
$name)
=
@_; • 


if
($name
=~
/$RE{profanity}/i)
{ 






return
( 










0,
'Would
you
speak
like
that
'. 













'in
front
of
your
mother?
*cough*' 






); 


} • 


return
1; } 92
  251. 251. 93
  252. 252. 
(Validator) 94
  253. 253. 
(Validator) ☈ 94
  254. 254. 
(Validator) ☈ ☈ 94
  255. 255. 
(Validator) ☈ ☈ ☈ ! 94
  256. 256. • package
Doxory::Model::Choice; use
Regexp::Common
'profanity_us'; • sub
canonicalize_name
{ • 


my
($self,
$name)
=
@_; • 


$name
=~
s/$RE{profanity}/**expletives**/gi; • 


return
$name; •} 95
  257. 257. 96
  258. 258. 
(Canonicalizer) 97
  259. 259. 
(Canonicalizer) ☈ 
Model
 97
  260. 260. 
(Canonicalizer) ☈ 
Model
 ☈ 
(Autocompleter)
 97
  261. 261. 
(Canonicalizer) ☈ 
Model
 ☈ 
(Autocompleter)
 ☈ :
 
Doxory 97
  262. 262. 98
  263. 263. •$
vim
lib/Doxory/Dispatcher.pm 99
  264. 264. •$
vim
lib/Doxory/Dispatcher.pm . 99
  265. 265. • package
Doxory::Dispatcher; use
Jifty::Dispatcher
‐base; • before
'*'
=>
run
{ 



if
(Jifty‐>web‐>current_user‐>id)
{ • 







my
$top
=
Jifty‐>web‐>navigation; • 







$top‐>child(


'Pick!'

=>
url
=>
'/pick'
); • 







$top‐>child(


'Choices'

=>
url
=>
'/choices'
); • 



} • 



elsif
($1
!~
/^login|^signup/)
{ • 







tangent
'login'; 



} • }; • ... 100
  266. 266. • package
Doxory::Dispatcher; use
Jifty::Dispatcher
‐base; • before
'*'
=>
run
{ 



if
(Jifty‐>web‐>current_user‐>id)
{ • 







my
$top
=
Jifty‐>web‐>navigation; • 







$top‐>child(
_('Pick!')
=>
url
=>
'/pick'
); • 







$top‐>child(
_('Choices')
=>
url
=>
'/choices'
); • 



} • 



elsif
($1
!~
/^login|^signup/)
{ • 







tangent
'login'; 



} • }; • ... 101
  267. 267. •$
vim
lib/Doxory/Model/*.pm 102
  268. 268. •$
vim
lib/Doxory/Model/*.pm 
label,
hints
 . 102
  269. 269. • package
Doxory::Model::Choice; • use
Jifty::DBI::Schema; • use
Doxory::Record
schema
{ • 
 • column
name
=> • 



label
is
_('I
need
help
deciding...'), • 



render
as
'textarea'; • 
 • column
a
=> • 



label
is
_('On
the
one
hand'), • 



render
as
'textarea',
is
mandatory; • column
b
=> • 



label
is
_('On
the
other
hand'), • 



render
as
'textarea',
is
mandatory; • column
asked_by
=> • 



label
is
_('Asked
by'), • 



default
is
defer
{
Jifty‐>web‐>current_user‐>id
}, • 



references
Doxory::Model::User; • 
 • }; 103
  270. 270. package
Doxory::Model::User; use
Jifty::DBI::Schema; 
 use
Doxory::Record
schema
{ 
 column
name
=> 



label
is
_('Username'), 



hints
is
_('Other
people
see
this
when
you
ask
questions.'), 



is
distinct, 



is
mandatory; 
 column
email
=> 



label
is
_('Email'), 



hints
is
_('We
will
not
sell
it
to
anybody.
Honest.'), 



default
is
'', 



is
distinct, 



is
immutable; 
 }; 104
  271. 271. • package
Doxory::Model::Vote; • use
Jifty::DBI::Schema; • use
Doxory::Record
schema
{ • 
 • column
choice
=> • 



references
Doxory::Model::Choice; • 
 • column
voter
=> • 



references
Doxory::Model::User; • column
suggestion
=> • 



valid
are
qw(
a
b
skip
); • column
comments
=> • 



label
is
_('Comments?'), • 



render
as
'textarea’; • 
 • }; 105
  272. 272. •$
vim
lib/Doxory/View.pm 106
  273. 273. •$
vim
lib/Doxory/View.pm . 106
  274. 274. • package
Doxory::View; use
Jifty::View::Declare
‐base; template
'/'
=>
page
{ 



h1
{
_('Ask
a
question!')
} • 



show
'new_choice'; • }; • private
template
new_choice
=>
sub
{ 



div
{
form
{ • 







my
$action
=
new_action(
class
=>
'CreateChoice'
); • 







render_action(
$action
=>
['name',
'a',
'b']
); • 







form_submit(
label
=>
_('Ask
the
Crowd!')
); • 



}
} • }; • ... 107
  275. 275. 108
  276. 276. • $
jifty
po
‐‐language
zh_tw 108
  277. 277. . • $
jifty
po
‐‐language
zh_tw 108
  278. 278. . • $
jifty
po
‐‐language
zh_tw • INFO
‐
Extracting
messages
from
'lib/Doxory/Dispatcher.pm' INFO
‐
Extracting
messages
from
'lib/Doxory/View.pm' INFO
‐
Extracting
messages
from
'lib/Doxory/Model/Choice.pm' INFO
‐
Extracting
messages
from
'lib/Doxory/Model/User.pm' INFO
‐
Extracting
messages
from
'lib/Doxory/Model/Vote.pm' INFO
‐
Extracting
messages
from
'bin/jifty' INFO
‐
Updating
message
catalog
'share/po/zh_tw.po' 108
  279. 279. . • $
jifty
po
‐‐language
zh_tw • INFO
‐
Extracting
messages
from
'lib/Doxory/Dispatcher.pm' INFO
‐
Extracting
messages
from
'lib/Doxory/View.pm' INFO
‐
Extracting
messages
from
'lib/Doxory/Model/Choice.pm' INFO
‐
Extracting
messages
from
'lib/Doxory/Model/User.pm' INFO
‐
Extracting
messages
from
'lib/Doxory/Model/Vote.pm' INFO
‐
Extracting
messages
from
'bin/jifty' INFO
‐
Updating
message
catalog
'share/po/zh_tw.po' • $
vim
share/po/zh_tw.po 108
  280. 280. . • $
jifty
po
‐‐language
zh_tw • INFO
‐
Extracting
messages
from
'lib/Doxory/Dispatcher.pm' INFO
‐
Extracting
messages
from
'lib/Doxory/View.pm' INFO
‐
Extracting
messages
from
'lib/Doxory/Model/Choice.pm' INFO
‐
Extracting
messages
from
'lib/Doxory/Model/User.pm' INFO
‐
Extracting
messages
from
'lib/Doxory/Model/Vote.pm' INFO
‐
Extracting
messages
from
'bin/jifty' INFO
‐
Updating
message
catalog
'share/po/zh_tw.po' • $
vim
share/po/zh_tw.po . 108
  281. 281. msgid
"" msgstr
"" "Content‐Type:
text/plain;
 charset=CHARSET " • #:
lib/Doxory/Model/Choice.pm:9 #:
lib/Doxory/View.pm:8 • msgid
"I
need
help
deciding..." msgid
"Ask
a
question!" • msgstr
"" msgstr
"" • #:
lib/Doxory/Model/Choice.pm:13 #:
lib/Doxory/View.pm:16 • msgid
"On
the
one
hand" msgid
"Ask
the
crowd!" • msgstr
"" msgstr
"" • #:
lib/Doxory/Model/Choice.pm:18 #:
lib/Doxory/Model/Choice.pm:23 • msgid
"On
the
other
hand" msgid
"Asked
by" • msgstr
"" msgstr
"" • #:
lib/Doxory/Dispatcher.pm:9 #:
lib/Doxory/Dispatcher.pm:10 • msgid
"Pick!" msgid
"Choices" • msgstr
"" msgstr
"" • #:
lib/Doxory/Model/Vote.pm:18 msgid
"Comments?" msgstr
"" 109
  282. 282. msgid
"" msgstr
"" "Content‐Type:
text/plain;
 charset=UTF‐8 " • #:
lib/Doxory/Model/Choice.pm:9 #:
lib/Doxory/View.pm:8 • msgid
"I
need
help
deciding..." msgid
"Ask
a
question!" • msgstr
" ,
 ..." msgstr
" !" • #:
lib/Doxory/Model/Choice.pm:13 #:
lib/Doxory/View.pm:16 • msgid
"On
the
one
hand" msgid
"Ask
the
crowd!" • msgstr
" ...?" msgstr
" !" • #:
lib/Doxory/Model/Choice.pm:18 #:
lib/Doxory/Model/Choice.pm:23 • msgid
"On
the
other
hand" msgid
"Asked
by" • msgstr
" ...?" msgstr
" " • #:
lib/Doxory/Dispatcher.pm:9 #:
lib/Doxory/Dispatcher.pm:10 • msgid
"Pick!" msgid
"Choices" • msgstr
" !" msgstr
" " • #:
lib/Doxory/Model/Vote.pm:18 msgid
"Comments?" msgstr
" ?" 110
  283. 283. 111
  284. 284. ... 111
  285. 285. 112
  286. 286. • $
b2g.pl
‐p
‐u
share/po/zh_tw.po
>
share/po/zh_cn.po 112
  287. 287. 
Encode::HanConvert
 . • $
b2g.pl
‐p
‐u
share/po/zh_tw.po
>
share/po/zh_cn.po 112
  288. 288. 
Encode::HanConvert
 . • $
b2g.pl
‐p
‐u
share/po/zh_tw.po
>
share/po/zh_cn.po • $
vim
etc/config.yml 112
  289. 289. 
Encode::HanConvert
 . • $
b2g.pl
‐p
‐u
share/po/zh_tw.po
>
share/po/zh_cn.po • $
vim
etc/config.yml . 强 设 112
  290. 290. •‐‐‐ •framework: •

L10N: •



PoDir:
share/po • 113
  291. 291. •‐‐‐ •framework: •

L10N: •



PoDir:
share/po •



Lang:
zh‐cn • 114
  292. 292. 115
  293. 293. ! 国际 115
  294. 294. 116
  295. 295. 117
  296. 296. 
HTTP
 117
  297. 297. 
HTTP
 Module::Install 117
  298. 298. 
HTTP
 Module::Install 
PAR
 117
  299. 299. 
(Halo) 118
  300. 300. 
(Halo) 118
  301. 301. 
(Halo) 118
  302. 302. 
(Halo) ... ! 118
  303. 303. Halo 119
  304. 304. Halo SQL
 119
  305. 305. Halo SQL
 SQL
 119
  306. 306. Halo SQL
 SQL
 119
  307. 307. Halo SQL
 SQL
 119
  308. 308. 
(DevelMode) 120
  309. 309. 
(DevelMode) Module::Refresh 120
  310. 310. 
(DevelMode) Module::Refresh Log4Perl
 120
  311. 311. 
(DevelMode) Module::Refresh Log4Perl
 120
  312. 312. 121
  313. 313. Lighttpd
/
Apache 121
  314. 314. Lighttpd
/
Apache CSS::Squish
 121
  315. 315. Lighttpd
/
Apache CSS::Squish
 JavaScript::Squish
 121
  316. 316. ... 122
  317. 317. ... 
I18N
 122
  318. 318. ... 
I18N
 
Session 122
  319. 319. ... 
I18N
 
Session 
(Event)
 122
  320. 320. ✈ 123
  321. 321. 124
  322. 322. ✈ Wiki
UI
 124
  323. 323. ✈ Wiki
UI
 ✈ ,
 124
  324. 324. ✈ Wiki
UI
 ✈ ,
 ✈ ,
 ,
MTV... 124
  325. 325. 125
  326. 326. ✈ Wifty 125
  327. 327. ✈ Wifty ✈ CommitBit 125
  328. 328. ✈ Wifty ✈ CommitBit ✈ BabelBee 125
  329. 329. ✈ Ping
 ✈ Wifty ✈ CommitBit ✈ BabelBee 125
  330. 330. ✈ Ping
 ✈ Wifty ✈ Chat ✈ CommitBit ✈ BabelBee 125
  331. 331. ✈ Ping
 ✈ Wifty ✈ Chat ✈ CommitBit ✈ Clock ✈ BabelBee 125
  332. 332. ✈ Ping
 ✈ Wifty ✈ Chat ✈ CommitBit ✈ Clock ✈ BabelBee ✈ Doxory! 125
  333. 333. 
Jifty 126
  334. 334. 
Jifty ✈ cpan
Jifty 126
  335. 335. 
Jifty ✈ cpan
Jifty ✈ http://svn.jifty.org/svn/jifty.org 126
  336. 336. 
Jifty ✈ cpan
Jifty ✈ http://svn.jifty.org/svn/jifty.org ✈ http://jifty.org/ 126
  337. 337. 127
  338. 338. ✈ Jifty::Manual::Tutorial 127
  339. 339. ✈ Jifty::Manual::Tutorial ✈ irc.freenode.net
#jifty 127
  340. 340. ✈ Jifty::Manual::Tutorial ✈ irc.freenode.net
#jifty ✈ jifty‐devel@lists.jifty.org 127
  341. 341. fin. 128
  342. 342. Bonus Slides 129
  343. 343. ☺ 130
  344. 344. Anatomy
of
a
Jifty
App 131
  345. 345. Anatomy
of
a
Jifty
App ☺ Model
:
Columns 131
  346. 346. Anatomy
of
a
Jifty
App ☺ Model
:
Columns ☺ Action
:
Parameters 131
  347. 347. Anatomy
of
a
Jifty
App ☺ Model
:
Columns ☺ Action
:
Parameters ☺ Template
:
Fragments 131
  348. 348. More
Components 132
  349. 349. More
Components ☺ Dispatcher 132
  350. 350. More
Components ☺ Dispatcher ☺ ClassLoader 132
  351. 351. More
Components ☺ Dispatcher ☺ ClassLoader ☺ Continuations 132
  352. 352. ䷗ 133
  353. 353. Jifty::DBI 134
  354. 354. Jifty::DBI ∅ CREATE
TABLE 134
  355. 355. Jifty::DBI ∅ CREATE
TABLE ∅ ALTER
TABLE 134
  356. 356. Jifty::DBI ∅ CREATE
TABLE ∅ ALTER
TABLE ∅ CREATE
FOREIGN
KEY 134
  357. 357. Object
Relational
Mapper 135
  358. 358. Object
Relational
Mapper ∅ SELECT 135
  359. 359. Object
Relational
Mapper ∅ SELECT ∅ INSERT 135
  360. 360. Object
Relational
Mapper ∅ SELECT ∅ UPDATE ∅ INSERT 135
  361. 361. Object
Relational
Mapper ∅ SELECT ∅ UPDATE ∅ INSERT ∅ DELETE 135
  362. 362. Jifty::DBI::Handle 136
  363. 363. Jifty::DBI::Handle ䷗ SQLite 136
  364. 364. Jifty::DBI::Handle ䷗ SQLite ䷗ Postgres 136
  365. 365. Jifty::DBI::Handle ䷗ SQLite ䷗ MySQL ䷗ Postgres 136
  366. 366. Jifty::DBI::Handle ䷗ SQLite ䷗ MySQL ䷗ Postgres ䷗ Oracle 136
  367. 367. Jifty::DBI::Collection 137
  368. 368. Jifty::DBI::Collection ䷗ Joins
and
Limits 137
  369. 369. Jifty::DBI::Collection ䷗ Joins
and
Limits ䷗ Paging
=
Data::Page 137
  370. 370. Jifty::DBI::Collection ䷗ Joins
and
Limits ䷗ Paging
=
Data::Page ䷗ Caching
=
Memcached 137
  371. 371. Jifty::DBI::Schema 138
  372. 372. Jifty::DBI::Schema ䷗ Declarative
Columns 138
  373. 373. Jifty::DBI::Schema ䷗ Declarative
Columns ䷗ Remember
our
Doxory? 138
  374. 374. Jifty::DBI::Schema ䷗ Declarative
Columns ䷗ Remember
our
Doxory? ䷗ Time
for
0.0.2! 138
  375. 375. 139
  376. 376. • package
Doxory::Model::Comment; use
Jifty::DBI::Schema; use
Doxory::Record
schema
{ since
'0.0.2'; 139
  377. 377. • package
Doxory::Model::Comment; use
Jifty::DBI::Schema; use
Doxory::Record
schema
{ since
'0.0.2'; • column
User

=>
refers
to
Doxory::Model:User; column
author
=>
refers
to
Doxory::Model::User; 139
  378. 378. • package
Doxory::Model::Comment; use
Jifty::DBI::Schema; use
Doxory::Record
schema
{ since
'0.0.2'; • column
User

=>
refers
to
Doxory::Model:User; column
author
=>
refers
to
Doxory::Model::User; • column
body
=> 


label


is
'Content', 


type



is
'Text', 


render

as
'Textarea', 


default
is
'First
Post!'; 139
  379. 379. • package
Doxory::Model::Comment; use
Jifty::DBI::Schema; use
Doxory::Record
schema
{ since
'0.0.2'; • column
User

=>
refers
to
Doxory::Model:User; column
author
=>
refers
to
Doxory::Model::User; • column
body
=> 


label


is
'Content', 


type



is
'Text', 


render

as
'Textarea', 


default
is
'First
Post!'; • column
title
=> 


is
mandatory, 


label


is
'Title', 


length

is
40, 


hints


is
'40
bytes
max'; 139
  380. 380. • package
Doxory::Model::Comment; use
Jifty::DBI::Schema; use
Doxory::Record
schema
{ since
'0.0.2'; • column
User

=>
refers
to
Doxory::Model:User; column
author
=>
refers
to
Doxory::Model::User; • column
body
=> 


label


is
'Content', 


type



is
'Text', 


render

as
'Textarea', 


default
is
'First
Post!'; • column
title
=> 


is
mandatory, 


label


is
'Title', 


length

is
40, 


hints


is
'40
bytes
max'; • }; 139
  381. 381. Database
Upgrade 140
  382. 382. Database
Upgrade ䷗ Used
to
be
painful 140
  383. 383. Database
Upgrade ䷗ Used
to
be
painful ䷗ Not
anymore 140
  384. 384. Database
Upgrade ䷗ Used
to
be
painful ䷗ Not
anymore ䷗ Jifty
fixed
it! 140
  385. 385. 141
  386. 386. • $
vim
etc/config.yml 141
  387. 387. • $
vim
etc/config.yml • (Set
version
to
0.0.2) 141
  388. 388. • $
vim
etc/config.yml • (Set
version
to
0.0.2) • $
jifty
server 141
  389. 389. • $
vim
etc/config.yml • (Set
version
to
0.0.2) • $
jifty
server • Application
schema
version
in
database
(v0.0.1)
 doesn't
match
application
schema
version
(0.0.2) Please
run
`bin/jifty
schema
‐‐setup`
to
upgrade
 the
database. 141
  390. 390. • $
vim
etc/config.yml • (Set
version
to
0.0.2) • $
jifty
server • Application
schema
version
in
database
(v0.0.1)
 doesn't
match
application
schema
version
(0.0.2) Please
run
`bin/jifty
schema
‐‐setup`
to
upgrade
 the
database. • $
jifty
schema
‐‐setup 141
  391. 391. • $
vim
etc/config.yml • (Set
version
to
0.0.2) • $
jifty
server • Application
schema
version
in
database
(v0.0.1)
 doesn't
match
application
schema
version
(0.0.2) Please
run
`bin/jifty
schema
‐‐setup`
to
upgrade
 the
database. • $
jifty
schema
‐‐setup • Jifty
version
0.605070
up
to
date. INFO
‐
Generating
SQL
to
upgrade
Doxory 






v0.0.1
database
to
v0.0.2 INFO
‐
Upgraded
to
version
v0.0.2 141
  392. 392. • $
vim
etc/config.yml • (Set
version
to
0.0.2) • $
jifty
server • Application
schema
version
in
database
(v0.0.1)
 doesn't
match
application
schema
version
(0.0.2) Please
run
`bin/jifty
schema
‐‐setup`
to
upgrade
 the
database. • $
jifty
schema
‐‐setup • Jifty
version
0.605070
up
to
date. INFO
‐
Generating
SQL
to
upgrade
Doxory 






v0.0.1
database
to
v0.0.2 INFO
‐
Upgraded
to
version
v0.0.2 • $
jifty
server 141
  393. 393. • $
vim
etc/config.yml • (Set
version
to
0.0.2) • $
jifty
server • Application
schema
version
in
database
(v0.0.1)
 doesn't
match
application
schema
version
(0.0.2) Please
run
`bin/jifty
schema
‐‐setup`
to
upgrade
 the
database. • $
jifty
schema
‐‐setup • Jifty
version
0.605070
up
to
date. INFO
‐
Generating
SQL
to
upgrade
Doxory 






v0.0.1
database
to
v0.0.2 INFO
‐
Upgraded
to
version
v0.0.2 • $
jifty
server • INFO
‐
You
can
connect
to
your
server
at 






http://localhost:8888/ 141
  394. 394. 142
  395. 395. • column
tags
=> 


since
'0.0.3', 


refers
to
Doxory::Model::TagCollection
by
'User'; 142
  396. 396. • column
tags
=> 


since
'0.0.3', 


refers
to
Doxory::Model::TagCollection
by
'User'; • column
mood
=> 


since
'0.0.4', 


default
is
'happy', 


valid
are 






{
display
=>
'Sad',
value
=>
'sad'
}, 






{
display
=>
'Happy',
value
=>
'happy'
}; 142
  397. 397. • column
tags
=> 


since
'0.0.3', 


refers
to
Doxory::Model::TagCollection
by
'User'; • column
mood
=> 


since
'0.0.4', 


default
is
'happy', 


valid
are 






{
display
=>
'Sad',
value
=>
'sad'
}, 






{
display
=>
'Happy',
value
=>
'happy'
}; • column
created
=> 


since
'0.0.5', 


is
immutable, 


type
is
'timestamp', 


default
is
literal
'now()', 


filters
are
'Jifty::DBI::Filter::DateTime'; 142
  398. 398. 143
  399. 399. • $
vim
etc/config.yml 143
  400. 400. • $
vim
etc/config.yml • (Set
version
to
0.0.5) 143
  401. 401. • $
vim
etc/config.yml • (Set
version
to
0.0.5) • $
jifty
schema
‐‐setup 143
  402. 402. • $
vim
etc/config.yml • (Set
version
to
0.0.5) • $
jifty
schema
‐‐setup • Jifty
version
0.605070
up
to
date. INFO
‐
Generating
SQL
to
upgrade
Doxory 






v0.0.2
database
to
v0.0.5 INFO
‐
Upgraded
to
version
v0.0.5 143
  403. 403. • $
vim
etc/config.yml • (Set
version
to
0.0.5) • $
jifty
schema
‐‐setup • Jifty
version
0.605070
up
to
date. INFO
‐
Generating
SQL
to
upgrade
Doxory 






v0.0.2
database
to
v0.0.5 INFO
‐
Upgraded
to
version
v0.0.5 • $
jifty
server 143
  404. 404. • $
vim
etc/config.yml • (Set
version
to
0.0.5) • $
jifty
schema
‐‐setup • Jifty
version
0.605070
up
to
date. INFO
‐
Generating
SQL
to
upgrade
Doxory 






v0.0.2
database
to
v0.0.5 INFO
‐
Upgraded
to
version
v0.0.5 • $
jifty
server • INFO
‐
You
can
connect
to
your
server
at 






http://localhost:8888/ 143
  405. 405. ⇛ 144
  406. 406. Action
=
APIs 145
  407. 407. Action
=
APIs ⇛ Method
Calls 145
  408. 408. Action
=
APIs ⇛ Method
Calls ⇛ Typed
named
arguments 145
  409. 409. Action
=
APIs ⇛ Method
Calls ⇛ Typed
named
arguments ⇛ Returns
results
or
errors 145
  410. 410. Action
≠
URLs 146
  411. 411. Action
≠
URLs ⇛ Many
actions
on
one
page 146
  412. 412. Action
≠
URLs ⇛ Many
actions
on
one
page ⇛ Called
with
web
forms 146
  413. 413. Action
≠
URLs ⇛ Many
actions
on
one
page ⇛ Called
with
web
forms ⇛ Sounds
like
RPC? 146
  414. 414. Action
=
RPC 147
  415. 415. Action
=
RPC ⇛ Web
form
encoding 147
  416. 416. Action
=
RPC ⇛ Web
form
encoding ⇛ XML/YAML
encoding 147
  417. 417. Action
=
RPC ⇛ Web
form
encoding ⇛ XML/YAML
encoding ⇛ Web
services
for
free! 147
  418. 418. Model
⇛
Action 148
  419. 419. Model
⇛
Action ⇛ Doxory::Action::CreateUser 148
  420. 420. Model
⇛
Action ⇛ Doxory::Action::CreateUser ⇛ Doxory::Action::SearchUser 148
  421. 421. Model
⇛
Action ⇛ Doxory::Action::CreateUser ⇛ Doxory::Action::SearchUser ⇛ Doxory::Action::UpdateUser 148
  422. 422. Model
⇛
Action ⇛ Doxory::Action::CreateUser ⇛ Doxory::Action::SearchUser ⇛ Doxory::Action::UpdateUser ⇛ Doxory::Action::DeleteUser 148
  423. 423. Make
your
own
Actions 149
  424. 424. 150
  425. 425. • package
Hello::Action::SayHi; use
Jifty::Param::Schema; use
Jifty::Action
schema
{ 
 param
name
=> 


label
is
'Your
name?'; 
 }; 150
  426. 426. • package
Hello::Action::SayHi; use
Jifty::Param::Schema; use
Jifty::Action
schema
{ 
 param
name
=> 


label
is
'Your
name?'; 
 }; • sub
take_action
{ 


my
$self
=
shift; 


my
$name
=
$self‐>argument_value('name'); 


$self‐>result‐>message(
"Hello,
$name"
); } 150
  427. 427. 151
  428. 428. • <%init> my
$action
=
Jifty‐>web‐>new_action( 



class
=>
'SayHi' ); </%init> 151
  429. 429. • <%init> my
$action
=
Jifty‐>web‐>new_action( 



class
=>
'SayHi' ); </%init> • <&|/_elements/wrapper&> <%
Jifty‐>web‐>form‐>start
%> <%
$action‐>form_field('name')
%> <%
Jifty‐>web‐>form‐>submit
%> <%
Jifty‐>web‐>form‐>end
%> </&> 151
  430. 430. • <%init> my
$action
=
Jifty‐>web‐>new_action( 



class
=>
'SayHi' ); </%init> • <&|/_elements/wrapper&> <%
Jifty‐>web‐>form‐>start
%> <%
$action‐>form_field('name')
%> <%
Jifty‐>web‐>form‐>submit
%> <%
Jifty‐>web‐>form‐>end
%> </&> 151
  431. 431. • <%init> my
$action
=
Jifty‐>web‐>new_action( 



class
=>
'SayHi' ); </%init> • <&|/_elements/wrapper&> <%
Jifty‐>web‐>form‐>start
%> <%
$action‐>form_field('name')
%> <%
Jifty‐>web‐>form‐>submit
%> <%
Jifty‐>web‐>form‐>end
%> </&> 151
  432. 432. 152
  433. 433. • $
curl
 

http://localhost:8888/__jifty/webservices/yaml? 

J:A‐1=SayHi;J:A:F‐name‐1=Jesse 152
  434. 434. • $
curl
 

http://localhost:8888/__jifty/webservices/yaml? 

J:A‐1=SayHi;J:A:F‐name‐1=Jesse • 1:
!!perl/hash:Jifty::Result 

_content:
{} 

action_class:
Hello::Action::SayHi 

failure:
0 

field_errors: 



name:
~ 

field_warnings: 



name:
~ 

message:
'Hello,
Jesse' 152
  435. 435. ☸ 153
  436. 436. Jifty::Dispatcher 154
  437. 437. Dispatcher
=
Kernel 155
  438. 438. Dispatcher
=
Kernel ☸ Simple 155
  439. 439. Dispatcher
=
Kernel ☸ Simple ☸ Declarative 155
  440. 440. Dispatcher
=
Kernel ☸ Simple ☸ Declarative ☸ Encapsulates
view
logic 155
  441. 441. Three
Stages 156
  442. 442. Three
Stages ☸ Before:
Sets
up
state 156
  443. 443. Three
Stages ☸ Before:
Sets
up
state ☸ On:
Shows
your
pages 156
  444. 444. Three
Stages ☸ Before:
Sets
up
state ☸ On:
Shows
your
pages ☸ After:
Cleans
up
state 156
  445. 445. Jifty::ClassLoader 157
  446. 446. Scaffolding
Bad 158
  447. 447. Scaffolding
Bad ☸ Ugly 158
  448. 448. Scaffolding
Bad ☸ Ugly ☸ Redundant 158
  449. 449. Scaffolding
Bad ☸ Ugly ☸ Redundant ☸ Fragile 158
  450. 450. Scaffolding
Bad ☸ Ugly ☸ Annoying ☸ Redundant ☸ Fragile 158
  451. 451. Scaffolding
Bad ☸ Ugly ☸ Annoying ☸ Redundant ☸ Redundant ☸ Fragile 158
  452. 452. Scaffolding
Bad ☸ Ugly ☸ Annoying ☸ Redundant ☸ Redundant ☸ Fragile ☸ Redundant 158
  453. 453. Why
Empty
Classes? 159
  454. 454. Why
Empty
Classes? ☸ Jifty::ClassLoader 159
  455. 455. Why
Empty
Classes? ☸ Jifty::ClassLoader ☸ Auto‐creates
classes 159
  456. 456. Why
Empty
Classes? ☸ Jifty::ClassLoader ☸ Auto‐creates
classes ☸ Never
writes
them
to
disk 159
  457. 457. Auto‐created
Classes
 160
  458. 458. Auto‐created
Classes
 ☸ Doxory 160
  459. 459. Auto‐created
Classes
 ☸ Doxory ☸ Doxory::Record 160
  460. 460. Auto‐created
Classes
 ☸ Doxory ☸ Doxory::Record ☸ Doxory::Collection 160
  461. 461. Auto‐created
Classes
 ☸ Doxory ☸ Doxory::Record ☸ Doxory::Collection ☸ Doxory::Bootstrap 160
  462. 462. Auto‐created
Classes
 ☸ Doxory ☸ Doxory::Record ☸ Doxory::Collection ☸ Doxory::Bootstrap ☸ Doxory::Upgrade 160
  463. 463. Auto‐created
Classes
 ☸ Doxory ☸ Doxory::Record ☸ Doxory::Collection ☸ Doxory::Bootstrap ☸ Doxory::Upgrade ☸ Doxory::Dispatcher 160
  464. 464. Auto‐created
Classes
 ☸ Doxory ☸ Doxory::Record ☸ Doxory::Collection ☸ Doxory::Bootstrap ☸ Doxory::Upgrade ☸ Doxory::Dispatcher ☸ Doxory::CurrentUser 160
  465. 465. Auto‐created
Classes
 ☸ Doxory ☸ Doxory::Model::UserCollecti on ☸ Doxory::Record ☸ Doxory::Collection ☸ Doxory::Bootstrap ☸ Doxory::Upgrade ☸ Doxory::Dispatcher ☸ Doxory::CurrentUser 160
  466. 466. Auto‐created
Classes
 ☸ Doxory ☸ Doxory::Model::UserCollecti on ☸ Doxory::Record ☸ Doxory::Action::CreateUser ☸ Doxory::Collection ☸ Doxory::Bootstrap ☸ Doxory::Upgrade ☸ Doxory::Dispatcher ☸ Doxory::CurrentUser 160
  467. 467. Auto‐created
Classes
 ☸ Doxory ☸ Doxory::Model::UserCollecti on ☸ Doxory::Record ☸ Doxory::Action::CreateUser ☸ Doxory::Collection ☸ Doxory::Action::SearchUser ☸ Doxory::Bootstrap ☸ Doxory::Upgrade ☸ Doxory::Dispatcher ☸ Doxory::CurrentUser 160
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×