Journal poster number 9

koschei on 2002-09-18T01:27:11

#!/usr/bin/perl -w
use strict;
use WWW::UsePerl::Journal;

my $subject = <>;
chomp $subject;
my $entry = join( '', <> );

my $j = WWW::UsePerl::Journal->new('fred');
$j->login('xxxx');
$j->postentry(
    title => $subject,
    text => $entry,
);

[updated with petdance's changed]


Why open manually?

petdance on 2002-09-18T01:33:46

Why open the file manually? Let the magic of <> do it for you. Change:
my $file = shift;

die unless defined $file and length $file;
my $subject;
my $entry;
{
    open my $fh, $file or die "Cannot open $file: $!\n";
    $subject = <$fh>;
    $entry = join('', <$fh>);
    close($fh)
}
chomp $subject;
to
my $subject = <>;
chomp $subject;

my $entry = join( '', <> );
Magical @ARGV processing is your friend!

Re:Why open manually?

koschei on 2002-09-18T01:38:41

Erm. It's an artefact that I should've removed. The program used to do much more. Then I realised the other features were irritating me.