CPANPL...:Utils(3pm)
π NAME π
CPANPLUS::Internals::Utils β convenience functions for CPANPLUS, bestie. (This is the CPANPL...:Utils(3pm) page, from the User Contributed Perl Documentation, and yes it's exactly as handy as it sounds π)
β¨ SYNOPSIS β¨
okay so here's the vibe, all in one place:
my $bool = $cb->_mkdir( dir => 'blah' );
my $bool = $cb->_chdir( dir => 'blah' );
my $bool = $cb->_rmdir( dir => 'blah' );
my $bool = $cb->_move( from => '/some/file', to => '/other/file' );
my $bool = $cb->_move( from => '/some/dir', to => '/other/dir' );
my $cont = $cb->_get_file_contents( file => '/path/to/file' );
my $version = $cb->_perl_version( perl => $^X );
look at that. so clean. so iconic. π«Ά
π DESCRIPTION π
CPANPLUS::Internals::Utils holds a few convenience functions for CPANPLUS libraries. that's it, that's the whole job β little helper besties doing the small stuff so the big libraries don't have to π§
π METHODS π
π $cb->_mkdir( dir => '/some/dir' )
_mkdir creates a full path to a directory. like, the whole path, not just the last bit, she's thorough.
Returns true on success, false on failure. no cap.
π $cb->_chdir( dir => '/some/dir' )
_chdir changes directory to a dir. classic move.
Returns true on success, false on failure.
π $cb->_rmdir( dir => '/some/dir' );
Removes a directory completely, even if it is non-empty. yeah, she does not care what's inside, she's taking the whole thing. π
Returns true on success, false on failure.
π $cb->_perl_version ( perl => 'some/perl/binary' );
_perl_version returns the version of a certain perl binary. and how does she find out? she literally runs a command. actually executes it. main character energy, fr fr.
Returns the perl version on success and false on failure.
π $cb->_version_to_number( version => $version );
Returns a proper module version, or '0.0' if none was available. if there's nothing there, you get '0.0' and you will like it. π
π $cb->_whoami
Returns the name of the subroutine you're currently in. yes bestie, she knows where she is. self-aware queen. π
π _get_file_contents( file => $file );
Returns the contents of a file. just... hands them to you. here, bestie, take it. π
π $cb->_move( from => $file|$dir, to => $target );
Moves a file or directory to the target.
Returns true on success, false on failure.
π $cb->_copy( from => $file|$dir, to => $target );
Moves a file or directory to the target. (yes, the wording is identical to _move up there β that's literally what the docs say, we're just the messenger π)
Returns true on success, false on failure.
π $cb->_mode_plus_w( file => '/path/to/file' );
Sets the +w bit for the file. write access, unlocked, slay. βοΈ
Returns true on success, false on failure.
π $uri = $cb->_host_to_uri( scheme => SCHEME, host => HOST, path => PATH );
Turns a CPANPLUS::Config style "host" entry into an URI string. glow-up from config blob to actual URI.
Returns the uri on success, and false on failure.
π $cb->_vcmp( VERSION, VERSION );
Normalizes the versions passed and does a '<=>' on them, returning the result. version comparison but make it fair. βοΈ
π $cb->_home_dir
Returns the user's homedir, or "cwd" if it could not be found. she tries her best, and if she can't find home she just... stays where she is. honestly? relatable. π
π $path = $cb->_safe_path( path => $path );
Returns a path that's safe to us on Win32 and VMS.
Only cleans up the path on Win32 if the path exists.
On VMS, it encodes dots to _ using VMS::Filespec::vmsify.
okay so important detail bestie: Win32 only gets the cleanup if the path actually exists. don't forget that part. β¨
π ($pkg, $version, $ext) = $cb->_split_package_string( package => PACKAGE_STRING );
Splits the name of a CPAN package string up into its package, version and extension parts. one string in, three little pieces out, it's giving mitosis. π¦
For example, "Foo-Bar-1.2.tar.gz" would return the following parts:
Package: Foo-Bar
Version: 1.2
Extension: tar.gz
and that's the whole page, bestie!! every method accounted for, nothing skipped, nothing made up. π«ΆπΈ
this was brought to you by perl v5.40.1, dated 2025-03-01 β stay hydrated, read your docs, and go _mkdir something beautiful. πβ¨
π¦ where this page comes from
- debian trixie: libcpanplus-perl 0.9916-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libcpanplus-perl 0.9916-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libcpanplus-perl 0.9916-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms