Hi there,

On Sat, 14 Sep 2024, oetschi.ex...@bluewin.ch wrote:

oetschi.ex...@bluewin.ch

1st of all: I use Backuppc for years and it is a very good tool.

+1

... When I upgraded ... I got some nasty problems:

This happens more or less every time I upgrade anything Debian-based.
I upgraded to Bookworm in July and I've only just got the scanner to
work again - and it *still* doesn't work with the GUI tools. :(

... After very long time I found a hint in a backuppc installation document:
Whenever you change something in the browser (e.g. WakeupSchedule)
then there are bracketts in arrays changed form [ ] or { } to ( )
and backuppc can't start anymore.

Where did you find this?  In Perl brace styles have strong meanings.
They mean completely different things, they can't be interchanged.

So there is the possibility to reactivate backuppc when you correct
the packuppc file "config.pl. When it is overcorrected then rsync
doesn't work and gives error messages.

I don't think rsync has anything specifically to do with this, I think
it's probably just one of the (probably many) symptoms.

Here I give you the correct notation of the arrays in config.pl (I only saw 4):

$Conf{WakeupSchedule} = [ ... ]
$Conf{CgiNavBarLinks} = [ ... ]

These two are arrayrefs, that is they are scalars which refer to arrays.
This seems correct according to my own config.pl.

In Perl you can create arrays with names, for example by writing

@array = (list);

whose elements you can access as  $array[n]

or wou can create anonymous arrays, for example by writing

$arrayref = [list];

which you can only access through references for example using

$arrayref->[n]

in this case.  Here is how I might do that with a one-liner on the
command line for fun:

$ perl -e '$arrayref = [1,2,3]; print $arrayref->[1],"\n";'
2
$

$Conf{CgiStatusHilightColor} = { ... }

This seems correct according to my own config.pl.

It is a hashref.  For example

$ perl -e '$hashref = {a,1,b,2,c,3}; print $hashref->{b},"\n";'
2
$

Note that in Perl '=>' is the same as ',' (in fact it is often called
the 'fat comma') so I would probably more usually write

$ perl -e '$hashref = {a=>1,b=>2,c=>3}; print $hashref->{b},"\n";'
2
$

$Conf{CgiUserConfigEdit} = ( ... )

This last one seems wrong, at least compared with my own config.pl in
which $Conf{CgiUserConfigEdit} is a hashref (i.e. its value is a Perl
scalar containing a reference to a hash) so it's initialized using the
syntax

$hashref = { list of key,value pairs };

It is perhaps slightly confusing that the scalar

$Conf{CgiUserConfigEdit}

is itself stored in (and so part of) the Perl hash called %Conf - and
so it will be accessed using the Perl notation $hash{key}.  In this
case, 'key' is CgiUserConfigEdit.  You *can* instead write

%Conf{CgiUserConfigEdit}

to access the same scalar but the Perl interpreter would probably
scold you for that because it's bad form.

But above all note the difference between accessing part of the hash
which is named

%Conf

by using syntax such as [*]

$Conf{$key} or $Conf{key}

and accessing part of an anonymous hash (which, er, does not have a
name so I can't write it down:) through a reference which points to it
by using the syntax

$hashref->{$key} or $hashref->{key} or $hashref->{'key'}

It isn't rocket science but, for the first couple of decades of using
Perl it's amongst the more confusing aspects of the syntax.  There may
be, unfortunately, quite a few of those.

[*] I generally prefer to quote 'barewords', even used as hash keys,
so I'd use $Conf{'key'} rather than $Conf{key}.

--

73,
Ged.


_______________________________________________
BackupPC-users mailing list
BackupPC-users@lists.sourceforge.net
List:    https://lists.sourceforge.net/lists/listinfo/backuppc-users
Wiki:    https://github.com/backuppc/backuppc/wiki
Project: https://backuppc.github.io/backuppc/

Reply via email to