line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# $Id: Object.pm,v 1.16 2008/03/03 16:55:04 asc Exp $ |
2
|
1
|
|
|
1
|
|
5
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
136
|
|
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
package Net::Delicious::Object; |
5
|
|
|
|
|
|
|
$Net::Delicious::Object::VERSION = '1.14'; |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
=head1 NAME |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
Net::Delicious::Object - base class for Net::Delicious thingies |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
=head1 SYNOPSIS |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
package Net::Delicious::TunaBlaster; |
14
|
|
|
|
|
|
|
use base qw (Net::Delicious::Object); |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
=head1 DESCRIPTION |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
Base class for Net::Delicious thingies. You should never access this |
19
|
|
|
|
|
|
|
package directly. |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
=cut |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub new { |
24
|
0
|
|
|
0
|
0
|
|
my $pkg = shift; |
25
|
0
|
|
|
|
|
|
my $args = shift; |
26
|
|
|
|
|
|
|
|
27
|
0
|
|
|
|
|
|
my @keys = keys %$args; |
28
|
|
|
|
|
|
|
|
29
|
0
|
|
|
|
|
|
my $self = bless \%{$args}, $pkg; |
|
0
|
|
|
|
|
|
|
30
|
0
|
|
|
|
|
|
$self->{'__properties'} = \@keys; |
31
|
|
|
|
|
|
|
|
32
|
0
|
|
|
|
|
|
my $class = ref($self); |
33
|
|
|
|
|
|
|
|
34
|
0
|
|
|
|
|
|
foreach my $meth (@keys) { |
35
|
|
|
|
|
|
|
|
36
|
0
|
0
|
|
|
|
|
if (! $self->can($meth)) { |
37
|
|
|
|
|
|
|
|
38
|
1
|
|
|
1
|
|
13
|
no strict "refs"; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
207
|
|
39
|
|
|
|
|
|
|
|
40
|
0
|
|
|
|
|
|
*{ $class . "::" . $meth } = sub { |
41
|
0
|
|
|
0
|
|
|
my $instance = shift; |
42
|
0
|
|
|
|
|
|
return $instance->{$meth}; |
43
|
0
|
|
|
|
|
|
}; |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
0
|
|
|
|
|
|
return $self; |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
sub as_hashref { |
51
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
52
|
0
|
|
|
|
|
|
return {$self->_mk_hash()}; |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
sub _mk_hash { |
56
|
0
|
|
|
0
|
|
|
my $self = shift; |
57
|
|
|
|
|
|
|
|
58
|
0
|
|
|
|
|
|
my %hash = map { |
59
|
0
|
|
|
|
|
|
$_ => $self->{$_}; |
60
|
0
|
|
|
|
|
|
} @{$self->{'__properties'}}; |
61
|
|
|
|
|
|
|
|
62
|
0
|
|
|
|
|
|
return %hash; |
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=head1 VERSION |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
1.13 |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=head1 DATE |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
$Date: 2008/03/03 16:55:04 $ |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=head1 AUTHOR |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
Aaron Straup Cope Eascope@cpan.orgE |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=head1 LICENSE |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
Copyright (c) 2004-2008 Aaron Straup Cope. All rights reserved. |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
This is free software, you may use it and distribute it under the |
82
|
|
|
|
|
|
|
same terms as Perl itself. |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=cut |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
return 1; |