University of Natural Resources and Life Sciences (BOKU)
Institute of Computational Biology

PerlDoc

See PublishedAPI for packages intended to be used by Plugin and Contrib authors, or browse all packages.
See also Developing plugins, Developer's Bible, Technical Overview


Parent package: Foswiki::Util
Child packages:

    Package Foswiki::Util::MuteOut

    Very simplistic redirection of STDERR/STDOUT.

    SYNOPSIS

    Simply avoid any output:

    
    use Foswiki::Util::MuteOut;
    
    sub proc {
        my ($dir) = @_;
    
        my $rc = system "ls -la $dir";
        print STDERR "RC=", $rc;
    }
    
    my $mute = Foswiki::Util::MuteOut->new;
    
    # Nothing will be displayed by proc()
    $mute->exec(\&proc, "/etc");
    

    Capture output into files:

    my $capture = Foswiki::Util::MuteOut->new(
        outFile => 'stdout.txt',
        errFile => 'stderr.txt',
    );
    
    # The output will end up in corresponding files.
    $capture->exec(\&proc, "/etc");
    

    DESCRIPTION

    Redirections are restored when the object destroyed.

    Topic revision: r1 - 2023-08-06, UnknownUser
    2024-09-20 - 06:01 Foswiki v2.1.8