Help for this page

Select Code to Download


  1. or download this
    use Sudo;
      my $su;
    ...
                     );
       
      $result = $su->sudo_run();
    
  2. or download this
    sudo_run
    
        The sudo_run function first checks the attributes to make sure the
    + minimum required set exists, and then attempts to execute sudo witho
    +ut shell interpolation. You will need to take this into account in ca
    +se you get confusing failure modes. You may set the debug attribute t
    +o 1, 2, or 3 to get progressively more information.
    
        The object will return a hash. The hash will have state informatio
    +n within it. If the C'error' key exists, an error occured and you can
    + parse the value to see what the error was. If the run was successful
    +, C'stdout' key exists, and its value corresponds to stdout output fr
    +om the program run by sudo. Similarly the C'stderr' key will exist fo
    +r a successful run, and the value corresponds to stderr output from t
    +he program run by sudo. The C"rc" key will also be defined with the p
    +rograms return code.
    
  3. or download this
    foreach my $key (sort keys %result) {
        print("$key => $result{$key} \n");
    }