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/Big5HKSCS.pm view on Meta::CPAN
#
# Filter >
# Source >>>
# Escape >>>>> executable without re-escape
#
# Filter >>>
# Source >
# Escape >>>>> executable without re-escape
#----------------------------------------------------
my $mtime_filter = (Ebig5hkscs::stat(__FILE__ ))[9];
my $mtime_source = (Ebig5hkscs::stat($filename ))[9];
my $mtime_escape = (Ebig5hkscs::stat("$filename.e"))[9];
if (($mtime_escape < $mtime_source) or ($mtime_escape < $mtime_filter)) {
Ebig5hkscs::unlink "$filename.e";
}
}
}
if (not Ebig5hkscs::e("$filename.e")) {
my $fh = gensym();
Ebig5hkscs::_open_a($fh, "$filename.e") or die __FILE__, ": Can't write open file: $filename.e\n";
lib/Big5HKSCS.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 = Big5HKSCS::escape_script($filename);
print {$fh} $e_script;
my $mode = (Ebig5hkscs::stat($filename))[2] & 0777;
chmod $mode, "$filename.e";
close($fh) or die "Can't close file: $filename.e: $!";
}
my $fh = gensym();
Ebig5hkscs::_open_r($fh, "$filename.e") or die __FILE__, ": Can't read open file: $filename.e\n";
if (0) {
}
lib/Big5HKSCS.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 Ebig5hkscs::*(),
Ebig5hkscs::lstat(), and Ebig5hkscs::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.
lib/Ebig5hkscs.pm view on Meta::CPAN
sub Ebig5hkscs::u_();
sub Ebig5hkscs::g_();
sub Ebig5hkscs::k_();
sub Ebig5hkscs::T_();
sub Ebig5hkscs::B_();
sub Ebig5hkscs::M_();
sub Ebig5hkscs::A_();
sub Ebig5hkscs::C_();
sub Ebig5hkscs::glob($);
sub Ebig5hkscs::glob_();
sub Ebig5hkscs::lstat(*);
sub Ebig5hkscs::lstat_();
sub Ebig5hkscs::opendir(*$);
sub Ebig5hkscs::stat(*);
sub Ebig5hkscs::stat_();
sub Ebig5hkscs::unlink(@);
sub Ebig5hkscs::chdir(;$);
sub Ebig5hkscs::do($);
sub Ebig5hkscs::require(;$);
sub Ebig5hkscs::telldir(*);
sub Big5HKSCS::ord(;$);
sub Big5HKSCS::ord_();
sub Big5HKSCS::reverse(@);
lib/Ebig5hkscs.pm view on Meta::CPAN
# For example, "nobody"-like users might use /nonexistant
if (defined $home and ! Ebig5hkscs::d($home)) {
$home = undef;
}
return $home;
}
#
# Big5-HKSCS file lstat (with parameter)
#
sub Ebig5hkscs::lstat(*) {
local $_ = shift if @_;
if (-e $_) {
return CORE::lstat _;
}
elsif (_MSWin32_5Cended_path($_)) {
# Even if ${^WIN32_SLOPPY_STAT} is set to a true value, Ebig5hkscs::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/Ebig5hkscs.pm view on Meta::CPAN
if (CORE::opendir $dh, "$_[1]/.") {
return 1;
}
}
return undef;
}
#
# Big5-HKSCS file stat (with parameter)
#
sub Ebig5hkscs::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, Ebig5hkscs::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/Ebig5hkscs.pm view on Meta::CPAN
}
else {
$realfilename = "$prefix/$filename";
}
if (Ebig5hkscs::f($realfilename)) {
my $script = '';
if (Ebig5hkscs::e("$realfilename.e")) {
my $e_mtime = (Ebig5hkscs::stat("$realfilename.e"))[9];
my $mtime = (Ebig5hkscs::stat($realfilename))[9];
my $module_mtime = (Ebig5hkscs::stat(__FILE__))[9];
if (($e_mtime < $mtime) or ($mtime < $module_mtime)) {
Ebig5hkscs::unlink "$realfilename.e";
}
}
if (Ebig5hkscs::e("$realfilename.e")) {
my $fh = gensym();
if (_open_r($fh, "$realfilename.e")) {
if ($^O eq 'MacOS') {
CORE::eval q{
lib/Ebig5hkscs.pm view on Meta::CPAN
else {
$realfilename = "$prefix/$_";
}
if (Ebig5hkscs::f($realfilename)) {
$INC{$_} = $realfilename;
my $script = '';
if (Ebig5hkscs::e("$realfilename.e")) {
my $e_mtime = (Ebig5hkscs::stat("$realfilename.e"))[9];
my $mtime = (Ebig5hkscs::stat($realfilename))[9];
my $module_mtime = (Ebig5hkscs::stat(__FILE__))[9];
if (($e_mtime < $mtime) or ($mtime < $module_mtime)) {
Ebig5hkscs::unlink "$realfilename.e";
}
}
if (Ebig5hkscs::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/Ebig5hkscs.pm view on Meta::CPAN
Ebig5hkscs::fc(...);
Ebig5hkscs::fc_;
Ebig5hkscs::ignorecase(...);
Ebig5hkscs::capture(...);
Ebig5hkscs::chr(...);
Ebig5hkscs::chr_;
Ebig5hkscs::X ...;
Ebig5hkscs::X_;
Ebig5hkscs::glob(...);
Ebig5hkscs::glob_;
Ebig5hkscs::lstat(...);
Ebig5hkscs::lstat_;
Ebig5hkscs::opendir(...);
Ebig5hkscs::stat(...);
Ebig5hkscs::stat_;
Ebig5hkscs::unlink(...);
Ebig5hkscs::chdir(...);
Ebig5hkscs::do(...);
Ebig5hkscs::require(...);
Ebig5hkscs::telldir(...);
# "no Ebig5hkscs;" not supported
=head1 ABSTRACT
lib/Ebig5hkscs.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 = Ebig5hkscs::lstat($file);
@lstat = Ebig5hkscs::lstat_;
Like Ebig5hkscs::stat, returns information on file, except that if file is a symbolic
link, Ebig5hkscs::lstat returns information about the link; Ebig5hkscs::stat returns
information about the file pointed to by the link. If symbolic links are
unimplemented on your system, a normal Ebig5hkscs::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/Ebig5hkscs.pm view on Meta::CPAN
$rc = Ebig5hkscs::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 = Ebig5hkscs::stat(FILEHANDLE);
$stat = Ebig5hkscs::stat(DIRHANDLE);
$stat = Ebig5hkscs::stat($expr);
$stat = Ebig5hkscs::stat_;
@stat = Ebig5hkscs::stat(FILEHANDLE);
@stat = Ebig5hkscs::stat(DIRHANDLE);
@stat = Ebig5hkscs::stat($expr);
@stat = Ebig5hkscs::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) = Ebig5hkscs::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/Ebig5hkscs.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 Ebig5hkscs::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 Ebig5hkscs::stat, Ebig5hkscs::lstat, or Ebig5hkscs::stat-based file test subroutine
(such as Ebig5hkscs::r, Ebig5hkscs::w, and Ebig5hkscs::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 = (Ebig5hkscs::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 = Ebig5hkscs::unlink(@list);
$unlink = Ebig5hkscs::unlink($file);
$unlink = Ebig5hkscs::unlink;
t/Big5HKSCS/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/Big5HKSCS/215_lstat.t view on Meta::CPAN
if ($chcp !~ /932|950/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/Big5HKSCS/220_stat.t view on Meta::CPAN
if ($chcp !~ /932|950/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__