From 7c49967bbe362210c81a40160c96d1ce5b9369d8 Mon Sep 17 00:00:00 2001 From: Toni Gundogdu Date: Tue, 30 Aug 2011 14:05:14 +0300 Subject: [PATCH] Replace spew_e with say stderr --- bin/umph | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/bin/umph b/bin/umph index a4d6270..e2df04c 100755 --- a/bin/umph +++ b/bin/umph @@ -84,15 +84,14 @@ sub print_help } sub spew_qe {print STDERR @_ unless $config{quiet}} -sub spew_e {print STDERR @_} my @items; sub main { - init(); + init; print_help if scalar @ARGV == 0; - spew_qe("Checking ... "); + spew_qe "Checking ... "; require LWP; my $a = new LWP::UserAgent; @@ -112,13 +111,13 @@ sub main my $l = to_item($entry, "link")->getAttributeNode("href")->getValue; my %data = (title => $t, url => $l, selected => 1); push @items, \%data; - spew_qe "." unless $config{quiet}; + spew_qe "."; } $doc->dispose; - spew_qe "done.\n" unless $config{quiet}; + spew_qe "done.\n"; - spew_e "error: nothing found.\n" and return 1 + say STDERR "error: nothing found." and return 1 unless scalar @items; prompt() if $config{interactive}; @@ -197,14 +196,14 @@ sub prompt 'r' => \&revert_selection, ); - spew_e qq/Enter prompt. Type "help" to get a list of commands.\n/; + say STDERR qq/Enter prompt. Type "help" to get a list of commands./; list(); use constant P => "(umph) "; while (not $done) { - spew_e P; + print STDERR P; my $ln = ; next unless $ln; @@ -227,12 +226,12 @@ sub toggle_number $items[$i]->{selected} = not $items[$i]->{selected}; list(); } - else {spew_e "error: out of range\n"} + else {say STDERR "error: out of range"} } sub help { - spew_e qq/Commands: + say STDERR qq/Commands: help .. this list .. list found videos (> indicates selected) all .. select all videos @@ -241,8 +240,7 @@ sub help (number) .. toggle (select, unselect) video, see list output dump .. dump selected video urls to stdout and exit quit .. terminate program -Command name abbreviations are allowed, e.g. "a" instead of "all". -/; +Command name abbreviations are allowed, e.g. "a" instead of "all"./; } sub list -- 2.11.4.GIT