File: tlj

package info (click to toggle)
liblivejournal-perl 1.3-7
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 256 kB
  • sloc: perl: 757; makefile: 4
file content (202 lines) | stat: -rwxr-xr-x 3,879 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
#!/usr/bin/perl -w

# $Id: tlj,v 1.4 2001/03/22 21:39:02 archon Exp $

use strict;
use LiveJournal;
use Data::Dumper;

# This file is an example of the basic use of LiveJournal.pm functionality.
# It probably won't work correctly unless certain sections are commented
# out or provided with valid data.  It's just a script I use for debugging
# while writing the module.              - archon

sub main {

=comment
	my %hash = (
		user => q/bogus/,
		password => q/bogus/,
	);

	my $lj = LiveJournal->new(\%hash);

=cut
	my $lj = LiveJournal::LiveJournalrc->new();

	if ($lj) {

		my %lhash = (
#				getmoods => 0,
#				getmenus => 1,
#				getpickws => 1,
		);

		my $log = $lj->login(\%lhash);
		$lj->parse_login($log);

#		print Dumper $lj;

=comment
		my $access = $lj->access();
		print Dumper $access;

		my $friend_group = $lj->friend_group();
		print Dumper $friend_group;

		my $friend_group_max = $lj->friend_group_max();
		print Dumper $friend_group_max;

		my $menu = $lj->menu();
		print Dumper $menu;

		my $mood = $lj->mood();
		print Dumper $mood;

		my $name = $lj->name();
		print Dumper $name;

		my $pic_keyword = $lj->pic_keyword();
		print Dumper $pic_keyword;

=cut
		my $friend = LiveJournal::Friend->new();
		if ($friend) {

=comment
			my $cf = $friend->check();
			print Dumper $cf if $cf;

			my %eghash = (
					2 => {
						name => 'halb',
					}
			);

			my $eg = $friend->editgroups(\%eghash);
			print Dumper $eg if $eg;

			my $gfg = $friend->getgroups();
			print Dumper $gfg if $gfg;

=cut
			my ($gf) = $friend->get(1, 1);
			if ($gf) {
				$friend->parse($gf);
			}
			print Dumper $friend->friends();
=comment			

			my $aftg = $friend->add_friend_to_group("bogon", 2);
			print Dumper $aftg;

			my ($ig) = $friend->friends_by_group();
			print Dumper $ig if $ig;

			my ($nf) = $friend->numfriends();
			print "Number of friends: $nf\n";
			
			my ($fgm) = $friend->friend_group_max();
			print "$fgm\n";

			my @del = qw/2/;
			my $dg = $friend->deletegroups(\@del);
			print Dumper $dg if $dg;

			my %fh = (
					archon => {
						fg => q/#000000/,
						bg => q/#FFFFFF/,
					},
			);

			my ($af) = $friend->edit(\%fh);
			print Dumper $af if ($af);

			my @fra;
			push @fra, 'archon';

			my ($rf) = $friend->remove(\@fra);
			print Dumper $rf if $rf;

			my @faa = qw/mayzie #668833 #AA8822/;
			my ($af) = $friend->add(@faa);
			print Dumper $af if $af;

=comment
			my ($fo) = $friend->friendof();

			if ($fo) {
				$friend->parse($fo);
				print Dumper $friend;
			}
=cut
		} else {
			print "Couldn't make friends\n";
		}

		my $journal = LiveJournal::Journal->new();
		if ($journal) {

=comment
			my ($dc) = $journal->getdaycounts();
			print Dumper $dc if $dc;

			my ($si) = $journal->syncitems();
			print Dumper $si if $si;

			my %ghash = (
					selecttype => 'lastn',
					howmany => 1,
					usejournal => 'colin',
			);

			my ($ge) = $journal->get(\%ghash);
			print Dumper $ge if $ge;

			my ($rp) = $journal->remove(\@id);
			print Dumper $rp if $rp;


			local $/ = undef;
			my $content = <DATA>;
			$/ = "\n";

			local $/ = undef;
			my $content = <DATA>;
			$/ = "\n";
			my %phash = (
					event => $journal->escape($content),
					subject => "LiveJournal.pm v1.4",
					security => "public",
					prop_current_moodid => 90,
					prop_current_music => "Pearl Jam - Black",
					usejournal => 'lj_perl',
			);
			my ($pe) = $journal->post(\%phash);
			print Dumper $pe if $pe;

=comment
			local $/ = undef;
			my $content = <DATA>;
			$/ = "\n";
			my $itemid = 1915598;
			my %ehash = (
					itemid => $itemid,
					event => $journal->escape($content),
					usejournal => 'lj_dev',
					subject => 'This is a new subject',
			);
			my $ee = $journal->edit(\%ehash);
			print Dumper $ee if $ee;

=cut
		}
	} else {
		die "Unable to establish connection with LiveJournal server.\n";
	}
}

main();

__DATA__