| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | package Net::Twitter::Role::Legacy; | 
| 2 |  |  |  |  |  |  | $Net::Twitter::Role::Legacy::VERSION = '4.01010'; | 
| 3 | 9 |  |  | 9 |  | 7291 | use Moose::Role; | 
|  | 9 |  |  |  |  | 22235 |  | 
|  | 9 |  |  |  |  | 49 |  | 
| 4 |  |  |  |  |  |  |  | 
| 5 | 9 |  |  | 9 |  | 34996 | use namespace::autoclean; | 
|  | 9 |  |  |  |  | 14 |  | 
|  | 9 |  |  |  |  | 75 |  | 
| 6 |  |  |  |  |  |  |  | 
| 7 |  |  |  |  |  |  | with map "Net::Twitter::Role::$_", qw/ | 
| 8 |  |  |  |  |  |  | API::REST | 
| 9 |  |  |  |  |  |  | API::Search | 
| 10 |  |  |  |  |  |  | API::TwitterVision | 
| 11 |  |  |  |  |  |  | WrapError | 
| 12 |  |  |  |  |  |  | /; | 
| 13 |  |  |  |  |  |  |  | 
| 14 |  |  |  |  |  |  | has arrayref_on_error => ( isa => 'Bool', is => 'rw', default => 0, trigger => \&_set_error_return_val ); | 
| 15 |  |  |  |  |  |  | has twittervision     => ( isa => 'Bool', is => 'rw', default => 0 ); | 
| 16 |  |  |  |  |  |  |  | 
| 17 |  |  |  |  |  |  | sub _set_error_return_val { | 
| 18 | 0 |  |  | 0 |  |  | my $self = shift; | 
| 19 |  |  |  |  |  |  |  | 
| 20 | 0 | 0 |  |  |  |  | $self->_error_return_val($self->arrayref_on_error ? [] : undef); | 
| 21 |  |  |  |  |  |  | } | 
| 22 |  |  |  |  |  |  |  | 
| 23 |  |  |  |  |  |  | # Legacy Net::Twitter does not make the call unless twittervision is true. | 
| 24 |  |  |  |  |  |  | # Bug or feature? | 
| 25 |  |  |  |  |  |  | around 'update_twittervision' => sub { | 
| 26 |  |  |  |  |  |  | my $next = shift; | 
| 27 |  |  |  |  |  |  | my $self = shift; | 
| 28 |  |  |  |  |  |  |  | 
| 29 |  |  |  |  |  |  | return unless $self->twittervision; | 
| 30 |  |  |  |  |  |  |  | 
| 31 |  |  |  |  |  |  | return $next->($self, @_); | 
| 32 |  |  |  |  |  |  | }; | 
| 33 |  |  |  |  |  |  |  | 
| 34 |  |  |  |  |  |  | sub clone { | 
| 35 | 0 |  |  | 0 | 1 |  | my $self = shift; | 
| 36 |  |  |  |  |  |  |  | 
| 37 | 0 |  |  |  |  |  | return bless { %{$self} }, ref $self; | 
|  | 0 |  |  |  |  |  |  | 
| 38 |  |  |  |  |  |  | } | 
| 39 |  |  |  |  |  |  |  | 
| 40 |  |  |  |  |  |  | 1; | 
| 41 |  |  |  |  |  |  |  | 
| 42 |  |  |  |  |  |  | __END__ | 
| 43 |  |  |  |  |  |  |  | 
| 44 |  |  |  |  |  |  | =head1 NAME | 
| 45 |  |  |  |  |  |  |  | 
| 46 |  |  |  |  |  |  | Net::Twitter::Role::Legacy - A Net::Twitter legacy compatibility layer as a Moose role | 
| 47 |  |  |  |  |  |  |  | 
| 48 |  |  |  |  |  |  | =head1 VERSION | 
| 49 |  |  |  |  |  |  |  | 
| 50 |  |  |  |  |  |  | version 4.01010 | 
| 51 |  |  |  |  |  |  |  | 
| 52 |  |  |  |  |  |  | =head1 SYNOPSIS | 
| 53 |  |  |  |  |  |  |  | 
| 54 |  |  |  |  |  |  | use Net::Twitter; | 
| 55 |  |  |  |  |  |  |  | 
| 56 |  |  |  |  |  |  | my $nt = Net::Twitter->new( | 
| 57 |  |  |  |  |  |  | username => $username, | 
| 58 |  |  |  |  |  |  | password => $password, | 
| 59 |  |  |  |  |  |  | traits   => [qw/Legacy/], | 
| 60 |  |  |  |  |  |  | ); | 
| 61 |  |  |  |  |  |  |  | 
| 62 |  |  |  |  |  |  | my $followers = $nt->followers; | 
| 63 |  |  |  |  |  |  | if ( !followers ) { | 
| 64 |  |  |  |  |  |  | warn $nt->http_message; | 
| 65 |  |  |  |  |  |  | } | 
| 66 |  |  |  |  |  |  |  | 
| 67 |  |  |  |  |  |  | =head1 DESCRIPTION | 
| 68 |  |  |  |  |  |  |  | 
| 69 |  |  |  |  |  |  | This module provides a B<Net::Twitter> compatibility layer for | 
| 70 |  |  |  |  |  |  | Net::Twitter.  It pulls in the additional traits: C<API::REST>, C<API::Search>, | 
| 71 |  |  |  |  |  |  | C<API::Identica>, and C<WrapError>. | 
| 72 |  |  |  |  |  |  |  | 
| 73 |  |  |  |  |  |  | =head1 METHODS | 
| 74 |  |  |  |  |  |  |  | 
| 75 |  |  |  |  |  |  | =over 4 | 
| 76 |  |  |  |  |  |  |  | 
| 77 |  |  |  |  |  |  | =item new | 
| 78 |  |  |  |  |  |  |  | 
| 79 |  |  |  |  |  |  | This method takes the same parameters as L<Net::Twitter/new>.  In addition, it | 
| 80 |  |  |  |  |  |  | also support the options: | 
| 81 |  |  |  |  |  |  |  | 
| 82 |  |  |  |  |  |  | =over 4 | 
| 83 |  |  |  |  |  |  |  | 
| 84 |  |  |  |  |  |  | =item arrayref_on_error | 
| 85 |  |  |  |  |  |  |  | 
| 86 |  |  |  |  |  |  | When set to 1, on error, rather than returning undef, the API methods will | 
| 87 |  |  |  |  |  |  | return an empty ARRAY ref.  Defaults to 0. | 
| 88 |  |  |  |  |  |  |  | 
| 89 |  |  |  |  |  |  | =item twittervision | 
| 90 |  |  |  |  |  |  |  | 
| 91 |  |  |  |  |  |  | When set to 1, enables the C<upade_twittervision> call.  Defaults to 0. | 
| 92 |  |  |  |  |  |  |  | 
| 93 |  |  |  |  |  |  | =back | 
| 94 |  |  |  |  |  |  |  | 
| 95 |  |  |  |  |  |  | =item clone | 
| 96 |  |  |  |  |  |  |  | 
| 97 |  |  |  |  |  |  | Creates a shallow copy of the C<Net::Twitter> object.  This was useful, in legacy | 
| 98 |  |  |  |  |  |  | versions of C<Net::Twitter> for handling concurrent requests (for instance with | 
| 99 |  |  |  |  |  |  | L<LWP::UserAgent::POE>).  Since errors are wrapped in the C<Net::Twitter> concurrent | 
| 100 |  |  |  |  |  |  | requests each needed their own object.  C<clone> served that purpose. | 
| 101 |  |  |  |  |  |  |  | 
| 102 |  |  |  |  |  |  | The recommended approach for concurrent requests is to use C<Net::Twitter>'s ability | 
| 103 |  |  |  |  |  |  | throw exceptions, now. | 
| 104 |  |  |  |  |  |  |  | 
| 105 |  |  |  |  |  |  | =back | 
| 106 |  |  |  |  |  |  |  | 
| 107 |  |  |  |  |  |  | =head1 SEE ALSO | 
| 108 |  |  |  |  |  |  |  | 
| 109 |  |  |  |  |  |  | L<Net::Twitter> | 
| 110 |  |  |  |  |  |  |  | 
| 111 |  |  |  |  |  |  | =head1 AUTHOR | 
| 112 |  |  |  |  |  |  |  | 
| 113 |  |  |  |  |  |  | Marc Mims <marc@questright.com> | 
| 114 |  |  |  |  |  |  |  | 
| 115 |  |  |  |  |  |  | =head1 LICENSE | 
| 116 |  |  |  |  |  |  |  | 
| 117 |  |  |  |  |  |  | Copyright (c) 2009 Marc Mims | 
| 118 |  |  |  |  |  |  |  | 
| 119 |  |  |  |  |  |  | This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. | 
| 120 |  |  |  |  |  |  |  | 
| 121 |  |  |  |  |  |  | =head1 DISCLAIMER OF WARRANTY | 
| 122 |  |  |  |  |  |  |  | 
| 123 |  |  |  |  |  |  | BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY | 
| 124 |  |  |  |  |  |  | FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN | 
| 125 |  |  |  |  |  |  | OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES | 
| 126 |  |  |  |  |  |  | PROVIDE THE SOFTWARE "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER | 
| 127 |  |  |  |  |  |  | EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | 
| 128 |  |  |  |  |  |  | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE | 
| 129 |  |  |  |  |  |  | ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH | 
| 130 |  |  |  |  |  |  | YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL | 
| 131 |  |  |  |  |  |  | NECESSARY SERVICING, REPAIR, OR CORRECTION. | 
| 132 |  |  |  |  |  |  |  | 
| 133 |  |  |  |  |  |  | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING | 
| 134 |  |  |  |  |  |  | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR | 
| 135 |  |  |  |  |  |  | REDISTRIBUTE THE SOFTWARE AS PERMITTED BY THE ABOVE LICENSE, BE | 
| 136 |  |  |  |  |  |  | LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL, | 
| 137 |  |  |  |  |  |  | OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE | 
| 138 |  |  |  |  |  |  | THE SOFTWARE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING | 
| 139 |  |  |  |  |  |  | RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A | 
| 140 |  |  |  |  |  |  | FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF | 
| 141 |  |  |  |  |  |  | SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF | 
| 142 |  |  |  |  |  |  | SUCH DAMAGES. |