File: moo-roles-into-moose-class-attr-override-with-autoclean.t

package info (click to toggle)
libmoo-perl 2.002005-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 856 kB
  • ctags: 192
  • sloc: perl: 2,561; makefile: 6
file content (38 lines) | stat: -rw-r--r-- 699 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
use Moo::_strictures;
use Test::More;
use lib "t/lib";
use InlineModule (
  MooRoleWithAttrWithAutoclean => q{
    package MooRoleWithAttrWithAutoclean;
    use Moo::Role;
    # Note that autoclean here is the key bit!
    # It causes the metaclass to be loaded and used before the 'has' fires
    # so Moo needs to blow it away again at that point so the attribute gets
    # added
    use namespace::autoclean;

    has output_to => (
        is => 'ro',
        required => 1,
    );

    1;
  },
);

{
  package Bax;
  use Moose;

  with qw/
    MooRoleWithAttrWithAutoclean
  /;


  has '+output_to' => (
      required => 1,
  );
}

pass 'classes and roles built without error';
done_testing;