From 06f184c14dc5a81400bb07cf235e99d9c7d761c5 Mon Sep 17 00:00:00 2001 From: Reinhold Kainhofer <reinhold@kainhofer.com> Date: Wed, 14 Jul 2010 15:15:46 +0200 Subject: [PATCH] Implement reading from stdin --- pae2xml.pl | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/pae2xml.pl b/pae2xml.pl index 810ee1b..4648fb3 100755 --- a/pae2xml.pl +++ b/pae2xml.pl @@ -553,12 +553,15 @@ Error: $msg\n"; sub read_file { my ($fn) = @_; - if (!(open FH, $fn)) - { + my $res = ""; + if ($fn eq "-") { + while (<STDIN>) { $res .= $_; } # read all lines + } else { + if (!(open FH, $fn)) { return ""; } - my $res = ""; - while (<FH>) { $res .= $_; } # read all lines - close (FH); + while (<FH>) { $res .= $_; } # read all lines + close (FH); + } return $res; } -- GitLab