summaryrefslogtreecommitdiff
path: root/usr/src/libpiny/lib/Piny/User/IkiWiki.pm
blob: 8585e90ecdf17287d68f08ed056c422809b643e1 (plain)
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
# Copyright © 2010 Julian Blake Kongslie <jblake@omgwallhack.org>
# Licensed under the BSD 3-clause license.

use strict;
use warnings;

package Piny::User::IkiWiki;

use Moose;
use Moose::Util::TypeConstraints;
use MooseX::StrictConstructor;

use Piny::User;

extends "Piny::User";

# Types

subtype 'IkiWikiUsername'
  => as 'Str'
  => where { $_ =~ /^ikiwiki-[a-zA-Z][a-zA-Z0-9_.-]*$/ }
  => message { 'That username is not in the correct format for an ikiwiki user.' }
  ;

# Attributes

has 'name' =>
  ( is          => 'ro'
  , isa         => 'IkiWikiUsername'
  , lazy_build  => 1
  );

# Moose boilerplate

__PACKAGE__->meta->make_immutable;

1;