File: Types.pm

package info (click to toggle)
libmason-perl 2.24-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 748 kB
  • sloc: perl: 4,882; makefile: 7
file content (22 lines) | stat: -rw-r--r-- 677 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
package Mason::Types;
$Mason::Types::VERSION = '2.24';
use Moose::Util::TypeConstraints;
use strict;
use warnings;

subtype 'Mason::Types::CompRoot' => as 'ArrayRef[Str]';
coerce 'Mason::Types::CompRoot' => from 'Str' => via { [$_] };

subtype 'Mason::Types::OutMethod' => as 'CodeRef';
coerce 'Mason::Types::OutMethod' => from 'ScalarRef' => via {
    my $ref = $_;
    sub { $$ref .= $_[0] }
};

subtype 'Mason::Types::RegexpRefOrStr' => as 'RegexpRef';
coerce 'Mason::Types::RegexpRefOrStr' => from 'Str' => via { qr/$/ };

subtype 'Mason::Types::Autoextend' => as 'ArrayRef[Str]';
coerce 'Mason::Types::Autoextend' => from 'Bool' => via { $_ ? [ '.mp', '.mc' ] : [] };

1;