Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 197 lines (142 sloc) 8.547 kB
8c82f36 @kthakore Out line for CPAN added
kthakore authored
1 =head0 CPAN
18bc16f @kthakore Initial Commit
kthakore authored
2
56722d2 @kthakore Intro blurb for CPAN chapter
kthakore authored
3 The Comprehensive Perl Archive Network (CPAN) is the other part of the Perl language. By now most Perl developers should be aware of how to search and get modules from CPAN. This chapter will focus on why to use CPAN for games. Next we will take a look in what domain (Model, View or Controller) does a module solve a problem for. Moreover we would want to look at what is criteria to pick one module from another, using the many tools provided by CPAN.
18bc16f @kthakore Initial Commit
kthakore authored
4
8c82f36 @kthakore Out line for CPAN added
kthakore authored
5 =head1 Modules
18bc16f @kthakore Initial Commit
kthakore authored
6
8c82f36 @kthakore Out line for CPAN added
kthakore authored
7 It is good to reuse code.
18bc16f @kthakore Initial Commit
kthakore authored
8
8c82f36 @kthakore Out line for CPAN added
kthakore authored
9 =head2 MVC Method
18bc16f @kthakore Initial Commit
kthakore authored
10
8c82f36 @kthakore Out line for CPAN added
kthakore authored
11 See where the module fits, Model, View or Controller
18bc16f @kthakore Initial Commit
kthakore authored
12
8c82f36 @kthakore Out line for CPAN added
kthakore authored
13 =head3 View
14
15 SDL will do most but helper module (Clipboard) are cool to have.
16
17 =head3 Model
18
19 Storable for games that need to store stuff
20
21 =head3 Controller
22
23 Game::Life, make some of the games in SDL!
24
25 =head1 Picking Modules
26
0b1aefe @garu CPAN chapter: finding the right module
garu authored
27 So, you thought of a nice game, identified your needs, typed some
28 keywords in L<http://seach.cpan.org>, and got tons of results. What now?
29 How to avoid vaporware and find the perfect solution for your needs?
30
31 =head2 Documentation
32
33 Once you find a potential module for your application, make sure you
34 will know how to use it. Take a look at the SYNOPSIS section of the
35 module, it should contain some code snippets showing you how to use
36 the module's main features. Are you comfortable with the usage syntax?
37 Does it seem to do what you expect it to? Will it fit nicely to whatever
38 it is you're coding?
39
40 Next, skim through the rest of the documentation. Is it solid enough
41 for you? Does it look complete enough for your needs, or is it
42 easily extendable?
43
44 =head2 License
45
46 It's useless to find a module you can't legally use. Most (if not all)
47 modules in L<CPAN|http://search.cpan.org> are free and open source
48 software, but even so each needs a license telling developers what
49 they can and cannot do with it. A lot of CPAN modules are released
50 I<"under the same terms as Perl itself">, and this means you can
51 pick between the Artistic License or the GPL (version 1).
52
53 Below is a short and incomplete list of some popular license choices
54 by CPAN developers:
55
56 =over 4
57
58 =item * Artistic License - L<http://dev.perl.org/licenses/artistic.html>
59
60 =item * GPL (all versions and variations) - L<http://www.gnu.org/licenses>
61
62 =item * MIT License - L<http://www.opensource.org/licenses/mit-license.php>
63
64 =back
65
66 See L<http://www.opensource.org/licenses/alphabetical> for a
67 comprehensive list with each license's full documentation.
68
69 You should be able to find the module's license by going to a
70 "LICENSE AND COPYRIGHT" section, usually available at the bottom of the
71 documentation, or by looking for a license file inside that distribution.
72
73 B<Note:> Some modules might even be released into CPAN as
74 I<< public domain >>, meaning they are not covered by intellectual
75 property rights at all, and you are free to use them as you see fit.
76 Even so, it's usually considered polite to mention authors as a courtesy,
77 you know, giving credit where credit is due.
78
79
80 =head2 Ratings
81
82 The CPAN Ratings is a service where developers rate modules they
83 used for their own projects, and is a great way to have some actual
84 feedback on how it was to use the code on a real application. The
85 ratings are compiled into a 1 to 5 grade, and displayed below the
86 module name on CPAN. You can click on the I<< "Reviews" >> link right
87 next to the rating stars to see any additional comments by the
88 reviewers, praising, criticizing or giving some additional comments
89 or the distribution and/or its competition.
90
8c82f36 @kthakore Out line for CPAN added
kthakore authored
91
92 =head2 Dependencies
93
0b1aefe @garu CPAN chapter: finding the right module
garu authored
94 Modules exist so you don't have to reinvent the wheel, and for that same
95 reason each usually depends on one or more modules itself. Don't worry
96 if a module depends on several others - code reusability is a good
97 thing.
98
99 You may, however, be interested in B<which> modules it depends on,
100 or, more practically, in the likelihood of a clean installation by your
101 users. For that, you can browse to L<http://deps.cpantesters.org> and
102 input the module's name on the search box.
103
104 The CPAN Testers is a collaborative matrix designed to help developers
105 test their modules in several different platforms, with over a hundred
106 testers each month making more than 3 million reports of CPAN modules.
107 This particular CPAN Testers service will show you a list of
108 dependencies and test results for each of them, calculating the average
109 chance of all tests passing (for any platform).
110
111 While seeing all the dependencies and test results of a couple of modules
112 that do the same thing might help you make your pick, it's important to
113 realize that the I<< "chance of all tests passing" >> information at
114 the bottom of the results means very little. This is because test
115 failures can rarely be considered independent events, and are usually
116 tied to not running on a specific type of operating system, to the perl
117 version, or even due to the tester running out of memory for reasons
118 that may not even concern the module being evaluated. If you don't care
119 about your application running on AIX or on perl 5.6.0, why would you
120 dismiss a module that only fails on those conditions?
8c82f36 @kthakore Out line for CPAN added
kthakore authored
121
122
0b1aefe @garu CPAN chapter: finding the right module
garu authored
123 =head2 CPAN Testers Charts
8c82f36 @kthakore Out line for CPAN added
kthakore authored
124
0b1aefe @garu CPAN chapter: finding the right module
garu authored
125 So, how do you know the actual test results for a module on the CPAN? How
126 can you tell if that module will run in your target machine according to
127 architecture, operating system and perl version?
128
129 The CPAN Testers website at L<http://www.cpantesters.org> offers a direct
130 search for distributions by name or author. To see the results for the
131 SDL module, for instance, you can go to
132 L<http://www.cpantesters.org/distro/S/SDL.html>. You can also find a
133 test report summary directly on CPAN, by selecting the distribution
134 and looking at the I<< "CPAN Testers" >> line. If you click on the
135 I<< "View Reports" >> link, you'll be redirected to the proper CPAN
136 Testers page, like the one shown above.
137
138 The first chart is a PASS summary, containing information about the most
139 recent version of that module with at least one I<PASS> report submitted,
140 separated by platform and perl version.
141
142 Second is a list of selected reports, detailing all the submitted test
143 results for the latest version of the given module. If you see a
144 I<FAIL> or I<UNKNOWN> result that might concern you - usually at a
145 platform you expect your application to run - you can click on it to
146 see a verbose output of all the tests, to see why it failed.
147
148 Another interesting information displayed is the report summary on the
149 left sidebar, showing a small colored graph of PASS-UNKNOWN-FAIL
150 results for the latest versions of the chosen module. If you see a
151 released version with lots of FAIL results, it might be interesting to
152 dig deeper or simply require a greater version of that module in your
153 application.
8c82f36 @kthakore Out line for CPAN added
kthakore authored
154
155
156 =head3 Bug Reports
157
0b1aefe @garu CPAN chapter: finding the right module
garu authored
158 When picking a module to use, it is very important to check out its
159 bug reports. You can do that by either clicking on the
160 I<< "View/Report Bugs" >> link on the module's page on CPAN, or
161 on the I<< "CPAN RT" >> (for Request Tracker) box on the right side of
162 the documentation page.
163
164 Look for open bugs and their description - i.e. if it's a bug or a
165 whislist - and see if it concerns your planned usage for that module.
166 Some bug reports are simple notices about a typo on the documentation
167 or a very specific issue, so make sure you look around the ticket
168 description to see if it's something that blocks your usage, or if
169 you can live with it, at least until the author delivers an update.
170
171 It may also interest you to see how long the open bugs have been there.
172 Distributions with bugs dating for more than two years might indicate
173 that the author abandoned the module to pursue other projects, so you'll
174 likely be on your own if you find any bumps. Of course, being free
175 software, that doesn't mean you can't fix things yourself, and maybe even
176 ask the author for maintainance privileges so you can update your fixes
177 for other people to use.
178
179
180 =head2 Release Date
181
182 A old distribution might mean a solid and stable distribution, but it
183 can also mean that the author doesn't care much about it anymore. If
184 you find a module whose latest version is over 5 years old, make sure
185 to double check test results and bug reports, as explained above.
8c82f36 @kthakore Out line for CPAN added
kthakore authored
186
56722d2 @kthakore Intro blurb for CPAN chapter
kthakore authored
187 =head1 Conclusion
8c82f36 @kthakore Out line for CPAN added
kthakore authored
188
0b1aefe @garu CPAN chapter: finding the right module
garu authored
189 CPAN is an amazing repository filled with nice modules ready for you to
190 use in your games. More than often you'll find that 90% of your
191 application is already done on CPAN, and all you have to do to get that
192 awesome idea implemented is glue them together, worrying only about your
193 application's own logic instead of boring sidework. This means faster
194 development, and more fun!
18bc16f @kthakore Initial Commit
kthakore authored
195
196 =for vim: spell
Something went wrong with that request. Please try again.