Skip to content

Commit

Permalink
Doc fixes; auto_install
Browse files Browse the repository at this point in the history
  • Loading branch information
semifor committed May 24, 2009
1 parent a18f34c commit 1776dd7
Show file tree
Hide file tree
Showing 8 changed files with 59 additions and 65 deletions.
3 changes: 3 additions & 0 deletions Changes
@@ -1,3 +1,6 @@
2.99000_03 2009-05-22
- Broke MANIFEST on the prior dist (fixed)

2.99000_02 2009-05-22
- Corrected POD NAME sections and module naming
- Temporarily removed lib/Net/Twitter/Search.pm from MANIFEST
Expand Down
3 changes: 2 additions & 1 deletion Makefile.PL
Expand Up @@ -28,9 +28,10 @@ no_index directory => 'src';
repository 'git://github.com/semifor/Net-Twitter.git';
homepage 'http://github.com/semifor/Net-Twitter';


eval {
system 'pod2text lib/Net/Twitter.pod > README';
};

auto_install;

WriteAll;
37 changes: 21 additions & 16 deletions README
@@ -1,8 +1,8 @@
NAME
Net::Twitter - A interface to the Twitter API
Net::Twitter - A perl interface to the Twitter API

VERSION
This document describes Net::Twitter version 2.99000_01
This document describes Net::Twitter version 2.99000_03

SYNOPSIS
use Net::Twitter;
Expand Down Expand Up @@ -39,8 +39,8 @@ METHODS AND ARGUMENTS
parameters, all of them optional:

traits
This option is an ARRAY ref of traits used to control which APIs
the constructed "Net::Twitter" object will support and how it
An ARRAY ref of traits used to control which APIs the
constructed "Net::Twitter" object will support and how it
handles errors. Possible values are:

API::REST
Expand Down Expand Up @@ -141,13 +141,14 @@ METHODS AND ARGUMENTS
"API::REST" trait is included.

apihost
The Twitter API host. This defaults to "twitter.com:80". This
option is available when the "API::REST" trait is included.
A string containing the Twitter API host. It defaults to
"twitter.com:80". This option is available when the "API::REST"
trait is included.

apirealm
The Twitter API realm used for Basic Authentication. This
defaults to "Twitter API". This option is available when the
"API::REST" trait is included.
A string containing the Twitter API realm used for Basic
Authentication. It defaults to "Twitter API". This option is
available when the "API::REST" trait is included.

identica
If set to 1, "Net::Twitter" overrides the defaults for "apiurl",
Expand All @@ -156,11 +157,6 @@ METHODS AND ARGUMENTS
0. This option is available when the "API::REST" trait is
included.

arrayref_on_error
Deprecated. This option is only available when the "Legacy"
trait is included. When set to 1, an empty ARRAY ref is returned
on error, rather than undef.

credentials($username, $password)
Set the credentials for authentication. This is helpful for managing
multiple accounts.
Expand Down Expand Up @@ -805,8 +801,17 @@ ERROR HANDLING
When trait "WrapError" is specified (or "Legacy", which includes trait
"WrapError"), "Net::Twitter" returns undef on error. To retrieve
information about the error, use methods "http_code", "http_message",
and "get_error". (These methods are described in the "/WrapError"
section, above.
and "get_error". These methods are described in the
Net::Twitter::WrapError.

if ( my $followers = $nt->followers ) {
for my $follower ( @$followers ) {
#...
}
}
else {
warn "HTTP message: ", $nt->http_message, "\n";
}

Since an error is stored in the object instance, this error handling
strategy is problematic when using a user agent like
Expand Down
2 changes: 1 addition & 1 deletion lib/Net/Twitter.pm
Expand Up @@ -11,7 +11,7 @@ use namespace::autoclean;
with 'MooseX::Traits';

# use *all* digits for fBSD ports
our $VERSION = '2.99000_02';
our $VERSION = '2.99000_03';

$VERSION = eval $VERSION; # numify for warning-free dev releases

Expand Down
9 changes: 1 addition & 8 deletions lib/Net/Twitter/Legacy.pm
Expand Up @@ -101,14 +101,7 @@ throw exceptions, now.
=head1 SEE ALSO
=over 4
=item L<Net::Twitter::Base>
This is the base class for Net::Twitter::Compat. See its documentation
for more details.
=back
L<Net::Twitter>
=head1 AUTHOR
Expand Down
28 changes: 8 additions & 20 deletions lib/Net/Twitter/WrapError.pm
Expand Up @@ -78,27 +78,21 @@ Net::Twitter::WrapError - Wraps Net::Twitter exceptions
=head1 DESCRIPTION
This module provides a B<Net::Twitter> compatibility layer for
Net::Twitter. Net::Twitter::Base throws exceptions for Twitter API and
network errors. This module catches those errors returning C<undef> to the
caller, instead. It provides L</"get_error">, L</"http_code"> and
L</"http_message">, like Net::Twitter, for accessing that error information.
This module provides an alternate error handling strategy for C<Net::Twitter>.
Rather than throwing exceptions, API methods return C<undef> and error
information is available through method calls on the C<Net::Twitter> object.
This module is provided to make it easy to test or migrate applications to
Net::Twitter::REST.
This module does not provide full compatibility with Net::Twitter. It does not,
for example, provided C<update_twittervision> or the Twitter Search API
methods. (See L<Net::Twitter::Search> for Net::Twitter::Lite's answer to
answer to the latter.
This is the error handling strategy used when C<trait> C<Legacy> is used. It
was the error handling strategy employed by C<Net::Twitter> prior to version
3.00.
=head1 METHODS
=over 4
=item new
This method takes the same parameters as L<Net::Twitter::Base/new>.
This method takes the same parameters as L<Net::Twitter/new>.
=item get_error
Expand All @@ -116,14 +110,8 @@ Returns the HTTP message for the most recent API method call if it ended in erro
=head1 SEE ALSO
=over 4
=item L<Net::Twitter::Base>
L<Net::Twitter>
This is the base class for Net::Twitter::Compat. See its documentation
for more details.
=back
=head1 AUTHOR
Expand Down
40 changes: 22 additions & 18 deletions src/net-twitter-pod.tt2
@@ -1,6 +1,6 @@
=head1 NAME

Net::Twitter - A interface to the Twitter API
Net::Twitter - A perl interface to the Twitter API

=head1 VERSION

Expand Down Expand Up @@ -52,9 +52,9 @@ all of them optional:

=item traits

This option is an ARRAY ref of traits used to control which APIs the
constructed C<Net::Twitter> object will support and how it handles errors.
Possible values are:
An ARRAY ref of traits used to control which APIs the constructed
C<Net::Twitter> object will support and how it handles errors. Possible
values are:

=over 4

Expand Down Expand Up @@ -156,22 +156,23 @@ only used in the C<update> method in the REST API. It defaults to
web" for status messages posted from C<Net::Twitter> when displayed via the
Twitter web interface. The value for this parameter is provided by Twitter
when a Twitter application is registered. See
L<http://apiwiki.twitter.com/FAQ#HowdoIget%E2%80%9CfromMyApp%E2%80%9DappendedtoupdatessentfrommyAPIapplication>.
L<http://apiwiki.twitter.com/FAQ#HowdoIget%E2%80%9CfromMyApp%E2%80%9DappendedtoupdatessentfrommyAPIapplication>.

=item apiurl

The URL for the Twitter API. This defaults to "http://twitter.com". This
option is available when the C<API::REST> trait is included.
option is available when the C<API::REST> trait is included.

=item apihost

The Twitter API host. This defaults to "twitter.com:80". This option is
available when the C<API::REST> trait is included.
A string containing the Twitter API host. It defaults to "twitter.com:80".
This option is available when the C<API::REST> trait is included.

=item apirealm

The Twitter API realm used for Basic Authentication. This defaults to "Twitter
API". This option is available when the C<API::REST> trait is included.
A string containing the Twitter API realm used for Basic Authentication. It
defaults to "Twitter API". This option is available when the C<API::REST>
trait is included.

=item identica

Expand All @@ -180,12 +181,6 @@ and C<apirealm> to "http://identi.ca/api", "identi.ca:80", and "Laconica API"
respectively. It defaults to 0. This option is available when the
C<API::REST> trait is included.

=item arrayref_on_error

Deprecated. This option is only available when the C<Legacy> trait is
included. When set to 1, an empty ARRAY ref is returned on error, rather than
undef.

=back

=item credentials($username, $password)
Expand Down Expand Up @@ -313,7 +308,16 @@ wrapping errors. Exception handling is the newer, recommended strategy.
When trait C<WrapError> is specified (or C<Legacy>, which includes trait
C<WrapError>), C<Net::Twitter> returns undef on error. To retrieve information
about the error, use methods C<http_code>, C<http_message>, and C<get_error>.
(These methods are described in the C</WrapError> section, above.
These methods are described in the L<Net::Twitter::WrapError>.

if ( my $followers = $nt->followers ) {
for my $follower ( @$followers ) {
#...
}
}
else {
warn "HTTP message: ", $nt->http_message, "\n";
}

Since an error is stored in the object instance, this error handling strategy
is problematic when using a user agent like C<LWP::UserAgent::POE> that
Expand All @@ -330,7 +334,7 @@ exceptions by using C<eval> blocks and testing $@:
my $statuses = $nt->friends_timeline(); # this might die!

for my $status ( @$statuses ) {
#...
#...
}
};
if ( $@ ) {
Expand Down
2 changes: 1 addition & 1 deletion t/02_fails.t
Expand Up @@ -9,7 +9,7 @@ use Net::Twitter;

my $nt = Net::Twitter->new(
traits => [qw/API::REST/],
username => 'NTLite',
username => 'just_me',
password => 'secret',
);

Expand Down

0 comments on commit 1776dd7

Please sign in to comment.