-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathEARLY_NOTES
90 lines (55 loc) · 3.03 KB
/
EARLY_NOTES
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
RANDOM NOTES
============
There is an example application in the eg/ directory
called "Example".
This is how you currently run this squatting application:
cd eg/
squatting Example
(Example.pm needs to be discoverable through @INC.)
- -*- -
If you're familiar w/ the Camping API,
the Squatting API will feel similar.
- -*- -
Example::Controllers is the package that contains all the controllers.
- -*- -
Controllers are objects (not classes)
that are constructed using the C() function.
- -*- -
Controllers represent HTTP Resources
that support HTTP Methods
like GET and POST with
the object methods
get and post.
This was the genius of Camping.
I can't think of a better way to
express RESTful controllers.
- -*- -
Example::Views is the package that contains all the views.
- -*- -
Views are also objects (not classes)
that are constructed using the V() function.
- -*- -
The methods of a view are thought of as templates.
- -*- -
The responsibility of a template is to
1) take a hashref of variables and
2) return a string.
You may use any templating system you want,
or even none at all.
- -*- -
You may define a layout template called 'layout'
which will be used to wrap the content of any other template.
If you don't want your template to be wrapped, you have
to give it a name with a '_' in front.
- -*- -
You may define a generic template called '_' for use when
a specific template can't be found.
- -*- -
You may have multiple views.
- -*- -
The first view you define is your default view.
- -*- -
The optional 2nd parameter to the render() method
lets you specify which view you want to use. For example,
$self->render('profile', 'json')
would render the 'profile' template using the 'json' view.