diff options
Diffstat (limited to 'ext')
-rw-r--r-- | ext/DB_File/DB_File.pm | 14 | ||||
-rw-r--r-- | ext/DB_File/Makefile.PL | 2 | ||||
-rw-r--r-- | ext/DynaLoader/DynaLoader.pm | 1 | ||||
-rw-r--r-- | ext/DynaLoader/Makefile.PL | 1 | ||||
-rw-r--r-- | ext/Fcntl/Fcntl.pm | 1 | ||||
-rw-r--r-- | ext/Fcntl/Makefile.PL | 1 | ||||
-rw-r--r-- | ext/FileHandle/FileHandle.pm | 426 | ||||
-rw-r--r-- | ext/FileHandle/FileHandle.xs | 159 | ||||
-rw-r--r-- | ext/FileHandle/Makefile.PL | 5 | ||||
-rw-r--r-- | ext/GDBM_File/GDBM_File.pm | 2 | ||||
-rw-r--r-- | ext/GDBM_File/GDBM_File.xs | 2 | ||||
-rw-r--r-- | ext/GDBM_File/Makefile.PL | 1 | ||||
-rw-r--r-- | ext/NDBM_File/Makefile.PL | 1 | ||||
-rw-r--r-- | ext/NDBM_File/NDBM_File.pm | 2 | ||||
-rw-r--r-- | ext/ODBM_File/Makefile.PL | 1 | ||||
-rw-r--r-- | ext/ODBM_File/ODBM_File.pm | 2 | ||||
-rw-r--r-- | ext/ODBM_File/hints/dec_osf.pl | 5 | ||||
-rw-r--r-- | ext/POSIX/Makefile.PL | 1 | ||||
-rw-r--r-- | ext/POSIX/POSIX.pm | 104 | ||||
-rw-r--r-- | ext/POSIX/POSIX.pod | 142 | ||||
-rw-r--r-- | ext/POSIX/POSIX.xs | 80 | ||||
-rw-r--r-- | ext/SDBM_File/Makefile.PL | 1 | ||||
-rw-r--r-- | ext/SDBM_File/SDBM_File.pm | 2 | ||||
-rw-r--r-- | ext/Safe/Makefile.PL | 1 | ||||
-rw-r--r-- | ext/Safe/Safe.pm | 289 | ||||
-rw-r--r-- | ext/Safe/Safe.xs | 17 | ||||
-rw-r--r-- | ext/Socket/Makefile.PL | 2 | ||||
-rw-r--r-- | ext/Socket/Socket.pm | 2 |
28 files changed, 934 insertions, 333 deletions
diff --git a/ext/DB_File/DB_File.pm b/ext/DB_File/DB_File.pm index 08463dfabc..6ca011b5d0 100644 --- a/ext/DB_File/DB_File.pm +++ b/ext/DB_File/DB_File.pm @@ -170,12 +170,12 @@ sub CLEAR { croak "DB_File::BTREEINFO::CLEAR is not implemented" } package DB_File ; use Carp; -$VERSION = 1.01 ; +$VERSION = $VERSION = 1.01 ; #typedef enum { DB_BTREE, DB_HASH, DB_RECNO } DBTYPE; -$DB_BTREE = TIEHASH DB_File::BTREEINFO ; -$DB_HASH = TIEHASH DB_File::HASHINFO ; -$DB_RECNO = TIEHASH DB_File::RECNOINFO ; +$DB_BTREE = $DB_BTREE = TIEHASH DB_File::BTREEINFO ; +$DB_HASH = $DB_HASH = TIEHASH DB_File::HASHINFO ; +$DB_RECNO = $DB_RECNO = TIEHASH DB_File::RECNOINFO ; require TieHash; require Exporter; @@ -233,11 +233,7 @@ sub AUTOLOAD { goto &$AUTOLOAD; } -@liblist = (); -@liblist = split ' ', $Config::Config{"DB_File_loadlibs"} - if defined $Config::Config{"DB_File_loadlibs"}; - -bootstrap DB_File @liblist; +bootstrap DB_File ; # Preloaded methods go here. Autoload methods go after __END__, and are # processed by the autosplit program. diff --git a/ext/DB_File/Makefile.PL b/ext/DB_File/Makefile.PL index f67e6cd642..4cda63507d 100644 --- a/ext/DB_File/Makefile.PL +++ b/ext/DB_File/Makefile.PL @@ -5,7 +5,7 @@ WriteMakefile( LIBS => ["-L/usr/local/lib -ldb"], MAN3PODS => ' ', # Pods will be built by installman. #INC => '-I/usr/local/include', - VERSION => 1.01, + VERSION_FROM => 'DB_File.pm', XSPROTOARG => '-noprototypes', # XXX remove later? ); diff --git a/ext/DynaLoader/DynaLoader.pm b/ext/DynaLoader/DynaLoader.pm index 8de1808151..d809b82eaf 100644 --- a/ext/DynaLoader/DynaLoader.pm +++ b/ext/DynaLoader/DynaLoader.pm @@ -18,6 +18,7 @@ require AutoLoader; @ISA=qw(AutoLoader); +$VERSION = $VERSION = "1.00" ; sub import { } # override import inherited from AutoLoader diff --git a/ext/DynaLoader/Makefile.PL b/ext/DynaLoader/Makefile.PL index 1b1bf7ee24..3dd655da5b 100644 --- a/ext/DynaLoader/Makefile.PL +++ b/ext/DynaLoader/Makefile.PL @@ -6,6 +6,7 @@ WriteMakefile( MAN3PODS => ' ', # Pods will be built by installman. SKIP => [qw(dynamic dynamic_lib dynamic_bs)], XSPROTOARG => '-noprototypes', # XXX remove later? + VERSION_FROM => 'DynaLoader.pm', clean => {FILES => 'DynaLoader.c'}, ); diff --git a/ext/Fcntl/Fcntl.pm b/ext/Fcntl/Fcntl.pm index b9251509db..aef7ad3d00 100644 --- a/ext/Fcntl/Fcntl.pm +++ b/ext/Fcntl/Fcntl.pm @@ -27,6 +27,7 @@ require Exporter; use AutoLoader; require DynaLoader; @ISA = qw(Exporter DynaLoader); +$VERSION = $VERSION = "1.00"; # Items to export into callers namespace by default # (move infrequently used names to @EXPORT_OK below) @EXPORT = diff --git a/ext/Fcntl/Makefile.PL b/ext/Fcntl/Makefile.PL index c432e1aa63..9dc0474e7e 100644 --- a/ext/Fcntl/Makefile.PL +++ b/ext/Fcntl/Makefile.PL @@ -2,5 +2,6 @@ use ExtUtils::MakeMaker; WriteMakefile( MAN3PODS => ' ', # Pods will be built by installman. XSPROTOARG => '-noprototypes', # XXX remove later? + VERSION_FROM => 'Fcntl.pm', ); diff --git a/ext/FileHandle/FileHandle.pm b/ext/FileHandle/FileHandle.pm new file mode 100644 index 0000000000..93a3088886 --- /dev/null +++ b/ext/FileHandle/FileHandle.pm @@ -0,0 +1,426 @@ +package FileHandle; + +=head1 NAME + +FileHandle - supply object methods for filehandles + +=head1 SYNOPSIS + + use FileHandle; + + $fh = new FileHandle; + if ($fh->open "< file") { + print <$fh>; + $fh->close; + } + + $fh = new FileHandle "> FOO"; + if (defined $fh) { + print $fh "bar\n"; + $fh->close; + } + + $fh = new FileHandle "file", "r"; + if (defined $fh) { + print <$fh>; + undef $fh; # automatically closes the file + } + + $fh = new FileHandle "file", O_WRONLY|O_APPEND; + if (defined $fh) { + print $fh "corge\n"; + undef $fh; # automatically closes the file + } + + ($readfh, $writefh) = FileHandle::pipe; + + autoflush STDOUT 1; + +=head1 DESCRIPTION + +C<FileHandle::new> creates a C<FileHandle>, which is a reference to a +newly created symbol (see the C<Symbol> package). If it receives any +parameters, they are passed to C<FileHandle::open>; if the open fails, +the C<FileHandle> object is destroyed. Otherwise, it is returned to +the caller. + +C<FileHandle::new_from_fd> creates a C<FileHandle> like C<new> does. +It requires two parameters, which are passed to C<FileHandle::fdopen>; +if the fdopen fails, the C<FileHandle> object is destroyed. +Otherwise, it is returned to the caller. + +C<FileHandle::open> accepts one parameter or two. With one parameter, +it is just a front end for the built-in C<open> function. With two +parameters, the first parameter is a filename that may include +whitespace or other special characters, and the second parameter is +the open mode in either Perl form (">", "+<", etc.) or POSIX form +("w", "r+", etc.). + +C<FileHandle::fdopen> is like C<open> except that its first parameter +is not a filename but rather a file handle name, a FileHandle object, +or a file descriptor number. + +See L<perlfunc> for complete descriptions of each of the following +supported C<FileHandle> methods, which are just front ends for the +corresponding built-in functions: + + close + fileno + getc + gets + eof + clearerr + seek + tell + +See L<perlvar> for complete descriptions of each of the following +supported C<FileHandle> methods: + + autoflush + output_field_separator + output_record_separator + input_record_separator + input_line_number + format_page_number + format_lines_per_page + format_lines_left + format_name + format_top_name + format_line_break_characters + format_formfeed + +Furthermore, for doing normal I/O you might need these: + +=over + +=item $fh->print + +See L<perlfunc/print>. + +=item $fh->printf + +See L<perlfunc/printf>. + +=item $fh->getline + +This works like <$fh> described in L<perlop/"I/O Operators"> +except that it's more readable and can be safely called in an +array context but still returns just one line. + +=item $fh->getlines + +This works like <$fh> when called in an array context to +read all the remaining lines in a file, except that it's more readable. +It will also croak() if accidentally called in a scalar context. + +=back + +=head1 SEE ALSO + +L<perlfunc>, +L<perlop/"I/O Operators">, +L<POSIX/"FileHandle"> + +=head1 BUGS + +Due to backwards compatibility, all filehandles resemble objects +of class C<FileHandle>, or actually classes derived from that class. +They actually aren't. Which means you can't derive your own +class from C<FileHandle> and inherit those methods. + +=cut + +require 5.000; +use Carp; +use Fcntl; +use Symbol; +use English; +use SelectSaver; + +require Exporter; +require DynaLoader; +@ISA = qw(Exporter DynaLoader); + +@EXPORT = (@Fcntl::EXPORT, + qw(_IOFBF _IOLBF _IONBF)); + +@EXPORT_OK = qw( + autoflush + output_field_separator + output_record_separator + input_record_separator + input_line_number + format_page_number + format_lines_per_page + format_lines_left + format_name + format_top_name + format_line_break_characters + format_formfeed + + print + printf + getline + getlines +); + + +################################################ +## Interaction with the XS. +## + +bootstrap FileHandle; + +sub AUTOLOAD { + if ($AUTOLOAD =~ /::(_?[a-z])/) { + $AutoLoader::AUTOLOAD = $AUTOLOAD; + goto &AutoLoader::AUTOLOAD + } + my $constname = $AUTOLOAD; + $constname =~ s/.*:://; + my $val = constant($constname); + defined $val or croak "$constname is not a valid FileHandle macro"; + *$AUTOLOAD = sub { $val }; + goto &$AUTOLOAD; +} + + +################################################ +## Constructors, destructors. +## + +sub new { + @_ >= 1 && @_ <= 3 or croak 'usage: new FileHandle [FILENAME [,MODE]]'; + my $class = shift; + my $fh = gensym; + if (@_) { + FileHandle::open($fh, @_) + or return undef; + } + bless $fh, $class; +} + +sub new_from_fd { + @_ == 3 or croak 'usage: new_from_fd FileHandle FD, MODE'; + my $class = shift; + my $fh = gensym; + FileHandle::fdopen($fh, @_) + or return undef; + bless $fh, $class; +} + +sub DESTROY { + my ($fh) = @_; + close($fh); +} + +################################################ +## Open and close. +## + +sub pipe { + @_ and croak 'usage: FileHandle::pipe()'; + my $readfh = new FileHandle; + my $writefh = new FileHandle; + pipe($readfh, $writefh) + or return undef; + ($readfh, $writefh); +} + +sub _open_mode_string { + my ($mode) = @_; + $mode =~ /^\+?(<|>>?)$/ + or $mode =~ s/^r(\+?)$/$1</ + or $mode =~ s/^w(\+?)$/$1>/ + or $mode =~ s/^a(\+?)$/$1>>/ + or croak "FileHandle: bad open mode: $mode"; + $mode; +} + +sub open { + @_ >= 2 && @_ <= 4 or croak 'usage: $fh->open(FILENAME [,MODE [,PERMS]])'; + my ($fh, $file) = @_; + if (@_ > 2) { + my ($mode, $perms) = @_[2, 3]; + if ($mode =~ /^\d+$/) { + defined $perms or $perms = 0666; + return sysopen($fh, $file, $mode, $perms); + } + $file = "./" . $file unless $file =~ m#^/#; + $file = _open_mode_string($mode) . " $file\0"; + } + open($fh, $file); +} + +sub fdopen { + @_ == 3 or croak 'usage: $fh->fdopen(FD, MODE)'; + my ($fh, $fd, $mode) = @_; + if (ref($fd) =~ /GLOB\(/) { + # It's a glob reference; remove the star from its name. + ($fd = "".$$fd) =~ s/^\*//; + } elsif ($fd =~ m#^\d+$#) { + # It's an FD number; prefix with "=". + $fd = "=$fd"; + } + open($fh, _open_mode_string($mode) . '&' . $fd); +} + +sub close { + @_ == 1 or croak 'usage: $fh->close()'; + close($_[0]); +} + +################################################ +## Normal I/O functions. +## + +sub fileno { + @_ == 1 or croak 'usage: $fh->fileno()'; + fileno($_[0]); +} + +sub getc { + @_ == 1 or croak 'usage: $fh->getc()'; + getc($_[0]); +} + +sub gets { + @_ == 1 or croak 'usage: $fh->gets()'; + my ($handle) = @_; + scalar <$handle>; +} + +sub eof { + @_ == 1 or croak 'usage: $fh->eof()'; + eof($_[0]); +} + +sub clearerr { + @_ == 1 or croak 'usage: $fh->clearerr()'; + seek($_[0], 0, 1); +} + +sub seek { + @_ == 3 or croak 'usage: $fh->seek(POS, WHENCE)'; + seek($_[0], $_[1], $_[2]); +} + +sub tell { + @_ == 1 or croak 'usage: $fh->tell()'; + tell($_[0]); +} + +sub print { + @_ or croak 'usage: $fh->print([ARGS])'; + my $this = shift; + print $this @_; +} + +sub printf { + @_ or croak 'usage: $fh->printf([ARGS])'; + my $this = shift; + printf $this @_; +} + +sub getline { + @_ == 1 or croak 'usage: $fh->getline'; + my $this = shift; + return scalar <$this>; +} + +sub getlines { + @_ == 1 or croak 'usage: $fh->getline()'; + my $this = shift; + wantarray or croak "Can't call FileHandle::getlines in a scalar context"; + return <$this>; +} + +################################################ +## State modification functions. +## + +sub autoflush { + my $old = new SelectSaver qualify($_[0], caller); + my $prev = $OUTPUT_AUTOFLUSH; + $OUTPUT_AUTOFLUSH = @_ > 1 ? $_[1] : 1; + $prev; +} + +sub output_field_separator { + my $old = new SelectSaver qualify($_[0], caller); + my $prev = $OUTPUT_FIELD_SEPARATOR; + $OUTPUT_FIELD_SEPARATOR = $_[1] if @_ > 1; + $prev; +} + +sub output_record_separator { + my $old = new SelectSaver qualify($_[0], caller); + my $prev = $OUTPUT_RECORD_SEPARATOR; + $OUTPUT_RECORD_SEPARATOR = $_[1] if @_ > 1; + $prev; +} + +sub input_record_separator { + my $old = new SelectSaver qualify($_[0], caller); + my $prev = $INPUT_RECORD_SEPARATOR; + $INPUT_RECORD_SEPARATOR = $_[1] if @_ > 1; + $prev; +} + +sub input_line_number { + my $old = new SelectSaver qualify($_[0], caller); + my $prev = $INPUT_LINE_NUMBER; + $INPUT_LINE_NUMBER = $_[1] if @_ > 1; + $prev; +} + +sub format_page_number { + my $old = new SelectSaver qualify($_[0], caller); + my $prev = $FORMAT_PAGE_NUMBER; + $FORMAT_PAGE_NUMBER = $_[1] if @_ > 1; + $prev; +} + +sub format_lines_per_page { + my $old = new SelectSaver qualify($_[0], caller); + my $prev = $FORMAT_LINES_PER_PAGE; + $FORMAT_LINES_PER_PAGE = $_[1] if @_ > 1; + $prev; +} + +sub format_lines_left { + my $old = new SelectSaver qualify($_[0], caller); + my $prev = $FORMAT_LINES_LEFT; + $FORMAT_LINES_LEFT = $_[1] if @_ > 1; + $prev; +} + +sub format_name { + my $old = new SelectSaver qualify($_[0], caller); + my $prev = $FORMAT_NAME; + $FORMAT_NAME = qualify($_[1], caller) if @_ > 1; + $prev; +} + +sub format_top_name { + my $old = new SelectSaver qualify($_[0], caller); + my $prev = $FORMAT_TOP_NAME; + $FORMAT_TOP_NAME = qualify($_[1], caller) if @_ > 1; + $prev; +} + +sub format_line_break_characters { + my $old = new SelectSaver qualify($_[0], caller); + my $prev = $FORMAT_LINE_BREAK_CHARACTERS; + $FORMAT_LINE_BREAK_CHARACTERS = $_[1] if @_ > 1; + $prev; +} + +sub format_formfeed { + my $old = new SelectSaver qualify($_[0], caller); + my $prev = $FORMAT_FORMFEED; + $FORMAT_FORMFEED = $_[1] if @_ > 1; + $prev; +} + +1; diff --git a/ext/FileHandle/FileHandle.xs b/ext/FileHandle/FileHandle.xs new file mode 100644 index 0000000000..d9c8b68dc1 --- /dev/null +++ b/ext/FileHandle/FileHandle.xs @@ -0,0 +1,159 @@ +#include "EXTERN.h" +#include "perl.h" +#include "XSUB.h" +#include <stdio.h> + +typedef int SysRet; +typedef FILE * InputStream; +typedef FILE * OutputStream; + +static bool +constant(name, pval) +char *name; +IV *pval; +{ + switch (*name) { + case '_': + if (strEQ(name, "_IOFBF")) +#ifdef _IOFBF + { *pval = _IOFBF; return TRUE; } +#else + return FALSE; +#endif + if (strEQ(name, "_IOLBF")) +#ifdef _IOLBF + { *pval = _IOLBF; return TRUE; } +#else + return FALSE; +#endif + if (strEQ(name, "_IONBF")) +#ifdef _IONBF + { *pval = _IONBF; return TRUE; } +#else + return FALSE; +#endif + break; + } + + return FALSE; +} + + +MODULE = FileHandle PACKAGE = FileHandle PREFIX = f + +SV * +constant(name) + char * name + CODE: + IV i; + if (constant(name, &i)) + RETVAL = newSViv(i); + else + RETVAL = &sv_undef; + OUTPUT: + RETVAL + +SV * +fgetpos(handle) + InputStream handle + CODE: + if (handle) { + Fpos_t pos; + fgetpos(handle, &pos); + ST(0) = sv_2mortal(newSVpv((char*)&pos, sizeof(Fpos_t))); + } + else { + ST(0) = &sv_undef; + errno = EINVAL; + } + +SysRet +fsetpos(handle, pos) + InputStream handle + SV * pos + CODE: + if (handle) + RETVAL = fsetpos(handle, (Fpos_t*)SvPVX(pos)); + else { + RETVAL = -1; + errno = EINVAL; + } + OUTPUT: + RETVAL + +int +ungetc(handle, c) + InputStream handle + int c + CODE: + if (handle) + RETVAL = ungetc(c, handle); + else { + RETVAL = -1; + errno = EINVAL; + } + OUTPUT: + RETVAL + +OutputStream +new_tmpfile(packname = "FileHandle") + char * packname + CODE: + RETVAL = tmpfile(); + OUTPUT: + RETVAL + +int +ferror(handle) + InputStream handle + CODE: + if (handle) + RETVAL = ferror(handle); + else { + RETVAL = -1; + errno = EINVAL; + } + OUTPUT: + RETVAL + +SysRet +fflush(handle) + OutputStream handle + CODE: + if (handle) + RETVAL = fflush(handle); + else { + RETVAL = -1; + errno = EINVAL; + } + OUTPUT: + RETVAL + +void +setbuf(handle, buf) + OutputStream handle + char * buf = SvPOK(ST(1)) ? sv_grow(ST(1), BUFSIZ) : 0; + CODE: + if (handle) + setbuf(handle, buf); + + +#ifdef _IOFBF + +SysRet +setvbuf(handle, buf, type, size) + OutputStream handle + char * buf = SvPOK(ST(1)) ? sv_grow(ST(1), SvIV(ST(3))) : 0; + int type + int size + CODE: + if (handle) + RETVAL = setvbuf(handle, buf, type, size); + else { + RETVAL = -1; + errno = EINVAL; + } + OUTPUT: + RETVAL + +#endif /* _IOFBF */ diff --git a/ext/FileHandle/Makefile.PL b/ext/FileHandle/Makefile.PL new file mode 100644 index 0000000000..8424f4d985 --- /dev/null +++ b/ext/FileHandle/Makefile.PL @@ -0,0 +1,5 @@ +use ExtUtils::MakeMaker; +WriteMakefile( + MAN3PODS => ' ', # Pods will be built by installman. + XSPROTOARG => '-noprototypes', # XXX remove later? +); diff --git a/ext/GDBM_File/GDBM_File.pm b/ext/GDBM_File/GDBM_File.pm index 179f9a96e8..ed80aa9c6b 100644 --- a/ext/GDBM_File/GDBM_File.pm +++ b/ext/GDBM_File/GDBM_File.pm @@ -56,6 +56,8 @@ require DynaLoader; GDBM_WRITER ); +$VERSION = $VERSION = "1.00"; + sub AUTOLOAD { local($constname); ($constname = $AUTOLOAD) =~ s/.*:://; diff --git a/ext/GDBM_File/GDBM_File.xs b/ext/GDBM_File/GDBM_File.xs index 5567020391..a423c88c70 100644 --- a/ext/GDBM_File/GDBM_File.xs +++ b/ext/GDBM_File/GDBM_File.xs @@ -233,7 +233,7 @@ gdbm_sync(db) GDBM_File db int -gdbm_exists(db, key) +gdbm_EXISTS(db, key) GDBM_File db datum key diff --git a/ext/GDBM_File/Makefile.PL b/ext/GDBM_File/Makefile.PL index 627800899b..1925623031 100644 --- a/ext/GDBM_File/Makefile.PL +++ b/ext/GDBM_File/Makefile.PL @@ -3,4 +3,5 @@ WriteMakefile( LIBS => ["-L/usr/local/lib -lgdbm", "-ldbm"], MAN3PODS => ' ', # Pods will be built by installman. XSPROTOARG => '-noprototypes', # XXX remove later? + VERSION_FROM => 'GDBM_File.pm', ); diff --git a/ext/NDBM_File/Makefile.PL b/ext/NDBM_File/Makefile.PL index c765dd5cd9..9fd37eb85e 100644 --- a/ext/NDBM_File/Makefile.PL +++ b/ext/NDBM_File/Makefile.PL @@ -3,4 +3,5 @@ WriteMakefile( LIBS => ["-L/usr/local/lib -lndbm", "-ldbm -lucb"], MAN3PODS => ' ', # Pods will be built by installman. XSPROTOARG => '-noprototypes', # XXX remove later? + VERSION_FROM => 'NDBM_File.pm', ); diff --git a/ext/NDBM_File/NDBM_File.pm b/ext/NDBM_File/NDBM_File.pm index e40fe854fe..53a136ebf0 100644 --- a/ext/NDBM_File/NDBM_File.pm +++ b/ext/NDBM_File/NDBM_File.pm @@ -4,6 +4,8 @@ require TieHash; require DynaLoader; @ISA = qw(TieHash DynaLoader); +$VERSION = $VERSION = "1.00"; + bootstrap NDBM_File; 1; diff --git a/ext/ODBM_File/Makefile.PL b/ext/ODBM_File/Makefile.PL index 495df3ad1f..9662f6e63a 100644 --- a/ext/ODBM_File/Makefile.PL +++ b/ext/ODBM_File/Makefile.PL @@ -3,4 +3,5 @@ WriteMakefile( LIBS => ["-ldbm -lucb"], MAN3PODS => ' ', # Pods will be built by installman. XSPROTOARG => '-noprototypes', # XXX remove later? + VERSION_FROM => 'ODBM_File.pm', ); diff --git a/ext/ODBM_File/ODBM_File.pm b/ext/ODBM_File/ODBM_File.pm index d844c673c3..336af3dba1 100644 --- a/ext/ODBM_File/ODBM_File.pm +++ b/ext/ODBM_File/ODBM_File.pm @@ -4,6 +4,8 @@ require TieHash; require DynaLoader; @ISA = qw(TieHash DynaLoader); +$VERSION = $VERSION = "1.00"; + bootstrap ODBM_File; 1; diff --git a/ext/ODBM_File/hints/dec_osf.pl b/ext/ODBM_File/hints/dec_osf.pl new file mode 100644 index 0000000000..f041bf96c0 --- /dev/null +++ b/ext/ODBM_File/hints/dec_osf.pl @@ -0,0 +1,5 @@ +# The -hidden option causes compilation to fail on Digital Unix. +# Andy Dougherty <doughera@lafcol.lafayette.edu> +# Sat Jan 13 16:29:52 EST 1996 +$self->{LDDLFLAGS} = $Config{lddlflags}; +$self->{LDDLFLAGS} =~ s/-hidden//; diff --git a/ext/POSIX/Makefile.PL b/ext/POSIX/Makefile.PL index 4a7eb9af73..68bce135f8 100644 --- a/ext/POSIX/Makefile.PL +++ b/ext/POSIX/Makefile.PL @@ -3,4 +3,5 @@ WriteMakefile( LIBS => ["-lm -lposix -lcposix"], MAN3PODS => ' ', # Pods will be built by installman. XSPROTOARG => '-noprototypes', # XXX remove later? + VERSION_FROM => 'POSIX.pm', ); diff --git a/ext/POSIX/POSIX.pm b/ext/POSIX/POSIX.pm index ee35ea20fb..ab309cc609 100644 --- a/ext/POSIX/POSIX.pm +++ b/ext/POSIX/POSIX.pm @@ -1,12 +1,16 @@ package POSIX; use Carp; -require Exporter; use AutoLoader; -require DynaLoader; require Config; +use Symbol; + +require Exporter; +require DynaLoader; @ISA = qw(Exporter DynaLoader); +$VERSION = $VERSION = "1.00" ; + %EXPORT_TAGS = ( assert_h => [qw(assert NDEBUG)], @@ -78,8 +82,8 @@ require Config; stddef_h => [qw(NULL offsetof)], stdio_h => [qw(BUFSIZ EOF FILENAME_MAX L_ctermid L_cuserid - L_tmpname NULL SEEK_CUR SEEK_END SEEK_SET STREAM_MAX - TMP_MAX stderr stdin stdout _IOFBF _IOLBF _IONBF + L_tmpname NULL SEEK_CUR SEEK_END SEEK_SET + STREAM_MAX TMP_MAX stderr stdin stdout clearerr fclose fdopen feof ferror fflush fgetc fgetpos fgets fopen fprintf fputc fputs fread freopen fscanf fseek fsetpos ftell fwrite getchar gets @@ -206,30 +210,21 @@ sub AUTOLOAD { } sub usage { - local ($mess) = @_; + my ($mess) = @_; croak "Usage: POSIX::$mess"; } sub redef { - local ($mess) = @_; + my ($mess) = @_; croak "Use method $mess instead"; } sub unimpl { - local ($mess) = @_; + my ($mess) = @_; $mess =~ s/xxx//; croak "Unimplemented: POSIX::$mess"; } -sub gensym { - my $pkg = @_ ? ref($_[0]) || $_[0] : ""; - local *{$pkg . "::GLOB" . ++$seq}; - \delete ${$pkg . "::"}{'GLOB' . $seq}; -} - -sub ungensym { -} - ############################ package POSIX::SigAction; @@ -238,75 +233,6 @@ sub new { } ############################ -package FileHandle; - -sub new { - POSIX::usage "FileHandle->new(filename, posixmode)" if @_ != 3; - local($class,$filename,$mode) = @_; - local($sym) = $class->POSIX::gensym; - $mode =~ s/a.*/>>/ || - $mode =~ s/w.*/>/ || - ($mode = '<'); - open($sym, "$mode $filename") and - bless $sym => $class; -} - -sub new_from_fd { - POSIX::usage "FileHandle->new_from_fd(fd,mode)" if @_ != 3; - local($class,$fd,$mode) = @_; - local($sym) = $class->POSIX::gensym; - $mode =~ s/a.*/>>/ || - $mode =~ s/w.*/>/ || - ($mode = '<'); - open($sym, "$mode&=$fd") and - bless $sym => $class; -} - -sub clearerr { - POSIX::usage "clearerr(filehandle)" if @_ != 1; - seek($_[0], 0, 1); -} - -sub close { - POSIX::usage "close(filehandle)" if @_ != 1; - close($_[0]); -} - -sub DESTROY { - close($_[0]); -} - -sub eof { - POSIX::usage "eof(filehandle)" if @_ != 1; - eof($_[0]); -} - -sub getc { - POSIX::usage "getc(filehandle)" if @_ != 1; - getc($_[0]); -} - -sub gets { - POSIX::usage "gets(filehandle)" if @_ != 1; - local($handle) = @_; - scalar <$handle>; -} - -sub fileno { - POSIX::usage "fileno(filehandle)" if @_ != 1; - fileno($_[0]); -} - -sub seek { - POSIX::usage "seek(filehandle,pos,whence)" if @_ != 3; - seek($_[0], $_[1], $_[2]); -} - -sub tell { - POSIX::usage "tell(filehandle)" if @_ != 1; - tell($_[0]); -} -############################ package POSIX; # return to package POSIX so AutoSplit is happy 1; __END__ @@ -335,7 +261,7 @@ sub closedir { sub opendir { usage "opendir(directory)" if @_ != 1; - local($dirhandle) = POSIX->gensym; + my $dirhandle = gensym; opendir($dirhandle, $_[0]) ? $dirhandle : undef; @@ -807,9 +733,9 @@ sub chmod { sub fstat { usage "fstat(fd)" if @_ != 1; - local(*TMP); + local *TMP; open(TMP, "<&$_[0]"); # Gross. - local(@l) = stat(TMP); + my @l = stat(TMP); close(TMP); @l; } @@ -922,7 +848,7 @@ sub getgid { sub getgroups { usage "getgroups()" if @_ != 0; - local(%seen) = (); + my %seen; grep(!$seen{$_}++, split(' ', $) )); } diff --git a/ext/POSIX/POSIX.pod b/ext/POSIX/POSIX.pod index 2549a613ac..4b7585117c 100644 --- a/ext/POSIX/POSIX.pod +++ b/ext/POSIX/POSIX.pod @@ -1230,144 +1230,6 @@ Returns C<undef> on failure. =head1 CLASSES -=head2 FileHandle - -=over 8 - -=item new - -Open a file and return a Perl filehandle. The first parameter is the -filename and the second parameter is the mode. The mode should be specified -as C<a> for append, C<w> for write, and E<lt> or C<""> for read. - -Open a file for reading. - - $fh = FileHandle->new( "foo", "" ); - die "Unable to open foo for reading" unless $fh; - -Open a file for writing. - - $fh = FileHandle->new( "foo", "w" ); - die "Unable to open foo for writing" unless $fh; - -Use C<FileHandle::close()> to close the file or let the FileHandle object's -destructor perform the close. - -=item clearerr - -Resets the error indicator and EOF indicator to zero. - - $fh->clearerr; - -=item close - -Close the file. - - $fh->close; - -=item eof - -Tests for end of file. - - if( $fh->eof ){ - print "end of file\n"; - } - -=item error - -Returns non-zero if there has been an error while reading or writing a file. - - if( $fh->error ){ - print "error\n"; - } - -=item fileno - -Returns the integer file descriptor associated with the file. - - $fileno = $fh->fileno; - -=item flush - -Flush the stream. - - $fh->flush; - -Returns C<undef> on failure. - -=item getc - -Get a character from the stream. - - $ch = $fh->getc; - -=item getpos - -Retrieve the file pointer position. The returned value can be used as an -argument to C<setpos()>. - - $pos = $fh->getpos; - -=item gets - -Retrieve a line from the open file. - - $line = $fh->gets; - -=item new_from_fd - -Open a file using a file descriptor. Return a Perl filehandle. The first -parameter should be a file descriptor, which can come from C<POSIX::open()>. -The second parameter, the mode, should be C<a> for append, C<w> for write, -and E<lt> or C<""> for read. The mode should match the mode which was used -when the file descriptor was created. - - $fd = POSIX::open( "typemap" ); - $fh = FileHandle->new_from_fd( $fd, "<" ); - die "FileHandle failed" unless $fh; - -=item new_tmpfile - -Creates a temporary file, opens it for writing, and returns a Perl -filehandle. Consult your system's C<tmpfile()> manpage for details. - - $fh = FileHandle->new_tmpfile; - die "FileHandle failed" unless $fh; - -=item seek - -Reposition file pointer. - - $fh->seek( 2, &POSIX::SEEK_SET ); - -=item setbuf - - -=item setpos - -Set the file pointer position. - - $pos = $fh->getpos; - $fh->setpos( $pos ); - -Returns C<undef> on failure. - -=item setvbuf - - -Returns C<undef> on failure. - -=item tell - -Returns the current file position, in bytes. - - $pos = $fh->tell; - -=item ungetc - - -=back - =head2 POSIX::SigAction =over 8 @@ -1733,7 +1595,7 @@ EXIT_FAILURE EXIT_SUCCESS MB_CUR_MAX RAND_MAX =item Constants -BUFSIZ EOF FILENAME_MAX L_ctermid L_cuserid L_tmpname TMP_MAX _IOFBF _IOLBF _IONBF +BUFSIZ EOF FILENAME_MAX L_ctermid L_cuserid L_tmpname TMP_MAX =back @@ -1773,5 +1635,5 @@ WIFEXITED WEXITSTATUS WIFSIGNALED WTERMSIG WIFSTOPPED WSTOPSIG =head1 CREATION -This document generated by ./mkposixman.PL version 19951212. +This document generated by ./mkposixman.PL version 19960129. diff --git a/ext/POSIX/POSIX.xs b/ext/POSIX/POSIX.xs index 2a6244a752..69db228b33 100644 --- a/ext/POSIX/POSIX.xs +++ b/ext/POSIX/POSIX.xs @@ -52,8 +52,6 @@ #include <utime.h> #endif -typedef FILE * InputStream; -typedef FILE * OutputStream; typedef int SysRet; typedef long SysRetLong; typedef sigset_t* POSIX__SigSet; @@ -2123,25 +2121,6 @@ int arg; #endif break; } - if (strEQ(name, "_IOFBF")) -#ifdef _IOFBF - return _IOFBF; -#else - goto not_there; -#endif - if (strEQ(name, "_IOLBF")) -#ifdef _IOLBF - return _IOLBF; -#else - goto not_there; -#endif - if (strEQ(name, "_IONBF")) -#ifdef _IONBF - return _IONBF; -#else - goto not_there; -#endif - break; } errno = EINVAL; return 0; @@ -2382,65 +2361,6 @@ setcc(termios_ref, ccix, cc) #endif - -MODULE = FileHandle PACKAGE = FileHandle PREFIX = f - -SV * -fgetpos(handle) - InputStream handle - CODE: - { - Fpos_t pos; - fgetpos(handle, &pos); - ST(0) = sv_2mortal(newSVpv((char*)&pos, sizeof(Fpos_t))); - } - -SysRet -fsetpos(handle, pos) - InputStream handle - SV * pos - CODE: - RETVAL = fsetpos(handle, (Fpos_t*)SvPVX(pos)); - OUTPUT: - RETVAL - -int -ungetc(handle, c) - InputStream handle - int c - CODE: - RETVAL = ungetc(c, handle); - OUTPUT: - RETVAL - -OutputStream -new_tmpfile(packname = "FileHandle") - char * packname - CODE: - RETVAL = tmpfile(); - OUTPUT: - RETVAL - -int -ferror(handle) - InputStream handle - -SysRet -fflush(handle) - OutputStream handle - -void -setbuf(handle, buf) - OutputStream handle - char * buf = SvPOK(ST(1)) ? sv_grow(ST(1), BUFSIZ) : 0; - -SysRet -setvbuf(handle, buf, type, size) - OutputStream handle - char * buf = SvPOK(ST(1)) ? sv_grow(ST(1), SvIV(ST(3))) : 0; - int type - int size - MODULE = POSIX PACKAGE = POSIX double diff --git a/ext/SDBM_File/Makefile.PL b/ext/SDBM_File/Makefile.PL index 634df7ce0d..2ad5745858 100644 --- a/ext/SDBM_File/Makefile.PL +++ b/ext/SDBM_File/Makefile.PL @@ -9,6 +9,7 @@ WriteMakefile( MYEXTLIB => 'sdbm/libsdbm$(LIB_EXT)', MAN3PODS => ' ', # Pods will be built by installman. XSPROTOARG => '-noprototypes', # XXX remove later? + VERSION_FROM => 'SDBM_File.pm', ); diff --git a/ext/SDBM_File/SDBM_File.pm b/ext/SDBM_File/SDBM_File.pm index 1f93e52893..d8b80c7a63 100644 --- a/ext/SDBM_File/SDBM_File.pm +++ b/ext/SDBM_File/SDBM_File.pm @@ -4,6 +4,8 @@ require TieHash; require DynaLoader; @ISA = qw(TieHash DynaLoader); +$VERSION = $VERSION = "1.00" ; + bootstrap SDBM_File; 1; diff --git a/ext/Safe/Makefile.PL b/ext/Safe/Makefile.PL index 2024998728..77d3b7372e 100644 --- a/ext/Safe/Makefile.PL +++ b/ext/Safe/Makefile.PL @@ -2,4 +2,5 @@ use ExtUtils::MakeMaker; WriteMakefile( MAN3PODS => ' ', # Pods will be built by installman. XSPROTOARG => '-noprototypes', # XXX remove later? + VERSION_FROM => 'Safe.pm', ); diff --git a/ext/Safe/Safe.pm b/ext/Safe/Safe.pm index 5014b384fc..5f24d1928a 100644 --- a/ext/Safe/Safe.pm +++ b/ext/Safe/Safe.pm @@ -2,8 +2,9 @@ package Safe; require Exporter; require DynaLoader; use Carp; +$VERSION = $VERSION = "1.00"; @ISA = qw(Exporter DynaLoader); -@EXPORT_OK = qw(op_mask ops_to_mask mask_to_ops opcode opname +@EXPORT_OK = qw(op_mask ops_to_mask mask_to_ops opcode opname opdesc MAXO emptymask fullmask); =head1 NAME @@ -250,13 +251,6 @@ Malcolm Beattie, mbeattie@sable.ox.ac.uk. =cut -my $safes = "1111111111111111111111101111111111111111111111111111111111111111" - . "1111111111111111111111111111111111111111111111111111111111111111" - . "1111110011111111111011111111111111111111111111111111111101001010" - . "0110111111111111111111110011111111100001000000000000000000000100" - . "0000000000000111110000001111111110100000000000001111111111111111" - . "11111111111111111110"; - my $default_root = 'Root000000000'; my $default_mask; @@ -392,7 +386,282 @@ EOT bootstrap Safe; -$safes .= "0" x (MAXO() - length($safes)); -($default_mask = $safes) =~ tr/01/\1\0/; # invert for mask +$default_mask = fullmask; +my $name; +while (defined ($name = <DATA>)) { + chomp $name; + next if $name =~ /^#/; + my $code = opcode($name); + substr($default_mask, $code, 1) = "\0"; +} 1; + +__DATA__ +null +stub +scalar +pushmark +wantarray +const +gvsv +gv +gelem +padsv +padav +padhv +padany +pushre +rv2gv +rv2sv +av2arylen +rv2cv +anoncode +prototype +refgen +srefgen +ref +bless +glob +readline +rcatline +regcmaybe +regcomp +match +subst +substcont +trans +sassign +aassign +chop +schop +chomp +schomp +defined +undef +study +pos +preinc +i_preinc +predec +i_predec +postinc +i_postinc +postdec +i_postdec +pow +multiply +i_multiply +divide +i_divide +modulo +i_modulo +repeat +add +i_add +subtract +i_subtract +concat +stringify +left_shift +right_shift +lt +i_lt +gt +i_gt +le +i_le +ge +i_ge +eq +i_eq +ne +i_ne +ncmp +i_ncmp +slt +sgt +sle +sge +seq +sne +scmp +bit_and +bit_xor +bit_or +negate +i_negate +not +complement +atan2 +sin +cos +rand +srand +exp +log +sqrt +int +hex +oct +abs +length +substr +vec +index +rindex +sprintf +formline +ord +chr +crypt +ucfirst +lcfirst +uc +lc +quotemeta +rv2av +aelemfast +aelem +aslice +each +values +keys +delete +exists +rv2hv +helem +hslice +split +join +list +lslice +anonlist +anonhash +splice +push +pop +shift +unshift +reverse +grepstart +grepwhile +mapstart +mapwhile +range +flip +flop +and +or +xor +cond_expr +andassign +orassign +method +entersub +leavesub +caller +warn +die +reset +lineseq +nextstate +dbstate +unstack +enter +leave +scope +enteriter +iter +enterloop +leaveloop +return +last +next +redo +goto +close +fileno +tie +untie +dbmopen +dbmclose +sselect +select +getc +read +enterwrite +leavewrite +prtf +print +sysread +syswrite +send +recv +eof +tell +seek +truncate +fcntl +ioctl +sockpair +bind +connect +listen +accept +shutdown +gsockopt +ssockopt +getsockname +ftrwrite +ftsvtx +open_dir +readdir +telldir +seekdir +rewinddir +kill +getppid +getpgrp +setpgrp +getpriority +setpriority +time +tms +localtime +alarm +dofile +entereval +leaveeval +entertry +leavetry +ghbyname +ghbyaddr +ghostent +gnbyname +gnbyaddr +gnetent +gpbyname +gpbynumber +gprotoent +gsbyname +gsbyport +gservent +shostent +snetent +sprotoent +sservent +ehostent +enetent +eprotoent +eservent +gpwnam +gpwuid +gpwent +spwent +epwent +ggrnam +ggrgid +ggrent +sgrent +egrent diff --git a/ext/Safe/Safe.xs b/ext/Safe/Safe.xs index ec7abce67a..8296262dd7 100644 --- a/ext/Safe/Safe.xs +++ b/ext/Safe/Safe.xs @@ -92,6 +92,18 @@ opname(...) } void +opdesc(...) + PPCODE: + int i, myopcode; + for (i = 0; i < items; i++) + { + myopcode = SvIV(ST(i)); + if (myopcode < 0 || myopcode >= maxo) + croak("opcode out of range"); + XPUSHs(sv_2mortal(newSVpv(op_desc[myopcode], 0))); + } + +void opcode(...) PPCODE: int i, j; @@ -99,7 +111,10 @@ opcode(...) for (i = 0; i < items; i++) { op = SvPV(ST(i), na); - for (j = 0; j < maxo && strNE(op, op_name[j]); j++) /* nothing */ ; + for (j = 0; j < maxo; j++) { + if (strEQ(op, op_name[j]) || strEQ(op, op_desc[j])) + break; + } if (j == maxo) croak("bad op name \"%s\"", op); XPUSHs(sv_2mortal(newSViv(j))); diff --git a/ext/Socket/Makefile.PL b/ext/Socket/Makefile.PL index f4850a0175..acf167e057 100644 --- a/ext/Socket/Makefile.PL +++ b/ext/Socket/Makefile.PL @@ -1,6 +1,6 @@ use ExtUtils::MakeMaker; WriteMakefile( - VERSION => 1.5, + VERSION_FROM => 'Socket.pm', MAN3PODS => ' ', # Pods will be built by installman. XSPROTOARG => '-noprototypes', # XXX remove later? ); diff --git a/ext/Socket/Socket.pm b/ext/Socket/Socket.pm index 6462713c43..9cc7585cb3 100644 --- a/ext/Socket/Socket.pm +++ b/ext/Socket/Socket.pm @@ -1,5 +1,5 @@ package Socket; -$VERSION = 1.5; +$VERSION = $VERSION = "1.5"; =head1 NAME |