BackupPC-users

[BackupPC-users] BUGS in Lib.pm with CORRECTION

2011-08-01 22:33:36
Subject: [BackupPC-users] BUGS in Lib.pm with CORRECTION
From: "Jeffrey J. Kosowsky" <backuppc AT kosowsky DOT org>
To: General list for user discussion <backuppc-users AT lists.sourceforge DOT net>
Date: Mon, 01 Aug 2011 22:31:54 -0400
Lib.pm has a bug that appears twice:
The 2 occurrences of:
    $cmd = join(" ", $cmd) if ( ref($cmd) eq "ARRAY" );
should be replaced by:
    $cmd = join(" ", @$cmd) if ( ref($cmd) eq "ARRAY" );
Otherwise you are joining array refs rather than arrays which is
meaningless/error.


Also, I would suggest that the function cmdVarSubstitute always return
an array. Currently, it returns an array except in the case when it is
passed a single perl coderef. As a result, if one set DumpPreUserCmd
(or its equivalents) to a coderef then BacckupPC_dump barfs with an
error like:
          Can't use string ("&{sub { blah blah blah ;}}") as an ARRAY ref while
          "strict refs" in use at /usr/share/BackupPC/bin/BackupPC_dump

Alternatively, one could also test for ref($cmd) = "ARRAY" in
BackupPC_dump, but it is probably cleaner and more consistent to do
the conversion here in Lib.pm so that one always has an array ref.

Unless and until such correction is made, one can only pass an
arrayref to a coderef, i.e., if you are using perl code for
DumpPreUserCmd, it must be of form:
        $Conf{DumpPreUserCmd} = ["&{sub { blahblahblah }}"];

Well, the cool thing is that it works!

------------------------------------------------------------------------------
BlackBerry&reg; DevCon Americas, Oct. 18-20, San Francisco, CA
The must-attend event for mobile developers. Connect with experts. 
Get tools for creating Super Apps. See the latest technologies.
Sessions, hands-on labs, demos & much more. Register early & save!
http://p.sf.net/sfu/rim-blackberry-1
_______________________________________________
BackupPC-users mailing list
BackupPC-users AT lists.sourceforge DOT net
List:    https://lists.sourceforge.net/lists/listinfo/backuppc-users
Wiki:    http://backuppc.wiki.sourceforge.net
Project: http://backuppc.sourceforge.net/

<Prev in Thread] Current Thread [Next in Thread>
  • [BackupPC-users] BUGS in Lib.pm with CORRECTION, Jeffrey J. Kosowsky <=