diff --git a/Repositories/otago_eprints3/otago_eprints/cfg/cfg.d/twitter.pl b/Repositories/otago_eprints3/otago_eprints/cfg/cfg.d/twitter.pl new file mode 100755 index 0000000..cdc7d14 --- /dev/null +++ b/Repositories/otago_eprints3/otago_eprints/cfg/cfg.d/twitter.pl @@ -0,0 +1,16 @@ + $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 &`; + } + };