#!/usr/bin/perl -w # Yes, I use a UNIX hashbang line, even though I'm running # under Windows. Call me weird. use strict; use warnings; use Hook::LexWrap; sub wrapClassMethod { my ($symbol) = @_; my $name = *{$symbol}{NAME}; #print "Wrapping $package" . "::" . "$name\n"; # Install our access level checker : wrap $name, pre => sub { # First I thought I was getting wrapClassMethod's @_, # but this isn't the case. It's getting curioser and # curioser. my ($first,@args) = @_; print "\$symbol here is $symbol\n"; $first = "" unless defined $first; print "\$first here is $first\n"; print "*** They are the same.\n" if $first eq $symbol; print "They are not the same.\n" unless $first eq $symbol; my $a; print "This works :"; $a = $_[0]; print "$a\n"; print "This dosen't work (core dump) :"; $a = $_[1]; print "$a\n"; }; } sub wrapped_NoAttr { print "foo\n"; }; wrapClassMethod(*wrapped_NoAttr); wrapped_NoAttr("bar"); #### perl -MHTTP::Daemon -MHTTP::Response -MLWP::Simple -e ' ; # The $d = new HTTP::Daemon and fork and getprint $d->url and exit;#spider ($c = $d->accept())->get_request(); $c->send_response( new #in the HTTP::Response(200,$_,$_,qq(Just another Perl hacker\n))); ' # web