1CPANPLUS::Internals::UtUislesr(3C)ontributed Perl DocumeCnPtAaNtPiLoUnS::Internals::Utils(3)
2
3
4
6 CPANPLUS::Internals::Utils - convenience functions for CPANPLUS
7
9 my $bool = $cb->_mkdir( dir => 'blah' );
10 my $bool = $cb->_chdir( dir => 'blah' );
11 my $bool = $cb->_rmdir( dir => 'blah' );
12
13 my $bool = $cb->_move( from => '/some/file', to => '/other/file' );
14 my $bool = $cb->_move( from => '/some/dir', to => '/other/dir' );
15
16 my $cont = $cb->_get_file_contents( file => '/path/to/file' );
17
18
19 my $version = $cb->_perl_version( perl => $^X );
20
22 "CPANPLUS::Internals::Utils" holds a few convenience functions for
23 CPANPLUS libraries.
24
26 $cb->_mkdir( dir => '/some/dir' )
27 "_mkdir" creates a full path to a directory.
28
29 Returns true on success, false on failure.
30
31 $cb->_chdir( dir => '/some/dir' )
32 "_chdir" changes directory to a dir.
33
34 Returns true on success, false on failure.
35
36 $cb->_rmdir( dir => '/some/dir' );
37 Removes a directory completely, even if it is non-empty.
38
39 Returns true on success, false on failure.
40
41 $cb->_perl_version ( perl => 'some/perl/binary' );
42 "_perl_version" returns the version of a certain perl binary. It does
43 this by actually running a command.
44
45 Returns the perl version on success and false on failure.
46
47 $cb->_version_to_number( version => $version );
48 Returns a proper module version, or '0.0' if none was available.
49
50 $cb->_whoami
51 Returns the name of the subroutine you're currently in.
52
53 _get_file_contents( file => $file );
54 Returns the contents of a file
55
56 $cb->_move( from => $file|$dir, to => $target );
57 Moves a file or directory to the target.
58
59 Returns true on success, false on failure.
60
61 $cb->_copy( from => $file|$dir, to => $target );
62 Moves a file or directory to the target.
63
64 Returns true on success, false on failure.
65
66 $cb->_mode_plus_w( file => '/path/to/file' );
67 Sets the +w bit for the file.
68
69 Returns true on success, false on failure.
70
71 $uri = $cb->_host_to_uri( scheme => SCHEME, host => HOST, path => PATH );
72 Turns a CPANPLUS::Config style "host" entry into an URI string.
73
74 Returns the uri on success, and false on failure
75
76 $cb->_vcmp( VERSION, VERSION );
77 Normalizes the versions passed and does a '<=>' on them, returning the
78 result.
79
80 $cb->_home_dir
81 Returns the user's homedir, or "cwd" if it could not be found
82
83 $path = $cb->_safe_path( path => $path );
84 Returns a path that's safe to us on Win32 and VMS.
85
86 Only cleans up the path on Win32 if the path exists.
87
88 On VMS, it encodes dots to _ using "VMS::Filespec::vmsify"
89
90 ($pkg, $version, $ext) = $cb->_split_package_string( package =>
91 PACKAGE_STRING );
92 Splits the name of a CPAN package string up into its package, version
93 and extension parts.
94
95 For example, "Foo-Bar-1.2.tar.gz" would return the following parts:
96
97 Package: Foo-Bar
98 Version: 1.2
99 Extension: tar.gz
100
101
102
103perl v5.34.0 2021-08-23 CPANPLUS::Internals::Utils(3)