NAME
CPANPLUS::Dist::Slackware::Util - Utility functions
VERSION
This document describes CPANPLUS::Dist::Slackware::Util version 1.030.
SYNOPSIS
use CPANPLUS::Dist::Slackware::Util qw(can_run run slurp spurt filetype gzip);
my $program = can_run('perl');
if ( $program ) {
my $cmd = [ $program, '-v' ];
my $output = '';
if ( run( $cmd, { buffer => \$output } ) ) {
print $output;
}
}
if ( spurt( '/tmp/hello.txt', 'hello, world' ) ) {
my $str = slurp('/tmp/hello.txt');
if ( my $filename = gzip('/tmp/hello.txt') ) {
print $filename, ': ', filetype($filename), "\n";
}
}
DESCRIPTION
This module provides utility functions for CPANPLUS::Dist::Slackware.
FUNCTIONS
- $path = can_run( $program )
-
Locate a program and return the path to the binary or undef.
- $ok = run( $cmd, { dir => $dir, buffer => \$str, verbose => 0|1 } )
-
Run a command in the current or a specified directory. Optionally stores the output in a scalar.
- $str = slurp( $filename )
-
Read a file.
- $ok = spurt( $filename, $str, ... )
-
Write to a file.
- $str = filetype( $filename )
-
Get a file's type.
- $gzname = gzip( $filename )
-
Compress a file.
- $ok = strip( $filename, ... )
-
Strip object files.
DIAGNOSTICS
- Could not create file FILE
-
A file could not be opened for writing.
- Could not write to file FILE
-
Is a file system full?
- Could not run COMMAND
-
An external command failed to execute.
CONFIGURATION AND ENVIRONMENT
None.
DEPENDENCIES
See CPANPLUS::Dist::Slackware.
INCOMPATIBILITIES
None known.
SEE ALSO
CPANPLUS::Dist::Slackware
AUTHOR
Andreas Voegele <voegelas@cpan.org>
BUGS AND LIMITATIONS
Please report any bugs using the issue tracker at https://github.com/graygnuorg/CPANPLUS-Dist-Slackware/issues.
LICENSE AND COPYRIGHT
Copyright 2017-2020 Andreas Voegele
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
See https://dev.perl.org/licenses/ for more information.