Apache-Filter

 view release on metacpan or  search on metacpan

Build.PL  view on Meta::CPAN

       sub ACTION_test {
	 my $self = shift;
	 
	 $self->depends_on('build');
	 
	 # Could be File::Spec-ified, but this is mostly a Unix module
	 $self->add_to_cleanup(qw(t/httpd t/httpd.conf t/error_log));
	 $self->do_system('t/httpd', '-f', $self->base_dir . "/t/httpd.conf");
	 
	 $ENV{PORT} = %s;  # Used by the test scripts
	   eval { $self->SUPER::ACTION_test };
	 warn $@ if $@;
	 
	 $self->do_system("kill `cat t/httpd.pid`");
       }
     EOF
    );
}

my $b = $class->new
  (

lib/Apache/Filter.pm  view on Meta::CPAN

  my $self = shift;
  unless ($self->is_last_filter) {
    # This lets previous filters set content_type, which becomes default for final filter.
    $self->content_type($_[0]) if @_;

    # Prevent early filters from messing up the content-length of late filters
    $self->header_out('Content-Length'=> undef);
    return;
  }

  return $self->SUPER::send_http_header(@_);
}

sub send_fd {
  my $self = shift;
  if ($self->is_last_filter and eval{fileno $_[0]}) {
    # Can send native filehandle directly to client
    $self->SUPER::send_fd(@_);
  } else {
    my $fd = shift;
    print while <$fd>;
  }
}

sub print {
  my $self = shift;
  $self->send_http_header() unless $self->sent_header;
  print STDOUT @_;

lib/Apache/RegistryFilter.pm  view on Meta::CPAN

use strict;
use Apache::RegistryNG;
use Apache::Constants qw(:common);
use Symbol;
use vars qw($Debug @ISA);

@ISA = qw(Apache::RegistryNG);

sub handler ($$) {
  my ($class, $r) = @_ > 1 ? (shift, shift) : (__PACKAGE__, shift);
  $class->SUPER::handler($r->filter_register);
}

sub readscript {
  my $pr = shift;
  my $r = $pr->{r};
  
  # Get a filehandle to the Perl code
  my $fh;
  if (lc $r->dir_config('Filter') eq 'on') {
    my $status;

lib/Apache/RegistryFilter.pm  view on Meta::CPAN

  # If the script was read & compiled in this child in a previous run,
  # we won't have called filter_input().  Call it now.
  unless ($r->notes('FilterRead') eq 'this_time') {
    $r->filter_input(handle => {}) 
  }

  # We temporarily override the header-sending routines to make them
  # noops.  This lets people leave these methods in their scripts.
  local *Apache::send_http_header = sub {};
  local *Apache::send_cgi_header = sub {};
  $pr->SUPER::run(@_);
}

1;

__END__

=head1 NAME

Apache::RegistryFilter - run Perl scripts in an Apache::Filter chain



( run in 2.180 seconds using v1.01-cache-2.11-cpan-0bb4e1dffa6 )