perl: Set program name to the true name instead of 'perl'.

Currently any Perl program has the handle program name field set
to 'perl'.  Set it to the true name (derived from $0).
This commit is contained in:
Richard W.M. Jones
2015-09-13 13:45:32 +01:00
parent 1b856a20ba
commit e102bcf3cf

View File

@@ -753,6 +753,12 @@ sub new {
my $g = Sys::Guestfs::_create ($flags);
my $self = { _g => $g, _flags => $flags };
bless $self, $class;
# If we don't do this, the program name is always set to 'perl'.
my $program = $0;
$program =~ s{.*/}{};
$self->set_program ($program);
return $self;
}