GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
Catalyst::Plugin::C3(3) User Contributed Perl Documentation Catalyst::Plugin::C3(3)

Catalyst::Plugin::C3 - Catalyst Plugin to subvert NEXT to use Class::C3

Use it in an application:

  package MyCatApp;
  use Catalyst qw/ -Debug C3 Static::Simple /;

Use it in another plugin:

  package Catalyst::Plugin::FooBar;
  use base qw/ Catalyst::Plugin::C3 /;

*** WARNING *** THIS MODULE IS STILL EXPERIMENTAL !!!

This module is related to the possible transition of Catalyst from NEXT to Class::C3. This transition hasn't happened yet, and might not for a while.

This module is only intended for use by Catalyst module developers at this time. You would know it if you should be using this module.

*** END WARNING ***

This module makes the use of the following idiom:

  use NEXT;

  sub foo {
    my $self = shift->NEXT::foo(@_);
  }

actually accomplish something more like:

  use Class::C3;

  sub foo {
    my $self = shift->next::method(@_);
  }

It does this by temporarily replacing "AUTOLOAD" in NEXT during the entire Catalyst request-handling phase. The behavior of the replacement function is dependant upon the class (or the class of the object) that NEXT was being called on.

If the class is not Catalyst-related, the function falls back to normal NEXT behavior. If the class is Catalyst-related, but its inheritance hierarchy is not C3-compatible, the function warns about the situation (once per class per interpreter) and again falls back to normal NEXT behavior.

If the class is both Catalyst-related and has a C3-compatible hierarchy, then NEXT calls are silently upgraded to their Class::C3 equivalents.

The difference between "$self->NEXT::foo()" and "$self->NEXT::ACTUAL::foo()" is preserved (the former becomes "maybe::next::method" and the latter becomes "next::method").

If you are going to place this module in your plugins list for a Catalyst app, it is best placed at the top of the list, above all other plugins.

Some other plugins may need require this plugin as a base-class in order to transition themselves to Class::C3 without worrying about being broken by other plugins which haven't made the transition. Most plugins will *not* need to do so. Any that do would have wierd hacks involving "*{NEXT::NEXT}" in them prior to their C3 conversion, so you'd know it.

In other words, a plugin should only base on this plugin if it needed NEXT hacks to work right under NEXT, and you're transitioning it to use Class::C3.

This plugin hooks into the "handle_request" method, sets up a "local" override of the standard version of "AUTOLOAD" in NEXT for the entire request.

Because calculating the MRO of every class every time ->NEXT::foo is used from within it is too expensive, runtime manipulations of @ISA are prohibited.

Brandon Black "blblack@gmail.com"

This program is free software, you can redistribute it and/or modify it under the same terms as Perl itself.
2007-06-04 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.