note
perl-diddler
At the bottom of the call stack, is a 'Vars' routine to wrap
fields in a hash. The relevant parts:
<code>
sub _Var ($$$;$) { # Wrkhorse code for manufctrd Vars
#note $p->obj, $vn=varname, $wa=wantarray val
my ($__, $p, $vn, $wa)=@$_;
$_=$__; '$_'
my $v = $p->{$vn}; # value
my $rfv = ref $v; # type(ref) of var
......
} elsif ($rfv == 'HASH') {
my $subvar=$arg; ## 1 var w/hash is is a key
$p->{$vn}{$subvar}=$_[0] if @_; ## another? =>assign value
return $p->{$vn}{$subvar}; <- returns has here.
</code>
That is called in sub 'by_mp' that takes care of init stuff and handles accessing the field: _by_mp in this case:
<code>
sub by_mp(;$) { my $map = shift; my $c = ref $map || $map;
...init...
my $arg_lvh = $map->_by_mp($arg);
if (ref $arg_lvh) {
$arg_lvh->fs_mp($arg);
return $arg_lvh; #<----seems to return from here
}
my $devno = (stat $arg)[0];
$arg_lvh = $map->by_devno($devno);
return undef unless $arg_lvh;
die P "by_mp: by_devno(%s) returned %s, of type \"%s\", not a ref\n",
$devno, $arg_lvh, ref $arg_lvh unless ref $arg_lvh;
$map->_by_mp($arg, $arg_lvh);
$arg_lvh->fs_mp($arg);
return $arg_lvh;
}
</code>
That is called in the level of code where I detect the problem:
<code>
sub lvm_BaseDiff_Lvh_4_Base_opt_mp ($;$) {
my $lvm = shift;
my ($base_lvh, $lv_mp) = @_;
my $diff_dev = pathcat("/dev",
$base_lvh->vg_name, $base_lvh->lv_name . ".diff");
#TPe "diff_dev=%s", $diff_dev;
# next is call to by_mp -- here is where I don't seem to be
#getting a reference back.
my $bdiff_lvh = $lvm->by_mp($lv_mp.".diff") if @_;
$bdiff_lvh = $lvm->by_devpath($diff_dev) unless ref $bdiff_lvh;
## commented version below was orig -- trying above --
## seems to work better, but seems a bit random...
#my $bdiff_lvh = (@_ && $lvm->by_mp($lv_mp . ".diff") or
# $lvm->by_devpath($diff_dev));
die P "Can't find \"diff\" dir for vol %s by mount or device path", $lv_mp
unless ref $bdiff_lvh;
$bdiff_lvh->fs_mp($lv_mp) unless $bdiff_lvh->fs_mp;
$bdiff_lvh->fs_type_name($base_lvh->fs_type_name)
unless $bdiff_lvh->fs_type_name;
</code>
1026212
1026224