Upgrade failure and corrupted installation ?

Zdenek Wagner zdenek.wagner at gmail.com
Tue Aug 29 15:46:44 CEST 2023


út 29. 8. 2023 v 12:05 odesílatel Jonathan Fine <jfine2358 at gmail.com> napsal:
>
> Hi
>
> Further to my previous post regarding Python's "with" statement.
>
> It seems that something similar can be done in Perl, via DESTROY being called when a variable goes out of scope. This statement is based on my understanding of the discussion in
> https://www.reddit.com/r/perl/comments/e4x90y/context_manager_in_perl/
>
> I'd be most grateful if Norbert, as an expert in both Perl and tlmgr, would tell us whether this would without too much difficulty provide "some journaling for tlmgr operations" (Norbert's words).
>
> In case anyone wishes to research this matter further, here's the search used to find the reddit link above.
> https://www.google.com/search?q=perl+python+with+statement
>
No, DESTROY is not called when a variable goes out of scope, it is a
destructor which is called when the last reference to the object
disappears. Imagine these two snippets:

1:
our $a = new Something;
{
  my $b = $a;
  ...
}

2:
our $a;
{
  my $b = new Something;
  ...
  $a = $b;
}

In both of them $b is a reference to Something. It goes out of scope
but Something->DESTROY will not be called because a reference still
exists in $a. Anyway, cleanup in perl is not a problem and can be done
by many different mechanisms but it is not journalling. Journalling
handles the case that a program crashes or is aborted and after
restart it should somehow recover its state.

Imagine the following code:

{
  my $a = new Something;
  ...
}

If the program somehow exits the block, Something->DESTROY will be
called (if defined). However, if a user presses Ctrl-C, it will not
exit the block but the perl interpreter will be stopped, i.e.
Something->DESTROY will not be called. You can only catch it by a
signal handler. The possibilities what you can do in a signal handler
are limited. I am almost sure that it is the same with python, Ctrl-C
will stop the python interpreter.


Zdeněk Wagner
https://www.zdenek-wagner.eu/


> --
> Jonathan
>
>



More information about the tex-live mailing list.