📄 file.pm
字号:
# The source files are wholly original Motorola proprietary work now being # licensed as BSD, the following Copyright Notice will be added to each source # code file, documentation and other materials with the distribution:# # Copyright 2006, Motorola, All Rights Reserved.# # This program is licensed under a BSD license with the following terms:# # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met:## - Redistributions of source code must retain the above copyright notice, # this list of conditions and the following disclaimer. ## - Redistributions in binary form must reproduce the above copyright notice, # this list of conditions and the following disclaimer in the documentation # and/or other materials provided with the distribution. ## - Neither the name of the MOTOROLA nor the names of its contributors may be # used to endorse or promote products derived from this software without # specific prior written permission.### THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE # POSSIBILITY OF SUCH DAMAGE.#package File;use strict;use Autoload;use Fcntl qw( O_RDONLY O_WRONLY O_RDWR O_CREAT O_TRUNC LOCK_EX LOCK_SH SEEK_SET SEEK_CUR SEEK_END);sub import { local $Exporter::ExportLevel = 1; Fcntl->import('/^(O|SEEK)_/');}use overload ( '""' => sub { *{$_[0]}->{SCALAR} }, '0+' => sub { fileno($_[0]) }, 'bool' => sub { defined($_[0]) }, 'cmp' => sub { $_[2] ? ("$_[1]" cmp "$_[0]") : ("$_[0]" cmp "$_[1]" ) }, '<=>' => sub { my ($a,$b) = $_[2] ? @_[1,0] : @_[0,1]; fileno($a) <=> fileno($b); }, #'<>' => \&readline,);foreach (qw(STDIN STDOUT STDERR)) { local *glob = *{$::{$_}}; bless(*glob{IO},__PACKAGE__); ${*glob} = $_;}sub new { my ($this,$file) = @_; my $class = ref($this) || $this; bless(gensym($file),$class);}{ my $sym = '$fh'; sub gensym(;$) { my $pkg = caller().'::'; my $fh; { no strict 'refs'; $fh = \*{$pkg.$sym}; delete($$pkg{$sym}); } eval { $$fh->{SCALAR} = @_ ? shift : "$fh" }; $@ ? die("Insecure dependency in symbol name\n") : $fh; }}sub DESTROY { my $fh = shift; $fh->close if fileno($fh);}sub abspath;sub autoflush;sub basename;sub chdir;sub close;sub copy;sub dirname;sub eof;sub exec;sub extension;sub find;sub findbin;sub gensym(;$);sub lstat;sub mkdir;sub mkpath;sub move;sub open;sub parse;sub print;sub pwd();sub read;sub readline;sub readlink;sub readpipe;sub remove;sub rename;sub rmdir;sub seek;sub shutdown;sub slurp;sub stat;sub symlink;sub sysread;sub sysseek;sub systell;sub system;sub syswrite;sub tell;sub transaction;sub truncate;sub unlink;sub untaint { shift =~ /^(.*)\z/so; $1 }# need to allow Autoload to re-register this package due to cyclic dependencyAutoload->import;1;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -