| 1 | package Net::Twitter::Cabal::Tweet; | ||
| 2 | #use Moose; | ||
| 3 | |||
| 4 | #has 'id' => ( is => 'ro', isa => 'Int' ); | ||
| 5 | #has 'content' => ( is => 'rw', isa => 'Str', required => 1 ); | ||
| 6 | #has 'poster' => ( is => 'ro', isa => 'Str', required => 1 ); | ||
| 7 | #has 'datetime' => ( is => 'ro', isa => 'DateTime' ); | ||
| 8 | #has 'length' => ( is => 'rw', isa => 'Int' ); | ||
| 9 | |||
| 10 | use strict; | ||
| 11 | use warnings; | ||
| 12 | |||
| 13 | use base 'Class::Accessor::Fast'; | ||
| 14 | __PACKAGE__->mk_accessors( qw/ | ||
| 15 | content | ||
| 16 | poster | ||
| 17 | / | ||
| 18 | ); | ||
| 19 | # id and datetime left for a future release (w/ store and forward) | ||
| 20 | # length left for a future release (w/ tweet splitting) | ||
| 21 | |||
| 22 | use Carp; | ||
| 23 | |||
| 24 | #use DateTime; | ||
| 25 | |||
| 26 | =head1 NAME | ||
| 27 | |||
| 28 | Net::Twitter::Cabal::Tweet - A tweet used by Net::Twitter::Cabal | ||
| 29 | |||
| 30 | =head1 VERSION | ||
| 31 | |||
| 32 | Version 0.01 | ||
| 33 | |||
| 34 | =cut | ||
| 35 | |||
| 36 | our $VERSION = '0.01'; | ||
| 37 | |||
| 38 | |||
| 39 | =head1 SYNOPSIS | ||
| 40 | |||
| 41 | Inside a cabal-controlling program: | ||
| 42 | |||
| 43 | my $tweet = Net::Twitter::Cabal::Tweet->new( { | ||
| 44 | poster => $nick, | ||
| 45 | content => "I'm inhaling", | ||
| 46 | } ); | ||
| 47 | |||
| 48 | This should only be used internally. | ||
| 49 | |||
| 50 | =head1 FUNCTIONS | ||
| 51 | |||
| 52 | =head2 new | ||
| 53 | |||
| 54 | my $tweet = Net::Twitter::Cabal::Tweet->new( { | ||
| 55 | poster => $nick, | ||
| 56 | content => $text, | ||
| 57 | } ); | ||
| 58 | |||
| 59 | =cut | ||
| 60 | |||
| 61 | sub new { | ||
| 62 | my $proto = shift; | ||
| 63 | my $class = ref $proto || $proto; | ||
| 64 | |||
| 65 | my $self = $class->SUPER::new( @_ ); | ||
| 66 | croak unless ( $self->poster && $self->content ); | ||
| 67 | |||
| 68 | return $self; | ||
| 69 | } | ||
| 70 | |||
| 71 | =head2 poster | ||
| 72 | |||
| 73 | =head2 content | ||
| 74 | |||
| 75 | Set/get the poster/content of a tweet: | ||
| 76 | |||
| 77 | $tweet->poster( $nick ); $tweet->poster; | ||
| 78 | $tweet->content( $content ); $tweet->content; | ||
| 79 | |||
| 80 | =head1 AUTHOR | ||
| 81 | |||
| 82 | Pedro Figueiredo, C<< <me at pedrofigueiredo.org> >> | ||
| 83 | |||
| 84 | =head1 BUGS | ||
| 85 | |||
| 86 | Please report any bugs or feature requests to C<bug-net-twitter-cabal at rt.cpan.org>, or through | ||
| 87 | the web interface at L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Net-Twitter-Cabal>. I will be notified, and then you'll | ||
| 88 | automatically be notified of progress on your bug as I make changes. | ||
| 89 | |||
| 90 | |||
| 91 | |||
| 92 | |||
| 93 | =head1 SUPPORT | ||
| 94 | |||
| 95 | You can find documentation for this module with the perldoc command. | ||
| 96 | |||
| 97 | perldoc Net::Twitter::Cabal::Tweet | ||
| 98 | |||
| 99 | |||
| 100 | You can also look for information at: | ||
| 101 | |||
| 102 | =over 4 | ||
| 103 | |||
| 104 | =item * RT: CPAN's request tracker | ||
| 105 | |||
| 106 | L<http://rt.cpan.org/NoAuth/Bugs.html?Dist=Net-Twitter-Cabal> | ||
| 107 | |||
| 108 | =item * AnnoCPAN: Annotated CPAN documentation | ||
| 109 | |||
| 110 | L<http://annocpan.org/dist/Net-Twitter-Cabal> | ||
| 111 | |||
| 112 | =item * CPAN Ratings | ||
| 113 | |||
| 114 | L<http://cpanratings.perl.org/d/Net-Twitter-Cabal> | ||
| 115 | |||
| 116 | =item * Search CPAN | ||
| 117 | |||
| 118 | L<http://search.cpan.org/dist/Net-Twitter-Cabal/> | ||
| 119 | |||
| 120 | =back | ||
| 121 | |||
| 122 | |||
| 123 | =head1 ACKNOWLEDGEMENTS | ||
| 124 | |||
| 125 | |||
| 126 | =head1 COPYRIGHT & LICENSE | ||
| 127 | |||
| 128 | Copyright 2009 Pedro Figueiredo, all rights reserved. | ||
| 129 | |||
| 130 | This program is free software; you can redistribute it and/or modify it | ||
| 131 | under the same terms as Perl itself. | ||
| 132 | |||
| 133 | |||
| 134 | =cut | ||
| 135 | |||
| 136 | 45; # End of Net::Twitter::Cabal::Tweet |