Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 432 lines (236 sloc) 8.612 kb
c0f208f @chromatic Initial checkin.
chromatic authored
1 =head1 Modern Perl
2
3 The justification for the book -- or, how to think about Perl to make learning
4 and understanding it easier.
5
6 =head2 The Perl Philosophy
7
8 Fundamental features of the language and its design.
9
10 =over
11
5d8dd55 @chromatic Added Expressivity section.
chromatic authored
12 =item expressivity
c0f208f @chromatic Initial checkin.
chromatic authored
13
5d8dd55 @chromatic Added Expressivity section.
chromatic authored
14 L<expressivity> *
c0f208f @chromatic Initial checkin.
chromatic authored
15
5d8dd55 @chromatic Added Expressivity section.
chromatic authored
16 =item context
17
18 L<context_philosophy> *
c0f208f @chromatic Initial checkin.
chromatic authored
19
20 =item implicit ideas
21
5d8dd55 @chromatic Added Expressivity section.
chromatic authored
22 L<implicit_ideas> *
c0f208f @chromatic Initial checkin.
chromatic authored
23
24 =item perldoc
25
5d8dd55 @chromatic Added Expressivity section.
chromatic authored
26 L<perldoc> *
c0f208f @chromatic Initial checkin.
chromatic authored
27
28 =back
29
30 =head2 The CPAN
31
32 Evolution happens outside the core I<on purpose>.
33
d9d7b3a @chromatic Updated outline with recent changes.
chromatic authored
34 L<cpan> *
4fea9b6 @chromatic Filled out first half of Values section.
chromatic authored
35
c0f208f @chromatic Initial checkin.
chromatic authored
36 =head2 The Perl Community
37
d9d7b3a @chromatic Updated outline with recent changes.
chromatic authored
38 L<perl_community> x
39
c0f208f @chromatic Initial checkin.
chromatic authored
40 How and where to find other people to learn and to share.
41
42 =head2 The Language Itself
43
44 A basic explanation for elements of the language itself.
45
46 =head3 Syntactic Elements
47
48 An explanation of the individual syntactic elements which make up the language.
49
50 =head3 Names
51
4fea9b6 @chromatic Filled out first half of Values section.
chromatic authored
52 L<names> *
c0f208f @chromatic Initial checkin.
chromatic authored
53
54 Mostly identifiers. How they work, what's valid, and what's not.
55
56 =head3 Values
57
d9d7b3a @chromatic Updated outline with recent changes.
chromatic authored
58 L<values> +
c0f208f @chromatic Initial checkin.
chromatic authored
59
60 Strings, numbers, everything without a sigil.
61
62 =head3 Operators
63
64 This has to be more than just a list of operators (and how do you explain the
65 difference between perlop and perlfunc?).
66
67 =head3 Control Flow
68
d9d7b3a @chromatic Updated outline with recent changes.
chromatic authored
69 L<control_flow> *
70
c0f208f @chromatic Initial checkin.
chromatic authored
71 Loops, jumps, and labels. Defer calling functions? Exceptions??
72
73 =head3 Variables
74
75 How did I miss this one? Probably don't want to get into references yet.
76 Should mention magic global variables.
77
78 =head3 Barewords
79
80 There are several types. Do special tokens such as BEGIN, INIT, and
81 __END_/__DATA__ count?
82
83 =head3 Functions
84
85 Anything invocable. Again, probably don't want to get into references.
86
87 =head3 Objects and Methods
88
89 How do you discuss these without discussing references?
90
91 =head2 Data Types
92
93 Containers; Perl's built-in data types.
94
95 =head3 Scalars
96
d9d7b3a @chromatic Updated outline with recent changes.
chromatic authored
97 L<scalars> *
98
c0f208f @chromatic Initial checkin.
chromatic authored
99 Should be simple, provided that the reference part stays put. Should mention
d4a8add @Util Fixed typos.
Util authored
100 numification/stringification, magical auto-increment.
c0f208f @chromatic Initial checkin.
chromatic authored
101
102 =head3 Arrays
103
d9d7b3a @chromatic Updated outline with recent changes.
chromatic authored
104 L<arrays> *
105
c0f208f @chromatic Initial checkin.
chromatic authored
106 Make it clear that arrays and lists are very different things. Discuss
8ee3dc8 Missing C<...> on code.
Mark Hindess authored
107 distinction between indexes and length? Avoid C<$#> altogether? (Don't have to
c0f208f @chromatic Initial checkin.
chromatic authored
108 be comprehensive, just clear.)
109
110 C<$var1, $var2, $var3> -- why arrays are useful
111
89d7389 @chromatic Expanded hashes chapter; ready for editing.
chromatic authored
112 =head3 Hashes *
c0f208f @chromatic Initial checkin.
chromatic authored
113
114 Insertion order is appropriate. So is stringification.
115
116 The "variable variable name" problem.
117
118 =head3 References
119
120 Stringification and magical increment/decrement don't work. Brace
121 disambiguation is ugly, but usually suffices.
122
123 =head2 Operators
124
125 The types of things you find in C<perldoc -f>.
126
127 =head3 Context
128
d9d7b3a @chromatic Updated outline with recent changes.
chromatic authored
129 L<context_philosophy>
130
c0f208f @chromatic Initial checkin.
chromatic authored
131 This is perhaps the most important insight into Perl on its own as a language,
132 so it belongs in a position where everyone will read it. It might need its own
133 short chapter.
134
135 =head3 Operator Types
136
137 Not sure what exactly this will be; perhaps infix, prefix, and built-in
138 functions.
139
1b3e297 @chromatic Touched up outline with recent changes.
chromatic authored
140 =head3 Coercion *
c0f208f @chromatic Initial checkin.
chromatic authored
141
142 Here's why there's a specific operators chapter. Working effectively with Perl
143 means taking advantage of operators to enforce stringy, numeric, etc contexts
144 on dynamic values.
145
146 =head2 Functions
147
148 =head3 Parameters
149
150 Positional, named, reference. Most people use positional; mention the others.
151
152 =head3 Context
153
154 Not sure this belongs here, but having brought it up in the context of
155 operators, it might be appropriate. Certainly return context is interesting.
156
157 =head3 Scope
158
d9d7b3a @chromatic Updated outline with recent changes.
chromatic authored
159 L<scope> x
160
c0f208f @chromatic Initial checkin.
chromatic authored
161 May be more appropriate conceptually before discussing parameter handling, but
162 seems to flow better here. Difference between global and lexical.
163
164 =head3 Anonymous Functions
165
d9d7b3a @chromatic Updated outline with recent changes.
chromatic authored
166 L<anonymous_functions> (x)
167
c0f208f @chromatic Initial checkin.
chromatic authored
168 Must come after references and functions. Mention typeglobs? The name doesn't
169 matter to Perl. Any CV is invokable.
170
171 =head3 Closures
172
d9d7b3a @chromatic Updated outline with recent changes.
chromatic authored
173 L<closures>
174
c0f208f @chromatic Initial checkin.
chromatic authored
175 Combines scopes, lexicals, and functions. This is the time to talk about
176 binding and closing over. Delayed computation. Encapsulation. Abstraction.
177
d9d7b3a @chromatic Updated outline with recent changes.
chromatic authored
178 =head2 Regular Expressions
179
180 L<regular_expressions> *
c0f208f @chromatic Initial checkin.
chromatic authored
181
182 This won't be a fun chapter, but it's a necessary chapter. What's the minimal
183 I can write to be effective?
184
185 =head3 Basic Matching
186
187 Literals, quantifiers, metacharacters, alternations, character classes.
188
189 =head3 Regexp Flags
190
191 /e, /x, /s, /m
192
193 =head3 Compiled and Composed Regexes
194
195 C<qr//>
196
197 =head3 Named Captures
198
199 Describe Perl 5.10 features; mention older syntax in passing.
200
201 =head3 Assertions and Extended Regexes
202
203 Briefly describe lookbehind and lookahead. Leave it at that level of detail.
204 Mention the limitations of regular expressions? New section?
205
206 =head2 Useful Operators
207
208 Things you use all the time but might bite you.
209
210 =head3 IO
211
212 print, say, open, readline
213
214 =head3 Array Ops
215
216 push, pop, shift, unshift, splice
217
218 =head3 List Ops
219
220 map, grep, for
221
222 slicing
223
224 Ranges?
225
226 sort
227
228 List::Util
229
230 =head3 Hash Operations
231
232 keys, values, each (watch the iterator problem)
233
0116b1c @chromatic Wrote Packages section and part of Modules section.
chromatic authored
234 =head3 Packages * and Modules
c0f208f @chromatic Initial checkin.
chromatic authored
235
236 A separate chapter?
237
238 use
239 require
240 import()
241
0c12545 @chromatic Updated outline.
chromatic authored
242 =head2 Objects *
c0f208f @chromatic Initial checkin.
chromatic authored
243
9bc3fc8 @chromatic Replaced references to Mouse with Moose, per suggestion from Stevan Litt...
chromatic authored
244 Perhaps start with syntactic elements and then show Moose? Vice versa? Must
c0f208f @chromatic Initial checkin.
chromatic authored
245 cover packages and modules first, at least.
246
247 =head3 Packages
248
249 Maybe need an encapsulation and modules chapter -- BEGIN and import() plus
250 exporting. What's the best way to export?
251
252 =head3 Blessed References
253
254 Very bare-bones object stuff. Should mention constructors.
255
256 =head3 Inheritance
257
258 Really not a fan.
259
260 =head3 Other Forms of Code Reuse
261
262 Mixins, roles.
263
0c12545 @chromatic Updated outline.
chromatic authored
264 =head3 Moose *
c0f208f @chromatic Initial checkin.
chromatic authored
265
9bc3fc8 @chromatic Replaced references to Mouse with Moose, per suggestion from Stevan Litt...
chromatic authored
266 The bare bones: classes, attributes, methods.
267
268 Note that this is the single place in the book in which I want to describe
269 something other than the default language behavior. Hoist this up earlier?
270
c0f208f @chromatic Initial checkin.
chromatic authored
271 =head3 Reflection
272
273 C<isa()> and C<can()>
274
275 =head2 Style
276
277 This may need to merge with idioms. It also might get cut down too. There's a
278 lot to say in here. I don't want to repeat Perl Best Practices, but I do want
279 to show off some of the power of the language when used appropriately. Cutting
280 this up between Idioms and Beautiful Features may work best.
281
1b3e297 @chromatic Touched up outline with recent changes.
chromatic authored
282 =head3 Testing *
c0f208f @chromatic Initial checkin.
chromatic authored
283
284 Might explain this much earlier, right after syntactic features, so that people
285 can use it to explore on their own (and the text can use it to show off
286 examples).
287
288 =head2 Making the Most of Perl / Writing Real Programs
289
290 Things you must use to get the most out of Perl. Context would appear here,
291 but it's so fundamental to understanding the language that it has to come much
292 earlier.
293
294 =head3 Perldoc and POD
295
d9d7b3a @chromatic Updated outline with recent changes.
chromatic authored
296 L<perldoc> *
297
c0f208f @chromatic Initial checkin.
chromatic authored
298 Documentation and using the documentation.
299
300 =head3 CPAN
301
302 Probably deserves its own chapter.
303
304 =head3 C<strict> and C<warnings> modes, C<use 5.010>
305
306 Probably will have introduced these earlier.
307
308 =head3 Lexical Pragmas
309
310 Swap this with the previous? Depends on flow of narrative.
311
312 =head3 Code Generation
313
314 Don't want to get too far afield into C<Devel::Declare> and don't want to push
315 C<AUTOLOAD> too heavily, but C<BEGIN>-time manipulations are very, very
316 powerful.
317
318 =head3 Taint Mode
319
320 General security?
321
322 Exceptions?
323
324 =head3 Attributes
325
326 This is getting esoteric, and there are grotty bits of Attribute::Handlers I
327 don't want to explain. However, they're useful.
328
329 =head2 Idioms
330
331 A handful of common idioms often found in well-written Perl programs.
332
333 =head3 Dispatch Table
334
335 "I know what action I want to take based on input I get."
336
337 =head3 Iteration
338
339 The difference between C<for> and C<while>.
340
341 =head3 C<map>-based Transformations
342
343 Thinking in lists.
344
345 =head3 Or-Else/Dor-Else
346
347 The orcish maneuver.
348
349 =head3 Early Exit Guard with Postfix Conditional
350
351 return if...
352 return unless...
353
354 =head2 What to Avoid
355
356 Here are features of Perl I wish would go away. I can't say "The internals",
357 can I? Explain how it's so painful you wish it weren't there or how it's
358 almost impossible to get right.
359
360 =head3 Dative Syntax
361
d9d7b3a @chromatic Updated outline with recent changes.
chromatic authored
362 L<indirect_objects> *
363
c0f208f @chromatic Initial checkin.
chromatic authored
364 Barewords plus parsing sugar = avoid.
365
366 =head3 Method/Sub Equivalence
367
d9d7b3a @chromatic Updated outline with recent changes.
chromatic authored
368 L<method_sub_equivalence> *
369
c0f208f @chromatic Initial checkin.
chromatic authored
370 The best you can do is treat them differently.
371
372 =head3 Tie
373
374 You may run into this. You shouldn't have to.
375
376 =head3 Prototypes
377
d9d7b3a @chromatic Updated outline with recent changes.
chromatic authored
378 L<prototypes> *
379
c0f208f @chromatic Initial checkin.
chromatic authored
380 They don't work the way you think they do.
381
382 =head3 Typeglobs and Reflection
383
9bc3fc8 @chromatic Replaced references to Mouse with Moose, per suggestion from Stevan Litt...
chromatic authored
384 Use Moose instead.
c0f208f @chromatic Initial checkin.
chromatic authored
385
a818aad @chromatic Updated outline with a new section.
chromatic authored
386 =head3 Postfix/State
387
388 postfix if and lexicals
389
c0f208f @chromatic Initial checkin.
chromatic authored
390 =head2 Avoid When Possible
391
392 Features that don't work quite right but you can't quite avoid.
393
394 =head3 Reference Syntax
395
8ee3dc8 Missing C<...> on code.
Mark Hindess authored
396 Don't double C<$$>, collapse multiple arrows, use braces copiously.
c0f208f @chromatic Initial checkin.
chromatic authored
397
398 =head3 Barewords
399
400 You can almost always avoid them.
401
402 =head3 Global Variables
403
404 You only need to know a few; localize the rest.
405
9285723 @chromatic Wrote "Missing Defaults" section.
chromatic authored
406 =head3 Missing Defaults *
c0f208f @chromatic Initial checkin.
chromatic authored
407
9285723 @chromatic Wrote "Missing Defaults" section.
chromatic authored
408 No C<strict>, C<warnings> by default. Also C<autodie> and C<IO::Handle>.
c0f208f @chromatic Initial checkin.
chromatic authored
409
410 =head3 Blessed Hashes
411
412 Covered in OO; mention here.
413
414 =head3 C<isa()> and C<can()>
415
416 Maybe covered in OO?
417
418 =head3 C<AUTOLOAD>
419
420 In general, you can avoid this.
421
422 =head3 C<UNIVERSAL>
423
424 In conjunction with attributes....
425
426 =head2 What's Missing
427
428 Core Modules
429 Date/Time
430 Cookbooky Stuff
431 Build.PL/Module::Build ?
Something went wrong with that request. Please try again.