| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Net::LDAP::Batch::Action; |
|
2
|
3
|
|
|
3
|
|
19
|
use strict; |
|
|
3
|
|
|
|
|
7
|
|
|
|
3
|
|
|
|
|
96
|
|
|
3
|
3
|
|
|
3
|
|
16
|
use warnings; |
|
|
3
|
|
|
|
|
7
|
|
|
|
3
|
|
|
|
|
71
|
|
|
4
|
3
|
|
|
3
|
|
38
|
use Carp; |
|
|
3
|
|
|
|
|
6
|
|
|
|
3
|
|
|
|
|
206
|
|
|
5
|
3
|
|
|
3
|
|
18
|
use base qw( Class::Accessor::Fast ); |
|
|
3
|
|
|
|
|
6
|
|
|
|
3
|
|
|
|
|
1591
|
|
|
6
|
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = '0.02'; |
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
__PACKAGE__->mk_accessors(qw( ldap entry complete debug )); |
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
=head1 NAME |
|
12
|
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
Net::LDAP::Batch::Action - base class for LDAP actions |
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
16
|
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
use Net::LDAP::Batch::Action; |
|
18
|
|
|
|
|
|
|
my $action = Net::LDAP::Batch::Action->new( |
|
19
|
|
|
|
|
|
|
{ |
|
20
|
|
|
|
|
|
|
ldap => $net_ldap_object, |
|
21
|
|
|
|
|
|
|
}); |
|
22
|
|
|
|
|
|
|
$action->execute or $action->rollback; |
|
23
|
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
26
|
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
This is a base class for batch actions. |
|
28
|
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
B Net::LDAP::Batch::Action objects will croak() if anything |
|
30
|
|
|
|
|
|
|
unusual happens. This approach assumes that Catastrophic Failure is a |
|
31
|
|
|
|
|
|
|
Good Thing. So use eval() if you need to catch exceptions. |
|
32
|
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
=head1 METHODS |
|
34
|
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
=head2 new( I ) |
|
36
|
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
Overrides base Class::Accessor::Fast constructor to call init(). |
|
38
|
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
This class defines the following accessor methods, all of which |
|
40
|
|
|
|
|
|
|
can be set via new() or by themselves. |
|
41
|
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
=over |
|
43
|
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=item |
|
45
|
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
ldap |
|
47
|
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=item |
|
49
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
entry |
|
51
|
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=item |
|
53
|
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
complete |
|
55
|
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=item |
|
57
|
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
debug |
|
59
|
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=back |
|
61
|
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=cut |
|
63
|
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
sub new { |
|
65
|
3
|
|
|
3
|
1
|
6
|
my $class = shift; |
|
66
|
3
|
|
|
|
|
24
|
my $self = $class->SUPER::new(@_); |
|
67
|
3
|
|
|
|
|
79
|
$self->init; |
|
68
|
3
|
|
|
|
|
20
|
return $self; |
|
69
|
|
|
|
|
|
|
} |
|
70
|
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=head2 init |
|
72
|
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
Confirms that the ldap() accessor returns a Net::LDAP-derived object. |
|
74
|
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
=cut |
|
76
|
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
sub init { |
|
78
|
3
|
|
|
3
|
1
|
4
|
my $self = shift; |
|
79
|
3
|
50
|
33
|
|
|
21
|
if ( !$self->ldap or !$self->ldap->isa('Net::LDAP') ) { |
|
80
|
0
|
|
|
|
|
0
|
croak "Net::LDAP object required"; |
|
81
|
|
|
|
|
|
|
} |
|
82
|
3
|
50
|
|
|
|
96
|
$self->debug(1) if $ENV{PERL_DEBUG}; |
|
83
|
3
|
|
|
|
|
6
|
return $self; |
|
84
|
|
|
|
|
|
|
} |
|
85
|
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
=head2 execute |
|
87
|
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
Perform the action. Default behaviour is to croak indicating |
|
89
|
|
|
|
|
|
|
you must override the method in your subclass. |
|
90
|
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
=cut |
|
92
|
|
|
|
|
|
|
|
|
93
|
0
|
|
|
0
|
1
|
|
sub execute { croak "must override execute()" } |
|
94
|
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
=head2 rollback |
|
96
|
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
Undo the action. Default behaviour is to croak indicating you |
|
98
|
|
|
|
|
|
|
must override the method in your subclass. |
|
99
|
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
=cut |
|
101
|
|
|
|
|
|
|
|
|
102
|
0
|
|
|
0
|
1
|
|
sub rollback { croak "must override rollback()" } |
|
103
|
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
=head2 get_ldap_err( I ) |
|
105
|
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
Returns the stringified error message for the I object. |
|
107
|
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
=cut |
|
109
|
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
sub get_ldap_err { |
|
111
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
112
|
0
|
0
|
|
|
|
|
my $msg = shift or croak "ldap_msg required"; |
|
113
|
0
|
|
|
|
|
|
my $str = "\n" |
|
114
|
|
|
|
|
|
|
. join( "\n", |
|
115
|
|
|
|
|
|
|
"Return code: " . $msg->code, |
|
116
|
|
|
|
|
|
|
"Message: " . $msg->error_name, |
|
117
|
|
|
|
|
|
|
" :" . $msg->error_text, |
|
118
|
|
|
|
|
|
|
"MessageID: " . $msg->mesg_id, |
|
119
|
|
|
|
|
|
|
"DN: " . $msg->dn, |
|
120
|
|
|
|
|
|
|
) . "\n"; |
|
121
|
0
|
|
|
|
|
|
return $str; |
|
122
|
|
|
|
|
|
|
} |
|
123
|
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
1; |
|
125
|
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
__END__ |