1Prima::Utils(3)       User Contributed Perl Documentation      Prima::Utils(3)
2
3
4

NAME

6       Prima::Utils - miscellanneous routines
7

DESCRIPTION

9       The module contains several helper routines, implemented in both C and
10       perl.  Whereas the C-coded parts are accessible only if 'use Prima;'
11       statement was issued prior to the 'use Prima::Utils' invocation, the
12       perl-coded are always available.  This makes the module valuable when
13       used without the rest of toolkit code.
14

API

16       alarm $TIMEOUT, $SUB, @PARAMS
17           Calls SUB with PARAMS after TIMEOUT milliseconds.
18
19       beep [ FLAGS = mb::Error ]
20           Invokes the system-depended sound and/or visual bell, corresponding
21           to one of following constants:
22
23                   mb::Error
24                   mb::Warning
25                   mb::Information
26                   mb::Question
27
28       get_gui
29           Returns one of "gui::XXX" constants, reflecting the graphic user
30           interface used in the system:
31
32                   gui::Default
33                   gui::PM
34                   gui::Windows
35                   gui::XLib
36                   gui::GTK
37
38       get_os
39           Returns one of "apc::XXX" constants, reflecting the platfrom.
40           Currently, the list of the supported platforms is:
41
42                   apc::Win32
43                   apc::Unix
44
45       ceil DOUBLE
46           Obsolete function.
47
48           Returns stdlib's ceil() of DOUBLE
49
50       find_image PATH
51           Converts PATH from perl module notation into a file path, and
52           searches for the file in @INC paths set. If a file is found, its
53           full filename is returned; otherwise "undef" is returned.
54
55       floor DOUBLE
56           Obsolete function.
57
58           Returns stdlib's floor() of DOUBLE
59
60       getdir PATH
61           Reads content of PATH directory and returns array of string pairs,
62           where the first item is a file name, and the second is a file type.
63
64           The file type is a string, one of the following:
65
66                   "fifo" - named pipe
67                   "chr"  - character special file
68                   "dir"  - directory
69                   "blk"  - block special file
70                   "reg"  - regular file
71                   "lnk"  - symbolic link
72                   "sock" - socket
73                   "wht"  - whiteout
74
75           This function was implemented for faster directory reading, to
76           avoid successive call of "stat" for every file.
77
78           Also, getdir is consistently inclined to treat filenames in utf8,
79           disregarding both perl unicode settings and the locale.
80
81       last_error
82           Returns last system error, if any
83
84       path [ FILE ]
85           If called with no parameters, returns path to a directory, usually
86           ~/.prima, that can be used to contain the user settings of a
87           toolkit module or a program. If FILE is specified, appends it to
88           the path and returns the full file name. In the latter case the
89           path is automatically created by "File::Path::mkpath" unless it
90           already exists.
91
92       post $SUB, @PARAMS
93           Postpones a call to SUB with PARAMS until the next event loop tick.
94
95       query_drives_map [ FIRST_DRIVE = "A:" ]
96           Returns anonymous array to drive letters, used by the system.
97           FIRST_DRIVE can be set to other value to start enumeration from.
98           Some OSes can probe eventual diskette drives inside the drive
99           enumeration routines, so there is a chance to increase
100           responsiveness of the function it might be reasonable to set
101           FIRST_DRIVE to "C:" string.
102
103           If the system supports no drive letters, empty array reference is
104           returned ( unix ).
105
106       query_drive_type DRIVE
107           Returns one of "dt::XXX" constants, describing the type of drive,
108           where DRIVE is a 1-character string. If there is no such drive, or
109           the system supports no drive letters ( unix ), "dt::None" is
110           returned.
111
112                   dt::None
113                   dt::Unknown
114                   dt::Floppy
115                   dt::HDD
116                   dt::Network
117                   dt::CDROM
118                   dt::Memory
119
120       sound [ FREQUENCY = 2000, DURATION = 100 ]
121           Issues a tone of FREQUENCY in Hz with DURATION in milliseconds.
122
123       username
124           Returns the login name of the user.  Sometimes is preferred to the
125           perl-provided "getlogin" ( see "getlogin" in perlfunc ) .
126
127       xcolor COLOR
128           Accepts COLOR string on one of the three formats:
129
130                   #rgb
131                   #rrggbb
132                   #rrrgggbbb
133
134           and returns 24-bit RGB integer value.
135

AUTHOR

137       Dmitry Karasik, <dmitry@karasik.eu.org>.
138

SEE ALSO

140       Prima
141
142
143
144perl v5.32.1                      2021-01-27                   Prima::Utils(3)
Impressum