Debian Codegraph @

tlj

raw
1 #!/usr/bin/perl -w
2
3 # $Id: tlj,v 1.4 2001/03/22 21:39:02 archon Exp $
4
5 use strict;
6 use LiveJournal;
7 use Data::Dumper;
8
9 # This file is an example of the basic use of LiveJournal.pm functionality.
10 # It probably won't work correctly unless certain sections are commented
11 # out or provided with valid data. It's just a script I use for debugging
12 # while writing the module. - archon
13
14 sub main {
15
16 =comment
17 my %hash = (
18 user => q/bogus/,
19 password => q/bogus/,
20 );
21
22 my $lj = LiveJournal->new(\%hash);
23
24 =cut
25 my $lj = LiveJournal::LiveJournalrc->new();
26
27 if ($lj) {
28
29 my %lhash = (
30 # getmoods => 0,
31 # getmenus => 1,
32 # getpickws => 1,
33 );
34
35 my $log = $lj->login(\%lhash);
36 $lj->parse_login($log);
37
38 # print Dumper $lj;
39
40 =comment
41 my $access = $lj->access();
42 print Dumper $access;
43
44 my $friend_group = $lj->friend_group();
45 print Dumper $friend_group;
46
47 my $friend_group_max = $lj->friend_group_max();
48 print Dumper $friend_group_max;
49
50 my $menu = $lj->menu();
51 print Dumper $menu;
52
53 my $mood = $lj->mood();
54 print Dumper $mood;
55
56 my $name = $lj->name();
57 print Dumper $name;
58
59 my $pic_keyword = $lj->pic_keyword();
60 print Dumper $pic_keyword;
61
62 =cut
63 my $friend = LiveJournal::Friend->new();
64 if ($friend) {
65
66 =comment
67 my $cf = $friend->check();
68 print Dumper $cf if $cf;
69
70 my %eghash = (
71 2 => {
72 name => 'halb',
73 }
74 );
75
76 my $eg = $friend->editgroups(\%eghash);
77 print Dumper $eg if $eg;
78
79 my $gfg = $friend->getgroups();
80 print Dumper $gfg if $gfg;
81
82 =cut
83 my ($gf) = $friend->get(1, 1);
84 if ($gf) {
85 $friend->parse($gf);
86 }
87 print Dumper $friend->friends();
88 =comment
89
90 my $aftg = $friend->add_friend_to_group("bogon", 2);
91 print Dumper $aftg;
92
93 my ($ig) = $friend->friends_by_group();
94 print Dumper $ig if $ig;
95
96 my ($nf) = $friend->numfriends();
97 print "Number of friends: $nf\n";
98
99 my ($fgm) = $friend->friend_group_max();
100 print "$fgm\n";
101
102 my @del = qw/2/;
103 my $dg = $friend->deletegroups(\@del);
104 print Dumper $dg if $dg;
105
106 my %fh = (
107 archon => {
108 fg => q/#000000/,
109 bg => q/#FFFFFF/,
110 },
111 );
112
113 my ($af) = $friend->edit(\%fh);
114 print Dumper $af if ($af);
115
116 my @fra;
117 push @fra, 'archon';
118
119 my ($rf) = $friend->remove(\@fra);
120 print Dumper $rf if $rf;
121
122 my @faa = qw/mayzie #668833 #AA8822/;
123 my ($af) = $friend->add(@faa);
124 print Dumper $af if $af;
125
126 =comment
127 my ($fo) = $friend->friendof();
128
129 if ($fo) {
130 $friend->parse($fo);
131 print Dumper $friend;
132 }
133 =cut
134 } else {
135 print "Couldn't make friends\n";
136 }
137
138 my $journal = LiveJournal::Journal->new();
139 if ($journal) {
140
141 =comment
142 my ($dc) = $journal->getdaycounts();
143 print Dumper $dc if $dc;
144
145 my ($si) = $journal->syncitems();
146 print Dumper $si if $si;
147
148 my %ghash = (
149 selecttype => 'lastn',
150 howmany => 1,
151 usejournal => 'colin',
152 );
153
154 my ($ge) = $journal->get(\%ghash);
155 print Dumper $ge if $ge;
156
157 my ($rp) = $journal->remove(\@id);
158 print Dumper $rp if $rp;
159
160
161 local $/ = undef;
162 my $content = <DATA>;
163 $/ = "\n";
164
165 local $/ = undef;
166 my $content = <DATA>;
167 $/ = "\n";
168 my %phash = (
169 event => $journal->escape($content),
170 subject => "LiveJournal.pm v1.4",
171 security => "public",
172 prop_current_moodid => 90,
173 prop_current_music => "Pearl Jam - Black",
174 usejournal => 'lj_perl',
175 );
176 my ($pe) = $journal->post(\%phash);
177 print Dumper $pe if $pe;
178
179 =comment
180 local $/ = undef;
181 my $content = <DATA>;
182 $/ = "\n";
183 my $itemid = 1915598;
184 my %ehash = (
185 itemid => $itemid,
186 event => $journal->escape($content),
187 usejournal => 'lj_dev',
188 subject => 'This is a new subject',
189 );
190 my $ee = $journal->edit(\%ehash);
191 print Dumper $ee if $ee;
192
193 =cut
194 }
195 } else {
196 die "Unable to establish connection with LiveJournal server.\n";
197 }
198 }
199
200 main();
201
202 __DATA__