mod_perl logo perl icon
previous page: ModPerl::Const -- ModPerl Constantspage up: mod_perl 2.0 APInext page: ModPerl::MethodLookup -- Lookup mod_perl modules, objects and methods

ModPerl::Global -- Perl API for manipulating special Perl lists






The mod_perl Developer's Cookbook

The mod_perl Developer's Cookbook

By Geoffrey Young, Paul Lindner, Randy Kobes
mod_perl Pocket Reference

mod_perl Pocket Reference

By Andrew Ford
Writing Apache Modules with Perl and C

Writing Apache Modules with Perl and C

By Lincoln Stein, Doug MacEachern
Embedding Perl in HTML with Mason

Embedding Perl in HTML with Mason

By Dave Rolsky, Ken Williams
mod_perl2 User's Guide

mod_perl2 User's Guide

By Stas Bekman, Jim Brandt
Practical mod_perl

Practical mod_perl

By Stas Bekman, Eric Cholet


Table of Contents

Synopsis

  use ModPerl::Global ();
  my $package = 'MyApache2::Package';
  
  # make the END blocks of this package special
  ModPerl::Global::special_list_register(END => $package);
  
  # Execute all encoutered END blocks from this package now
  ModPerl::Global::special_list_call(    END => $package);
  
  # delete the list of END blocks
  ModPerl::Global::special_list_clear(   END => $package);


TOP

Description

ModPerl::Global provides an API to manipulate special perl lists. At the moment only the END blocks list is supported.

This API allows you to change the normal Perl behavior, and execute special lists when you need to.

For example ModPerl::RegistryCooker uses it to run END blocks in the scripts at the end of each request.

Before loading a module containing package $package, you need to register it, so the special blocks will be intercepted by mod_perl and not given to Perl. special_list_register does that. Later on when you want to execute the special blocks, special_list_call should be called. Unless you want to call the list more than once, clear the list with special_list_clear.



TOP

API

ModPerl::Global provides the following methods:



TOP

special_list_call

Call the special list

  $ok = special_list_call($key => $package);


TOP

special_list_clear

Clear the special list

  $ok = special_list_clear($key => $package);


TOP

special_list_register

Register the special list

  $ok = special_list_call($key => $package);

Notice that you need to register the package before it is loaded. If you register it after, Perl has already compiled the END blocks and there are no longer under your control.



TOP

See Also

mod_perl 2.0 documentation.



TOP

Copyright

mod_perl 2.0 and its core modules are copyrighted under The Apache Software License, Version 2.0.



TOP

Authors

The mod_perl development team and numerous contributors.






TOP
previous page: ModPerl::Const -- ModPerl Constantspage up: mod_perl 2.0 APInext page: ModPerl::MethodLookup -- Lookup mod_perl modules, objects and methods