add presentation files from ipw 2009
[catagits/Web-Simple.git] / docs / antiquated-perl.xul
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
3 Antiquated
4 Perl
5 ----
6 Modern
7 Perl?
8 ----
9 Post
10 Modern
11 Perl
12 ----
13 Enlightened
14 Perl
15 ----
16 everybody
17 knows
18 ----
19 Catalyst
20 Moose
21 DBIx::Class
22 ----
23 Modern
24 Perl?
25 ----
26 perl5
27 v10
28 ----
29   given ($x) {
30     when (3) {
31   ...
32 ----
33 ~~
34 ----
35 what's the
36 opposite?
37 ----
38 Old
39 Perl?
40 ----
41 if it 
42 works
43 ----
44 Legacy
45 Perl?
46 ----
47 not
48 interesting
49 ----
50 Stupid
51 Perl
52 ----
53 *$&^*(^
54 FormMail.PL
55 ----
56 Antiquated
57 Perl
58 ----
59 Antique
60 ----
61 Old *and*
62 beautiful
63 ----
64 Simple
65 Elegant
66 ----
67   $|++
68 ----
69   use IO::Handle;
70   STDOUT->autoflush(1);
71 ----
72 it's core.
73 it's fine.
74 ----
75 but why
76 think?
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 ----
99 bitwise
100 negation
101 ----
102 so ...
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 ----
119 overload::constant
120 ----
121 lets you
122 affect
123 parsing
124 ----
125 numbers
126 strings
127 ----
128 q qq qr
129 t s qw
130 ----
131 i18n.pm
132 ----
133 ~~"$foo bar"
134 loc("_[0] bar", $foo)
135 ----
136 for
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 ----
161 prototypes
162 ----
163   sub foo (&) {
164 ----
165   foo {
166     ...
167   };
168 ----
169   prototype \&foo
170 ----
171 typeglobs
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 ----
188 strict
189 and
190 warnings
191 ----
192   strict->import
193 ----
194 affects
195 compilation
196 scope
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 ----
216 B::Hooks::EndOfScope
217 ----
218 tie
219 ----
220   tie $var, 'Foo';
221 ----
222   sub FETCH
223   sub STORE
224 ----
225 Scalar
226 Array
227 Hash
228 Handle
229 ----
230 now ...
231 ----
232 mst: destruction
233 testing technology
234 since March 1983
235 ----
236 3 days
237 old
238 ----
239 2 weeks
240 early
241 ----
242 incubator
243 ----
244 glass box
245 plastic tray
246 heater
247 ----
248 design
249 flaw
250 ----
251 BANG
252 ----
253 so ...
254 ----
255 interesting
256 fact
257 ----
258 prototypes
259 only warn
260 when parsed
261 ----
262 error when
263 compiled
264 ----
265 so ...
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 ----
299 I hate
300 fetching
301 $self
302 ----
303   *{"${app}::self"}
304     = \${"${app}::self"};
305 ----
306 use 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 ----
316 HTML
317 output
318 ----
319 templates
320 ----
321 HTML is
322 NOT 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 ----
348 glob('/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 ----
361 what about
362 interpolation
363 ----
364   my $stuff = 'foo"bar';
365   <a href="$stuff">
366 ----
367 hmm ...
368 ----
369 overload::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 ----
384 hooking
385 it 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 ----
405 and the result?
406 ----
407  goto &demo;
408 ----
409 questions?
410 ----
411 thank
412 you
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