Release commit for 0.008
[catagits/Web-Simple.git] / docs / antiquated-perl.xul
CommitLineData
879d8965 1<?xml version="1.0" encoding="UTF-8"?><?xml-stylesheet href="chrome://global/skin/" type="text/css"?><?xml-stylesheet href="takahashi.css" type="text/css"?><page xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="presentation" xmlns:html="http:/www.w3.org/1999/xhtml" orient="vertical" onkeypress="Presentation.onKeyPress(event);">\r
2<html:textarea id="builtinCode" style="visibility: collapse"><![CDATA[\r
3Antiquated
4Perl
5----
6Modern
7Perl?
8----
9Post
10Modern
11Perl
12----
13Enlightened
14Perl
15----
16everybody
17knows
18----
19Catalyst
20Moose
21DBIx::Class
22----
23Modern
24Perl?
25----
26perl5
27v10
28----
29 given ($x) {
30 when (3) {
31 ...
32----
33~~
34----
35what's the
36opposite?
37----
38Old
39Perl?
40----
41if it
42works
43----
44Legacy
45Perl?
46----
47not
48interesting
49----
50Stupid
51Perl
52----
53*$&^*(^
54FormMail.PL
55----
56Antiquated
57Perl
58----
59Antique
60----
61Old *and*
62beautiful
63----
64Simple
65Elegant
66----
67 $|++
68----
69 use IO::Handle;
70 STDOUT->autoflush(1);
71----
72it's core.
73it's fine.
74----
75but why
76think?
77----
78 select((select(FOO),$|++)[0])
79----
80 (select(FOO),$|++)
81 ->
82 ($old_selected_fh,$|)
83----
84 (select(FOO),$|++)[0]
85 ->
86 $old_select_fh
87----
88 select((select(FOO),$|++)[0])
89 ->
90 use IO::Handle;
91 FOO->autoflush(1)
92----
93~~
94----
95 ~~@x
96----
97 ~(~(@x))
98----
99bitwise
100negation
101----
102so ...
103----
104 ~@x
105 ->
106 ~(scalar @x)
107----
108 ~~$number
109 ->
110 $number
111----
112 ~~@x
113 ->
114 scalar @x
115----
116 perl -MMoose -e'print ~~keys %INC'
117 84
118----
119overload::constant
120----
121lets you
122affect
123parsing
124----
125numbers
126strings
127----
128q qq qr
129t s qw
130----
131i18n.pm
132----
133~~"$foo bar"
134loc("_[0] bar", $foo)
135----
136for
137----
138 for ($foo) {
139 /bar/ and ...
140----
141 for ($foo) {
142 /bar/ and return do {
143 <code here>
144 }
145----
146 /foo/gc
147----
148 /\Gbar/gc
149----
150 sub parse {
151 my ($self, $str) = @_;
152 for ($str) {
153 /match1/gc and return
154 $self->_subparse_1($_)
155----
156 sub _subparse_1 {
157 my ($self) = @_;
158 for ($_[1]) {
159 /\Gsubmatch1/gc ...
160----
161prototypes
162----
163 sub foo (&) {
164----
165 foo {
166 ...
167 };
168----
169 prototype \&foo
170----
171typeglobs
172----
173 *{"${package}::${name}"}
174 = sub { ... }
175----
176 local
177----
178 local $_
179----
180 local *Carp::croak
181 = \&Carp::confess;
182----
183 do {
184 local (@ARGV, $/) = $file;
185 <>
186 }
187----
188strict
189and
190warnings
191----
192 strict->import
193----
194affects
195compilation
196scope
197----
198 sub strict_and_warnings::import {
199 strict->import;
200 warnings->import;
201 }
202----
203 use strict_and_warnings;
204----
205$^H
206%^H
207----
208 $^H |= 0x120000;
209 $^H{'foo'}
210 = bless($foo, 'My::Foo');
211----
212 sub My::Foo::DESTROY {
213----
214 delete ${$package}{myimport}
215----
216B::Hooks::EndOfScope
217----
218tie
219----
220 tie $var, 'Foo';
221----
222 sub FETCH
223 sub STORE
224----
225Scalar
226Array
227Hash
228Handle
229----
230now ...
231----
232mst: destruction
233testing technology
234since March 1983
235----
2363 days
237old
238----
2392 weeks
240early
241----
242incubator
243----
244glass box
245plastic tray
246heater
247----
248design
249flaw
250----
251BANG
252----
253so ...
254----
255interesting
256fact
257----
258prototypes
259only warn
260when parsed
261----
262error when
263compiled
264----
265so ...
266----
267 dispatch [
268 sub (GET + /) { ... },
269 sub (GET + /user/*) { ... }
270 ];
271----
272 foreach my $sub (@$dispatch) {
273 my $proto = prototype $sub;
274 $parser->parse($proto);
275 ...
276----
277 PARSE: { do {
278 push @match, $self->_parse_spec_section($spec)
279 or $self->_blam("Unable to work out what the next section is");
280 last PARSE if (pos == length);
281 /\G\+/gc or $self->_blam('Spec sections must be separated by +');
282 } until (pos == length) };
283----
284 sub _blam {
285 my ($self, $error) = @_;
286 my $hat = (' ' x pos).'^';
287 die "Error parsing dispatch specification: ${error}\n
288 ${_}
289 ${hat} here\n";
290 }
291----
292 Error parsing ...
293 GET+/foo
294 ^ here
295----
296 sub (GET + /user/*) {
297 my ($self, $user) = @_;
298----
299I hate
300fetching
301$self
302----
303 *{"${app}::self"}
304 = \${"${app}::self"};
305----
306use vars
307----
308 sub _run_with_self {
309 my ($self, $run, @args) = @_;
310 my $class = ref($self);
311 no strict 'refs';
312 local *{"${class}::self"} = \$self;
313 $self->$run(@args);
314 }
315----
316HTML
317output
318----
319templates
320----
321HTML is
322NOT TEXT
323----
324 <div>,
325 $text,
326 </div>;
327----
328<div>
329----
330<$fh>
331----
332 tie *{"${app}::${name}"},
333 'XML::Tags::TIEHANDLE',
334 "<${name}>";
335----
336 sub TIEHANDLE { my $str = $_[1]; bless \$str, $_[0] }
337 sub READLINE { ${$_[0]} }
338----
339 sub DESTROY {
340 my ($into, @names) = @$_[0];
341 no strict 'refs';
342 delete ${$into}{$_}
343 for @names;
344 }
345----
346</div>
347----
348glob('/div');
349----
350 *CORE::GLOBAL::glob
351 = sub { ... };
352----
353 delete
354 ${CORE::GLOBAL::}{glob};
355----
356 sub foo {
357 use XML::Tags qw(div);
358 <div>, "foo!", </div>;
359 }
360----
361what about
362interpolation
363----
364 my $stuff = 'foo"bar';
365 <a href="$stuff">
366----
367hmm ...
368----
369overload::constant!
370----
371 glob('a href="'.$stuff.'"');
372----
373 glob(
374 bless(\'a href="', 'MagicTag')
375 .$stuff
376 .bless(\'"', 'MagicTag')
377 )
378----
379 use overload
380 '.' => 'concat';
381
382 sub concat {
383----
384hooking
385it up
386----
387 sub (.html) {
388 filter_response {
389 $self->render_html($_[1])
390 }
391 }
392----
393 bless(
394 $_[1],
395 'Web::Simple::ResponseFilter'
396 );
397----
398 if ($self->_is_response_filter($result)) {
399 return $self->_run_with_self(
400 $result,
401 $self->_run_dispatch_for($new_env, \@disp)
402 );
403 }
404----
405and the result?
406----
407 goto &demo;
408----
409questions?
410----
411thank
412you
413]]></html:textarea>\r
414\r
415\r
416\r
417\r
418\r
419\r
420\r
421\r
422\r
423\r
424\r
425<deck flex="1" id="deck">\r
426\r
427<vbox flex="1"\r
428 onmousemove="Presentation.onMouseMoveOnCanvas(event);">\r
429 <toolbox id="canvasToolbar">\r
430 <toolbar>\r
431 <toolbarbutton oncommand="Presentation.home()" label="|&lt;&lt;"\r
432 observes="canBack"/>\r
433 <toolbarbutton oncommand="Presentation.back()" label="&lt;"\r
434 observes="canBack"/>\r
435 <toolbarbutton oncommand="Presentation.forward()" label="&gt;"\r
436 observes="canForward"/>\r
437 <toolbarbutton oncommand="Presentation.end()" label="&gt;&gt;|"\r
438 observes="canForward"/>\r
439 <toolbarseparator/>\r
440 <hbox align="center">\r
441 <textbox id="current_page" size="4"\r
442 oninput="if (this.value) Presentation.showPage(parseInt(this.value)-1);"/>\r
443 <description value="/"/>\r
444 <description id="max_page"/>\r
445 </hbox>\r
446 <toolbarseparator/>\r
447 <vbox flex="2">\r
448 <spacer flex="1"/>\r
449 <scrollbar id="scroller"\r
450 align="center" orient="horizontal"\r
451 oncommand="Presentation.showPage(parseInt(event.target.getAttribute('curpos')));"\r
452 onclick="Presentation.showPage(parseInt(event.target.getAttribute('curpos')));"\r
453 onmousedown="Presentation.onScrollerDragStart();"\r
454 onmousemove="Presentation.onScrollerDragMove();"\r
455 onmouseup="Presentation.onScrollerDragDrop();"/>\r
456 <spacer flex="1"/>\r
457 </vbox>\r
458 <toolbarseparator/>\r
459 <spacer flex="1"/>\r
460 <toolbarseparator/>\r
461 <toolbarbutton id="toggleEva" label="Eva"\r
462 type="checkbox"\r
463 autoCheck="false"\r
464 oncommand="Presentation.toggleEvaMode();"/>\r
465 <toolbarseparator/>\r
466 <toolbarbutton label="Edit"\r
467 oncommand="Presentation.toggleEditMode();"/>\r
468 <toolbarbutton oncommand="Presentation.reload();" label="Reload"/>\r
469 </toolbar>\r
470 </toolbox>\r
471 <vbox flex="1" id="canvas"\r
472 onclick="Presentation.onPresentationClick(event);">\r
473 <spacer flex="1"/>\r
474 <hbox flex="1">\r
475 <spacer flex="1"/>\r
476 <vbox id="content"/>\r
477 <spacer flex="1"/>\r
478 </hbox>\r
479 <spacer flex="1"/>\r
480 </vbox>\r
481</vbox>\r
482\r
483\r
484<vbox flex="1" id="edit">\r
485 <toolbox>\r
486 <toolbar>\r
487 <toolbarbutton label="New Page"\r
488 oncommand="Presentation.addPage()"/>\r
489 <spacer flex="1"/>\r
490 <toolbarseparator/>\r
491 <toolbarbutton label="View"\r
492 oncommand="Presentation.toggleEditMode();"/>\r
493 <toolbarbutton oncommand="Presentation.reload();" label="Reload"/>\r
494 </toolbar>\r
495 </toolbox>\r
496 <textbox id="textField" flex="1" multiline="true"\r
497 oninput="Presentation.onEdit()"/>\r
498 <hbox collapsed="true">\r
499 <iframe id="dataLoader" onload="if (window.Presentation) Presentation.onDataLoad();"/>\r
500 </hbox>\r
501</vbox>\r
502\r
503</deck>\r
504\r
505\r
506<broadcasterset>\r
507 <broadcaster id="canBack"/>\r
508 <broadcaster id="canForward"/>\r
509</broadcasterset>\r
510\r
511<commandset>\r
512 <command id="cmd_forward"\r
513 oncommand="if (Presentation.isPresentationMode) Presentation.forward();"/>\r
514 <command id="cmd_back"\r
515 oncommand="if (Presentation.isPresentationMode) Presentation.back();"/>\r
516 <command id="cmd_home"\r
517 oncommand="if (Presentation.isPresentationMode) Presentation.home();"/>\r
518 <command id="cmd_end"\r
519 oncommand="if (Presentation.isPresentationMode) Presentation.end();"/>\r
520</commandset>\r
521<keyset>\r
522 <key keycode="VK_ENTER" command="cmd_forward"/>\r
523 <key keycode="VK_RETURN" command="cmd_forward"/>\r
524 <key keycode="VK_PAGE_DOWN" command="cmd_forward"/>\r
525 <key keycode="VK_RIGHT" command="cmd_forward"/>\r
526 <key keycode="VK_DOWN" command="cmd_forward"/>\r
527 <!-- key keycode="VK_BACK_SPACE" command="cmd_back"/-->\r
528 <key keycode="VK_PAGE_UP" command="cmd_back"/>\r
529 <!-- <key keycode="VK_BACK_UP" command="cmd_back"/>-->\r
530 <!-- <key keycode="VK_BACK_LEFT" command="cmd_back"/>-->\r
531 <key keycode="VK_HOME" command="cmd_home"/>\r
532 <key keycode="VK_END" command="cmd_end"/>\r
533 <key key="n" modifiers="accel" oncommand="Presentation.addPage();"/>\r
534 <key key="r" modifiers="accel" oncommand="window.location.reload();"/>\r
535 <key key="e" modifiers="accel" oncommand="Presentation.toggleEditMode();"/>\r
536 <key key="a" modifiers="accel" oncommand="Presentation.toggleEvaMode();"/>\r
537</keyset>\r
538\r
539\r
540<script src="takahashi.js" type="application/x-javascript" />\r
541</page>\r
542<!-- ***** BEGIN LICENSE BLOCK *****\r
543 - Version: MPL 1.1\r
544 -\r
545 - The contents of this file are subject to the Mozilla Public License Version\r
546 - 1.1 (the "License"); you may not use this file except in compliance with\r
547 - the License. You may obtain a copy of the License at\r
548 - http://www.mozilla.org/MPL/\r
549 -\r
550 - Software distributed under the License is distributed on an "AS IS" basis,\r
551 - WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License\r
552 - for the specific language governing rights and limitations under the\r
553 - License.\r
554 -\r
555 - The Original Code is the Takahashi-Method-based Presentation Tool in XUL.\r
556 -\r
557 - The Initial Developer of the Original Code is SHIMODA Hiroshi.\r
558 - Portions created by the Initial Developer are Copyright (C) 2005\r
559 - the Initial Developer. All Rights Reserved.\r
560 -\r
561 - Contributor(s): SHIMODA Hiroshi <piro@p.club.ne.jp>\r
562 -\r
563 - ***** END LICENSE BLOCK ***** -->\r
564\r
565\r