No! I use Filter::Simple, and I parse subs and classes only in the 2nd part of the filter, where strings are in a place holder:
Soo, I take care about quoted strings! ;-PFILTER_ONLY( all => \&filter_html_blocks , code => \&CLASS_HPLOO , all + => \&dump_code ) ;
Here's a valid code:
Generated code:use Class::HPLOO ;#qw(dump) ; print "class null { sub n { 1 } }\n" ; class Foo { sub test { print "test>>@_\n" ; print " sub fake { 2 } \n" ; } }
print "class null { sub n { 1 } }\n" ; { package Foo ; use strict qw(vars) ; sub new { my $class = shift ; my $this = bless({} , $class) ; my $ret_this = $this->Foo(@_) if defined &Foo ; $this = $ret_this if ( UNIVERSAL::isa($ret_this,$class) ) ; $this = undef if ( $ret_this eq '0' ) ; return $this ; } sub test { my $this = shift ; print "test>>@_\n" ; print " sub fake { 2 } \n" ; } }
Graciliano M. P.
"Creativity is the expression of the liberty".
In reply to Re: Re: How about class Foo {...} definition for Perl?
by gmpassos
in thread How about class Foo {...} definition for Perl?
by gmpassos
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |