NAME
CTK::Util - CTK Utilities
VERSION
Version 2.12
REVISION
$Revision: 145 $
SYNOPSIS
use CTK::Util;
use CTK::Util qw( :BASE ); # Export only BASE subroutines. See TAGS section
my @ls = ls(".");
# or (for CTK module)
use CTK;
my @ls = CTK::ls(".");
# or (for core and extended subroutines only)
use CTK;
my $c = new CTK;
my $prefix = $c->getsyscfg("prefix");
DESCRIPTION
Public subroutines
SUBROUTINES
All subroutines are listed in alphabetical order
basetime
$secs = basetime();
The time at which the program began running, in seconds. This function returns result of expression:
time() - $^T
Tags: BASE, DATE
bload
$bindata = bload( $file_or_fh, $onutf8 );
Reading file in binary mode as ':raw:utf8' layer (if $onutf8 is true) or regular binary layer.
Tags: BASE, FILE, ATOM
bsave
$status = bsave( $file_or_fh, $bindata, $onutf8 );
Saving file in binary mode as ':raw:utf8' layer (if $onutf8 is true) or regular binary layer.
Tags: BASE, FILE, ATOM
catdir, catfile, rootdir, tmpdir, updir, curdir, path, splitpath, splitdir
This is the File::Spec functions, and exported here for historical reasons.
See File::Spec::Functions and File::Spec for details
- catdir
-
$path = catdir( @directories );
Concatenate two or more directory names to form a complete path ending with a directory. But remove the trailing slash from the resulting string, because it doesn't look good, isn't necessary and confuses OS/2. Of course, if this is the root directory, don't cut off the trailing slash :-)
- catfile
-
$path = catfile( @directories, $filename );
Concatenate one or more directory names and a filename to form a complete path ending with a filename
- curdir
-
$curdir = curdir();
Returns a string representation of the current directory.
- path
-
@PATH = path();
Takes no argument. Returns the environment variable PATH (or the local platform's equivalent) as a list.
- rootdir
-
$rootdir = rootdir();
Returns a string representation of the root directory.
- splitdir
-
@dirs = splitdir( $directories );
The opposite of "catdir"
- splitpath
-
($volume,$directories,$file) = splitpath( $path ); ($volume,$directories,$file) = splitpath( $path, $no_file );
Splits a path in to volume, directory, and filename portions. On systems with no concept of volume, returns '' for volume.
For systems with no syntax differentiating filenames from directories, assumes that the last file is a path unless $no_file is true or a trailing separator or /. or /.. is present. On Unix, this means that $no_file true makes this return ( '', $path, '' ).
- tmpdir
-
$tmpdir = tmpdir();
Returns a string representation of the first writable directory from a list of possible temporary directories. Returns the current directory if no writable temporary directories are found. The list of directories checked depends on the platform; e.g. File::Spec::Unix checks $ENV{TMPDIR} (unless taint is on) and /tmp.
- updir
-
$updir = updir();
Returns a string representation of the parent directory.
Tags: API, BASE
cdata
$cdatatext = cdata( $text );
Returns a string "<![CDATA[$text]]>" for plain XML documents.
Tags: BASE, FORMAT
correct_date
$mydate = correct_date( $date );
Returns date in format dd.mm.yyyy or null ('') if $date is wrongly.
Tags: BASE, DATE
correct_dig
$mydig = correct_dig( $string );
Returns digits only from string or 0 if string is not correctly.
Tags: BASE, FORMAT
correct_number
$mynumber = correct_number( $string, $sep );
Placement of separators discharges among digits. For example 1`234`567 if $sep is char "`" (default)
Tags: BASE, FORMAT
current_date
$date = current_date();
Returns current date in format dd.mm.yyyy
Tags: BASE, DATE
current_date_time
$datetime = current_date_time();
Returns current date in format dd.mm.yyyy hh.mm.ss
Tags: BASE, DATE
date_time2dig
$dtd = date_time2dig( $datetime );
Returns $datetime (or current) in format yyyymmddhhmmss
Tags: BASE, DATE
date2dig
$dd = date2dig( $date );
Returns $date (or current) in format yyyymmdd
Tags: BASE, DATE
date2localtime
$time = date2localtime( $date );
Returns time from date format dd.mm.yyyy in time() value in seconds since the system epoch (Midnight, January 1, 1970 GMT on Unix, for example).
See "timelocal" in Time::Local
Tags: BASE, DATE
datef
See "dtf"
Tags: BASE, DATE
datetime2localtime
$time = datetime2localtime( $datetime );
Returns time from datetime format dd.mm.yyyy hh.mm.ss in time() value in seconds since the system epoch (Midnight, January 1, 1970 GMT on Unix, for example).
See "timelocal" in Time::Local
Tags: BASE, DATE
datetimef
See "dtf"
Tags: BASE, DATE
dformat
$string = dformat( $mask, \%replacehash );
Replace substrings "[...]" in mask and returns replaced result. Data for replacing get from \%replacehash
For example:
# -> 01-foo-bar.baz.tgz
$string = dformat( "01-[NAME]-bar.[EXT].tgz", {
NAME => 'foo',
EXT => 'baz',
} );
See also "fformat" for working with files
Tags: BASE, FORMAT
dig2date
$date = dig2date_time( $dd );
Returns date (or current) from format yyyymmdd in format dd.mm.yyyy
Tags: BASE, DATE
dig2date_time
$datetime = dig2date_time( $dtd );
Returns date (or current) from format yyyymmddhhmmss in format dd.mm.yyyy hh.mm.ss
Tags: BASE, DATE
dtf
$datetime = dtf( $format, $time );
$datetime = dtf( $format, $time, 1 ); # in GMT context
$datetime = dtf( $format, $time, 'MSK' ); # TimeZone (Z) = MSK
$datetime = dtf( $format, $time, 'GMT' ); # TimeZone (Z) = GMT
Returns time in your format. Each conversion specification is replaced by appropriate characters as described in the following list.
s, ss, _s - Seconds
m, mm, _m - Minutes
h, hh, _h - Hours
D, DD, _D - Day of month
M, MM, _M - Month
Y, YY, YYY, YYYY - Year
w - Short form of week day (Sat, Tue and etc)
W - Week day (Saturdat, Tuesday and etc)
MON, mon - Short form of month (Apr, May and etc)
MONTH, month - Month (April, May and etc)
Z - short name of local TimeZone
G - short name of TimeZone GMT (for GMT context only)
U - short name of TimeZone UTC (for GMT context only)
Examples:
# RFC2822
$dt = dtf("%w, %DD %MON %YYYY %hh:%mm:%ss +0400"); # Tue, 12 Feb 2013 16:07:05 +0400
# W3CDTF (ISO 8601) -- Mail format
$dt = dtf("%YYYY-%MM-%DDT%hh:%mm:%ss+04:00"); # 2013-02-12T16:10:28+04:00
# CTIME
$dt = dtf("%w %MON %_D %hh:%mm:%ss %YYYY"); # Tue Feb 2 16:15:18 2013
# CTIME with TimeZone
$dt = dtf("%w %MON %_D %hh:%mm:%ss %YYYY %Z", time(), 'MSK'); # Tue Feb 12 17:21:50 2013 MSK
# Russian date and time format
$dt = dtf("%DD.%MM.%YYYY %hh:%mm:%ss"); # 12.02.2013 16:16:53
# DIG form
$dt = dtf("%YYYY%MM%DD%hh%mm%ss"); # 20130212161844
# HTTP headers format (See CGI::Util::expires)
$dt = dtf("%w, %DD %MON %YYYY %hh:%mm:%ss %G", time, 1); # Tue, 12 Feb 2013 13:35:04 GMT
# HTTP/cookie format (See CGI::Util::expires)
$dt = dtf("%w, %DD-%MON-%YYYY %hh:%mm:%ss %G", time, 1); # Tue, 12-Feb-2013 13:35:04 GMT
For more features please use Date::Format and DateTime
Tags: BASE, DATE
eqtime
eqtime("source/file", "destination/file");
Sets modified time of destination to that of source.
Tags: BASE, FILE, ATOM
escape
$safe = escape("10% is enough\n");
Replaces each unsafe character in the string "10% is enough\n" with the corresponding escape sequence and returns the result. The string argument should be a string of bytes.
See also URI::Escape
Tags: BASE, FORMAT
fformat
$file = fformat( $mask, $filename );
Replace substrings "[FILENAME]", "[NAME]", "[FILEEXT]", "[EXT]" and "[FILE]" in mask and returns replaced result. Data for replacing get from filename:
[FILENAME] -- Fileneme only
[NAME] -- Fileneme only
[FILEEXT] -- Extension only
[EXT] -- Extension only
[FILE] -- = "[FILENAME].[FILEEXT]" ($filename)
For example:
$file = fformat( "01-[NAME]-bar.[EXT].tgz", "foo.baz" ); # -> 01-foo-bar.baz.tgz
See also "dformat"
Tags: BASE, FORMAT
file_load
See "bload"
Tags: BASE, FILE, ATOM
file_save
See "bsave"
Tags: BASE, FILE, ATOM
fload
$textdata = fload( $file );
Reading file in regular text mode
Tags: BASE, FILE, ATOM
fsave
$status = fsave( $file, $textdata );
Saving file in regular text mode
Tags: BASE, FILE, ATOM
getdirlist
$listref = getdirlist( $dir, $mask );
Returns reference to array directories of directory $dir by $mask (regexp or scalar string).
See also "ls"
Tags: BASE, FILE, ATOM
getfilelist
$listref = getlist( $dir, $mask );
Returns reference to array files of directory $dir by $mask (regexp or scalar string).
See also "ls"
Tags: BASE, FILE, ATOM
getlist
See "getfilelist"
Tags: BASE, FILE, ATOM
load_file
See "fload"
Tags: BASE, FILE, ATOM
localtime2date
$date = localtime2date( time() )
Returns time in format dd.mm.yyyy
Tags: BASE, DATE
localtime2date_time
$datetime = localtime2date_time( time() )
Returns time in format dd.mm.yyyy hh.mm.ss
Tags: BASE, DATE
ls
@list = ls( $dir);
@list = ls( $dir, $mask );
A function returns list content of directory $dir by $mask (regexp or scalar string)
Tags: BASE, FILE, ATOM
preparedir
$status = preparedir( $dir );
$status = preparedir( \@dirs );
$status = preparedir( \%dirs );
$status = preparedir( $dir, $chmode );
Preparing directory: creation and permission modification. The function returns true or false.
The $chmode argument should be a octal value, for example:
$status = preparedir( [qw/ foo bar baz /], 0777 );
Tags: BASE, FILE, ATOM
randchars
$rand = randchars( $n ); # default chars collection: 0..9,'a'..'z','A'..'Z'
$rand = randchars( $n, \@collection ); # Defined chars collection
Returns random sequence of casual characters by the amount of n
For example:
$rand = randchars( 8, [qw/a b c d e f/]); # -> cdeccfdf
Tags: BASE, FORMAT
randomize
$rand = randomize( $n );
Returns random number of the set amount of characters
Tags: BASE, FORMAT
save_file
See "fsave"
Tags: BASE, FILE, ATOM
scandirs
@dirs = scandirs( $dir, $mask );
A function returns all directories of directory $dir by $mask (regexp or scalar string) in format: [$path, $name]
Tags: BASE, FILE, ATOM
scanfiles
@files = scanfiles( $dir, $mask );
A function returns all files of directory $dir by $mask (regexp or scalar string) in format: [$path, $name]
Tags: BASE, FILE, ATOM
shred
$stat = shred( $file );
Do a more secure overwrite of given files or devices, to make it harder for even very expensive hardware probing to recover the data.
Tags: BASE, FILE, ATOM
shuffle
@cards = shuffle(0..51); # 0..51 in a random order
Returns the elements of LIST in a random order
Pure-Perl implementation of Function List::Util::PP::shuffle (Copyright (c) 1997-2009 Graham Barr <gbarr@pobox.com>. All rights reserved.)
See also List::Util
Tags: BASE, FORMAT
slash
$slashed = slash( $string );
Escaping symbols \ and ' and returns strings \\ and \'
Tags: BASE, FORMAT
splitformat
See "fformat"
Tags: BASE, FORMAT
tag
$detagged = tag( $string );
<, >, " and ' chars convert to <, >, " and ' strings.
Tags: BASE, FORMAT
tag_create
$string = tag_create( $detagged );
Reverse function "tag"
Tags: BASE, FORMAT
timef
See "dtf"
Tags: BASE, DATE
to_base64
$base64_text = to_base64( $utf8_text );
Function to encode strings into the base64 encoding specified in RFC 2045 - MIME (Multipurpose Internet Mail Extensions). The base64 encoding is designed to represent arbitrary sequences of octets in a form that need not be humanly readable. A 65-character subset ([A-Za-z0-9+/=]) of US-ASCII is used, enabling 6 bits to be represented per printable character.
See also MIME::Base64
Tags: BASE, FORMAT
to_cp1251
See "to_windows1251"
Tags: BASE, FORMAT
to_utf8
$utf8_text = to_utf8( $win1251_text )
$utf8_text = to_utf8( $win1251_text, "Windows-1251" )
Decodes a sequence of octets ($win1251_text) assumed to be in ENCODING (Windows-1251) into Perl's internal form and returns the resulting string. As in encode(), ENCODING can be either a canonical name or an alias. For encoding names and aliases, see Encode.
Obsolete alias: CP1251toUTF8
Tags: BASE, FORMAT
to_windows1251
$win1251_text = to_windows1251( $utf8_text )
$win1251_text = to_windows1251( $utf8, "Windows-1251" )
Encodes a string from Perl's internal form into ENCODING (Windows-1251) and returns a sequence of octets ($win1251_text). ENCODING can be either a canonical name or an alias. For encoding names and aliases, see Encode.
Obsolete alias: UTF8toCP1251
Tags: BASE, FORMAT
touch
touch( "file" );
Makes file exist, with current timestamp
Tags: BASE, FILE, ATOM
translate
$string = translate( $rus_string );
Translation russian (windows-1251/CP-1251) chars in latin symbols (poland transcription)
Tags: BASE, FORMAT
unescape
$str = unescape(escape("10% is enough\n"));
Returns a string with each %XX sequence replaced with the actual byte (octet).
This does the same as:
$string =~ s/%([0-9A-Fa-f]{2})/chr(hex($1))/eg;
See also URI::Escape
Tags: BASE, FORMAT
variant_stf
$fixlenstr = variant_stf( "qwertyuiop", 3 ); # -> q.p
$fixlenstr = variant_stf( "qwertyuiop", 7 ); # -> qw...op
Returns a line the fixed length from 3 to the n chars
Tags: BASE, FORMAT
visokos
$lybool = visokos( 2012 );
Returns a leap-year or not
Tags: BASE, DATE
UTILITY SUBROUTINES
com
See "execute"
Tags: UTIL, ATOM
exe
See "execute"
Tags: UTIL, ATOM
execute
$out = execute( "ls -la" );
$out = execute( "ls -la", $in, \$err, $binmode );
Executing external (system) command with IPC::Open3 using.
Variables $in, $err and $binmode is OPTIONAL.
$binmode set up binary mode layer as ':raw:utf8' layer (if $binmode is ':raw:utf8', for example) or regular binary layer (if $binmode is true).
See also IPC::Open3
Tags: UTIL, ATOM
ftp
%ftpct = (
ftphost => '192.168.1.1',
ftpuser => 'login',
ftppassword => 'password',
ftpdir => '~/',
voidfile => './void.txt',
#ftpattr => {}, # See Net::FTP
);
$ftpct = ftp( \%ftpct, 'connect' ); # Returns the connect's object
$rfiles = ftp( \%ftpct, 'ls' ); # Returns reference to array of directory listing
@remotefiles = $rfiles ? grep {!(/^\./)} @$rfiles : ();
ftp( \%ftpct, 'delete', $rfile ); # Delete remote file
ftp( \%ftpct, 'get', $rfile, $lfile ); # Get remote file to local file
ftp( \%ftpct, 'put', $lfile, $rfile ); # Put local file to remote file
Simple working with FTP.
See also Net::FTP
Tags: UTIL, ATOM
ftpgetlist
$rfiles = ftpgetlist( \%ftpct, $mask);
Returns reference to array of remote source listing by mask (as regexp, optional)
See "ftp"
Tags: UTIL, ATOM
ftptest
$status = ftptest( \%ftpct );
FTP connect testing.
See "ftp"
Tags: UTIL, ATOM
sendmail
my $sent = sendmail(
-to => 'to@example.com',
-cc => 'cc@example.com', ### OPTIONAL
-from => 'from@example.com',
-subject => 'my subject',
-message => 'my message',
-type => 'text/plain',
-sendmail => '/usr/sbin/sendmail', ### OPTIONAL
-charset => 'windows-1251',
-flags => '-t', ### OPTIONAL
-smtp => '192.168.1.1', ### OPTIONAL
-authuser => '', ### OPTIONAL
-authpass => '', ### OPTIONAL
-attach => [ ### OPTIONAL
{
Type=>'text/plain',
Data=>'document 1 content',
Filename=>'doc1.txt',
Disposition=>'attachment',
},
{
Type=>'text/plain',
Data=>'document 2 content',
Filename=>'doc2.txt',
Disposition=>'attachment',
},
{
Type=>'text/html',
Data=>'blah-blah-blah',
Filename=>'response.htm',
Disposition=>'attachment',
},
{
Type=>'image/gif',
Path=>'aaa000123.gif',
Filename=>'logo.gif',
Disposition=>'attachment',
},
### ... ###
],
);
debug($sent ? 'mail has been sent :)' : 'mail was not sent :(');
Send mail. See MIME::Lite for details
Tags: UTIL, ATOM
send_mail
See "sendmail"
Tags: UTIL, ATOM
EXTENDED SUBROUTINES
cachedir
my $value = cachedir();
my $value = $c->cachedir();
For example value can be set as: /var/cache
/var/cache is intended for cached data from applications. Such data is locally generated as a result of time-consuming I/O or calculation. The application must be able to regenerate or restore the data. Unlike /var/spool, the cached files can be deleted without data loss. The data must remain valid between invocations of the application and rebooting the system.
Files located under /var/cache may be expired in an application specific manner, by the system administrator, or both. The application must always be able to recover from manual deletion of these files (generally because of a disk space shortage). No other requirements are made on the data format of the cache directories.
See http://www.pathname.com/fhs/pub/ and "cachedir" in Sys::Path
Tags: API, BASE
docdir
my $value = docdir();
my $value = $c->docdir();
For example value can be set as: /usr/share/doc
Tags: API, BASE
localedir
my $value = localedir();
my $value = $c->localedir();
For example value can be set as: /usr/share/locale
Tags: API, BASE
localstatedir
my $value = localstatedir();
my $value = $c->localstatedir();
For example value can be set as: /var
/var - $Config::Config{'prefix'}
/var contains variable data files. This includes spool directories and files, administrative and logging data, and transient and temporary files. Some portions of /var are not shareable between different systems. For instance, /var/log, /var/lock, and /var/run. Other portions may be shared, notably /var/mail, /var/cache/man, /var/cache/fonts, and /var/spool/news.
/var is specified here in order to make it possible to mount /usr read-only. Everything that once went into /usr that is written to during system operation (as opposed to installation and software maintenance) must be in /var. If /var cannot be made a separate partition, it is often preferable to move /var out of the root partition and into the /usr partition. (This is sometimes done to reduce the size of the root partition or when space runs low in the root partition.) However, /var must not be linked to /usr because this makes separation of /usr and /var more difficult and is likely to create a naming conflict. Instead, link /var to /usr/var.
Applications must generally not add directories to the top level of /var. Such directories should only be added if they have some system-wide implication, and in consultation with the FHS mailing list.
See http://www.pathname.com/fhs/pub/ and "localstatedir" in Sys::Path
Tags: API, BASE
lockdir
my $value = lockdir();
my $value = $c->lockdir();
For example value can be set as: /var/lock
Lock files should be stored within the /var/lock directory structure. Lock files for devices and other resources shared by multiple applications, such as the serial device lock files that were originally found in either /usr/spool/locks or /usr/spool/uucp, must now be stored in /var/lock. The naming convention which must be used is "LCK.." followed by the base name of the device. For example, to lock /dev/ttyS0 the file "LCK..ttyS0" would be created. 5
The format used for the contents of such lock files must be the HDB UUCP lock file format. The HDB format is to store the process identifier (PID) as a ten byte ASCII decimal number, with a trailing newline. For example, if process 1230 holds a lock file, it would contain the eleven characters: space, space, space, space, space, space, one, two, three, zero, and newline.
See http://www.pathname.com/fhs/pub/ and "lockdir" in Sys::Path
Tags: API, BASE
prefixdir
my $value = prefixdir();
my $value = $c->prefixdir();
For example value can be set as: /usr
/usr - $Config::Config{'prefix'}
Is a helper function and should not be used directly.
/usr is the second major section of the filesystem. /usr is shareable, read-only data. That means that /usr should be shareable between various FHS-compliant hosts and must not be written to. Any information that is host-specific or varies with time is stored elsewhere.
Large software packages must not use a direct subdirectory under the /usr hierarchy.
See http://www.pathname.com/fhs/pub/ and "prefix" in Sys::Path
Tags: API, BASE
rundir
my $value = rundir();
my $value = $c->rundir();
For example value can be set as: /var/run
This directory contains system information data describing the system since it was booted. Files under this directory must be cleared (removed or truncated as appropriate) at the beginning of the boot process. Programs may have a subdirectory of /var/run; this is encouraged for programs that use more than one run-time file. 7 Process identifier (PID) files, which were originally placed in /etc, must be placed in /var/run. The naming convention for PID files is <program-name>.pid. For example, the crond PID file is named /var/run/crond.pid.
See http://www.pathname.com/fhs/pub/ and "rundir" in Sys::Path
Tags: API, BASE
sharedir
my $value = sharedir();
my $value = $c->sharedir();
For example value can be set as: /usr/share
The /usr/share hierarchy is for all read-only architecture independent data files. 10 This hierarchy is intended to be shareable among all architecture platforms of a given OS; thus, for example, a site with i386, Alpha, and PPC platforms might maintain a single /usr/share directory that is centrally-mounted. Note, however, that /usr/share is generally not intended to be shared by different OSes or by different releases of the same OS.
Any program or package which contains or requires data that doesn’t need to be modified should store that data in /usr/share (or /usr/local/share, if installed locally). It is recommended that a subdirectory be used in /usr/share for this purpose.
Game data stored in /usr/share/games must be purely static data. Any modifiable files, such as score files, game play logs, and so forth, should be placed in /var/games.
See http://www.pathname.com/fhs/pub/ and "datadir" in Sys::Path
Tags: API, BASE
sharedstatedir
my $value = sharedstatedir();
my $value = $c->sharedstatedir();
For example value can be set as: /var/lib
This hierarchy holds state information pertaining to an application or the system. State information is data that programs modify while they run, and that pertains to one specific host. Users must never need to modify files in /var/lib to configure a package’s operation.
State information is generally used to preserve the condition of an application (or a group of inter-related applications) between invocations and between different instances of the same application. State information should generally remain valid after a reboot, should not be logging output, and should not be spooled data.
An application (or a group of inter-related applications) must use a subdirectory of /var/lib for its data. There is one required subdirectory, /var/lib/misc, which is intended for state files that don’t need a subdirectory; the other subdirectories should only be present if the application in question is included in the distribution.
/var/lib/<name> is the location that must be used for all distribution packaging support. Different distributions may use different names, of course.
See http://www.pathname.com/fhs/pub/ and "sharedstatedir" in Sys::Path
Tags: API, BASE
spooldir
my $value = spooldir();
my $value = $c->spooldir();
For example value can be set as: /var/spool
/var/spool contains data which is awaiting some kind of later processing. Data in /var/spool represents work to be done in the future (by a program, user, or administrator); often data is deleted after it has been processed.
See http://www.pathname.com/fhs/pub/ and "spooldir" in Sys::Path
Tags: API, BASE
srvdir
my $value = srvdir();
my $value = $c->srvdir();
For example value can be set as: /srv
/srv contains site-specific data which is served by this system.
See http://www.pathname.com/fhs/pub/ and "srvdir" in Sys::Path
Tags: API, BASE
sysconfdir
my $value = sysconfdir();
my $value = $c->sysconfdir();
For example value can be set as: /etc
The /etc hierarchy contains configuration files. A "configuration file" is a local file used to control the operation of a program; it must be static and cannot be an executable binary.
See http://www.pathname.com/fhs/pub/ and "sysconfdir" in Sys::Path
Tags: API, BASE
syslogdir
my $value = syslogdir();
my $value = $c->syslogdir();
For example value can be set as: /var/log
This directory contains miscellaneous log files. Most logs must be written to this directory or an appropriate subdirectory.
See http://www.pathname.com/fhs/pub/ and "logdir" in Sys::Path
Tags: API, BASE
webdir
my $value = webdir();
my $value = $c->webdir();
For example value can be set as: /var/www
Directory where distribution put static web files.
Tags: API, BASE
CORE SUBROUTINES
carp, croak, cluck, confess
This is the Carp functions, and exported here for historical reasons.
- carp
-
carp( "string trimmed to 80 chars" );
Warn user (from perspective of caller)
- croak
-
croak( "We're outta here!" );
Die of errors (from perspective of caller)
- cluck
-
cluck( "This is how we got here!" );
Warn user (more detailed what carp with stack backtrace)
- confess
-
confess( "not implemented" );
Die of errors with stack backtrace
Tags: API, BASE
getsyscfg
See "syscfg"
Tags: API, BASE
isos
Returns true or false if the OS name is of the current value of $^O
isos('mswin32') ? "OK" : "NO";
# or
$c->isos('mswin32') ? "OK" : "NO";
See Perl::OSType for details
Tags: API, BASE
isostype
Given an OS type and OS name, returns true or false if the OS name is of the given type.
isostype('Windows') ? "OK" : "NO";
isostype('Unix', 'dragonfly') ? "OK" : "NO";
# or
$c->isostype('Windows') ? "OK" : "NO";
$c->isostype('Unix', 'dragonfly') ? "OK" : "NO";
See "is_os_type" in Perl::OSType
Tags: API, BASE
read_attributes
Smart rearrangement of parameters to allow named parameter calling. We do the rearrangement if the first parameter begins with a -
my @args = @_;
my ($content, $maxcnt, $timeout, $timedie, $base, $login, $password, $host, $table_tmp);
($content, $maxcnt, $timeout, $timedie, $base, $login, $password, $host, $table_tmp) =
read_attributes([
['DATA','CONTENT','USERDATA'],
['COUNT','MAXCOUNT','MAXCNT'],
['TIMEOUT','FORBIDDEN','INTERVAL'],
['TIMEDIE','TIME'],
['BD','DB','BASE','DATABASE'],
['LOGIN','USER'],
['PASSWORD','PASS'],
['HOST','HOSTNAME','ADDRESS','ADDR'],
['TABLE','TABLENAME','NAME','SESSION','SESSIONNAME']
],@args) if defined $args[0];
See CGI::Util
Tags: API, BASE
syscfg
Returns all hash %Config from system module Config or one value of this hash
my %syscfg = syscfg();
my $prefix = syscfg( "prefix" );
# or
my %syscfg = $c->syscfg();
my $prefix = $c->syscfg( "prefix" );
See Config module for details
Tags: API, BASE
TAGS
ALL, DEFAULT
Export all subroutines, default:
CP1251toUTF8
, UTF8toCP1251
, "basetime", "bload", "bsave", "cachedir", "carp", "catdir", "catfile", "cdata", "cluck", "com", "confess", "correct_date", "correct_dig", "correct_number", "croak", "curdir", "current_date", "current_date_time", "date2dig", "date2localtime", "date_time2dig", "datef", "datetime2localtime", "datetimef", "dformat", "dig2date", "dig2date_time", "docdir", "dtf", "eqtime", "escape", "exe", "execute", "fformat", "file_load", "file_save", "fload", "fsave", "ftp", "ftpgetlist", "ftptest", "getdirlist", "getfilelist", "getlist", "getsyscfg", "isos", "isostype", "load_file", "localedir", "localstatedir", "localtime2date", "localtime2date_time", "lockdir", "ls", "path", "prefixdir", "preparedir", "randchars", "randomize", "read_attributes", "rootdir", "rundir", "save_file", "scandirs", "scanfiles", "send_mail", "sendmail", "sharedir", "sharedstatedir", "shuffle", "slash", "splitdir", "splitformat", "splitpath", "spooldir", "srvdir", "syscfg", "sysconfdir", "syslogdir", "tag", "tag_create", "timef", "tmpdir", "to_base64", "to_cp1251", "to_utf8", "to_windows1251", "touch", "translate", "unescape", "updir", "variant_stf", "visokos", "webdir"
BASE
Export only base subroutines:
CP1251toUTF8
, UTF8toCP1251
, "basetime", "bload", "bsave", "cachedir", "carp", "catdir", "catfile", "cdata", "cluck", "confess", "correct_date", "correct_dig", "correct_number", "croak", "curdir", "current_date", "current_date_time", "date2dig", "date2localtime", "date_time2dig", "datef", "datetime2localtime", "datetimef", "dformat", "dig2date", "dig2date_time", "docdir", "dtf", "eqtime", "escape", "fformat", "file_load", "file_save", "fload", "fsave", "getdirlist", "getfilelist", "getlist", "getsyscfg", "isos", "isostype", "load_file", "localedir", "localstatedir", "localtime2date", "localtime2date_time", "lockdir", "ls", "path", "prefixdir", "preparedir", "randchars", "randomize", "read_attributes", "rootdir", "rundir", "save_file", "scandirs", "scanfiles", "sharedir", "sharedstatedir", "shred", "shuffle", "slash", "splitdir", "splitformat", "splitpath", "spooldir", "srvdir", "syscfg", "sysconfdir", "syslogdir", "tag", "tag_create", "timef", "tmpdir", "to_base64", "to_cp1251", "to_utf8", "to_windows1251", "touch", "translate", "unescape", "updir", "variant_stf", "visokos", "webdir"
FORMAT
Export only text format subroutines:
CP1251toUTF8
, UTF8toCP1251
, "cdata", "correct_dig", "correct_number", "dformat", "escape", "fformat", "randchars", "randomize", "shuffle", "slash", "splitformat", "tag", "tag_create", "to_base64", "to_cp1251", "to_utf8", "to_windows1251", "translate", "unescape", "variant_stf"
DATE
Export only date and time subroutines:
"basetime", "correct_date", "current_date", "current_date_time", "date2dig", "date2localtime", "date_time2dig", "datef", "datetime2localtime", "datetimef", "dig2date", "dig2date_time", "dtf", "localtime2date", "localtime2date_time", "timef", "visokos"
FILE
Export only file and directories subroutines:
"bload", "bsave", "eqtime", "file_load", "file_save", "fload", "fsave", "getdirlist", "getfilelist", "getlist", "load_file", "ls", "preparedir", "save_file", "scandirs", "scanfiles", "shred", "touch"
UTIL
Export only utility subroutines:
"com", "exe", "execute", "ftp", "ftpgetlist", "ftptest", "send_mail", "sendmail"
ATOM
Export only processing subroutines:
"bload", "bsave", "com", "eqtime", "exe", "execute", "file_load", "file_save", "fload", "fsave", "ftp", "ftpgetlist", "ftptest", "getdirlist", "getfilelist", "getlist", "load_file", "ls", "preparedir", "save_file", "scandirs", "scanfiles", "send_mail", "sendmail", "shred", "touch"
API
Export only inerface subroutines:
"cachedir", "carp", "catdir", "catfile", "cluck", "confess", "croak", "curdir", "docdir", "getsyscfg", "isos", "isostype", "localedir", "localstatedir", "lockdir", "path", "prefixdir", "read_attributes", "rootdir", "rundir", "sharedir", "sharedstatedir", "splitdir", "splitpath", "spooldir", "srvdir", "syscfg", "sysconfdir", "syslogdir", "tmpdir", "updir", "webdir"
SEE ALSO
MIME::Lite, CGI::Util, Time::Local, Net::FTP, IPC::Open3, List::Util
AUTHOR
Serz Minus (Lepenkov Sergey) http://serzik.ru <minus@mail333.com>
COPYRIGHT
Copyright (C) 1998-2013 D&D Corporation. All Rights Reserved
LICENSE
This program is free software; you can redistribute it and/or modify it under the same terms and conditions as Perl itself.
This program is distributed under the GNU LGPL v3 (GNU Lesser General Public License version 3).
See LICENSE
file
1 POD Error
The following errors were encountered while parsing the POD:
- Around line 951:
Non-ASCII character seen before =encoding in 'doesn’t'. Assuming CP1252