1Pinto::Util(3)        User Contributed Perl Documentation       Pinto::Util(3)
2
3
4

NAME

6       Pinto::Util - Static utility functions for Pinto
7

VERSION

9       version 0.14
10

DESCRIPTION

12       This is a private module for internal use only.  There is nothing for
13       you to see here (yet).  All API documentation is purely for my own
14       reference.
15

FUNCTIONS

17   throw($message)
18   throw($exception_object)
19       Throws a Pinto::Exception with the given message.  If given a reference
20       to a Pinto::Exception object, then it just throws it again.
21
22   debug( $message )
23   debug( sub {...} )
24       Writes the message on STDERR if the "PINTO_DEBUG" environment variable
25       is true.  If the argument is a subroutine, it will be invoked and its
26       output will be written instead.  Always returns true.
27
28   whine( $message )
29       Just calls warn(), but always appends the newline so that line numbers
30       are suppressed.
31
32   author_dir( @base, $author )
33       Given the name of an $author, returns the directory where the
34       distributions for that author belong (as a Path::Class::Dir).  The
35       optional @base can be a series of Path::Class:Dir or path parts (as
36       strings).  If @base is given, it will be prepended to the directory
37       that is returned.
38
39   itis( $var, $class )
40       Asserts whether var is a blessed reference and is an instance of the
41       $class.
42
43   parse_dist_path( $path )
44       Parses a path like the ones you would see in a full URI to a
45       distribution in a CPAN repository, or the URI fragment you would see in
46       a CPAN index.  Returns the author and file name of the distribution.
47       Subdirectories between the author name and the file name are discarded.
48
49   isa_perl( $path_or_uri )
50       Return true if $path_or_uri appears to point to a release of perl
51       itself.  This is based on some file naming patterns that I've seen in
52       the wild.  It may not be completely accurate.
53
54   mtime( $file )
55       Returns the last modification time (in epoch seconds) for the "file".
56       The argument is required and the file must exist or an exception will
57       be thrown.
58
59   md5( $file )
60       Returns the "MD-5" digest (as a hex string) for the $file.  The
61       argument is required and the file must exist on an exception will be
62       thrown.
63
64   sha256( $file )
65       Returns the "SHA-256" digest (as a hex string) for the $file.  The
66       argument is required and the file must exist on an exception will be
67       thrown.
68
69   validate_property_name( $prop_name )
70       Throws an exception if the property name is invalid.  Currently,
71       property names must be alphanumeric plus any underscores or hyphens.
72
73   validate_stack_name( $stack_name )
74       Throws an exception if the stack name is invalid.  Currently, stack
75       names must be alphanumeric plus underscores or hyphens.
76
77   current_utc_time()
78       Returns the current time (in epoch seconds) unless the current time has
79       been overridden by $Pinto::Globals::current_utc_time.
80
81   current_time_offset()
82       Returns the offset between current UTC time and the local time in
83       seconds, unless overridden by $Pinto::Globals::current_time_offset.
84       The "current_time" function is used to determine the current UTC time.
85
86   current_username()
87       Returns the username of the current user unless it has been overridden
88       by $Pinto::Globals::current_username.  The username can be defined
89       through a number of environment variables.  Throws an exception if no
90       username can be determined.
91
92   current_author_id()
93       Returns the author id of the current user unless it has been overridden
94       by $Pinto::Globals::current_author_id.  The author id can be defined
95       through environment variables.  Otherwise it defaults to the upper-case
96       form of the "current_username".  And since PAUSE only allows letters
97       and numbers in the author id, then we remove all of those from the
98       "current_username" too.
99
100   is_interactive()
101       Returns true if the process is connected to an interactive terminal
102       (i.e.  a keyboard & screen) unless it has been overridden by
103       $Pinto::Globals::is_interactive.
104
105   interpolate($string)
106       Performs interpolation on a literal string.  The string should not
107       include anything that looks like a variable.  Only metacharacters (like
108       \n) will be interpolated correctly.
109
110   trim_text($string)
111       Returns the string with all leading and trailing whitespace removed.
112
113   title_text($string)
114       Returns all the characters in $string before the first newline.  If
115       there is no newline, returns the entire $string.
116
117   body_text($string)
118       Returns all the characters in $string after the first newline.  If
119       there is no newline, returns an empty string.
120
121   truncate_text($string, $length, $elipses)
122       Truncates the $string and appends $elipses if the $string is longer
123       than $length characters.  $elipses defaults to '...' if not specified.
124
125   decamelize($string)
126       Returns the string forced to lower case and words separated by
127       underscores.  For example "FooBar" becomes "foo_bar".
128
129   indent_text($string, $n)
130       Returns a copy of $string with each line indented by $n spaces.  In
131       other words, it puts "4n" spaces immediately after each newline in
132       $string.  The original $string is not modified.
133
134   mksymlink($from => $to)
135       Creates a symlink between the two files.  No checks are performed to
136       see if either path is valid or already exists.  Throws an exception if
137       the operation fails or is not supported.
138
139   is_system_prop($string)
140       Returns true if $string is the name of a system property.
141
142   uuid()
143       Returns a UUID as a string.  Currently, the UUID is derived from random
144       numbers.
145
146   user_palette()
147       Returns a reference to an array containing the names of the colors
148       pinto can use.  This can be influenced by setting the "PINTO_PALETTE"
149       environment variable.
150
151   is_blank($string)
152       Returns true if the string is undefined, empty, or contains only
153       whitespace.
154
155   is_not_blank($string)
156       Returns true if the string contains any non-whitespace characters.
157
158   mask_uri_passwords($string)
159       Masks the parts the string that look like a password embedded in an
160       http or https URI. For example, "http://joe:secret@foo.com" would
161       return "http://joe:*password*@foo.com"
162
163   is_remote_repo {
164       Returns true if the argument looks like a URI to a remote repository
165

AUTHOR

167       Jeffrey Ryan Thalhammer <jeff@stratopan.com>
168
170       This software is copyright (c) 2015 by Jeffrey Ryan Thalhammer.
171
172       This is free software; you can redistribute it and/or modify it under
173       the same terms as the Perl 5 programming language system itself.
174
175
176
177perl v5.30.1                      2020-01-30                    Pinto::Util(3)
Impressum