Newer
Older
Digital_Repository / Repositories / otago_eprints3 / otago_eprints / cfg / cfg.d / twitter.pl
nstanger on 3 Apr 2009 683 bytes - Added Twitter configuration.
 $c->{eprint_status_change} = sub
 {
        my( $eprint, $old_status, $new_status ) = @_;

        if( $new_status eq "archive" )
        {
                my $twitter_username="OtagoSoBEprints";
                my $twitter_password="mmpcfjXIm1jY0cU";
                my $cmd1 = "curl -s 'http://is.gd/api.php?longurl=".$eprint->get_url."'";
                my $shorturl = `$cmd1`;
                my $title = $eprint->get_value( "title" );
                $title =~ s/'/\\'/g;
                my $cmd2 = "curl --basic -s --user $twitter_username:$twitter_password --data status='$title - $shorturl' http://twitter.com/statuses/update.xml";
                `$cmd2 &`;
        }
 };