File: Server.pm

package info (click to toggle)
libcatalystx-simplelogin-perl 0.21-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 464 kB
  • sloc: perl: 3,134; makefile: 2
file content (30 lines) | stat: -rw-r--r-- 797 bytes parent folder | download | duplicates (6)
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
package TestAppBase::Script::Server;
use Moose;
use MooseX::Types::Moose qw/Str/;
use Moose::Util::TypeConstraints;
use namespace::autoclean;

extends 'Catalyst::Script::Server';

my $appname = do {
    my $re = q{^TestApp(|DBIC|OpenID|Redirect|RenderTT)$};
    subtype Str,
    where { /$re/ },
    message { "Application name must match /$re/" };
};

# FIXME
# Gross, but overriding NoGetopt with Getopt doesn't work
# right, and nor does +application_name with cmd_aliases
# (as Moose uses a white list of options you can change
# with has +).
__PACKAGE__->meta->remove_attribute('application_name');
has application_name => (
    isa => $appname,
    traits => [qw/Getopt/],
    cmd_aliases   => ['app', 'name'],
    is       => 'ro',
    required => 1,
);

__PACKAGE__->meta->make_immutable;