Filter
view release on metacpan or search on metacpan
Call/Call.pm view on Meta::CPAN
sub filter_add($)
{
my($obj) = @_ ;
# Did we get a code reference?
my $coderef = (ref $obj eq 'CODE');
# If the parameter isn't already a reference, make it one.
if (!$coderef and (!ref($obj) or ref($obj) =~ /^ARRAY|HASH$/)) {
$obj = bless (\$obj, (caller)[0]);
}
# finish off the installation of the filter in C.
Filter::Util::Call::real_import($obj, (caller)[0], $coderef) ;
}
XSLoader::load('Filter::Util::Call');
1;
__END__
=head1 NAME
Filter::Util::Call - Perl Source Filter Utility Module
examples/closure/Include.pm view on Meta::CPAN
use Carp ;
sub import
{
my ($self) = shift ;
my ($filename) = shift ;
my $fh = new IO::File "<$filename"
or croak "Cannot open file '$filename': $!" ;
my $first_time = 1 ;
my ($orig_filename, $orig_line) = (caller)[1,2] ;
++ $orig_line ;
filter_add(
sub
{
$_ = <$fh> ;
if ($first_time) {
$_ = "#line 1 $filename\n$_" ;
$first_time = 0 ;
perlfilter.pod view on Meta::CPAN
use Filter::Util::Call;
use constant TRUE => 1;
use constant FALSE => 0;
sub import {
my ($type) = @_;
my (%context) = (
Enabled => defined $ENV{DEBUG},
InTraceBlock => FALSE,
Filename => (caller)[1],
LineNo => 0,
LastBegin => 0,
);
filter_add(bless \%context);
}
sub Die {
my ($self) = shift;
my ($message) = shift;
my ($line_no) = shift || $self->{LastBegin};
( run in 1.579 second using v1.01-cache-2.11-cpan-e93a5daba3e )