File Coverage

blib/lib/Repository/Simple/Permission.pm
Criterion Covered Total %
statement 10 12 83.3
branch n/a
condition n/a
subroutine 4 4 100.0
pod n/a
total 14 16 87.5


line stmt bran cond sub pod time code
1             package Repository::Simple::Permission;
2              
3 1     1   8387 use strict;
  1         3  
  1         42  
4 1     1   6 use warnings;
  1         2  
  1         47  
5              
6             our $VERSION = '0.06';
7              
8 1     1   801 use Repository::Simple::Util;
  1         3  
  1         70  
9              
10             our @CARP_NOT = qw( Repository::Simple::Util );
11              
12             =head1 NAME
13              
14             Repository::Simple::Permission - Defines the permission constants
15              
16             =head1 SYNOPSIS
17              
18             # Automatically imports all permission constants
19             use Repository::Simple::Permission;
20              
21             $repository->check_permission('/foo/bar', $READ);
22             $repository->check_permission('/foo/bar', $ADD_NODE);
23             $repository->check_permission('/foo/bar', $SET_PROPERTY);
24             $repository->check_permission('/foo/bar', $REMOVE);
25              
26             # Just import some of them
27             use Repository::Simple::Permission qw( $READ $SET_PROPERTY );
28              
29             $repository->check_permission('/foo/bar', $READ);
30             $repository->check_permission('/foo/bar', $SET_PROPERTY);
31              
32             # Or use constants by full name
33             use Repository::Simple::Permission qw
34              
35             $repository->check_permission('/foo/bar',
36             $Repository::Simple::Permission::READ);
37             $repository->check_permission('/foo/bar',
38             $Repository::Simple::Permission::ADD_NODE);
39             $repository->check_permission('/foo/bar',
40             $Repository::Simple::Permission::$SET_PROPERTY);
41             $repository->check_permission('/foo/bar',
42             $Repository::Simple::Permission::REMOVE);
43              
44             =head1 DESCRIPTION
45              
46             This class defines the permission constants.
47              
48             =cut
49              
50 1     1   492 use Readonly;
  0            
  0            
51             require Exporter;
52              
53             our @ISA = qw( Exporter );
54              
55             our @EXPORT = qw( $ADD_NODE $SET_PROPERTY $READ $REMOVE );
56              
57             Readonly our $ADD_NODE => 'add_node';
58             Readonly our $SET_PROPERTY => 'set_property';
59             Readonly our $REMOVE => 'remove';
60             Readonly our $READ => 'read';
61              
62             =head1 AUTHOR
63              
64             Andrew Sterling Hanenkamp, Ehanenkamp@cpan.orgE
65              
66             =head1 LICENSE AND COPYRIGHT
67              
68             Copyright 2006 Andrew Sterling Hanenkamp Ehanenkamp@cpan.orgE. All
69             Rights Reserved.
70              
71             This module is free software; you can redistribute it and/or modify it under
72             the same terms as Perl itself. See L.
73              
74             This program is distributed in the hope that it will be useful, but WITHOUT
75             ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
76             FOR A PARTICULAR PURPOSE.
77              
78             =cut
79              
80             1