KSC5601
view release on metacpan or search on metacpan
lib/Eksc5601.pm view on Meta::CPAN
$path .= '/';
my @subpath = ();
while ($path =~ /
((?: [^\xA1-\xFE\/\\]|[\xA1-\xFE][\x00-\xFF] )+?) [\/\\]
/oxmsg
) {
push @subpath, $1;
}
my $tail = pop @subpath;
my $head = join $pathsep, @subpath;
return $head, $tail;
}
#
# via File::HomeDir::Windows 1.00
#
sub my_home_MSWin32 {
# A lot of unix people and unix-derived tools rely on
# the ability to overload HOME. We will support it too
# so that they can replace raw HOME calls with File::HomeDir.
if (exists $ENV{'HOME'} and $ENV{'HOME'}) {
return $ENV{'HOME'};
}
# Do we have a user profile?
elsif (exists $ENV{'USERPROFILE'} and $ENV{'USERPROFILE'}) {
return $ENV{'USERPROFILE'};
}
# Some Windows use something like $ENV{'HOME'}
elsif (exists $ENV{'HOMEDRIVE'} and exists $ENV{'HOMEPATH'} and $ENV{'HOMEDRIVE'} and $ENV{'HOMEPATH'}) {
return join '', $ENV{'HOMEDRIVE'}, $ENV{'HOMEPATH'};
}
return undef;
}
#
# via File::HomeDir::Unix 1.00
#
sub my_home {
my $home;
if (exists $ENV{'HOME'} and defined $ENV{'HOME'}) {
$home = $ENV{'HOME'};
}
# This is from the original code, but I'm guessing
# it means "login directory" and exists on some Unixes.
elsif (exists $ENV{'LOGDIR'} and $ENV{'LOGDIR'}) {
$home = $ENV{'LOGDIR'};
}
### More-desperate methods
# Light desperation on any (Unixish) platform
else {
$home = CORE::eval q{ (getpwuid($<))[7] };
}
# On Unix in general, a non-existant home means "no home"
# For example, "nobody"-like users might use /nonexistant
if (defined $home and ! -d($home)) {
$home = undef;
}
return $home;
}
#
# ${^PREMATCH}, $PREMATCH, $` the string preceding what was matched
#
sub Eksc5601::PREMATCH {
if (defined($&)) {
if (defined($1) and (CORE::substr($&,-CORE::length($1),CORE::length($1)) eq $1)) {
return CORE::substr($&,0,CORE::length($&)-CORE::length($1));
}
else {
croak 'Use of "$`", $PREMATCH, and ${^PREMATCH} need to /( capture all )/ in regexp';
}
}
else {
return '';
}
return $`;
}
#
# ${^MATCH}, $MATCH, $& the string that matched
#
sub Eksc5601::MATCH {
if (defined($&)) {
if (defined($1)) {
return $1;
}
else {
croak 'Use of "$&", $MATCH, and ${^MATCH} need to /( capture all )/ in regexp';
}
}
else {
return '';
}
return $&;
}
#
# ${^POSTMATCH}, $POSTMATCH, $' the string following what was matched
#
sub Eksc5601::POSTMATCH {
return $';
}
#
# KSC5601 character to order (with parameter)
#
sub KSC5601::ord(;$) {
local $_ = shift if @_;
( run in 1.594 second using v1.01-cache-2.11-cpan-fe3c2283af0 )