From: Matt S Trout Date: Fri, 25 Feb 2011 01:09:06 +0000 (+0000) Subject: add Antiquated Perl slides as POD, delete takahashi code X-Git-Tag: v0.009~19 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FWeb-Simple.git;a=commitdiff_plain;h=58fd1f7faee53804aed291d17a25553cd6630aec add Antiquated Perl slides as POD, delete takahashi code The takahashi.js contained herein doesn't work on Firefox 3.6+ sadly, and the slides are the useful thing anyway - so I've moved them into an inline block in POD and nuked the files. Plus, the lack of copyright on the .js file and the mixed authorship of the .xul file were confusing Debian downstream. --- diff --git a/Changes b/Changes index bae79ff..e49d16a 100644 --- a/Changes +++ b/Changes @@ -1,5 +1,7 @@ Change log for Web::Simple + - Add Antiquated Perl slides in a POD document. + 0.008 - 2011-02-16 - Once more. diff --git a/docs/antiquated-perl.xul b/docs/antiquated-perl.xul deleted file mode 100644 index cc110bb..0000000 --- a/docs/antiquated-perl.xul +++ /dev/null @@ -1,565 +0,0 @@ - -autoflush(1); ----- -it's core. -it's fine. ----- -but why -think? ----- - select((select(FOO),$|++)[0]) ----- - (select(FOO),$|++) - -> - ($old_selected_fh,$|) ----- - (select(FOO),$|++)[0] - -> - $old_select_fh ----- - select((select(FOO),$|++)[0]) - -> - use IO::Handle; - FOO->autoflush(1) ----- -~~ ----- - ~~@x ----- - ~(~(@x)) ----- -bitwise -negation ----- -so ... ----- - ~@x - -> - ~(scalar @x) ----- - ~~$number - -> - $number ----- - ~~@x - -> - scalar @x ----- - perl -MMoose -e'print ~~keys %INC' - 84 ----- -overload::constant ----- -lets you -affect -parsing ----- -numbers -strings ----- -q qq qr -t s qw ----- -i18n.pm ----- -~~"$foo bar" -loc("_[0] bar", $foo) ----- -for ----- - for ($foo) { - /bar/ and ... ----- - for ($foo) { - /bar/ and return do { - - } ----- - /foo/gc ----- - /\Gbar/gc ----- - sub parse { - my ($self, $str) = @_; - for ($str) { - /match1/gc and return - $self->_subparse_1($_) ----- - sub _subparse_1 { - my ($self) = @_; - for ($_[1]) { - /\Gsubmatch1/gc ... ----- -prototypes ----- - sub foo (&) { ----- - foo { - ... - }; ----- - prototype \&foo ----- -typeglobs ----- - *{"${package}::${name}"} - = sub { ... } ----- - local ----- - local $_ ----- - local *Carp::croak - = \&Carp::confess; ----- - do { - local (@ARGV, $/) = $file; - <> - } ----- -strict -and -warnings ----- - strict->import ----- -affects -compilation -scope ----- - sub strict_and_warnings::import { - strict->import; - warnings->import; - } ----- - use strict_and_warnings; ----- -$^H -%^H ----- - $^H |= 0x120000; - $^H{'foo'} - = bless($foo, 'My::Foo'); ----- - sub My::Foo::DESTROY { ----- - delete ${$package}{myimport} ----- -B::Hooks::EndOfScope ----- -tie ----- - tie $var, 'Foo'; ----- - sub FETCH - sub STORE ----- -Scalar -Array -Hash -Handle ----- -now ... ----- -mst: destruction -testing technology -since March 1983 ----- -3 days -old ----- -2 weeks -early ----- -incubator ----- -glass box -plastic tray -heater ----- -design -flaw ----- -BANG ----- -so ... ----- -interesting -fact ----- -prototypes -only warn -when parsed ----- -error when -compiled ----- -so ... ----- - dispatch [ - sub (GET + /) { ... }, - sub (GET + /user/*) { ... } - ]; ----- - foreach my $sub (@$dispatch) { - my $proto = prototype $sub; - $parser->parse($proto); - ... ----- - PARSE: { do { - push @match, $self->_parse_spec_section($spec) - or $self->_blam("Unable to work out what the next section is"); - last PARSE if (pos == length); - /\G\+/gc or $self->_blam('Spec sections must be separated by +'); - } until (pos == length) }; ----- - sub _blam { - my ($self, $error) = @_; - my $hat = (' ' x pos).'^'; - die "Error parsing dispatch specification: ${error}\n - ${_} - ${hat} here\n"; - } ----- - Error parsing ... - GET+/foo - ^ here ----- - sub (GET + /user/*) { - my ($self, $user) = @_; ----- -I hate -fetching -$self ----- - *{"${app}::self"} - = \${"${app}::self"}; ----- -use vars ----- - sub _run_with_self { - my ($self, $run, @args) = @_; - my $class = ref($self); - no strict 'refs'; - local *{"${class}::self"} = \$self; - $self->$run(@args); - } ----- -HTML -output ----- -templates ----- -HTML is -NOT TEXT ----- -
, - $text, -
; ----- -
----- -<$fh> ----- - tie *{"${app}::${name}"}, - 'XML::Tags::TIEHANDLE', - "<${name}>"; ----- - sub TIEHANDLE { my $str = $_[1]; bless \$str, $_[0] } - sub READLINE { ${$_[0]} } ----- - sub DESTROY { - my ($into, @names) = @$_[0]; - no strict 'refs'; - delete ${$into}{$_} - for @names; - } ----- -
----- -glob('/div'); ----- - *CORE::GLOBAL::glob - = sub { ... }; ----- - delete - ${CORE::GLOBAL::}{glob}; ----- - sub foo { - use XML::Tags qw(div); -
, "foo!",
; - } ----- -what about -interpolation ----- - my $stuff = 'foo"bar'; - ----- -hmm ... ----- -overload::constant! ----- - glob('a href="'.$stuff.'"'); ----- - glob( - bless(\'a href="', 'MagicTag') - .$stuff - .bless(\'"', 'MagicTag') - ) ----- - use overload - '.' => 'concat'; - - sub concat { ----- -hooking -it up ----- - sub (.html) { - filter_response { - $self->render_html($_[1]) - } - } ----- - bless( - $_[1], - 'Web::Simple::ResponseFilter' - ); ----- - if ($self->_is_response_filter($result)) { - return $self->_run_with_self( - $result, - $self->_run_dispatch_for($new_env, \@disp) - ); - } ----- -and the result? ----- - goto &demo; ----- -questions? ----- -thank -you -]]>
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -