Unix-Sudo
view release on metacpan or search on metacpan
"requires" : {
"ExtUtils::MakeMaker" : "0"
}
},
"runtime" : {
"requires" : {
"B::Deparse" : "0",
"Capture::Tiny" : "0",
"Data::Compare" : "0",
"Data::Dumper" : "0",
"PadWalker" : "0",
"Probe::Perl" : "0",
"Taint::Runtime" : "0",
"Test::More" : "0.88"
}
}
},
"release_status" : "stable",
"resources" : {
"bugtracker" : {
"web" : "https://github.com/DrHyde/perl-modules-Unix-Sudo/issues"
name: Unix-Sudo
no_index:
directory:
- t
- inc
requires:
B::Deparse: '0'
Capture::Tiny: '0'
Data::Compare: '0'
Data::Dumper: '0'
PadWalker: '0'
Probe::Perl: '0'
Taint::Runtime: '0'
Test::More: '0.88'
resources:
bugtracker: https://github.com/DrHyde/perl-modules-Unix-Sudo/issues
repository: https://github.com/DrHyde/perl-modules-Unix-Sudo
version: '65535'
x_serialization_backend: 'CPAN::Meta::YAML version 0.018'
Makefile.PL view on Meta::CPAN
repository => 'https://github.com/DrHyde/perl-modules-Unix-Sudo',
bugtracker => 'https://github.com/DrHyde/perl-modules-Unix-Sudo/issues'
}
},
VERSION_FROM => 'lib/Unix/Sudo.pm',
PREREQ_PM => {
'B::Deparse' => 0,
'Capture::Tiny', => 0,
'Data::Compare' => 0,
'Data::Dumper' => 0,
'PadWalker' => 0,
'Probe::Perl', => 0,
'Taint::Runtime' => 0,
'Test::More' => '0.88', # need done_testing (0.88)
},
);
lib/Unix/Sudo.pm view on Meta::CPAN
use warnings;
our $VERSION = '65535';
require Exporter;
our @ISA = qw(Exporter);
our @EXPORT_OK = qw(sudo);
use B::Deparse;
use Data::Dumper;
use PadWalker qw(peek_my);
use Probe::Perl;
=head1 NAME
Unix::Sudo - Run a block of code as root
=head1 DESCRIPTION
Run a block of code as root
lib/Unix/Sudo.pm view on Meta::CPAN
C<sudo> might have to prompt for a password. If it does, then the prompt will
make it clear that this is Unix::Sudo asking for it.
It's not just your code that is passed to the child process. There are also a
bunch of C<-I> arguments, so that it knows about any directories in the parent
process's C<@INC>, and it will also get copies of all the lexical variables
that are in scope in the calling code.
Under the bonnet it uses L<B::Deparse> to turn your code-ref into text,
L<PadWalker>'s C<peek_my()> to get variables, and L<Data::Dumper> (and
C<$Data::Dumper::Deparse>) to turn those variables into text, all of which is
pre-pended to your code.
=head1 CAVEATS
Your code will always have C<strict> and C<warnings> turned on, and be run with
taint-checking enabled. If you need to you can turn tainting off as shown in
the synopsis. Note that you can't just say 'use Taint::Runtime qw(disable)', the C<eval> is
required, otherwise the C<use> will be run at compile-time I<in
the calling code> and not in the child process where you need it.
( run in 0.690 second using v1.01-cache-2.11-cpan-05444aca049 )