FANDOM


This example creates an apache filter which tries to insert a floating menu into the html.

Is very very draft.

#!/usr/bin/perl package FloatingMenu;

    1. some filter examples;
  1. http://search.cpan.org/dist/Apache-Clean/

use strict; use warnings;

use Apache2::Filter (); use Apache2::RequestRec (); use APR::Table ();

use Apache2::Const -compile => qw(OK); use constant BUFF_LEN => 1024;

sub handler {

 my $f = shift;
 unless ($f->ctx) {
     $f->r->headers_out->unset('Content-Length');
     $f->ctx(1);
 }

my $mydivdoc = <<END; <style>

  1. lemon-toolbar {
   background:#fff4c8;
   position:fixed;
   width: 100px;
   height: 40px;
   margin-right: auto;
   margin-left: auto;
   bottom:0px;

} </style>

<a href="http://portal.mysite.com">Home</a>

END

while ($f->read(my $buffer, BUFF_LEN)) {

 $buffer =~ s/<\/body>/$mydivdoc<\/body>/g;
 $f->print($buffer);

}

return Apache2::Const::OK; }

1;

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.