Char-Big5Plus

 view release on metacpan or  search on metacpan

lib/Ebig5plus.pm  view on Meta::CPAN

    print STDERR "\n";
    print STDERR @_;
    die "\n";
}

1;

__END__

=pod

=head1 NAME

Ebig5plus - Run-time routines for Big5Plus.pm

=head1 SYNOPSIS

  use Ebig5plus;

    Ebig5plus::split(...);
    Ebig5plus::tr(...);
    Ebig5plus::chop(...);
    Ebig5plus::index(...);
    Ebig5plus::rindex(...);
    Ebig5plus::lc(...);
    Ebig5plus::lc_;
    Ebig5plus::lcfirst(...);
    Ebig5plus::lcfirst_;
    Ebig5plus::uc(...);
    Ebig5plus::uc_;
    Ebig5plus::ucfirst(...);
    Ebig5plus::ucfirst_;
    Ebig5plus::fc(...);
    Ebig5plus::fc_;
    Ebig5plus::ignorecase(...);
    Ebig5plus::capture(...);
    Ebig5plus::chr(...);
    Ebig5plus::chr_;
    Ebig5plus::X ...;
    Ebig5plus::X_;
    Ebig5plus::glob(...);
    Ebig5plus::glob_;
    Ebig5plus::lstat(...);
    Ebig5plus::lstat_;
    Ebig5plus::opendir(...);
    Ebig5plus::stat(...);
    Ebig5plus::stat_;
    Ebig5plus::unlink(...);
    Ebig5plus::chdir(...);
    Ebig5plus::do(...);
    Ebig5plus::require(...);
    Ebig5plus::telldir(...);

  # "no Ebig5plus;" not supported

=head1 ABSTRACT

This module has run-time routines for use Big5Plus software automatically, you
do not have to use.

=head1 BUGS AND LIMITATIONS

I have tested and verified this software using the best of my ability.
However, a software containing much regular expression is bound to contain
some bugs. Thus, if you happen to find a bug that's in Big5Plus software and not
your own program, you can try to reduce it to a minimal test case and then
report it to the following author's address. If you have an idea that could
make this a more useful tool, please let everyone share it.

=head1 HISTORY

This Ebig5plus module first appeared in ActivePerl Build 522 Built under
MSWin32 Compiled at Nov 2 1999 09:52:28

=head1 AUTHOR

INABA Hitoshi E<lt>ina@cpan.orgE<gt>

This project was originated by INABA Hitoshi.
For any questions, use E<lt>ina@cpan.orgE<gt> so we can share
this file.

=head1 LICENSE AND COPYRIGHT

This module is free software; you can redistribute it and/or
modify it under the same terms as Perl itself. See L<perlartistic>.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

=head1 EXAMPLES

=over 2

=item * Split string

  @split = Ebig5plus::split(/pattern/,$string,$limit);
  @split = Ebig5plus::split(/pattern/,$string);
  @split = Ebig5plus::split(/pattern/);
  @split = Ebig5plus::split('',$string,$limit);
  @split = Ebig5plus::split('',$string);
  @split = Ebig5plus::split('');
  @split = Ebig5plus::split();
  @split = Ebig5plus::split;

  This subroutine scans a string given by $string for separators, and splits the
  string into a list of substring, returning the resulting list value in list
  context or the count of substring in scalar context. Scalar context also causes
  split to write its result to @_, but this usage is deprecated. The separators
  are determined by repeated pattern matching, using the regular expression given
  in /pattern/, so the separators may be of any size and need not be the same
  string on every match. (The separators are not ordinarily returned; exceptions
  are discussed later in this section.) If the /pattern/ doesn't match the string
  at all, Ebig5plus::split returns the original string as a single substring, If it
  matches once, you get two substrings, and so on. You may supply regular
  expression modifiers to the /pattern/, like /pattern/i, /pattern/x, etc. The
  //m modifier is assumed when you split on the pattern /^/.

  If $limit is specified and positive, the subroutine splits into no more than that
  many fields (though it may split into fewer if it runs out of separators). If

lib/Ebig5plus.pm  view on Meta::CPAN

    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 Ebig5plus::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 Ebig5plus::stat, Ebig5plus::lstat, or Ebig5plus::stat-based file test subroutine
  (such as Ebig5plus::r, Ebig5plus::w, and Ebig5plus::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 = (Ebig5plus::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 = Ebig5plus::unlink(@list);
  $unlink = Ebig5plus::unlink($file);
  $unlink = Ebig5plus::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 = Ebig5plus::chdir($dirname);
  $chdir = Ebig5plus::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'}
  otherwise; these are usually the process's home directory. The subroutine returns
  true on success, false otherwise (and puts the error code into $!).

  chdir("$prefix/lib") || die "Can't cd to $prefix/lib: $!";

  This subroutine has limitation on the MSWin32. See also BUGS AND LIMITATIONS.

=item * Do file

  $return = Ebig5plus::do($file);

  The do FILE form uses the value of FILE as a filename and executes the contents
  of the file as a Perl script. Its primary use is (or rather was) to include
  subroutines from a Perl subroutine library, so that:

  Ebig5plus::do('stat.pl');

  is rather like: 

  scalar CORE::eval `cat stat.pl`;   # `type stat.pl` on Windows

  except that Ebig5plus::do is more efficient, more concise, keeps track of the current
  filename for error messages, searches all the directories listed in the @INC
  array, and updates %INC if the file is found.
  It also differs in that code evaluated with Ebig5plus::do FILE can not see lexicals in
  the enclosing scope, whereas code in CORE::eval FILE does. It's the same, however,
  in that it reparses the file every time you call it -- so you might not want to do
  this inside a loop unless the filename itself changes at each loop iteration.

  If Ebig5plus::do can't read the file, it returns undef and sets $! to the error. If 
  Ebig5plus::do can read the file but can't compile it, it returns undef and sets an
  error message in $@. If the file is successfully compiled, do returns the value of
  the last expression evaluated.

  Inclusion of library modules (which have a mandatory .pm suffix) is better done
  with the use and require operators, which also Ebig5plus::do error checking and raise
  an exception if there's a problem. They also offer other benefits: they avoid
  duplicate loading, help with object-oriented programming, and provide hints to the
  compiler on function prototypes.

  But Ebig5plus::do FILE is still useful for such things as reading program configuration
  files. Manual error checking can be done this way:

  # read in config files: system first, then user
  for $file ("/usr/share/proggie/defaults.rc", "$ENV{HOME}/.someprogrc") {
      unless ($return = Ebig5plus::do($file)) {
          warn "couldn't parse $file: $@" if $@;
          warn "couldn't Ebig5plus::do($file): $!" unless defined $return;
          warn "couldn't run $file"            unless $return;
      }
  }

  A long-running daemon could periodically examine the timestamp on its configuration
  file, and if the file has changed since it was last read in, the daemon could use
  Ebig5plus::do to reload that file. This is more tidily accomplished with Ebig5plus::do than
  with Ebig5plus::require.

=item * Require file

  Ebig5plus::require($file);
  Ebig5plus::require();

  This subroutine asserts a dependency of some kind on its argument. If an argument is
  not supplied, $_ is used.

  Ebig5plus::require loads and executes the Perl code found in the separate file whose



( run in 3.511 seconds using v1.01-cache-2.11-cpan-75ffa21a3d4 )