#!/usr/bin/perl -w
require LWP::UserAgent;
$username = "yourusernamehere";
$password = "yourpasshere";
my $ua = LWP::UserAgent->new;
$ua->agent('WizTwitterBot/1.0');
$ua->timeout(10);
$ua->env_proxy;
$ua->credentials(
'twitter.com:80',
'Twitter API',
$username => $password,);
sub pausa #mette in pausa il programma prima di uscire
{
print "\nPremi Invio per continuare\n";
my $pausa = <STDIN>;
} #fine subroutine pausa
sub twitter_post {
$inputtext = shift;
my $update_url = 'http://twitter.com/statuses/update.xml';
# POST the update to twitter
my $response = $ua->post($update_url, [status => $inputtext ]);
# Inform the user if success...
if ($response->is_success) {
print "Twitter Updated!!!\n";
} else {
print "Update to Twitter failed...\n";
}
}
print "Insert your update: ";
$update = <STDIN>;
chomp($update);
twitter_post ($update);
pausa;
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|