Cookie Notice

As far as I know, and as far as I remember, nothing in this page does anything with Cookies.


Testing A Syntax Highlighting Widget...

And it works!

I was considering making a thing that highlighted syntax and made pretty code samples. As this is my coding blog, I considered that essential.

Then I thought about code reuse and wheel reinvention, and I started looking for syntax highlighters.

Damien of Damien Learns Perl (which is a perfectly fine thing to blog, by the way) pointed me to FaziBear's Syntax Highlighter, as well as the code to add to make it work for Perl.

Thank you all.

I just typed "Thank you wall". So, thank you too, Larry Wall, for creating Perl in the first place.


use 5.010 ;
use IO::Interactive qw{ interactive } ;
use Net::Twitter ;

my $user = 'Ha!' ;
my $pass = 'DoubleHa!' ;
my $status = join ' ', @ARGV ;

#There's a hard limit on the size of twits
#$status = substr $status , 0 , 140 ;
if ( length $status > 140 ) {
say { interactive } 'Too long' ;
exit ;

say $status ;

my $twit = Net::Twitter->new( username => $user, password => $pass ) ;

if ( $twit->update( $status ) ) {
say { interactive } 'OK' ;
} else {
say { interactive } 'FAIL' ;

This is a simple command line Perl program that posts to Twitter for you. I like graphical things for displaying my feed, but for writing, it's often more convenient to go to one of my dozens of terminals running bash and typing I\'m twittering from work right now. or maybe | .

1 comment:

  1. Thanks for mentionning my blog Dave ;)
    Just glad I was able to help a little.

    Well now, it's my turn to be grateful to you in DamienLearnsPerl. I'd like to modify your script to send messages to both Twitter and Identica (funny how I had been thinking about it just days before I read your post. Perfect timing!)