Brian Ingerson:
> On 09/10/02 21:54 +0100, Nicholas Clark wrote:
> > On Wed, Oct 09, 2002 at 01:06:15PM -0700, Brian Ingerson wrote:
>
> The problem is not stubbing, but knowing what to stub. I definitely
> don't want to parse C code for the runs that don't need compiling. But
> you bring up a good point.
> 
> So for the attribute based subs, I don't need to do anything, because
> they are already subs. Right?
>
....
> 
> My research shows the attributes.pm showed up in 5.6.0. It 
> has a UI that makes me want to use a cuss word. Damian's
> Attribute::Handlers rocks, but is not core until 5.8.0,
> although it should work on 5.6.0. I was just wondering if
> I could pull off the A::H stuff just using, attributes.pm.

I don't think you want to go there. attributes.pm is almost broken. Damian
had to do clever things to make it work. Better to use A::H than rewrite it,
and forego the patches and improvements which Arthur Bergman continues to
make to it. 

On the other hand, why not use filters? 

package MyFilter;
use Filter::Simple;
FILTER_ONLY code => sub { 
    s/:inline[^\(]*\((.*?)\)\s*(\r\n|\n)(.*?)\2\1\2
     /{$2print <<'EOF';$2$3$2EOF$2}$2/gsx;
};
1;
__END__


The above filter will change this:

package main;
use MyFilter;
sub hello :inline(C)
  void hello() { printf("hello world\n"); }
C


into this:

package main;
use MyFilter;
sub hello {
print <<'EOF';
  void hello() { printf("hello world\n"); }
EOF
}


And could surely be adapted...

By the time Inline goes core, both A::H and F::S will be core. Till then, if
they can install Inline, they can install a couple others. I don't
understand the aversion to using good CPAN modules. If it works... use it.

--
Garrett Goebel
IS Development Specialist

ScriptPro                   Direct: 913.403.5261
5828 Reeds Road               Main: 913.384.1008
Mission, KS 66202              Fax: 913.384.2180
www.scriptpro.com          [EMAIL PROTECTED]

Reply via email to