diff options
Diffstat (limited to 'Master/setuptl/TLPM/info.pm')
-rw-r--r-- | Master/setuptl/TLPM/info.pm | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/Master/setuptl/TLPM/info.pm b/Master/setuptl/TLPM/info.pm new file mode 100644 index 00000000000..324d1a68a32 --- /dev/null +++ b/Master/setuptl/TLPM/info.pm @@ -0,0 +1,39 @@ +# This file belongs to TLPM v2.14, TeX Live Package Manager +# Public Domain, P.Jackowski@gust.org.pl + +# info <pkg> +# retrieve package info from tpm file + +sub info +{ + my ($arg,$pkg,$tpm); + while(defined($arg = shift)) + { + $arg eq '' and next + or &no_opt($arg) and $pkg = $arg + or &is_opt($arg,'h','help') and return $heeelp -> ('info') + or &rem_opt($arg) and return $error{'wrong_opt'} -> ($arg,'info --help'); + } + return $error{'pkg_unspec'} -> () if $pkg eq ''; + if($pkg =~ $reg_scheme) + { + $pkg =~ s/\.scheme\z//; # different list and tpm... wrrrrr + } + $tpm = &get_tpm($pkg); + return $error{'pkg_not_found'} -> ($pkg) if $tpm eq ''; + local *INP; + local $/ = undef; + open(INP,"<$tpm") or return $error{'wrong_inp'} -> ($tpm); + $tpm = <INP>; + close INP; + foreach(qw/Name Title Type Version Date Description/) + { + if($tpm =~ /<TPM:$_>\s*(.+?)\s*<\/TPM:$_>/si)# rather rough, but do we need more? + { + $messf -> ("%-11s : %s\n",$_,$1); + } + } + $mess -> ("\n"); +} + +1; |