diff options
Diffstat (limited to 'Master/tlpkg/TeXLive/TLPSRC.pm')
-rw-r--r-- | Master/tlpkg/TeXLive/TLPSRC.pm | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/Master/tlpkg/TeXLive/TLPSRC.pm b/Master/tlpkg/TeXLive/TLPSRC.pm index cf03fe819f0..969463118c6 100644 --- a/Master/tlpkg/TeXLive/TLPSRC.pm +++ b/Master/tlpkg/TeXLive/TLPSRC.pm @@ -35,12 +35,13 @@ sub new { sub from_file { my $self = shift; - if (@_ != 1) { - die("Need a filename for initialization!"); - } - open(TMP,"<$_[0]") || die("Cannot open tlpsrc file: $_[0]"); + die("Need exactly one filename for initialization!") if @_ != 1; + my $srcfile = $_[0]; + + open(TMP, "<$srcfile") || die("failed to open tlpsrc '$srcfile': $!"); my @lines = <TMP>; close(TMP); + my $name = ""; # default category = Package my $category = "Package"; @@ -57,17 +58,17 @@ sub from_file { if ($line =~ /^\s*$/) { if (!$started) { next; } if ($finished) { next; } - die("No empty line allowed in tlpsrc file $_[0]!"); + die("$srcfile: empty line not allowed in tlpsrc"); } if ($line =~ /^ /) { - die("No continuation lines >>>$line<<< allowed in TLPSRC files!"); + die "$srcfile: continuation line not allowed in tlpsrc: $line\n"; } if ($line =~ /^name\s*([-\w]+)$/) { $name = "$1"; - $started && die("Cannot have two name directives!"); + $started && die("$srcfile: tlpsrc cannot have two name directives"); $started = 1; } else { - $started || die("First directive needs to be 'name'"); + $started || die("$srcfile: first tlpsrc directive must be 'name'"); if ($line =~ /^shortdesc\s*(.*)$/) { $shortdesc = "$1"; next; @@ -99,8 +100,7 @@ sub from_file { push @depends, "$1" if ("$1" ne ""); next; } else { - #die("Unknown directive ...$line... in $_[0], please fix it!"); - print STDERR "Unknown directive ...$line... in $_[0], please fix it!\n"; + warn "$srcfile: unknown tlpsrc directive, please fix: $line\n"; } } } |