fix the order of init_meta calls, when nesting
[gitmo/Moose.git] / t / metaclasses / exporter_meta_lookup.t
CommitLineData
58c2edea 1#!/usr/bin/perl
2
3use strict;
4use warnings;
5
6use Test::More;
7use Test::Fatal;
8
9{
10 package Class::Vacuum::Innards;
11 use Moose;
12
13 package Class::Vacuum;
14 use Moose ();
15 use Moose::Exporter;
16
17 BEGIN {
18 Moose::Exporter->setup_import_methods(
19 also => 'Moose',
20 meta_lookup => sub { Class::MOP::class_of('Class::Vacuum::Innards') },
21 );
22 }
23}
24
25{
26 package Victim;
27 BEGIN { Class::Vacuum->import };
28
29 has star_rod => (
30 is => 'ro',
31 );
32}
33
34ok(Class::Vacuum::Innards->can('star_rod'), 'Vacuum stole the star_rod method');
35ok(!Victim->can('star_rod'), 'Victim does not get it at all');
36
37done_testing;
38