UPDATE: OK, someone shoot me. I stupidly changed the function to put the return value as the croak statement. I need some sleep. Someone please delete this.
Monks, I'm stumped on something that's probably pretty obvious but is escaping me. I'm wondering if I can please get second pair of eyes because this is driving me crazy.
So this works fine:
$cmd = qq(perl -e "print ((stat '$path')[4])"); my $uid = $self->ssh->capture($cmd);
$self->ssh is a Moose attribute containing a Net::OpenSSH object (see below). $uid returns an expected "1000."
However, when I call the same command with my grab wrapper method for the Net::OpenSSH:
$cmd = qq(perl -e "print ((stat '$path')[4])"); my $uid = $self->grab($cmd); { package MyOpenSSH 0.000001; use Carp; use Data::Dumper; use Moose::Role; use Modern::Perl; use Net::OpenSSH; use Params::Validate; has 'ssh' => (is => 'rw', isa => 'Net::OpenSSH', required => 1, lazy + => 0, handles => qr/.*/, ); sub grab { my $self = shift; my $opts = shift; $self->ssh->capture($opts, @_); croak ('ssh command failed') if $self->ssh->error; } }
the $uid is set to '0'. What am I missing?
$PM = "Perl Monk's";
$MCF = "Most Clueless Friar Abbot Bishop Pontiff Deacon Curate";
$nysus = $PM . ' ' . $MCF;
Click here if you love Perl Monks
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |