Char-UHC
view release on metacpan or search on metacpan
lib/Euhc.pm view on Meta::CPAN
}
my $dummy_for_underline_cache = -B $fh;
sysseek $fh, $systell, 0;
}
else {
if (-d $_ or -d "$_/.") {
return wantarray ? (undef,@_) : undef;
}
$fh = gensym();
if (_open_r($fh, $_)) {
}
else {
return wantarray ? (undef,@_) : undef;
}
if (sysread $fh, my $block, 512) {
if ($block =~ /[\000\377]/oxms) {
$B = 1;
}
elsif (($block =~ tr/\000-\007\013\016-\032\034-\037\377//) * 10 > CORE::length $block) {
$B = 1;
}
}
# 0 byte or eof
else {
$B = 1;
}
my $dummy_for_underline_cache = -B $fh;
close($fh) or die "Can't close file: $_: $!";
}
return wantarray ? ($B,@_) : $B;
}
#
# UHC file test -M expr
#
sub Euhc::M(;*@) {
local $_ = shift if @_;
croak 'Too many arguments for -M (Euhc::M)' if @_ and not wantarray;
if ($_ eq '_') {
return wantarray ? (-M _,@_) : -M _;
}
elsif (defined fileno(my $fh = qualify_to_ref $_)) {
return wantarray ? (-M $fh,@_) : -M $fh;
}
elsif (-e $_) {
return wantarray ? (-M _,@_) : -M _;
}
elsif (_MSWin32_5Cended_path($_)) {
if (-d "$_/.") {
return wantarray ? (-M _,@_) : -M _;
}
else {
my $fh = gensym();
if (_open_r($fh, $_)) {
my($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,$ctime,$blksize,$blocks) = CORE::stat $fh;
close($fh) or die "Can't close file: $_: $!";
my $M = ($^T - $mtime) / (24*60*60);
return wantarray ? ($M,@_) : $M;
}
}
}
return wantarray ? (undef,@_) : undef;
}
#
# UHC file test -A expr
#
sub Euhc::A(;*@) {
local $_ = shift if @_;
croak 'Too many arguments for -A (Euhc::A)' if @_ and not wantarray;
if ($_ eq '_') {
return wantarray ? (-A _,@_) : -A _;
}
elsif (defined fileno(my $fh = qualify_to_ref $_)) {
return wantarray ? (-A $fh,@_) : -A $fh;
}
elsif (-e $_) {
return wantarray ? (-A _,@_) : -A _;
}
elsif (_MSWin32_5Cended_path($_)) {
if (-d "$_/.") {
return wantarray ? (-A _,@_) : -A _;
}
else {
my $fh = gensym();
if (_open_r($fh, $_)) {
my($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,$ctime,$blksize,$blocks) = CORE::stat $fh;
close($fh) or die "Can't close file: $_: $!";
my $A = ($^T - $atime) / (24*60*60);
return wantarray ? ($A,@_) : $A;
}
}
}
return wantarray ? (undef,@_) : undef;
}
#
# UHC file test -C expr
#
sub Euhc::C(;*@) {
local $_ = shift if @_;
croak 'Too many arguments for -C (Euhc::C)' if @_ and not wantarray;
if ($_ eq '_') {
return wantarray ? (-C _,@_) : -C _;
}
elsif (defined fileno(my $fh = qualify_to_ref $_)) {
return wantarray ? (-C $fh,@_) : -C $fh;
}
elsif (-e $_) {
return wantarray ? (-C _,@_) : -C _;
}
elsif (_MSWin32_5Cended_path($_)) {
if (-d "$_/.") {
return wantarray ? (-C _,@_) : -C _;
}
else {
my $fh = gensym();
if (_open_r($fh, $_)) {
my($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,$ctime,$blksize,$blocks) = CORE::stat $fh;
close($fh) or die "Can't close file: $_: $!";
my $C = ($^T - $ctime) / (24*60*60);
return wantarray ? ($C,@_) : $C;
}
}
}
return wantarray ? (undef,@_) : undef;
}
#
# UHC stacked file test $_
#
sub Euhc::filetest_ {
my $filetest = substr(pop @_, 1);
unless (CORE::eval qq{Euhc::${filetest}_}) {
return '';
}
for my $filetest (CORE::reverse @_) {
unless (CORE::eval qq{ $filetest _ }) {
return '';
}
}
return 1;
}
#
# UHC file test -r $_
#
sub Euhc::r_() {
if (-e $_) {
return -r _ ? 1 : '';
}
elsif (_MSWin32_5Cended_path($_)) {
if (-d "$_/.") {
return -r _ ? 1 : '';
}
else {
my $fh = gensym();
if (_open_r($fh, $_)) {
my $r = -r $fh;
close($fh) or die "Can't close file: $_: $!";
return $r ? 1 : '';
}
}
}
# 10.10. Returning Failure
# in Chapter 10. Subroutines
# of ISBN 0-596-00313-7 Perl Cookbook, 2nd Edition.
# (and so on)
# 2010-01-26 The difference of "return;" and "return undef;"
# http://d.hatena.ne.jp/gfx/20100126/1264474754
#
# "Perl Best Practices" recommends to use "return;"*1 to return nothing, but
# it might be wrong in some cases. If you use this idiom for those functions
# which are expected to return a scalar value, e.g. searching functions, the
lib/Euhc.pm view on Meta::CPAN
else {
$T = 1;
}
my $dummy_for_underline_cache = -T $fh;
close($fh) or die "Can't close file: $_: $!";
return $T;
}
#
# UHC file test -B $_
#
sub Euhc::B_() {
my $B = '';
if (-d $_ or -d "$_/.") {
return undef;
}
my $fh = gensym();
if (_open_r($fh, $_)) {
}
else {
return undef;
}
if (sysread $fh, my $block, 512) {
if ($block =~ /[\000\377]/oxms) {
$B = 1;
}
elsif (($block =~ tr/\000-\007\013\016-\032\034-\037\377//) * 10 > CORE::length $block) {
$B = 1;
}
}
# 0 byte or eof
else {
$B = 1;
}
my $dummy_for_underline_cache = -B $fh;
close($fh) or die "Can't close file: $_: $!";
return $B;
}
#
# UHC file test -M $_
#
sub Euhc::M_() {
if (-e $_) {
return -M _;
}
elsif (_MSWin32_5Cended_path($_)) {
if (-d "$_/.") {
return -M _;
}
else {
my $fh = gensym();
if (_open_r($fh, $_)) {
my($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,$ctime,$blksize,$blocks) = CORE::stat $fh;
close($fh) or die "Can't close file: $_: $!";
my $M = ($^T - $mtime) / (24*60*60);
return $M;
}
}
}
return undef;
}
#
# UHC file test -A $_
#
sub Euhc::A_() {
if (-e $_) {
return -A _;
}
elsif (_MSWin32_5Cended_path($_)) {
if (-d "$_/.") {
return -A _;
}
else {
my $fh = gensym();
if (_open_r($fh, $_)) {
my($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,$ctime,$blksize,$blocks) = CORE::stat $fh;
close($fh) or die "Can't close file: $_: $!";
my $A = ($^T - $atime) / (24*60*60);
return $A;
}
}
}
return undef;
}
#
# UHC file test -C $_
#
sub Euhc::C_() {
if (-e $_) {
return -C _;
}
elsif (_MSWin32_5Cended_path($_)) {
if (-d "$_/.") {
return -C _;
}
else {
my $fh = gensym();
if (_open_r($fh, $_)) {
my($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,$ctime,$blksize,$blocks) = CORE::stat $fh;
close($fh) or die "Can't close file: $_: $!";
my $C = ($^T - $ctime) / (24*60*60);
return $C;
}
}
}
return undef;
}
#
# UHC path globbing (with parameter)
#
sub Euhc::glob($) {
if (wantarray) {
my @glob = _DOS_like_glob(@_);
for my $glob (@glob) {
$glob =~ s{ \A (?:\./)+ }{}oxms;
}
return @glob;
}
else {
my $glob = _DOS_like_glob(@_);
$glob =~ s{ \A (?:\./)+ }{}oxms;
return $glob;
}
}
#
# UHC path globbing (without parameter)
#
sub Euhc::glob_() {
if (wantarray) {
my @glob = _DOS_like_glob();
for my $glob (@glob) {
$glob =~ s{ \A (?:\./)+ }{}oxms;
}
return @glob;
}
else {
my $glob = _DOS_like_glob();
$glob =~ s{ \A (?:\./)+ }{}oxms;
return $glob;
}
}
#
# UHC path globbing via File::DosGlob 1.10
#
# Often I confuse "_dosglob" and "_doglob".
# So, I renamed "_dosglob" to "_DOS_like_glob".
#
my %iter;
my %entries;
sub _DOS_like_glob {
# context (keyed by second cxix argument provided by core)
my($expr,$cxix) = @_;
lib/Euhc.pm view on Meta::CPAN
field, not all the rest of the fields. In time-critical applications, it behooves
you not to split into more fields than you really need. (The trouble with
powerful languages it that they let you be powerfully stupid at times.)
We said earlier that the separators are not returned, but if the /pattern/
contains parentheses, then the substring matched by each pair of parentheses is
included in the resulting list, interspersed with the fields that are ordinarily
returned. Here's a simple example:
Euhc::split(/([-,])/, "1-10,20");
which produces the list value:
(1, "-", 10, ",", 20)
With more parentheses, a field is returned for each pair, even if some pairs
don't match, in which case undefined values are returned in those positions. So
if you say:
Euhc::split(/(-)|(,)/, "1-10,20");
you get the value:
(1, "-", undef, 10, undef, ",", 20)
The /pattern/ argument may be replaced with an expression to specify patterns
that vary at runtime. As with ordinary patterns, to do run-time compilation only
once, use /$variable/o.
As a special case, if the expression is a single space (" "), the subroutine
splits on whitespace just as Euhc::split with no arguments does. Thus,
Euhc::split(" ") can be used to emulate awk's default behavior. In contrast,
Euhc::split(/ /) will give you as many null initial fields as there are
leading spaces. (Other than this special case, if you supply a string instead
of a regular expression, it'll be interpreted as a regular expression anyway.)
You can use this property to remove leading and trailing whitespace from a
string and to collapse intervaning stretches of whitespace into a single
space:
$string = join(" ", Euhc::split(" ", $string));
The following example splits an RFC822 message header into a hash containing
$head{'Date'}, $head{'Subject'}, and so on. It uses the trick of assigning a
list of pairs to a hash, because separators altinate with separated fields, It
users parentheses to return part of each separator as part of the returned list
value. Since the split pattern is guaranteed to return things in pairs by virtue
of containing one set of parentheses, the hash assignment is guaranteed to
receive a list consisting of key/value pairs, where each key is the name of a
header field. (Unfortunately, this technique loses information for multiple lines
with the same key field, such as Received-By lines. Ah well)
$header =~ s/\n\s+/ /g; # Merge continuation lines.
%head = ("FRONTSTUFF", Euhc::split(/^(\S*?):\s*/m, $header));
The following example processes the entries in a Unix passwd(5) file. You could
leave out the chomp, in which case $shell would have a newline on the end of it.
open(PASSWD, "/etc/passwd");
while (<PASSWD>) {
chomp; # remove trailing newline.
($login, $passwd, $uid, $gid, $gcos, $home, $shell) =
Euhc::split(/:/);
...
}
Here's how process each word of each line of each file of input to create a
word-frequency hash.
while (<>) {
for my $word (Euhc::split()) {
$count{$word}++;
}
}
The inverse of Euhc::split is join, except that join can only join with the
same separator between all fields. To break apart a string with fixed-position
fields, use unpack.
Processing long $string (over 32766 octets) requires Perl 5.010001 or later.
=item * Transliteration
$tr = Euhc::tr($variable,$bind_operator,$searchlist,$replacementlist,$modifier);
$tr = Euhc::tr($variable,$bind_operator,$searchlist,$replacementlist);
This is the transliteration (sometimes erroneously called translation) operator,
which is like the y/// operator in the Unix sed program, only better, in
everybody's humble opinion.
This subroutine scans a UHC string character by character and replaces all
occurrences of the characters found in $searchlist with the corresponding character
in $replacementlist. It returns the number of characters replaced or deleted.
If no UHC string is specified via =~ operator, the $_ variable is translated.
$modifier are:
---------------------------------------------------------------------------
Modifier Meaning
---------------------------------------------------------------------------
c Complement $searchlist.
d Delete found but unreplaced characters.
s Squash duplicate replaced characters.
r Return transliteration and leave the original string untouched.
---------------------------------------------------------------------------
To use with a read-only value without raising an exception, use the /r modifier.
print Euhc::tr('bookkeeper','=~','boep','peob','r'); # prints 'peekkoobor'
=item * Chop string
$chop = Euhc::chop(@list);
$chop = Euhc::chop();
$chop = Euhc::chop;
This subroutine chops off the last character of a string variable and returns the
character chopped. The Euhc::chop subroutine is used primary to remove the newline
from the end of an input recoed, and it is more efficient than using a
substitution. If that's all you're doing, then it would be safer to use chomp,
since Euhc::chop always shortens the string no matter what's there, and chomp
is more selective. If no argument is given, the subroutine chops the $_ variable.
lib/Euhc.pm view on Meta::CPAN
This subroutine is internal use to m/ /, s/ / /, split / /, and qr/ /.
=item * Make character
$chr = Euhc::chr($code);
$chr = Euhc::chr_;
This subroutine returns a programmer-visible character, character represented by
that $code in the character set. For example, Euhc::chr(65) is "A" in either
ASCII or UHC, not Unicode. For the reverse of Euhc::chr, use UHC::ord.
=item * File test subroutine Euhc::X
The following all subroutines function when the pathname ends with chr(0x5C) on
MSWin32.
A file test subroutine is a unary function that takes one argument, either a
filename or a filehandle, and tests the associated file to see whether something
is true about it. If the argument is omitted, it tests $_. Unless otherwise
documented, it returns 1 for true and "" for false, or the undefined value if
the file doesn't exist or is otherwise inaccessible. Currently implemented file
test subroutines are listed in:
Available in MSWin32, MacOS, and UNIX-like systems
------------------------------------------------------------------------------
Subroutine and Prototype Meaning
------------------------------------------------------------------------------
Euhc::r(*), Euhc::r_() File or directory is readable by this (effective) user or group
Euhc::w(*), Euhc::w_() File or directory is writable by this (effective) user or group
Euhc::e(*), Euhc::e_() File or directory name exists
Euhc::x(*), Euhc::x_() File or directory is executable by this (effective) user or group
Euhc::z(*), Euhc::z_() File exists and has zero size (always false for directories)
Euhc::f(*), Euhc::f_() Entry is a plain file
Euhc::d(*), Euhc::d_() Entry is a directory
------------------------------------------------------------------------------
Available in MacOS and UNIX-like systems
------------------------------------------------------------------------------
Subroutine and Prototype Meaning
------------------------------------------------------------------------------
Euhc::R(*), Euhc::R_() File or directory is readable by this real user or group
Same as Euhc::r(*), Euhc::r_() on MacOS
Euhc::W(*), Euhc::W_() File or directory is writable by this real user or group
Same as Euhc::w(*), Euhc::w_() on MacOS
Euhc::X(*), Euhc::X_() File or directory is executable by this real user or group
Same as Euhc::x(*), Euhc::x_() on MacOS
Euhc::l(*), Euhc::l_() Entry is a symbolic link
Euhc::S(*), Euhc::S_() Entry is a socket
------------------------------------------------------------------------------
Not available in MSWin32 and MacOS
------------------------------------------------------------------------------
Subroutine and Prototype Meaning
------------------------------------------------------------------------------
Euhc::o(*), Euhc::o_() File or directory is owned by this (effective) user
Euhc::O(*), Euhc::O_() File or directory is owned by this real user
Euhc::p(*), Euhc::p_() Entry is a named pipe (a "fifo")
Euhc::b(*), Euhc::b_() Entry is a block-special file (like a mountable disk)
Euhc::c(*), Euhc::c_() Entry is a character-special file (like an I/O device)
Euhc::u(*), Euhc::u_() File or directory is setuid
Euhc::g(*), Euhc::g_() File or directory is setgid
Euhc::k(*), Euhc::k_() File or directory has the sticky bit set
------------------------------------------------------------------------------
The tests -T and -B takes a try at telling whether a file is text or binary.
But people who know a lot about filesystems know that there's no bit (at least
in UNIX-like operating systems) to indicate that a file is a binary or text file
--- so how can Perl tell?
The answer is that Perl cheats. As you might guess, it sometimes guesses wrong.
This incomplete thinking of file test operator -T and -B gave birth to UTF8 flag
of a later period.
The Euhc::T, Euhc::T_, Euhc::B, and Euhc::B_ work as follows. The first block
or so of the file is examined for strange chatracters such as
[\000-\007\013\016-\032\034-\037\377] (that don't look like UHC). If more
than 10% of the bytes appear to be strange, it's a *maybe* binary file;
otherwise, it's a *maybe* text file. Also, any file containing ASCII NUL(\0) or
\377 in the first block is considered a binary file. If Euhc::T or Euhc::B is
used on a filehandle, the current input (standard I/O or "stdio") buffer is
examined rather than the first block of the file. Both Euhc::T and Euhc::B
return 1 as true on an empty file, or on a file at EOF (end-of-file) when testing
a filehandle. Both Euhc::T and Euhc::B doesn't work when given the special
filehandle consisting of a solitary underline. Because Euhc::T has to read to
do the test, you don't want to use Euhc::T on special files that might hang or
give you other kinds or grief. So on most occasions you'll want to test with a
Euhc::f first, as in:
next unless Euhc::f($file) && Euhc::T($file);
Available in MSWin32, MacOS, and UNIX-like systems
------------------------------------------------------------------------------
Subroutine and Prototype Meaning
------------------------------------------------------------------------------
Euhc::T(*), Euhc::T_() File looks like a "text" file
Euhc::B(*), Euhc::B_() File looks like a "binary" file
------------------------------------------------------------------------------
File ages for Euhc::M, Euhc::M_, Euhc::A, Euhc::A_, Euhc::C, and Euhc::C_
are returned in days (including fractional days) since the script started running.
This start time is stored in the special variable $^T ($BASETIME). Thus, if the
file changed after the script, you would get a negative time. Note that most time
values (86,399 out of 86,400, on average) are fractional, so testing for equality
with an integer without using the int function is usually futile. Examples:
next unless Euhc::M($file) > 0.5; # files are older than 12 hours
&newfile if Euhc::M($file) < 0; # file is newer than process
&mailwarning if int(Euhc::A_) == 90; # file ($_) was accessed 90 days ago today
Available in MSWin32, MacOS, and UNIX-like systems
------------------------------------------------------------------------------
Subroutine and Prototype Meaning
------------------------------------------------------------------------------
Euhc::M(*), Euhc::M_() Modification age (measured in days)
Euhc::A(*), Euhc::A_() Access age (measured in days)
Same as Euhc::M(*), Euhc::M_() on MacOS
Euhc::C(*), Euhc::C_() Inode-modification age (measured in days)
------------------------------------------------------------------------------
The Euhc::s, and Euhc::s_ returns file size in bytes if succesful, or undef
unless successful.
lib/Euhc.pm view on Meta::CPAN
@spacies = <"*e f*">;
@spacies = Euhc::glob('"*e f*"');
@spacies = Euhc::glob(q("*e f*"));
If you had to get a variable through, you could do this:
@spacies = Euhc::glob("'*${var}e f*'");
@spacies = Euhc::glob(qq("*${var}e f*"));
Another way on MSWin32
# relative path
@relpath_file = split(/\n/,`dir /b wildcard\\here*.txt 2>NUL`);
# absolute path
@abspath_file = split(/\n/,`dir /s /b wildcard\\here*.txt 2>NUL`);
# on COMMAND.COM
@relpath_file = split(/\n/,`dir /b wildcard\\here*.txt`);
@abspath_file = split(/\n/,`dir /s /b wildcard\\here*.txt`);
=item * Statistics about link
@lstat = Euhc::lstat($file);
@lstat = Euhc::lstat_;
Like Euhc::stat, returns information on file, except that if file is a symbolic
link, Euhc::lstat returns information about the link; Euhc::stat returns
information about the file pointed to by the link. If symbolic links are
unimplemented on your system, a normal Euhc::stat is done instead. If file is
omitted, returns information on file given in $_. Returns values (especially
device and inode) may be bogus.
This subroutine function when the filename ends with chr(0x5C) on MSWin32.
=item * Open directory handle
$rc = Euhc::opendir(DIR,$dir);
This subroutine opens a directory named $dir for processing by readdir, telldir,
seekdir, rewinddir, and closedir. The subroutine returns true if successful.
Directory handles have their own namespace from filehandles.
This subroutine function when the directory name ends with chr(0x5C) on MSWin32.
=item * Statistics about file
$stat = Euhc::stat(FILEHANDLE);
$stat = Euhc::stat(DIRHANDLE);
$stat = Euhc::stat($expr);
$stat = Euhc::stat_;
@stat = Euhc::stat(FILEHANDLE);
@stat = Euhc::stat(DIRHANDLE);
@stat = Euhc::stat($expr);
@stat = Euhc::stat_;
In scalar context, this subroutine returns a Boolean value that indicates whether
the call succeeded. In list context, it returns a 13-element list giving the
statistics for a file, either the file opened via FILEHANDLE or DIRHANDLE, or
named by $expr. It's typically used as followes:
($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,
$atime,$mtime,$ctime,$blksize,$blocks) = Euhc::stat($expr);
Not all fields are supported on all filesystem types; unsupported fields return
0. Here are the meanings of the fields:
-------------------------------------------------------------------------
Index Field Meaning
-------------------------------------------------------------------------
0 $dev Device number of filesystem
drive number for MSWin32
vRefnum for MacOS
1 $ino Inode number
zero for MSWin32
fileID/dirID for MacOS
2 $mode File mode (type and permissions)
3 $nlink Nunmer of (hard) links to the file
usually one for MSWin32 --- NTFS filesystems may
have a value greater than one
1 for MacOS
4 $uid Numeric user ID of file's owner
zero for MSWin32
zero for MacOS
5 $gid Numeric group ID of file's owner
zero for MSWin32
zero for MacOS
6 $rdev The device identifier (special files only)
drive number for MSWin32
NULL for MacOS
7 $size Total size of file, in bytes
8 $atime Last access time since the epoch
same as $mtime for MacOS
9 $mtime Last modification time since the epoch
since 1904-01-01 00:00:00 for MacOS
10 $ctime Inode change time (not creation time!) since the epoch
creation time instead of inode change time for MSWin32
since 1904-01-01 00:00:00 for MacOS
11 $blksize Preferred blocksize for file system I/O
zero for MSWin32
12 $blocks Actual number of blocks allocated
zero for MSWin32
int(($size + $blksize-1) / $blksize) for MacOS
-------------------------------------------------------------------------
$dev and $ino, token together, uniquely identify a file on the same system.
The $blksize and $blocks are likely defined only on BSD-derived filesystems.
The $blocks field (if defined) is reported in 512-byte blocks. The value of
$blocks * 512 can differ greatly from $size for files containing unallocated
blocks, or "hole", which aren't counted in $blocks.
If Euhc::stat is passed the special filehandle consisting of an underline, no
actual stat(2) is done, but the current contents of the stat structure from
the last Euhc::stat, Euhc::lstat, or Euhc::stat-based file test subroutine
(such as Euhc::r, Euhc::w, and Euhc::x) are returned.
Because the mode contains both the file type and its permissions, you should
mask off the file type portion and printf or sprintf using a "%o" if you want
to see the real permissions:
$mode = (Euhc::stat($expr))[2];
printf "Permissions are %04o\n", $mode & 07777;
If $expr is omitted, returns information on file given in $_.
This subroutine function when the filename ends with chr(0x5C) on MSWin32.
=item * Deletes a list of files.
$unlink = Euhc::unlink(@list);
$unlink = Euhc::unlink($file);
$unlink = Euhc::unlink;
Delete a list of files. (Under Unix, it will remove a link to a file, but the
file may still exist if another link references it.) If list is omitted, it
unlinks the file given in $_. The subroutine returns the number of files
successfully deleted.
This subroutine function when the filename ends with chr(0x5C) on MSWin32.
=item * Changes the working directory.
$chdir = Euhc::chdir($dirname);
$chdir = Euhc::chdir;
This subroutine changes the current process's working directory to $dirname, if
possible. If $dirname is omitted, $ENV{'HOME'} is used if set, and $ENV{'LOGDIR'}
( run in 1.594 second using v1.01-cache-2.11-cpan-5735350b133 )