view release on metacpan or search on metacpan
0.31 2009-01-29 00:00:00
- create test data file on execute test.pl
- require run-time module version
- rewrite all about "split" logic
- created by INABA Hitoshi
0.30 2009-01-04 00:00:00
- support context when calling lc(), lc, uc(), uc
- support chr(0x5C) ended path on MSWin32
- file test operators
- functions lstat(), opendir(), stat(), and unlink()
- glob() and <WILDCARD>
- remove pl2ebat.bat, jperl55.bat, jperl58.bat, and jperl510.bat
- merge esjis.pl into Sjis.pm
- matched variables $1,$2,$3,... after s/// came to function as it was a description
- support function of chr, ord, and reverse again
- add test filetest, pathdir, pathfile, and perlmemo
- created at kanmi-kissa Hahaso in Chichibu
0.29 2008-11-20 00:00:00
- remove \G from $your_gap
lib/Ekps9566.pm view on Meta::CPAN
sub Ekps9566::u_();
sub Ekps9566::g_();
sub Ekps9566::k_();
sub Ekps9566::T_();
sub Ekps9566::B_();
sub Ekps9566::M_();
sub Ekps9566::A_();
sub Ekps9566::C_();
sub Ekps9566::glob($);
sub Ekps9566::glob_();
sub Ekps9566::lstat(*);
sub Ekps9566::lstat_();
sub Ekps9566::opendir(*$);
sub Ekps9566::stat(*);
sub Ekps9566::stat_();
sub Ekps9566::unlink(@);
sub Ekps9566::chdir(;$);
sub Ekps9566::do($);
sub Ekps9566::require(;$);
sub Ekps9566::telldir(*);
sub KPS9566::ord(;$);
sub KPS9566::ord_();
sub KPS9566::reverse(@);
lib/Ekps9566.pm view on Meta::CPAN
# For example, "nobody"-like users might use /nonexistant
if (defined $home and ! Ekps9566::d($home)) {
$home = undef;
}
return $home;
}
#
# KPS9566 file lstat (with parameter)
#
sub Ekps9566::lstat(*) {
local $_ = shift if @_;
if (-e $_) {
return CORE::lstat _;
}
elsif (_MSWin32_5Cended_path($_)) {
# Even if ${^WIN32_SLOPPY_STAT} is set to a true value, Ekps9566::lstat()
# on Windows opens the file for the path which has 5c at end.
# (and so on)
local *MUST_BE_BAREWORD_AT_HERE;
if (CORE::open(MUST_BE_BAREWORD_AT_HERE, $_)) {
if (wantarray) {
my @stat = CORE::stat MUST_BE_BAREWORD_AT_HERE; # not CORE::lstat
close(MUST_BE_BAREWORD_AT_HERE) or die "Can't close file: $_: $!";
return @stat;
}
lib/Ekps9566.pm view on Meta::CPAN
if (CORE::opendir $dh, "$_[1]/.") {
return 1;
}
}
return undef;
}
#
# KPS9566 file stat (with parameter)
#
sub Ekps9566::stat(*) {
local $_ = shift if @_;
my $fh = qualify_to_ref $_;
if (defined fileno $fh) {
return CORE::stat $fh;
}
elsif (-e $_) {
return CORE::stat _;
}
elsif (_MSWin32_5Cended_path($_)) {
# Even if ${^WIN32_SLOPPY_STAT} is set to a true value, Ekps9566::stat()
# on Windows opens the file for the path which has 5c at end.
# (and so on)
local *MUST_BE_BAREWORD_AT_HERE;
if (CORE::open(MUST_BE_BAREWORD_AT_HERE, $_)) {
if (wantarray) {
my @stat = CORE::stat MUST_BE_BAREWORD_AT_HERE;
close(MUST_BE_BAREWORD_AT_HERE) or die "Can't close file: $_: $!";
return @stat;
}
lib/Ekps9566.pm view on Meta::CPAN
}
else {
$realfilename = "$prefix/$filename";
}
if (Ekps9566::f($realfilename)) {
my $script = '';
if (Ekps9566::e("$realfilename.e")) {
my $e_mtime = (Ekps9566::stat("$realfilename.e"))[9];
my $mtime = (Ekps9566::stat($realfilename))[9];
my $module_mtime = (Ekps9566::stat(__FILE__))[9];
if (($e_mtime < $mtime) or ($mtime < $module_mtime)) {
Ekps9566::unlink "$realfilename.e";
}
}
if (Ekps9566::e("$realfilename.e")) {
my $fh = gensym();
if (_open_r($fh, "$realfilename.e")) {
if ($^O eq 'MacOS') {
CORE::eval q{
lib/Ekps9566.pm view on Meta::CPAN
else {
$realfilename = "$prefix/$_";
}
if (Ekps9566::f($realfilename)) {
$INC{$_} = $realfilename;
my $script = '';
if (Ekps9566::e("$realfilename.e")) {
my $e_mtime = (Ekps9566::stat("$realfilename.e"))[9];
my $mtime = (Ekps9566::stat($realfilename))[9];
my $module_mtime = (Ekps9566::stat(__FILE__))[9];
if (($e_mtime < $mtime) or ($mtime < $module_mtime)) {
Ekps9566::unlink "$realfilename.e";
}
}
if (Ekps9566::e("$realfilename.e")) {
my $fh = gensym();
_open_r($fh, "$realfilename.e") or croak "Can't open file: $realfilename.e";
if ($^O eq 'MacOS') {
CORE::eval q{
lib/Ekps9566.pm view on Meta::CPAN
Ekps9566::fc(...);
Ekps9566::fc_;
Ekps9566::ignorecase(...);
Ekps9566::capture(...);
Ekps9566::chr(...);
Ekps9566::chr_;
Ekps9566::X ...;
Ekps9566::X_;
Ekps9566::glob(...);
Ekps9566::glob_;
Ekps9566::lstat(...);
Ekps9566::lstat_;
Ekps9566::opendir(...);
Ekps9566::stat(...);
Ekps9566::stat_;
Ekps9566::unlink(...);
Ekps9566::chdir(...);
Ekps9566::do(...);
Ekps9566::require(...);
Ekps9566::telldir(...);
# "no Ekps9566;" not supported
=head1 ABSTRACT
lib/Ekps9566.pm view on Meta::CPAN
# 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 = Ekps9566::lstat($file);
@lstat = Ekps9566::lstat_;
Like Ekps9566::stat, returns information on file, except that if file is a symbolic
link, Ekps9566::lstat returns information about the link; Ekps9566::stat returns
information about the file pointed to by the link. If symbolic links are
unimplemented on your system, a normal Ekps9566::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.
lib/Ekps9566.pm view on Meta::CPAN
$rc = Ekps9566::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 = Ekps9566::stat(FILEHANDLE);
$stat = Ekps9566::stat(DIRHANDLE);
$stat = Ekps9566::stat($expr);
$stat = Ekps9566::stat_;
@stat = Ekps9566::stat(FILEHANDLE);
@stat = Ekps9566::stat(DIRHANDLE);
@stat = Ekps9566::stat($expr);
@stat = Ekps9566::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) = Ekps9566::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
lib/Ekps9566.pm view on Meta::CPAN
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 Ekps9566::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 Ekps9566::stat, Ekps9566::lstat, or Ekps9566::stat-based file test subroutine
(such as Ekps9566::r, Ekps9566::w, and Ekps9566::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 = (Ekps9566::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 = Ekps9566::unlink(@list);
$unlink = Ekps9566::unlink($file);
$unlink = Ekps9566::unlink;
lib/KPS9566.pm view on Meta::CPAN
#
# Filter >
# Source >>>
# Escape >>>>> executable without re-escape
#
# Filter >>>
# Source >
# Escape >>>>> executable without re-escape
#----------------------------------------------------
my $mtime_filter = (Ekps9566::stat(__FILE__ ))[9];
my $mtime_source = (Ekps9566::stat($filename ))[9];
my $mtime_escape = (Ekps9566::stat("$filename.e"))[9];
if (($mtime_escape < $mtime_source) or ($mtime_escape < $mtime_filter)) {
Ekps9566::unlink "$filename.e";
}
}
}
if (not Ekps9566::e("$filename.e")) {
my $fh = gensym();
Ekps9566::_open_a($fh, "$filename.e") or die __FILE__, ": Can't write open file: $filename.e\n";
lib/KPS9566.pm view on Meta::CPAN
else {
CORE::eval q{ flock($fh, LOCK_EX) };
}
CORE::eval q{ truncate($fh, 0) };
seek($fh, 0, 0) or die __FILE__, ": Can't seek file: $filename.e\n";
my $e_script = KPS9566::escape_script($filename);
print {$fh} $e_script;
my $mode = (Ekps9566::stat($filename))[2] & 0777;
chmod $mode, "$filename.e";
close($fh) or die "Can't close file: $filename.e: $!";
}
my $fh = gensym();
Ekps9566::_open_r($fh, "$filename.e") or die __FILE__, ": Can't read open file: $filename.e\n";
if (0) {
}
lib/KPS9566.pm view on Meta::CPAN
=item * Unicode Properties (aka Character Properties) of Regular Expression
Unicode properties (aka character properties) of regexp are not available.
Also (?[]) in regexp of Perl 5.18 is not available. There is no plans to currently
support these.
=item * ${^WIN32_SLOPPY_STAT} is ignored
Even if ${^WIN32_SLOPPY_STAT} is set to a true value, file test functions Ekps9566::*(),
Ekps9566::lstat(), and Ekps9566::stat() on Microsoft Windows open the file for the path
which has chr(0x5c) at end.
=item * Delimiter of String and Regexp
qq//, q//, qw//, qx//, qr//, m//, s///, tr///, and y/// can't use a wide character
as the delimiter.
=item * \b{...} Boundaries in Regular Expressions
Following \b{...} available starting in v5.22 are not supported.
t/KPS9566/207_stat.t view on Meta::CPAN
close(FILE);
open(FILE,'>D@\/c.txt') || die "Can't open file: D@\/c.txt\n";
print FILE "1\n";
close(FILE);
open(FILE,'>D@\/F@\') || die "Can't open file: D@\/F@\\n";
print FILE "1\n";
close(FILE);
mkdir('D@\/D@\', 0777);
$_ = 'F@\';
if (@_ = stat($_)) {
print "ok - 1 $^X $__FILE__\n";
}
else{
print "not ok - 1 $^X $__FILE__\n";
}
$_ = 'D@\';
if (@_ = stat($_)) {
print "not ok - 2 $^X $__FILE__\n";
}
else{
print "ok - 2 $^X $__FILE__\n";
}
unlink('F@\');
rmdir('D@\/D@\');
unlink('D@\/a.txt');
unlink('D@\/b.txt');
unlink('D@\/c.txt');
unlink('D@\/F@\');
rmdir('D@\');
__END__
Perl/WindowsÅÌt@CpX
http://digit.que.ne.jp/work/wiki.cgi?Perl%E3%83%A1%E3%83%A2%2FWindows%E3%81%A7%E3%81%AE%E3%83%95%E3%82%A1%E3%82%A4%E3%83%AB%E3%83%91%E3%82%B9
t@CÖAR}hÌ®ìmF
u@\vÆ¢¤¶ñðÏ$_ÉüêAstat($_)ƵÄàÔèlªÈ¢
t/KPS9566/215_lstat.t view on Meta::CPAN
if ($chcp !~ /932|949/oxms) {
print "ok - 1 # SKIP $^X $0\n";
exit;
}
open(FILE,'>F@\') || die "Can't open file: F@\\n";
print FILE "1\n";
close(FILE);
# lstat
if (lstat('F@\')) {
print "ok - 1 lstat $^X $__FILE__\n";
}
else {
print "not ok - 1 lstat: $! $^X $__FILE__\n";
}
unlink('F@\');
__END__
t/KPS9566/220_stat.t view on Meta::CPAN
if ($chcp !~ /932|949/oxms) {
print "ok - 1 # SKIP $^X $0\n";
exit;
}
open(FILE,'>F@\') || die "Can't open file: F@\\n";
print FILE "1\n";
close(FILE);
# stat
if (stat('F@\')) {
print "ok - 1 stat $^X $__FILE__\n";
}
else {
print "not ok - 1 stat: $! $^X $__FILE__\n";
}
unlink('F@\');
__END__