SlideShare une entreprise Scribd logo
1  sur  505
Télécharger pour lire hors ligne
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/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
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/




                                             23
!




    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




                                         25
• $
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
•   package
Doxory::Model::User;
•   use
Jifty::DBI::Schema;
•   

•   use
Doxory::Record
schema
{
•   





•   

•   };


                                   26
•   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
28
•   $
jifty
schema
‐‐setup




                             28
•   $
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
•   $
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
•   $
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
•   $
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
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




                                          35
$
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
•   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
37
•   $
jifty
schema
‐‐drop‐database
‐‐setup




                                             37
•   $
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
•   $
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
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:
{}
•



‐
CompressedCSSandJS:
{}
•

•

•
                                46
•‐‐‐
•framework:
•

Plugins:
•



‐
SkeletonApp:
{}
•



‐
REST:
{}
•



‐
Halo:
{}
•



‐
ErrorTemplates:
{}
•



‐
CompressedCSSandJS:
{}
•



‐
Authentication::Password:
{}
•

SkipAccessControl:
1
•
                                      47
•‐‐‐
•framework:
•

Plugins:
•



‐
SkeletonApp:
{}
•



‐
REST:
{}
•



‐
Halo:
{}
•



‐
ErrorTemplates:
{}
•



‐
CompressedCSSandJS:
{}
•



‐
Authentication::Password:
{}
•

SkipAccessControl:
1
•
                
(ACL).


                                      47
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
=>
•   



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
•   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
51
51
52
52
53
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
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
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_user‐>id)
{




                                              58
•   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
•   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
•   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
•   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
•   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
59

“/”
   .




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



                            60
•$
vim
lib/Doxory/View.pm        



                              TT2
     !
                            
Mason
        !




                                               60
61
•   package
Doxory::View;
    use
Jifty::View::Declare
‐base;




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



h1
{
'Ask
a
question!'
}




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



h1
{
'Ask
a
question!'
}
•   



show
'new_choice';




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



h1
{
'Ask
a
question!'
}
•   



show
'new_choice';
•   };




                                      61
•   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
•   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
•   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
•   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
•   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
•   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
62
62
63
column
a
=>




label
is
'On
the
one
hand',




render
as
'textarea',




is
mandatory;




                                  63
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_choice
=>
sub
{
...
};




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

•   template
'/'
=>
page
{
...
};
    private
template
new_choice
=>
sub
{
...
};

•   template
choices
=>
page
{




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

•   template
'/'
=>
page
{
...
};
    private
template
new_choice
=>
sub
{
...
};

•   template
choices
=>
page
{
•   



h1
{
'My
Choices'
}
    



dl
{




                                                  67
•   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
•   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
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




                                         70
• $
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
•   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
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_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
•   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
•   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
•$
vim
lib/Doxory/View.pm



                            77
78
•   package
Doxory::View;




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

    template
''
=>
page
{
...
};
    private
template
choices
=>
sub
{
...
};




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

    template
''
=>
page
{
...
};
    private
template
choices
=>
sub
{
...
};

•   template
pick
=>
page
{




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

    template
''
=>
page
{
...
};
    private
template
choices
=>
sub
{
...
};

•   template
pick
=>
page
{
•   



my
$choice
=
get('choice');




                                               78
•   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
•   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
•   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
•   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
•   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
•   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
•   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
79
•   package
Doxory::View;
    use
Jifty::View::Declare
‐base;

    template
''
=>
page
{
...
};
    private
template
new_choice
=>
sub
{
...
};
    template
choices
=>
page
{
...
};
    template
pick
=>
page
{
...
};




                                                  79
•   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
•   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
•   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
•   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
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_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
•$
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
Choices'
}




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



h1
{
'My
Choices'
}
•   



dl
{




                                      86
•   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
•   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
•   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
•   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
•   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
•   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
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



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


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


                             88
☈   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)
=
@_;




                                       92
• 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
• 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
93

(Validator)




               94

(Validator)

☈




                   94

(Validator)

☈
☈


                   94

(Validator)

☈
☈
☈        !


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

• sub
canonicalize_name
{
• 


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


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


return
$name;
•}



                                                    95
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_user‐>id)
{
•   







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

•   







$top‐>child(


'Pick!'

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







$top‐>child(


'Choices'

=>
url
=>
'/choices'
);

•   



}
•   



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







tangent
'login';
    



}
•   };

•   ...



                                                                100
•   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
•$
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
=>
•   



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
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
•   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
•$
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!')
}
•   



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
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
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
.
•   $
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
.
•   $
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
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
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
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




                                                         112

Encode::HanConvert
      .

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




                                                         112

Encode::HanConvert
         .

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




                                                         112
•‐‐‐
•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!
                          125

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';




                                      139
•   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
•   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
•   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
•   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
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)

  doesn't
match
application
schema
version
(0.0.2)
  Please
run
`bin/jifty
schema
‐‐setup`
to
upgrade

  the
database.




                                                      141
• $
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
• $
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
• $
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
• $
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
142
• column
tags
=>
  


since
'0.0.3',
  


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




                                                         142
• 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
• 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
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
‐
Generating
SQL
to
upgrade
Doxory
  






v0.0.2
database
to
v0.0.5
  INFO
‐
Upgraded
to
version
v0.0.5




                                            143
• $
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
• $
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
⇛
    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


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

                               148
Make
your
own
Actions




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

  param
name
=>
  


label
is
'Your
name?';
  

  };




                                  150
• 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
151
•   <%init>
    my
$action
=
Jifty‐>web‐>new_action(
    



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




                                           151
•   <%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
•   <%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
•   <%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
152
• $
curl

  

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

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




                                                   152
• $
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
☸   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




                           160
Auto‐created
Classes

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




                           160
Auto‐created
Classes

☸ Doxory
☸ Doxory::Record
☸ Doxory::Collection
☸ Doxory::Bootstrap
☸ Doxory::Upgrade
☸ Doxory::Dispatcher
☸ Doxory::CurrentUser




                           160
Auto‐created
Classes

☸ Doxory                ☸ Doxory::Model::UserCollecti
                          on
☸ Doxory::Record
☸ Doxory::Collection
☸ Doxory::Bootstrap
☸ Doxory::Upgrade
☸ Doxory::Dispatcher
☸ Doxory::CurrentUser




                                                        160
Auto‐created
Classes

☸ Doxory                ☸ Doxory::Model::UserCollecti
                          on
☸ Doxory::Record
                        ☸ Doxory::Action::CreateUser
☸ Doxory::Collection
☸ Doxory::Bootstrap
☸ Doxory::Upgrade
☸ Doxory::Dispatcher
☸ Doxory::CurrentUser




                                                        160
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
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

Contenu connexe

Tendances

Consulta.consepto cristianandres fajardofandiño
Consulta.consepto cristianandres fajardofandiñoConsulta.consepto cristianandres fajardofandiño
Consulta.consepto cristianandres fajardofandiñochristiamandrees
 
Uso da TC nas Fraturas Faciais.
Uso da TC nas Fraturas Faciais.Uso da TC nas Fraturas Faciais.
Uso da TC nas Fraturas Faciais.LABMF -PE
 
Hr Marketing- Cuando Ellos Deciden
Hr Marketing- Cuando Ellos DecidenHr Marketing- Cuando Ellos Deciden
Hr Marketing- Cuando Ellos DecidenChristian Palau
 
대전개발자컨퍼런스 하이버네이트 발표자료 최범균
대전개발자컨퍼런스 하이버네이트 발표자료 최범균대전개발자컨퍼런스 하이버네이트 발표자료 최범균
대전개발자컨퍼런스 하이버네이트 발표자료 최범균beom kyun choi
 
Eduketing 2012. Comunicacion off y on line - Josep l. Segú
Eduketing 2012. Comunicacion off y on line - Josep l. SegúEduketing 2012. Comunicacion off y on line - Josep l. Segú
Eduketing 2012. Comunicacion off y on line - Josep l. SegúEDUKETING
 
Написание DSL в Perl
Написание DSL в PerlНаписание DSL в Perl
Написание DSL в Perlmayperl
 
HCI, 2005 Las Vegas
HCI, 2005 Las VegasHCI, 2005 Las Vegas
HCI, 2005 Las VegasIlkka Kakko
 
20081009 작업공수표
20081009 작업공수표20081009 작업공수표
20081009 작업공수표guest72f9872
 

Tendances (13)

Consulta.consepto cristianandres fajardofandiño
Consulta.consepto cristianandres fajardofandiñoConsulta.consepto cristianandres fajardofandiño
Consulta.consepto cristianandres fajardofandiño
 
Uso da TC nas Fraturas Faciais.
Uso da TC nas Fraturas Faciais.Uso da TC nas Fraturas Faciais.
Uso da TC nas Fraturas Faciais.
 
Fluxo caixa do igor
Fluxo caixa do igorFluxo caixa do igor
Fluxo caixa do igor
 
Hr Marketing- Cuando Ellos Deciden
Hr Marketing- Cuando Ellos DecidenHr Marketing- Cuando Ellos Deciden
Hr Marketing- Cuando Ellos Deciden
 
1payegam
1payegam1payegam
1payegam
 
www.markhoogeveen.com
www.markhoogeveen.comwww.markhoogeveen.com
www.markhoogeveen.com
 
대전개발자컨퍼런스 하이버네이트 발표자료 최범균
대전개발자컨퍼런스 하이버네이트 발표자료 최범균대전개발자컨퍼런스 하이버네이트 발표자료 최범균
대전개발자컨퍼런스 하이버네이트 발표자료 최범균
 
áêïëïõèéá áãéáó ìáñéíçó (äéïñè)
áêïëïõèéá áãéáó ìáñéíçó (äéïñè)áêïëïõèéá áãéáó ìáñéíçó (äéïñè)
áêïëïõèéá áãéáó ìáñéíçó (äéïñè)
 
Calendario cimat2012
Calendario cimat2012Calendario cimat2012
Calendario cimat2012
 
Eduketing 2012. Comunicacion off y on line - Josep l. Segú
Eduketing 2012. Comunicacion off y on line - Josep l. SegúEduketing 2012. Comunicacion off y on line - Josep l. Segú
Eduketing 2012. Comunicacion off y on line - Josep l. Segú
 
Написание DSL в Perl
Написание DSL в PerlНаписание DSL в Perl
Написание DSL в Perl
 
HCI, 2005 Las Vegas
HCI, 2005 Las VegasHCI, 2005 Las Vegas
HCI, 2005 Las Vegas
 
20081009 작업공수표
20081009 작업공수표20081009 작업공수표
20081009 작업공수표
 

Jifty

  • 1. Jifty 1
  • 2. 2
  • 5. 2007/04/01 ⚁ 
YAPC::Asia
 ⚁ 3
  • 6. 2007/04/01 ⚁ 
YAPC::Asia
 ⚁ :
 ! ⚁ 3
  • 10. 5
  • 11. 5
  • 12. ? ⚁ 5
  • 13. ? ⚁ :
 ! ⚁ 5
  • 14. 6
  • 15. 7
  • 16. 7
  • 17. 8
  • 18. 9
  • 19. 9
  • 21. ⚁ ⚁ ,
 ! ⚁ 9
  • 22. Pick! 10
  • 23. Pick! “ ” 10
  • 24. Pick! 11
  • 25. Pick! 11
  • 26. Pick! 12
  • 27. Pick! 12
  • 28. Pick! 13
  • 29. Pick! 13
  • 30. Pick! 14
  • 31. ... 15
  • 32. ... ! 16
  • 33. 17
  • 34. Jifty 18
  • 35. Jifty 18
  • 37. Jifty 
=
 
=
 18
  • 42. 20
  • 46. 21
  • 47. $
jifty
app
‐‐name
Doxory 21
  • 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. 22
  • 53. 23
  • 56. ! 24
  • 57. ! 
Doxory. 

(Users)
 ? 24
  • 58. 25
  • 61. • $
cd
Doxory • $
jifty
model
‐‐name
User • Writing
file
t/00‐model‐User.t Writing
file
lib/Doxory/Model/User.pm 25
  • 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. package
Doxory::Model::User; • use
Jifty::DBI::Schema; • 
 • use
Doxory::Record
schema
{ • 
 • 
 • }; 26
  • 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. 28
  • 66. $
jifty
schema
‐‐setup 28
  • 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. $
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. $
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. $
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. 29
  • 72. 29
  • 73. 30
  • 74. 30
  • 75. 31
  • 76. 31
  • 77. 32
  • 78. 32
  • 79. 33
  • 80. AudreyT 33
  • 81. AudreyT 33
  • 82. 34
  • 84. 35
  • 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. 37
  • 90. $
jifty
schema
‐‐drop‐database
‐‐setup 37
  • 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. $
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. 38
  • 94. 38
  • 95. 39
  • 96. 39
  • 97. 40
  • 98. 40
  • 99. 41
  • 100. 41
  • 101. 42
  • 102. 42
  • 103. 43
  • 104. ! ... ? 43
  • 105. 44
  • 106. 45
  • 112. 48
  • 114. •$
vim
lib/Doxory/Model/User.pm 
User.pm
 
mixin. 48
  • 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. 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. 51
  • 118. 51
  • 119. 52
  • 120. 52
  • 121. 53
  • 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. 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. 54
  • 125. 54
  • 126. 55
  • 127. ... ( ?) 55
  • 128. 56
  • 129. 57
  • 131. •$
vim
lib/Doxory/Dispatcher.pm Dispatcher
 
(View). 57
  • 132. 58
  • 133. package
Doxory::Dispatcher; use
Jifty::Dispatcher
‐base; 58
  • 134. package
Doxory::Dispatcher; use
Jifty::Dispatcher
‐base; • before
'*'
=>
run
{ 



if
(Jifty‐>web‐>current_user‐>id)
{ 58
  • 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. 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. 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. 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. 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. 59
  • 142. 60
  • 144. •$
vim
lib/Doxory/View.pm 


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



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



h1
{
'Ask
a
question!'
} • 



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



h1
{
'Ask
a
question!'
} • 



show
'new_choice'; • }; 61
  • 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. 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. 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. 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. 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. 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. 62
  • 157. 62
  • 158. 63
  • 160. 64
  • 161. 64
  • 162. 65
  • 165. 67
  • 166. package
Doxory::View; use
Jifty::View::Declare
‐base; 67
  • 167. package
Doxory::View; use
Jifty::View::Declare
‐base; • template
'/'
=>
page
{
...
}; private
template
new_choice
=>
sub
{
...
}; 67
  • 168. package
Doxory::View; use
Jifty::View::Declare
‐base; • template
'/'
=>
page
{
...
}; private
template
new_choice
=>
sub
{
...
}; • template
choices
=>
page
{ 67
  • 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. 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. 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. 68
  • 173. ...
 ?
 68
  • 174. 69
  • 175. 70
  • 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. 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. 72
  • 181. 72
  • 182. 73
  • 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. 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. 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
  • 190. 78
  • 191. package
Doxory::View; 78
  • 192. package
Doxory::View; • use
Jifty::View::Declare
‐base; template
''
=>
page
{
...
}; private
template
choices
=>
sub
{
...
}; 78
  • 193. package
Doxory::View; • use
Jifty::View::Declare
‐base; template
''
=>
page
{
...
}; private
template
choices
=>
sub
{
...
}; • template
pick
=>
page
{ 78
  • 194. package
Doxory::View; • use
Jifty::View::Declare
‐base; template
''
=>
page
{
...
}; private
template
choices
=>
sub
{
...
}; • template
pick
=>
page
{ • 



my
$choice
=
get('choice'); 78
  • 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. 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. 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. 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. 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. 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. 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. 79
  • 203. package
Doxory::View; use
Jifty::View::Declare
‐base; template
''
=>
page
{
...
}; private
template
new_choice
=>
sub
{
...
}; template
choices
=>
page
{
...
}; template
pick
=>
page
{
...
}; 79
  • 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. 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. 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. 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. 80
  • 209. 81
  • 210. 81
  • 211. 82
  • 212. 
choices
 , . 82
  • 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
  • 216. 86
  • 217. 86
  • 218. package
Doxory::View; use
Jifty::View::Declare
‐base; ... 86
  • 219. package
Doxory::View; use
Jifty::View::Declare
‐base; ... • template
choices
=>
page
{ 



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



h1
{
'My
Choices'
} • 



dl
{ 86
  • 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. 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. 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. 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. 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. 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. 87
  • 228. :
 .
☺ 87
  • 229. ! 88
  • 236. 89
  • 237. 90
  • 238. Doxory
 90
  • 239. Doxory
 ☈ 90
  • 240. Doxory
 ☈ ☈ ... 90
  • 241. Doxory
 91
  • 243. Doxory
 ☈ ! ☈ 91
  • 244. Doxory
 ☈ ! ☈ ☈ vim
lib/Doxory/Model/Choice.pm 91
  • 245. 92
  • 248. • package
Doxory::Model::Choice; • use
Regexp::Common
'profanity_us'; • sub
validate_name
{ 


my
($self,
$name)
=
@_; 92
  • 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. • 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. 93
  • 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. 96
  • 259. 
(Canonicalizer) ☈ 
Model
 97
  • 260. 
(Canonicalizer) ☈ 
Model
 ☈ 
(Autocompleter)
 97
  • 261. 
(Canonicalizer) ☈ 
Model
 ☈ 
(Autocompleter)
 ☈ :
 
Doxory 97
  • 262. 98
  • 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. 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
  • 268. •$
vim
lib/Doxory/Model/*.pm 
label,
hints
 . 102
  • 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
  • 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
  • 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. 108
  • 276. $
jifty
po
‐‐language
zh_tw 108
  • 277. . • $
jifty
po
‐‐language
zh_tw 108
  • 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. . • $
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. . • $
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. 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. 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. 111
  • 284. ... 111
  • 285. 112
  • 287. 
Encode::HanConvert
 . • $
b2g.pl
‐p
‐u
share/po/zh_tw.po
>
share/po/zh_cn.po 112
  • 288. 
Encode::HanConvert
 . • $
b2g.pl
‐p
‐u
share/po/zh_tw.po
>
share/po/zh_cn.po • $
vim
etc/config.yml 112
  • 289. 
Encode::HanConvert
 . • $
b2g.pl
‐p
‐u
share/po/zh_tw.po
>
share/po/zh_cn.po • $
vim
etc/config.yml . 强 设 112
  • 292. 115
  • 293. ! 国际 115
  • 294. 116
  • 295. 117
  • 296. 
HTTP
 117
  • 298. 
HTTP
 Module::Install 
PAR
 117
  • 299. 
(Halo) 118
  • 300. 
(Halo) 118
  • 301. 
(Halo) 118
  • 302. 
(Halo) ... ! 118
  • 303. Halo 119
  • 304. Halo SQL
 119
  • 312. 121
  • 316. ... 122
  • 319. ... 
I18N
 
Session 
(Event)
 122
  • 320. 123
  • 321. 124
  • 324. ✈ Wiki
UI
 ✈ ,
 ✈ ,
 ,
MTV... 124
  • 325. 125
  • 326. ✈ Wifty 125
  • 329. ✈ Ping
 ✈ Wifty ✈ CommitBit ✈ BabelBee 125
  • 330. ✈ Ping
 ✈ Wifty ✈ Chat ✈ CommitBit ✈ BabelBee 125
  • 331. ✈ Ping
 ✈ Wifty ✈ Chat ✈ CommitBit ✈ Clock ✈ BabelBee 125
  • 332. ✈ Ping
 ✈ Wifty ✈ Chat ✈ CommitBit ✈ Clock ✈ BabelBee ✈ Doxory! 125
  • 333. 
Jifty 126
  • 337. 127
  • 341. fin. 128
  • 343. 130
  • 352. 133
  • 353. Jifty::DBI 134
  • 360. Object
Relational
Mapper ∅ SELECT ∅ UPDATE ∅ INSERT 135
  • 361. Object
Relational
Mapper ∅ SELECT ∅ UPDATE ∅ INSERT ∅ DELETE 135
  • 365. Jifty::DBI::Handle ䷗ SQLite ䷗ MySQL ䷗ Postgres 136
  • 366. Jifty::DBI::Handle ䷗ SQLite ䷗ MySQL ䷗ Postgres ䷗ Oracle 136
  • 375. 139
  • 376. package
Doxory::Model::Comment; use
Jifty::DBI::Schema; use
Doxory::Record
schema
{ since
'0.0.2'; 139
  • 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. 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. 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. 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
  • 385. 141
  • 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. • $
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. • $
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. • $
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. • $
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. 142
  • 395. • column
tags
=> 


since
'0.0.3', 


refers
to
Doxory::Model::TagCollection
by
'User'; 142
  • 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. • 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. 143
  • 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. • $
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. • $
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. 144
  • 422. Model
⇛
Action ⇛ Doxory::Action::CreateUser ⇛ Doxory::Action::SearchUser ⇛ Doxory::Action::UpdateUser ⇛ Doxory::Action::DeleteUser 148
  • 424. 150
  • 425. • package
Hello::Action::SayHi; use
Jifty::Param::Schema; use
Jifty::Action
schema
{ 
 param
name
=> 


label
is
'Your
name?'; 
 }; 150
  • 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. 151
  • 428. <%init> my
$action
=
Jifty‐>web‐>new_action( 



class
=>
'SayHi' ); </%init> 151
  • 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. <%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. <%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. 152
  • 433. • $
curl
 

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

J:A‐1=SayHi;J:A:F‐name‐1=Jesse 152
  • 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. 153
  • 450. Scaffolding
Bad ☸ Ugly ☸ Annoying ☸ Redundant ☸ Fragile 158
  • 451. Scaffolding
Bad ☸ Ugly ☸ Annoying ☸ Redundant ☸ Redundant ☸ Fragile 158
  • 452. Scaffolding
Bad ☸ Ugly ☸ Annoying ☸ Redundant ☸ Redundant ☸ Fragile ☸ Redundant 158
  • 461. Auto‐created
Classes
 ☸ Doxory ☸ Doxory::Record ☸ Doxory::Collection ☸ Doxory::Bootstrap 160
  • 462. Auto‐created
Classes
 ☸ Doxory ☸ Doxory::Record ☸ Doxory::Collection ☸ Doxory::Bootstrap ☸ Doxory::Upgrade 160
  • 463. Auto‐created
Classes
 ☸ Doxory ☸ Doxory::Record ☸ Doxory::Collection ☸ Doxory::Bootstrap ☸ Doxory::Upgrade ☸ Doxory::Dispatcher 160
  • 464. Auto‐created
Classes
 ☸ Doxory ☸ Doxory::Record ☸ Doxory::Collection ☸ Doxory::Bootstrap ☸ Doxory::Upgrade ☸ Doxory::Dispatcher ☸ Doxory::CurrentUser 160
  • 465. Auto‐created
Classes
 ☸ Doxory ☸ Doxory::Model::UserCollecti on ☸ Doxory::Record ☸ Doxory::Collection ☸ Doxory::Bootstrap ☸ Doxory::Upgrade ☸ Doxory::Dispatcher ☸ Doxory::CurrentUser 160
  • 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. 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