| 1 | package LJ::Schedule::Post::Simple; | ||
| 2 | |||
| 3 | 2 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | 2 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | |||
| 6 | 2 | ▶ | use base qw(LJ::Schedule::Post); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 7 | |||
| 8 | 0 | ▶ | use LJ::Simple; |
|
Subroutine
BEGIN: called CC=1 SCAR=2.6
| |||
| 9 | |||
| 10 | =head1 NAME | ||
| 11 | |||
| 12 | LJ::Schedule::Post::Simple - The default LJ::Schedule posting component. | ||
| 13 | |||
| 14 | =head1 VERSION | ||
| 15 | |||
| 16 | Version 0.6 | ||
| 17 | |||
| 18 | =cut | ||
| 19 | |||
| 20 | our $VERSION = '0.6'; | ||
| 21 | |||
| 22 | =head1 SYNOPSIS | ||
| 23 | |||
| 24 | This module is used internally by LJ::Schedule, and shouldn't need to be | ||
| 25 | used directly. | ||
| 26 | |||
| 27 | =head1 AUTHOR | ||
| 28 | |||
| 29 | Ben Evans, C<< <ben at bpfh.net> >> | ||
| 30 | |||
| 31 | =head1 BUGS | ||
| 32 | |||
| 33 | Please report any bugs or feature requests to | ||
| 34 | C<bug-lj-schedule-post-simple at rt.cpan.org>, or through the web interface at | ||
| 35 | L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=LJ-Schedule>. | ||
| 36 | I will be notified, and then you'll automatically be notified of progress on | ||
| 37 | your bug as I make changes. | ||
| 38 | |||
| 39 | =head1 SUPPORT | ||
| 40 | |||
| 41 | You can find documentation for this module with the perldoc command. | ||
| 42 | |||
| 43 | perldoc LJ::Schedule | ||
| 44 | |||
| 45 | You can also look for information at: | ||
| 46 | |||
| 47 | =over 4 | ||
| 48 | |||
| 49 | =item * AnnoCPAN: Annotated CPAN documentation | ||
| 50 | |||
| 51 | L<http://annocpan.org/dist/LJ-Schedule> | ||
| 52 | |||
| 53 | =item * CPAN Ratings | ||
| 54 | |||
| 55 | L<http://cpanratings.perl.org/d/LJ-Schedule> | ||
| 56 | |||
| 57 | =item * RT: CPAN's request tracker | ||
| 58 | |||
| 59 | L<http://rt.cpan.org/NoAuth/Bugs.html?Dist=LJ-Schedule> | ||
| 60 | |||
| 61 | =item * Search CPAN | ||
| 62 | |||
| 63 | L<http://search.cpan.org/dist/LJ-Schedule> | ||
| 64 | |||
| 65 | =back | ||
| 66 | |||
| 67 | =head1 ACKNOWLEDGEMENTS | ||
| 68 | |||
| 69 | =head1 COPYRIGHT & LICENSE | ||
| 70 | |||
| 71 | Copyright 2006 Ben Evans, all rights reserved. | ||
| 72 | |||
| 73 | This program is free software; you can redistribute it and/or modify it | ||
| 74 | under the same terms as Perl itself. | ||
| 75 | |||
| 76 | =cut | ||
| 77 | |||
| 78 | # | ||
| 79 | # Default constructor | ||
| 80 | # | ||
| 81 | sub new { | ||
| 82 | my ($pkg, $params) = @_; | ||
| 83 | my $self = {}; | ||
| 84 | |||
| 85 | $self = $params if (ref($params) eq 'HASH'); | ||
| 86 | bless $self, $pkg; | ||
| 87 | |||
| 88 | return $self; | ||
| 89 | } | ||
| 90 | |||
| 91 | # | ||
| 92 | # Actually does the post | ||
| 93 | # | ||
| 94 | sub post_cal { | ||
| 95 | my $self = shift; | ||
| 96 | my $cal = shift; | ||
| 97 | |||
| 98 | my $post_content = $self->output_cal_for_lj($cal); | ||
| 99 | |||
| 100 | # print STDERR "In post_cal(): \n-------\n", $post_content, "\n\n"; | ||
| 101 | |||
| 102 | my $rh_res = {}; | ||
| 103 | |||
| 104 | my %lj_params = ( | ||
| 105 | user => $LJ::Schedule::CONFIG->{'private.user'}, | ||
| 106 | pass => $LJ::Schedule::CONFIG->{'private.pass'}, | ||
| 107 | entry => $post_content, | ||
| 108 | subject => $LJ::Schedule::CONFIG->{'entry.subject'}, | ||
| 109 | html => 1, | ||
| 110 | protect => $LJ::Schedule::CONFIG->{'entry.protect'}, | ||
| 111 | results => $rh_res, | ||
| 112 | ); | ||
| 113 | |||
| 114 | if (scalar(@{$LJ::Schedule::TAGS}) > 0) { | ||
| 115 | %lj_params = (%lj_params, 'tags' => $LJ::Schedule::TAGS); | ||
| 116 | } | ||
| 117 | |||
| 118 | my $post_ok = LJ::Simple::QuickPost(%lj_params) || die "$0: Failed to post entry: $LJ::Simple::error\n"; | ||
| 119 | |||
| 120 | # Currently unimplemented - will do if wanted | ||
| 121 | # mood => Current mood | ||
| 122 | # music => Current music | ||
| 123 | # groups => Friends groups list | ||
| 124 | |||
| 125 | |||
| 126 | return $post_ok; | ||
| 127 | } | ||
| 128 | |||
| 129 | |||
| 130 | 1; # End of LJ::Schedule::Post::Simple | ||