CPANPLUS::Dist::Debora::Util - Utility functions
version 0.012
use CPANPLUS::Dist::Debora::Util qw( parse_version module_is_distributed_with_perl decode_utf8 slurp_utf8 spew_utf8 can_run run find_most_recent_mtime find_shared_objects ); my $name = 'Module::CoreList'; my $version = parse_version('2.32'); my $ok = module_is_distributed_with_perl($name, $version); my $string = decode_utf8($bytes); my $ok = spew_utf8($filename, $string); my $string = slurp_utf8($filename); my $program = can_run('perl'); if ($program) { my $output = ''; if (run(command => [$program, '-v'], buffer => \$output)) { print $output; } } my $last_modification = find_most_recent_mtime($sourcedir); for my $filename (@{find_shared_objects($stagingdir)}) { say $filename; }
This module provides utility functions for CPANPLUS::Dist::Debora.
my $version = parse_version($string);
Returns a version object.
my $is_included = module_is_distributed_with_perl($name, $version);
Checks whether the specified module is part of the standard Perl distribution.
my $string = decode_utf8($bytes);
Decodes UTF-8 encoded bytes to a string.
my $string = slurp_utf8($filename);
Reads UTF-8 encoded data from a file.
my $ok = spew_utf8($filename, $string);
Writes a string to a file.
my $path = can_run($program);
Locates an external command and returns the path to the binary or the undefined value.
my $ok = run( command => [$program, @args], dir => $dir, buffer => \$bytes, verbose => 0|1, on_error => sub { say "Could not run '$_[0]': $_[1]" }, );
Runs an external command in the current or specified directory. Optionally stores the command output in a variable.
my $path = unix_path($path);
Converts an OS specific path into a Unix path with forward slashes.
my $type = filetype($filename);
Determines a file's type. Returns "data", "executable", "script" or "text";
my $mtime = find_most_recent_mtime($sourcedir);
Searches the specified directory recursively for the last modified file. Returns the modification time.
my @filenames = @{find_shared_objects($stagingdir)};
Searches the specified directory recursively for shared objects and executable programs.
my $is_testing = is_testing;
Returns true if automated or release testing is enabled.
An external command could not be run.
The test mode is enabled if any of these variables is set. No packages are installed in test mode.
Requires only modules that are distributed with Perl.
None.
Install IPC::Run if IPC::Open3 causes IO::Select to output warnings.
Andreas Vögele <voegelas@cpan.org>
Copyright (C) 2023 Andreas Vögele
This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install CPANPLUS::Dist::Debora, copy and paste the appropriate command in to your terminal.
cpanm
cpanm CPANPLUS::Dist::Debora
CPAN shell
perl -MCPAN -e shell install CPANPLUS::Dist::Debora
For more information on module installation, please visit the detailed CPAN module installation guide.