I would like to reference various variable in BackupPC_dump from the
perl code that I pass to DumpPreShareCmd.

Since the Perl code passed in DumpPreShareCmd  is eventually eval'd, I would
think that the variables in BackupPC_dump should still be in scope and
thus defined.

But this doesn't seem to be true...

For example, the following Perl code *fails* to run, presumably
because $sharename is not defined.
$Conf{DumpPreShareCmd} = '&{sub {
                       `date  >| /tmp/crap`;
                       `echo $sharename >> /tmp/crap`;
                            }}';

While by comparison, the following code runs fine
$Conf{DumpPreShareCmd} = '&{sub {
                       `date  >| /tmp/crap`;
                            }}';

as does:
$Conf{DumpPreShareCmd} = '&{sub {
                       `date  >| /tmp/crap`;
                       my $sharename = "abc";
                       `echo $sharename >> /tmp/crap`;
                            }}';


So, why isn't the variable '$sharename' which is defined in
BackupPC_dump not still in scope when $Conf{DumpPreShareCmd} is later
eval'd?

Note, the same problem occurs for any of the variables defined in BackupPC_dump.


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

Reply via email to