O'Reilly logo

Ubuntu Unleashed 2014 Edition: Covering 13.10 and 14.04,Ninth Edition by Paul Hudson, Andrew Hudson, Matthew Helmke

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Posting to Usenet

If some portion of your job requires periodic postings to Usenet—an FAQ listing, for example—the following Perl program can automate the process for you. In the code example, the posted text is read in from a text file, but your input can come from anywhere.

The program shown in Listing 40.8 uses the Net::NNTP module, which is a standard part of the Perl distribution. You can find more documentation on the Net::NNTP module by entering 'perldoc Net::NNTP' at the command line.

LISTING 40.8 Posting an Article to Usenet

#!/usr/bin/perl# load the post data into @postopen (POST, "post.file");@post = <POST>;close POST;# import the NNTP moduleuse Net::NNTP;$NNTPhost = 'news';# attempt to connect to the ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required