line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package OpenPlugin::Param; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
# $Id: Param.pm,v 1.16 2003/04/03 01:51:24 andreychek Exp $ |
4
|
|
|
|
|
|
|
|
5
|
2
|
|
|
2
|
|
12
|
use strict; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
76
|
|
6
|
2
|
|
|
2
|
|
11
|
use base qw( OpenPlugin::Plugin ); |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
7649
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
$OpenPlugin::Param::VERSION = sprintf("%d.%02d", q$Revision: 1.16 $ =~ /(\d+)\.(\d+)/); |
9
|
|
|
|
|
|
|
|
10
|
36
|
|
|
36
|
0
|
194
|
sub OP { return $_[0]->{_m}{OP} } |
11
|
0
|
|
|
0
|
0
|
0
|
sub type { return 'param' } |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
*get = \*get_incoming; |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
# Retrieve GET/POST parameters |
16
|
|
|
|
|
|
|
sub get_incoming { |
17
|
1
|
|
|
1
|
0
|
2
|
my ( $self, $name ) = @_; |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
# Just return a list of available parameters |
20
|
1
|
50
|
|
|
|
4
|
unless ( $name ) { |
21
|
0
|
|
|
|
|
0
|
return ( ref $self->state->{param} eq 'HASH' ) |
22
|
0
|
0
|
|
|
|
0
|
? keys %{ $self->state->{param} } : (); |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
# This parameter has a list of values |
26
|
1
|
50
|
33
|
|
|
3
|
if ( ref $self->state->{param}{ $name } eq 'ARRAY' and wantarray ) { |
27
|
0
|
|
|
|
|
0
|
return @{ $self->state->{param}{ $name } }; |
|
0
|
|
|
|
|
0
|
|
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
# Return a single parameter |
31
|
1
|
|
|
|
|
4
|
return $self->state->{param}{ $name }; |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub set_incoming { |
36
|
1
|
|
|
1
|
0
|
4
|
my ( $self, @args ) = @_; |
37
|
1
|
50
|
|
|
|
10
|
return undef unless ( $args[0] ); |
38
|
|
|
|
|
|
|
|
39
|
1
|
50
|
|
|
|
5
|
if( ref $args[0] eq 'HASH' ) { |
40
|
0
|
|
|
|
|
0
|
foreach my $arg ( keys %{ $args[0] } ) { |
|
0
|
|
|
|
|
0
|
|
41
|
0
|
|
|
|
|
0
|
$self->state->{ param }{ $arg } = $args[0]->{ $arg }; |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
else { |
45
|
1
|
|
|
|
|
18
|
$self->state->{ param }{ $args[0] } = $args[1]; |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
1; |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
__END__ |