JOAP/Proxy/Package.pm

filter: Statementstmt 88.2% 15 / 17 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 6 / 6 Podpod n/a totaltotal 91.3% 21 / 23 CC 1 SCAR 0.5
CC
1
Cov
88%
BEGIN
1.3
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« JOAP/Proxy/Error.pm ↑ Summary JOAP/Server/Object.pm »
1 # JOAP::Proxy::Package -- Classes that use JOAP
2 #
3 # Copyright (c) 2003, Evan Prodromou <evan@prodromou.san-francisco.ca.us>
4 #
5 # This library is free software; you can redistribute it and/or
6 # modify it under the terms of the GNU Lesser General Public
7 # License as published by the Free Software Foundation; either
8 # version 2.1 of the License, or (at your option) any later version.
9 #
10 # This library is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 # Lesser General Public License for more details.
14 #
15 # You should have received a copy of the GNU Lesser General Public
16 # License along with this library; if not, write to the Free Software
17 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18  
19 # tag: JOAP package base class
20  
21 package JOAP::Proxy::Package;
22 1 ▶use Class::Data::Inheritable;
Subroutine BEGIN: called CC=1 SCAR=0.0
23 1 ▶use base qw/Exporter Class::Data::Inheritable/;
Subroutine BEGIN: called CC=1 SCAR=0.0
24  
25 1 ▶use 5.008;
Subroutine BEGIN: called CC=1 SCAR=0.0
26 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
27 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
28 0 ▶use JOAP::Proxy::Error;
Subroutine BEGIN: called CC=1 SCAR=2.6
29  
30 our %EXPORT_TAGS = ( 'all' => [ qw// ] );
31 our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } );
32 our @EXPORT = qw//;
33  
34 our $VERSION = $JOAP::VERSION;
35 our $AUTOLOAD;
36  
37 JOAP::Proxy::Package->mk_classdata('Attributes');
38 JOAP::Proxy::Package->mk_classdata('Methods');
39 JOAP::Proxy::Package->mk_classdata('Timestamp');
40 JOAP::Proxy::Package->mk_classdata('Description');
41  
42 JOAP::Proxy::Package->Methods({});
43 JOAP::Proxy::Package->Attributes({});
44 JOAP::Proxy::Package->Timestamp(undef);
45 JOAP::Proxy::Package->Description('');
46  
47 # when describe stuff happens, we want to store it in the package
48 # rather than in the instance.
49  
50 sub attributes {
51 my $self = shift;
52 return $self->Attributes(@_);
53 }
54  
55 sub methods {
56 my $self = shift;
57 return $self->Methods(@_);
58 }
59  
60 sub timestamp {
61 my $self = shift;
62 return $self->Timestamp(@_);
63 }
64  
65 sub _set_timestamp {
66 my $self = shift;
67 return $self->Timestamp(@_);
68 }
69  
70 sub description {
71 my $self = shift;
72 return $self->Description(@_);
73 }
74  
75 sub _set_description {
76 my $self = shift;
77 return $self->Description(@_);
78 }
79  
80 # when we autoload, we want to cache the results in the package
81 # namespace.
82  
83 sub AUTOLOAD {
84  
85 my ($self) = $_[0];
86 my ($sub) = $AUTOLOAD;
87  
88 my ($pkg,$name) = ($sub =~ /(.*)::([^:]+)$/);
89 my ($func) = $self->can($name);
90  
91 if ($func) {
92 no strict 'refs';
93 *$sub = $func;
94 goto &$sub;
95 } else {
96 throw JOAP::Proxy::Error::Local("No attribute or method '$name'");
97 }
98 }
99  
100 1;
101 __END__
« JOAP/Proxy/Error.pm ↑ Summary JOAP/Server/Object.pm »