whitespace cleanup
[catagits/Catalyst-Runtime.git] / t / lib / CDICompatTestPlugin.pm
CommitLineData
85781ad7 1package CDICompatTestPlugin;
2
3# This plugin specificially tests an edge case of C::D::I compat,
4# where you load a plugin which creates an accessor with the same
5# name as a class data accessor (_config in this case)..
6
7# This is what happens if you use the authentication back-compat
8# stuff, as C::A::Plugin::Credential::Password is added to the plugin
9# list, and that uses base C::A::C::P class, does the mk_accessors.
10
88e5a8b0 11# If a class data method called _config hasn't been created in
85781ad7 12# MyApp ($app below), then our call to ->config gets our accessor
13# (rather than the class data one), and we fail..
14
15use strict;
16use warnings;
17use base qw/Class::Accessor::Fast/;
8a440eba 18use MRO::Compat;
85781ad7 19__PACKAGE__->mk_accessors(qw/_config/);
20
21sub setup {
22 my $app = shift;
23
24 $app->config;
8a440eba 25 $app->next::method(@_);
85781ad7 26}
27
df3ea11b 28# However, if we are too enthusiastic about adding accessors to the
88e5a8b0 29# MyApp package, then this method isn't called (as there is a local
df3ea11b 30# symbol already).
31
88e5a8b0 32# Note - use a different package here, so that Moose's
df3ea11b 33# package detection code doesn't get confused..
34$CDICompatTestPlugin::Data::HAS_RUN_SETUP_FINISHED = 0;
35
36sub setup_finished {
37 my $app = shift;
4e37bcd9 38 $CDICompatTestPlugin::Data::HAS_RUN_SETUP_FINISHED = 1;
df3ea11b 39 $app->next::method(@_);
40}
41
85781ad7 421;