| 1 | ########################################################### | ||
| 2 | # SIOC::User | ||
| 3 | # User class for the SIOC ontology | ||
| 4 | ########################################################### | ||
| 5 | # | ||
| 6 | # $Id: User.pm 10 2008-03-01 21:38:39Z geewiz $ | ||
| 7 | # | ||
| 8 | |||
| 9 | package SIOC::User; | ||
| 10 | |||
| 11 | 3 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 12 | 3 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 13 | 3 | ▶ | use Carp; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 14 | 3 | ▶ | use Data::Dumper qw( Dumper ); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 15 | |||
| 16 | 3 | ▶ | use version; our $VERSION = qv(1.0.0); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 17 | |||
| 18 | 3 | ▶ | use Moose; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 19 | 3 | ▶ | use MooseX::AttributeHelpers; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 20 | |||
| 21 | 3 | extends 'SIOC'; | |
| 22 | |||
| 23 | ### required attributes | ||
| 24 | |||
| 25 | 3 | has 'email' => ( | |
| 26 | isa => 'Str', | ||
| 27 | is => 'rw', | ||
| 28 | required => 1, | ||
| 29 | ); | ||
| 30 | |||
| 31 | 3 | has 'foaf_uri' => ( | |
| 32 | isa => 'Str', | ||
| 33 | is => 'rw', | ||
| 34 | required => 1, | ||
| 35 | ); | ||
| 36 | |||
| 37 | ### optional attributes | ||
| 38 | |||
| 39 | 3 | has 'email_sha1' => ( | |
| 40 | isa => 'Str', | ||
| 41 | is => 'rw', | ||
| 42 | ); | ||
| 43 | |||
| 44 | 3 | has 'account_of' => ( | |
| 45 | is => 'rw', | ||
| 46 | ); | ||
| 47 | |||
| 48 | 3 | has 'avatar' => ( | |
| 49 | is => 'rw', | ||
| 50 | ); | ||
| 51 | |||
| 52 | 3 | has 'function' => ( | |
| 53 | isa => 'ArrayRef[SIOC::Role]', | ||
| 54 | metaclass => 'Collection::Array', | ||
| 55 | is => 'rw', | ||
| 56 | provides => { | ||
| 57 | 'push' => 'add_function', | ||
| 58 | }, | ||
| 59 | ); | ||
| 60 | |||
| 61 | 3 | has 'usergroups' => ( | |
| 62 | isa => 'ArrayRef[SIOC::Usergroup]', | ||
| 63 | metaclass => 'Collection::Array', | ||
| 64 | is => 'rw', | ||
| 65 | provides => { | ||
| 66 | 'push' => 'add_usergroup', | ||
| 67 | }, | ||
| 68 | ); | ||
| 69 | |||
| 70 | 3 | has 'created_items' => ( | |
| 71 | isa => 'ArrayRef[SIOC::Item]', | ||
| 72 | metaclass => 'Collection::Array', | ||
| 73 | is => 'rw', | ||
| 74 | provides => { | ||
| 75 | 'push' => 'add_created_forum', | ||
| 76 | }, | ||
| 77 | ); | ||
| 78 | |||
| 79 | 3 | has 'modified_items' => ( | |
| 80 | isa => 'ArrayRef[SIOC::Item]', | ||
| 81 | metaclass => 'Collection::Array', | ||
| 82 | is => 'rw', | ||
| 83 | provides => { | ||
| 84 | 'push' => 'add_modified_forum', | ||
| 85 | }, | ||
| 86 | ); | ||
| 87 | |||
| 88 | 3 | has 'administered_sites' => ( | |
| 89 | isa => 'ArrayRef[SIOC::Site]', | ||
| 90 | metaclass => 'Collection::Array', | ||
| 91 | is => 'rw', | ||
| 92 | provides => { | ||
| 93 | 'push' => 'add_administered_site', | ||
| 94 | }, | ||
| 95 | ); | ||
| 96 | |||
| 97 | 3 | has 'moderated_forums' => ( | |
| 98 | isa => 'ArrayRef[SIOC::Forum]', | ||
| 99 | metaclass => 'Collection::Array', | ||
| 100 | is => 'rw', | ||
| 101 | provides => { | ||
| 102 | 'push' => 'add_moderated_forum', | ||
| 103 | }, | ||
| 104 | ); | ||
| 105 | |||
| 106 | 3 | has 'owned_containers' => ( | |
| 107 | isa => 'ArrayRef[SIOC::Container]', | ||
| 108 | metaclass => 'Collection::Array', | ||
| 109 | is => 'rw', | ||
| 110 | provides => { | ||
| 111 | 'push' => 'add_owned_container', | ||
| 112 | }, | ||
| 113 | ); | ||
| 114 | |||
| 115 | has 'subscriptions' => ( | ||
| 116 | isa => 'ArrayRef[SIOC::Container]', | ||
| 117 | metaclass => 'Collection::Array', | ||
| 118 | is => 'rw', | ||
| 119 | 0 | ▶ | default => sub { [] }, |
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||
| 120 | 3 | provides => { | |
| 121 | 'push' => 'add_subscription', | ||
| 122 | }, | ||
| 123 | ); | ||
| 124 | |||
| 125 | ### methods | ||
| 126 | |||
| 127 | 0 | ▶ | after 'fill_template' => sub { |
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||
| 128 | 0 | my ($self) = @_; | |
| 129 | |||
| 130 | 0 | $self->set_template_var(name => $self->name); | |
| 131 | 0 | $self->set_template_var(email => $self->email); | |
| 132 | 0 | $self->set_template_var(foaf_uri => $self->foaf_uri); | |
| 133 | 0 | $self->set_template_var(email_sha1 => $self->email_sha1); | |
| 134 | 0 | $self->set_template_var(avatar => $self->avatar); | |
| 135 | 3 | }; | |
| 136 | |||
| 137 | 3 | 1; | |
| 138 | |||
| 139 | __DATA__ | ||