macro::filter - macro.pm source filter backend


macro documentation Contained in the macro distribution.

Index


Code Index:

NAME

Top

macro::filter - macro.pm source filter backend

SYNOPSIS

Top

	use macro::filter add => sub{ $_[0] + $_[1] };

SEE ALSO

Top

macro.

AUTHOR

Top

Goro Fuji <gfuji(at)cpan.org>.

LICENSE AND COPYRIGHT

Top


macro documentation Contained in the macro distribution.

package macro::filter;

use strict;
use warnings;

BEGIN{
	require macro;
	our @ISA = qw(macro);
	*VERSION = \$macro::VERSION;
}

use Filter::Util::Call ();

sub import{
	my $class = shift;

	return unless @_;

	my $self  = $class->new();

	$self->defmacro(@_);

	
	Filter::Util::Call::filter_add($self);
	return;
}

sub filter :method{
	my($self) = @_;

	Filter::Util::Call::filter_del();

	1 while Filter::Util::Call::filter_read();

	$_ = $self->process( $_, [caller]);

	return 1;
}


1;
__END__