[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: tpm2deb-bin.pl: minor Perl issues



Hi all!

On Sam, 17 Mär 2007, Frank Küster wrote:
> 1. tpm2deb-bin.pl frequently uses constructs like
> 
> 	eval { mkpath($rundest) };
> 	if ($@) {
> 		die "Couldn't create dir: $@";
> 	}  
> 
>   In terms of readability, I would prefer
> 
>         system("mkdir -p $rundest") == 0
>                 or die "Couldn't create dir $rundest";
> 
>   Any reason not to make this change?

Not that I see one. 

> 2. Why are constructs like this needed:
> 
> 	my $newdest;
> 	my $foo="\$newdest = \"$dest\"";
> 	eval $foo;

Because tpm2deb.cfg contains references to variables of
tpm2deb-bin.pl ($destdir, ...), eg:
        mapping;texmf/web2c/mktex.*;remap;$rundest/texmf/web2c/$1
but there are more.

>    Why isn't it possible to just set my $newdest=$dest?  In some cases

Because we have to evaluate the stuff in tpm2deb.cfg.

> 3. We go through great pain to change @INC early in a BEGIN block to get
>    Tpm.pm and friends.  Why don't we just add /usr/share/tex-common to
>    @INC? Tpm.pm and FileUtils.pm are already there.

Great idea. But then we should update Tpm.pm and FileUtils.pm (in case
they have changes in TL2007)!

> 4. in the do_remap_and_copy function, the config-link option differs
>    from the others:
> 
>    - it does not remove leading texmf*/
>    - it adds $newdest to @configfiles, not $newdest/$file.
> 
>    Is this intended?  

I have *no* idea anymore, Probably I had the FULL filename in the
        config-link
option. But since it is NOT USED AT ALL in tpm2deb.cfg, we can remove
it. Or standardise it.

I mentioned this already once, it would be good if we could unify *ALL*
the mapping directives that the stuff at the end contains 'final' paths
like /var/lib/texmf or /etc/texmf/web2c/... and not strange path stuff
like $destdir/.... (which is
./debian/<package>/usr/share/texmf-texlive/...)

It was introduced to easily switch between
	/usr/share/texmf/
and
	/usr/share/texmf-texlive/
at the time when it wasn't clear where to go...

> 5. In &mycopy (and maybe at other places), does it make sense at all to
>    discard stderr?  I think if the command spits out something, it's
>    nearly always interesting.

Yes.

Best wishes

Norbert

-------------------------------------------------------------------------------
Dr. Norbert Preining <preining@logic.at>                    Università di Siena
Debian Developer <preining@debian.org>                         Debian TeX Group
gpg DSA: 0x09C5B094      fp: 14DF 2E6C 0307 BE6D AD76  A9C0 D2BF 4AA3 09C5 B094
-------------------------------------------------------------------------------
SNITTERBY (n.)
Someone who pins snitters (q.v.) on to snitterfields (q.v.) and is
also suspected of being responsible for the extinction of virginstows
(q.v.)
			--- Douglas Adams, The Meaning of Liff



Reply to: