line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# This code is a part of Slash, and is released under the GPL. |
2
|
|
|
|
|
|
|
# Copyright 1997-2005 by Open Source Technology Group. See README |
3
|
|
|
|
|
|
|
# and COPYING for more information, or see http://slashcode.com/. |
4
|
|
|
|
|
|
|
# $Id: Journal.pm,v 1.1 2005/11/21 17:31:47 pudge Exp $ |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
package Slash::Client::Journal; |
7
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
4425
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
36
|
|
9
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
31
|
|
10
|
|
|
|
|
|
|
|
11
|
1
|
|
|
1
|
|
6
|
use base 'Slash::Client'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
685
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
our $VERSION = 0.01; |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub new { |
16
|
1
|
|
|
1
|
0
|
27
|
my($class, $opts) = @_; |
17
|
|
|
|
|
|
|
|
18
|
1
|
|
|
|
|
10
|
my $self = $class->SUPER::new($opts); |
19
|
1
|
|
|
|
|
9
|
$self->{soap}{uri} = "$self->{http}://$self->{host}/Slash/Journal/SOAP"; |
20
|
1
|
|
|
|
|
5
|
$self->{soap}{proxy} = "$self->{http}://$self->{host}/journal.pl"; |
21
|
|
|
|
|
|
|
|
22
|
1
|
|
|
|
|
2
|
return $self; |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub _return_from_entry { |
26
|
0
|
|
|
0
|
|
0
|
my($self, $id, $list) = @_; |
27
|
|
|
|
|
|
|
|
28
|
0
|
0
|
|
|
|
0
|
if ($list) { |
29
|
0
|
|
|
|
|
0
|
my $entry = $self->get_entry($id); |
30
|
0
|
0
|
0
|
|
|
0
|
return($id, $entry->{url}) if $entry && $entry->{url}; |
31
|
|
|
|
|
|
|
} else { |
32
|
0
|
|
|
|
|
0
|
return $id; |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
0
|
|
|
|
|
0
|
return; |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
sub add_entry { |
39
|
0
|
|
|
0
|
1
|
0
|
my($self, $data) = @_; |
40
|
|
|
|
|
|
|
|
41
|
0
|
|
|
|
|
0
|
$data->{body} =~ s/\n/\012/g; # Local to Unix newlines, JIC |
42
|
|
|
|
|
|
|
|
43
|
0
|
|
|
|
|
0
|
my $id = 0; |
44
|
0
|
0
|
0
|
|
|
0
|
if ($data->{subject} && $data->{body}) { |
45
|
0
|
|
|
|
|
0
|
$id = $self->soap->add_entry($data)->result; |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
|
48
|
0
|
|
|
|
|
0
|
return $self->_return_from_entry($id, wantarray()); |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
sub modify_entry { |
52
|
0
|
|
|
0
|
1
|
0
|
my($self, $id, $data) = @_; |
53
|
|
|
|
|
|
|
|
54
|
0
|
|
|
|
|
0
|
$data->{body} =~ s/\n/\012/g; # Local to Unix newlines, JIC |
55
|
|
|
|
|
|
|
|
56
|
0
|
|
|
|
|
0
|
my $newid = 0; |
57
|
0
|
0
|
0
|
|
|
0
|
if ($data->{subject} && $data->{body} && $id) { |
|
|
|
0
|
|
|
|
|
58
|
0
|
|
|
|
|
0
|
$newid = $self->soap->modify_entry($id, $data)->result; |
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
|
61
|
0
|
|
|
|
|
0
|
return $self->_return_from_entry($id, wantarray()); |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
sub delete_entry { |
65
|
0
|
|
|
0
|
1
|
0
|
my($self, $id) = @_; |
66
|
|
|
|
|
|
|
|
67
|
0
|
|
|
|
|
0
|
return $self->soap->delete_entry($id)->result; |
68
|
|
|
|
|
|
|
} |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
sub get_entry { |
71
|
1
|
|
|
1
|
1
|
748
|
my($self, $id) = @_; |
72
|
|
|
|
|
|
|
|
73
|
1
|
|
|
|
|
11
|
return $self->soap->get_entry($id)->result; |
74
|
|
|
|
|
|
|
} |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
sub get_entries { |
77
|
0
|
|
|
0
|
1
|
|
my($self, $uid, $limit) = @_; |
78
|
|
|
|
|
|
|
|
79
|
0
|
|
|
|
|
|
return $self->soap->get_entries($uid, $limit)->result; |
80
|
|
|
|
|
|
|
} |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
1; |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
# http://use.perl.org/~pudge/journal/3294 |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
__END__ |