-------------------
+ Version 5.003_97c
+-------------------
+
+That second public beta will be Real Soon Now...
+
+ CORE LANGUAGE CHANGES
+
+ Title: "Refine setgroups() behavior of C<$)>"
+ From: Chip Salzenberg
+ Files: mg.c pod/perldelta.pod pod/perlvar.pod
+
+ Title: "Forbid -[Mm] on #! line"
+ From: Chip Salzenberg
+ Files: pod/perldelta.pod pod/perldiag.pod toke.c
+
+ CORE PORTABILITY
+
+ Title: "Fix dynamic loading (and argv[0]) under AmigaOS"
+ From: Norbert Pueschel
+ Msg-ID: <77724842@Armageddon.meb.uni-bonn.de>
+ Date: Tue, 08 Apr 1997 22:01:45 +0200
+ Files: hints/amigaos.sh
+
+ Title: "Special mkdir() for VMS"
+ From: Charles Bailey
+ Msg-ID: <01IHGOXN6MZM0004K3@hmivax.humgen.upenn.edu>
+ Date: Tue, 08 Apr 1997 12:33:56 -0400 (EDT)
+ Files: dosish.h lib/ExtUtils/MM_Unix.pm lib/File/Path.pm os2/os2ish.h
+ plan9/plan9ish.h pp_sys.c unixish.h vms/vms.c vms/vmsish.h
+
+ OTHER CORE CHANGES
+
+ Title: "Fix assignment from magic SV that becomes a glob"
+ From: Chip Salzenberg
+ Files: sv.c
+
+ BUILD PROCESS
+
+ Title: "Fix syntax error in Configure comment(!)"
+ From: Chip Salzenberg
+ Files: Configure
+
+ Title: "For Solaris, if -DDEBUGGING, default to '-KPIC', not '-Kpic'"
+ From: Chip Salzenberg
+ Files: Configure
+
+ Title: "Fix usage of dXSUB_SYS, esp. in ExtUtils::Miniperl"
+ From: Chip Salzenberg
+ Files: dosish.h minimod.pl os2/os2ish.h plan9/plan9ish.h vms/vmsish.h
+
+ LIBRARY AND EXTENSIONS
+
+ Title: "Replace Class::Template with improved Class::Struct"
+ From: Jim Miner <jfm@winternet.com>
+ Files: MANIFEST lib/Class/Struct.pm lib/Class/Template.pm
+ lib/File/stat.pm lib/Net/hostent.pm lib/Net/netent.pm
+ lib/Net/protoent.pm lib/Net/servent.pm lib/Time/gmtime.pm
+ lib/Time/localtime.pm lib/Time/tm.pm lib/User/grent.pm
+ lib/User/pwent.pm pod/perldelta.pod pod/perlfaq7.pod
+ pod/perlmod.pod pod/perltoot.pod
+
+ Title: "MakeMaker pathname patch"
+ From: Nick Ing-Simmons
+ Msg-ID: <199704091908.UAA00877@ni-s.u-net.com>
+ Date: Wed, 9 Apr 1997 20:08:23 +0100
+ Files: lib/ExtUtils/MM_Unix.pm lib/ExtUtils/MakeMaker.pm
+
+ Title: "Fix configuration of new socket"
+ From: Chip Salzenberg
+ Files: ext/IO/lib/IO/Socket.pm
+
+ Title: "Improve IO::Handle docs; don't export _open_mode_string"
+ From: Chip Salzenberg
+ Files: ext/IO/lib/IO/File.pm ext/IO/lib/IO/Handle.pm
+
+ Title: "Complex.pm: 0**0 sanity"
+ From: Jarkko Hietaniemi
+ Msg-ID: <199704091804.VAA13930@alpha.hut.fi>
+ Date: Wed, 9 Apr 1997 21:04:23 +0300 (EET DST)
+ Files: lib/Math/Complex.pm
+
+ Title: "Fix typos in Math::Trig"
+ From: Jarkko Hietaniemi
+ Files: lib/Math/Trig.pm
+
+ TESTS
+
+ Title: "Accommodate CodeBuilder variant of Machten 4.0.3"
+ From: Dominic Dunlop <domo@slipper.ip.lu>
+ Msg-ID: <v03020902af704d320f27@[194.51.248.88]>
+ Date: Tue, 8 Apr 1997 22:15:15 +0200
+ Files: t/io/fs.t t/op/stat.t
+
+ UTILITIES
+
+ (no changes)
+
+ DOCUMENTATION
+
+ Title: "IO::Socket doc fix"
+ From: Roderick Schertler
+ Msg-ID: <28383.860527843@eeyore.ibcinc.com>
+ Date: Tue, 08 Apr 1997 15:30:43 -0400
+ Files: ext/IO/lib/IO/Socket.pm
+
+
+-------------------
Version 5.003_97b
-------------------
'') case "$osname" in
hpux) dflt='+z' ;;
next) dflt='none' ;;
- solaris|svr4*|esix*) dflt='-Kpic' ;;
- irix*) dflt='-KPIC' ;;
+ svr4*|esix*) dflt='-Kpic' ;;
+ irix*) dflt='-KPIC' ;;
+ solaris) case "$ccflags" in
+ *-DDEBUGGING*) dflt='-KPIC' ;;
+ *) dflt='-Kpic' ;;
+ esac ;;
sunos) dflt='-pic' ;;
*) dflt='none' ;;
esac ;;
set setgroups d_setgrps
eval $inlibc
-: Find type of 2nd arg to getgroups (and setgroups)
+: Find type of 2nd arg to 'getgroups()' and 'setgroups()'
echo " "
case "$d_getgrps$d_setgrps" in
*define*)
lib/CPAN/FirstTime.pm Utility for creating CPAN config files
lib/CPAN/Nox.pm Runs CPAN while avoiding compiled extensions
lib/Carp.pm Error message base class
-lib/Class/Template.pm Structure/member template builder; makes nested types
+lib/Class/Struct.pm Declare struct-like datatypes as Perl classes
lib/Cwd.pm Various cwd routines (getcwd, fastcwd, chdir)
lib/Devel/SelfStubber.pm Generate stubs for SelfLoader.pm
lib/DirHandle.pm like FileHandle only for directories
lib/Time/Local.pm Reverse translation of localtime, gmtime
lib/Time/gmtime.pm By-name interface to Perl's built-in gmtime
lib/Time/localtime.pm By-name interface to Perl's built-in localtime
-lib/Time/tm.pm Internal oject for Time::{gm,local}time
+lib/Time/tm.pm Internal object for Time::{gm,local}time
lib/UNIVERSAL.pm Base class for ALL classes
lib/User/grent.pm By-name interface to Perl's built-in getgr*
lib/User/pwent.pm By-name interface to Perl's built-in getpw*
#endif /* DJGPP */
#define PERL_SYS_TERM()
-#define dXSUB_SYS int dummy
+#define dXSUB_SYS
#define TMPPATH "plXXXXXX"
#ifdef WIN32
#define Fstat(fd,bufptr) fstat((fd),(bufptr))
#define Fflush(fp) fflush(fp)
+#define Mkdir(path,mode) mkdir((path),(mode))
#ifndef WIN32
# define Stat(fname,bufptr) stat((fname),(bufptr))
@ISA = qw(IO::Handle);
-$VERSION = "1.16";
+$VERSION = "1.1602";
sub import {
my $pkg = shift;
unless ref($fh) eq "IO::Socket";
bless($fh, $domain2pkg[$domain]);
- $fh->configure;
+ $fh->configure($arg);
}
sub socket {
Examples:
$sock = IO::Socket::INET->new(PeerAddr => 'www.perl.org',
- PeerPort => http(80),
+ PeerPort => 'http(80)',
Proto => 'tcp');
$sock = IO::Socket::INET->new(PeerAddr => 'localhost:smtp(25)');
--- /dev/null
+package Class::Struct;
+
+## See POD after __END__
+
+require 5.002;
+
+use strict;
+use vars qw(@ISA @EXPORT);
+
+use Carp;
+
+require Exporter;
+@ISA = qw(Exporter);
+@EXPORT = qw(struct);
+
+## Tested on 5.002 and 5.003 without class membership tests:
+my $CHECK_CLASS_MEMBERSHIP = ($] >= 5.003_95);
+
+my $print = 0;
+sub printem {
+ if (@_) { $print = shift }
+ else { $print++ }
+}
+
+{
+ package Class::Struct::Tie_ISA;
+
+ sub TIEARRAY {
+ my $class = shift;
+ return bless [], $class;
+ }
+
+ sub STORE {
+ my ($self, $index, $value) = @_;
+ Class::Struct::_subclass_error();
+ }
+
+ sub FETCH {
+ my ($self, $index) = @_;
+ $self->[$index];
+ }
+
+ sub DESTROY { }
+}
+
+sub struct {
+
+ # Determine parameter list structure, one of:
+ # struct( class => [ element-list ])
+ # struct( class => { element-list })
+ # struct( element-list )
+ # Latter form assumes current package name as struct name.
+
+ my ($class, @decls);
+ my $base_type = ref $_[1];
+ if ( $base_type eq 'HASH' ) {
+ $class = shift;
+ @decls = %{shift()};
+ _usage_error() if @_;
+ }
+ elsif ( $base_type eq 'ARRAY' ) {
+ $class = shift;
+ @decls = @{shift()};
+ _usage_error() if @_;
+ }
+ else {
+ $base_type = 'ARRAY';
+ $class = (caller())[0];
+ @decls = @_;
+ }
+ _usage_error() if @decls % 2 == 1;
+
+ # Ensure we are not, and will not be, a subclass.
+
+ my $isa = do {
+ no strict 'refs';
+ \@{$class . '::ISA'};
+ };
+ _subclass_error() if @$isa;
+ tie @$isa, 'Class::Struct::Tie_ISA';
+
+ # Create constructor.
+
+ croak "function 'new' already defined in package $class"
+ if do { no strict 'refs'; defined &{$class . "::new"} };
+
+ my @methods = ();
+ my %refs = ();
+ my %arrays = ();
+ my %hashes = ();
+ my %classes = ();
+ my $got_class = 0;
+ my $out = '';
+
+ $out = "{\n package $class;\n use Carp;\n sub new {\n";
+
+ my $cnt = 0;
+ my $idx = 0;
+ my( $cmt, $name, $type, $elem );
+
+ if( $base_type eq 'HASH' ){
+ $out .= " my(\$r) = {};\n";
+ $cmt = '';
+ }
+ elsif( $base_type eq 'ARRAY' ){
+ $out .= " my(\$r) = [];\n";
+ }
+ while( $idx < @decls ){
+ $name = $decls[$idx];
+ $type = $decls[$idx+1];
+ push( @methods, $name );
+ if( $base_type eq 'HASH' ){
+ $elem = "{'$name'}";
+ }
+ elsif( $base_type eq 'ARRAY' ){
+ $elem = "[$cnt]";
+ ++$cnt;
+ $cmt = " # $name";
+ }
+ if( $type =~ /^\*(.)/ ){
+ $refs{$name}++;
+ $type = $1;
+ }
+ if( $type eq '@' ){
+ $out .= " \$r->$elem = [];$cmt\n";
+ $arrays{$name}++;
+ }
+ elsif( $type eq '%' ){
+ $out .= " \$r->$elem = {};$cmt\n";
+ $hashes{$name}++;
+ }
+ elsif ( $type eq '$') {
+ $out .= " \$r->$elem = undef;$cmt\n";
+ }
+ elsif( $type =~ /^\w+(?:::\w+)*$/ ){
+ $out .= " \$r->$elem = '${type}'->new();$cmt\n";
+ $classes{$name} = $type;
+ $got_class = 1;
+ }
+ else{
+ croak "'$type' is not a valid struct element type";
+ }
+ $idx += 2;
+ }
+ $out .= " bless \$r;\n }\n";
+
+ # Create accessor methods.
+
+ if ( $got_class && $CHECK_CLASS_MEMBERSHIP ) {
+ $out .= " use UNIVERSAL;\n";
+ }
+ my( $pre, $pst, $sel );
+ $cnt = 0;
+ foreach $name (@methods){
+ if ( do { no strict 'refs'; defined &{$class . "::$name"} } ) {
+ carp "function '$name' already defined, overrides struct accessor method"
+ if $^W;
+ }
+ else {
+ $pre = $pst = $cmt = $sel = '';
+ if( defined $refs{$name} ){
+ $pre = "\\(";
+ $pst = ")";
+ $cmt = " # returns ref";
+ }
+ $out .= " sub $name {$cmt\n my \$r = shift;\n";
+ if( $base_type eq 'ARRAY' ){
+ $elem = "[$cnt]";
+ ++$cnt;
+ }
+ elsif( $base_type eq 'HASH' ){
+ $elem = "{'$name'}";
+ }
+ if( defined $arrays{$name} ){
+ $out .= " my \$i;\n";
+ $out .= " \@_ ? (\$i = shift) : return $pre\$r->$elem$pst;\n";
+ $sel = "->[\$i]";
+ }
+ elsif( defined $hashes{$name} ){
+ $out .= " my \$i;\n";
+ $out .= " \@_ ? (\$i = shift) : return $pre\$r->$elem$pst;\n";
+ $sel = "->{\$i}";
+ }
+ elsif( defined $classes{$name} ){
+ if ( $CHECK_CLASS_MEMBERSHIP ) {
+ $out .= " croak '$name argument is wrong class' if \@_ && ! UNIVERSAL::isa(\$_[0], '$type');\n";
+ }
+ }
+ $out .= " croak 'Too many args to $name' if \@_ > 1;\n";
+ $out .= " \@_ ? ($pre\$r->$elem$sel = shift$pst) : $pre\$r->$elem$sel$pst;\n";
+ $out .= " }\n";
+ }
+ }
+ $out .= "}\n1;\n";
+
+ print $out if $print;
+ my $result = eval $out;
+ carp $@ if $@;
+}
+
+sub _usage_error {
+ confess "struct usage error";
+}
+
+sub _subclass_error {
+ croak 'struct class cannot be a subclass (@ISA not allowed)';
+}
+
+1; # for require
+
+
+__END__
+
+=head1 NAME
+
+Class::Struct - declare struct-like datatypes as Perl classes
+
+=head1 SYNOPSIS
+
+ use Class::Struct;
+ # declare struct, based on array:
+ struct( CLASS_NAME => [ ELEMENT_NAME => ELEMENT_TYPE, ... ]);
+ # declare struct, based on hash:
+ struct( CLASS_NAME => { ELEMENT_NAME => ELEMENT_TYPE, ... });
+
+ package CLASS_NAME;
+ use Class::Struct;
+ # declare struct, based on array, implicit class name:
+ struct( ELEMENT_NAME => ELEMENT_TYPE, ... );
+
+
+ package Myobj;
+ use Class::Struct;
+ # declare struct with four types of elements:
+ struct( s => '$', a => '@', h => '%', c => 'My_Other_Class' );
+
+ $obj = new Myobj; # constructor
+
+ # scalar type accessor:
+ $element_value = $obj->s; # element value
+ $obj->s('new value'); # assign to element
+
+ # array type accessor:
+ $ary_ref = $obj->a; # reference to whole array
+ $ary_element_value = $obj->a(2); # array element value
+ $obj->a(2, 'new value'); # assign to array element
+
+ # hash type accessor:
+ $hash_ref = $obj->h; # reference to whole hash
+ $hash_element_value = $obj->h('x'); # hash element value
+ $obj->h('x', 'new value'); # assign to hash element
+
+ # class type accessor:
+ $element_value = $obj->c; # object reference
+ $obj->c->method(...); # call method of object
+ $obj->c(new My_Other_Class); # assign a new object
+
+
+=head1 DESCRIPTION
+
+C<Class::Struct> exports a single function, C<struct>.
+Given a list of element names and types, and optionally
+a class name, C<struct> creates a Perl 5 class that implements
+a "struct-like" data structure.
+
+The new class is given a constructor method, C<new>, for creating
+struct objects.
+
+Each element in the struct data has an accessor method, which is
+used to assign to the element and to fetch its value. The
+default accessor can be overridden by declaring a C<sub> of the
+same name in the package. (See Example 2.)
+
+Each element's type can be scalar, array, hash, or class.
+
+
+=head2 The C<struct()> function
+
+The C<struct> function has three forms of parameter-list.
+
+ struct( CLASS_NAME => [ ELEMENT_LIST ]);
+ struct( CLASS_NAME => { ELEMENT_LIST });
+ struct( ELEMENT_LIST );
+
+The first and second forms explicitly identify the name of the
+class being created. The third form assumes the current package
+name as the class name.
+
+An object of a class created by the first and third forms is
+based on an array, whereas an object of a class created by the
+second form is based on a hash. The array-based forms will be
+somewhat faster and smaller; the hash-based forms are more
+flexible.
+
+The class created by C<struct> must not be a subclass of another
+class other than C<UNIVERSAL>.
+
+A function named C<new> must not be explicitly defined in a class
+created by C<struct>.
+
+The I<ELEMENT_LIST> has the form
+
+ NAME => TYPE, ...
+
+Each name-type pair declares one element of the struct. Each
+element name will be defined as an accessor method unless a
+method by that name is explicitly defined; in the latter case, a
+warning is issued if the warning flag (-w) is set.
+
+
+=head2 Element Types and Accessor Methods
+
+The four element types -- scalar, array, hash, and class -- are
+represented by strings -- C<'$'>, C<'@'>, C<'%'>, and a class name --
+optionally preceded by a C<'*'>.
+
+The accessor method provided by C<struct> for an element depends
+on the declared type of the element.
+
+=over
+
+=item Scalar (C<'$'> or C<'*$'>)
+
+The element is a scalar, and is initialized to C<undef>.
+
+The accessor's argument, if any, is assigned to the element.
+
+If the element type is C<'$'>, the value of the element (after
+assignment) is returned. If the element type is C<'*$'>, a reference
+to the element is returned.
+
+=item Array (C<'@'> or C<'*@'>)
+
+The element is an array, initialized to C<()>.
+
+With no argument, the accessor returns a reference to the
+element's whole array.
+
+With one or two arguments, the first argument is an index
+specifying one element of the array; the second argument, if
+present, is assigned to the array element. If the element type
+is C<'@'>, the accessor returns the array element value. If the
+element type is C<'*@'>, a reference to the array element is
+returned.
+
+=item Hash (C<'%'> or C<'*%'>)
+
+The element is a hash, initialized to C<()>.
+
+With no argument, the accessor returns a reference to the
+element's whole hash.
+
+With one or two arguments, the first argument is a key specifying
+one element of the hash; the second argument, if present, is
+assigned to the hash element. If the element type is C<'%'>, the
+accessor returns the hash element value. If the element type is
+C<'*%'>, a reference to the hash element is returned.
+
+=item Class (C<'Class_Name'> or C<'*Class_Name'>)
+
+The element's value must be a reference blessed to the named
+class or to one of its subclasses. The element is initialized to
+the result of calling the C<new> constructor of the named class.
+
+The accessor's argument, if any, is assigned to the element. The
+accessor will C<croak> if this is not an appropriate object
+reference.
+
+If the element type does not start with a C<'*'>, the accessor
+returns the element value (after assignment). If the element type
+starts with a C<'*'>, a reference to the element itself is returned.
+
+=back
+
+=head1 EXAMPLES
+
+=over
+
+=item Example 1
+
+Giving a struct element a class type that is also a struct is how
+structs are nested. Here, C<timeval> represents a time (seconds and
+microseconds), and C<rusage> has two elements, each of which is of
+type C<timeval>.
+
+ use Class::Struct;
+
+ struct( rusage => {
+ ru_utime => timeval, # seconds
+ ru_stime => timeval, # microseconds
+ });
+
+ struct( timeval => [
+ tv_secs => '$',
+ tv_usecs => '$',
+ ]);
+
+ # create an object:
+ my $t = new rusage;
+ # $t->ru_utime and $t->ru_stime are objects of type timeval.
+
+ # set $t->ru_utime to 100.0 sec and $t->ru_stime to 5.0 sec.
+ $t->ru_utime->tv_secs(100);
+ $t->ru_utime->tv_usecs(0);
+ $t->ru_stime->tv_secs(5);
+ $t->ru_stime->tv_usecs(0);
+
+
+=item Example 2
+
+An accessor function can be redefined in order to provide
+additional checking of values, etc. Here, we want the C<count>
+element always to be nonnegative, so we redefine the C<count>
+accessor accordingly.
+
+ package MyObj;
+ use Class::Struct;
+
+ # declare the struct
+ struct ( 'MyObj', { count => '$', stuff => '%' } );
+
+ # override the default accessor method for 'count'
+ sub count {
+ my $self = shift;
+ if ( @_ ) {
+ die 'count must be nonnegative' if $_[0] < 0;
+ $self->{'count'} = shift;
+ warn "Too many args to count" if @_;
+ }
+ return $self->{'count'};
+ }
+
+ package main;
+ $x = new MyObj;
+ print "\$x->count(5) = ", $x->count(5), "\n";
+ # prints '$x->count(5) = 5'
+
+ print "\$x->count = ", $x->count, "\n";
+ # prints '$x->count = 5'
+
+ print "\$x->count(-5) = ", $x->count(-5), "\n";
+ # dies due to negative argument!
+
+
+=head1 Author and Modification History
+
+
+Renamed to C<Class::Struct> and modified by Jim Miner, 1997-04-02.
+
+ members() function removed.
+ Documentation corrected and extended.
+ Use of struct() in a subclass prohibited.
+ User definition of accessor allowed.
+ Treatment of '*' in element types corrected.
+ Treatment of classes as element types corrected.
+ Class name to struct() made optional.
+ Diagnostic checks added.
+
+
+Originally C<Class::Template> by Dean Roehrich.
+
+ # Template.pm --- struct/member template builder
+ # 12mar95
+ # Dean Roehrich
+ #
+ # changes/bugs fixed since 28nov94 version:
+ # - podified
+ # changes/bugs fixed since 21nov94 version:
+ # - Fixed examples.
+ # changes/bugs fixed since 02sep94 version:
+ # - Moved to Class::Template.
+ # changes/bugs fixed since 20feb94 version:
+ # - Updated to be a more proper module.
+ # - Added "use strict".
+ # - Bug in build_methods, was using @var when @$var needed.
+ # - Now using my() rather than local().
+ #
+ # Uses perl5 classes to create nested data types.
+ # This is offered as one implementation of Tom Christiansen's "structs.pl"
+ # idea.
+
+=cut
# too often :)
my($self,@dirs) = @_;
- my(@m,$dir);
+ my(@m,$dir,$targdir);
foreach $dir (@dirs) {
my($src) = $self->catfile($self->{PERL_INC},'perl.h');
my($targ) = $self->catfile($dir,'.exists');
- my($targdir) = dirname($targ); # Necessary because catfile may have adapted syntax of $dir to target OS
+ # catfile may have adapted syntax of $dir to target OS, so...
+ if ($Is_VMS) { # Just remove file name; dirspec is often in macro
+ ($targdir = $targ) =~ s:/?\.exists$::;
+ }
+ else { # while elsewhere we expect to see the dir separator in $targ
+ $targdir = dirname($targ);
+ }
next if $self->{DIR_TARGET}{$self}{$targdir}++;
push @m, qq{
$targ :: $src
Initializes NAME, FULLEXT, BASEEXT, PARENT_NAME, DLBASE, PERL_SRC,
PERL_LIB, PERL_ARCHLIB, PERL_INC, INSTALLDIRS, INST_*, INSTALL*,
-PREFIX, CONFIG, AR, AR_STATIC_ARGS, LD, OBJ_EXT, LIB_EXT, MAP_TARGET,
+PREFIX, CONFIG, AR, AR_STATIC_ARGS, LD, OBJ_EXT, LIB_EXT, EXE_EXT, MAP_TARGET,
LIBPERL_A, VERSION_FROM, VERSION, DISTNAME, VERSION_SYM.
=cut
# all the installation path variables to literally $(PREFIX), so
# the user can still say make PREFIX=foo
my($configure_prefix) = $Config{'prefix'};
- $prefix = VMS::Filespec::unixify($prefix) if $Is_VMS;
+ $configure_prefix = VMS::Filespec::unixify($configure_prefix) if $Is_VMS;
$self->{PREFIX} ||= $configure_prefix;
@Get_from_Config =
qw(
ar cc cccdlflags ccdlflags dlext dlsrc ld lddlflags ldflags libc
- lib_ext obj_ext ranlib sitelibexp sitearchexp so
+ lib_ext obj_ext ranlib sitelibexp sitearchexp so exe_ext
);
my $item;
my(@created);
foreach $path (@$paths) {
next if -d $path;
+ # Logic wants Unix paths, so go with the flow.
+ $path = VMS::Filespec::unixify($path) if $Is_VMS;
my $parent = dirname($path);
push(@created,mkpath($parent, $verbose, $mode)) unless (-d $parent);
print "mkdir $path\n" if $verbose;
BEGIN {
use Exporter ();
- use vars qw(@ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
- @ISA = qw(Exporter);
+ use vars qw(@EXPORT @EXPORT_OK %EXPORT_TAGS);
@EXPORT = qw(stat lstat);
@EXPORT_OK = qw( $st_dev $st_ino $st_mode
$st_nlink $st_uid $st_gid
}
use vars @EXPORT_OK;
-use Class::Template qw(struct);
+# Class::Struct forbids use of @ISA
+sub import { goto &Exporter::import }
+
+use Class::Struct qw(struct);
struct 'File::stat' => [
map { $_ => '$' } qw{
dev ino mode nlink uid gid rdev size
=head1 NOTE
-While this class is currently implemented using the Class::Template
+While this class is currently implemented using the Class::Struct
module to build a struct-like class, you shouldn't rely upon this.
=head1 AUTHOR
BEGIN {
use Exporter ();
- use vars qw(@ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
- @ISA = qw(Exporter);
+ use vars qw(@EXPORT @EXPORT_OK %EXPORT_TAGS);
@EXPORT = qw(gethostbyname gethostbyaddr gethost);
@EXPORT_OK = qw(
$h_name @h_aliases
}
use vars @EXPORT_OK;
-use Class::Template qw(struct);
+# Class::Struct forbids use of @ISA
+sub import { goto &Exporter::import }
+
+use Class::Struct qw(struct);
struct 'Net::hostent' => [
name => '$',
aliases => '@',
=head1 NOTE
-While this class is currently implemented using the Class::Template
+While this class is currently implemented using the Class::Struct
module to build a struct-like class, you shouldn't rely upon this.
=head1 AUTHOR
BEGIN {
use Exporter ();
- use vars qw(@ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
- @ISA = qw(Exporter);
+ use vars qw(@EXPORT @EXPORT_OK %EXPORT_TAGS);
@EXPORT = qw(getnetbyname getnetbyaddr getnet);
@EXPORT_OK = qw(
$n_name @n_aliases
}
use vars @EXPORT_OK;
-use Class::Template qw(struct);
+# Class::Struct forbids use of @ISA
+sub import { goto &Exporter::import }
+
+use Class::Struct qw(struct);
struct 'Net::netent' => [
name => '$',
aliases => '@',
=head1 NOTE
-While this class is currently implemented using the Class::Template
+While this class is currently implemented using the Class::Struct
module to build a struct-like class, you shouldn't rely upon this.
=head1 AUTHOR
BEGIN {
use Exporter ();
- use vars qw(@ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
- @ISA = qw(Exporter);
+ use vars qw(@EXPORT @EXPORT_OK %EXPORT_TAGS);
@EXPORT = qw(getprotobyname getprotobynumber getprotoent);
@EXPORT_OK = qw( $p_name @p_aliases $p_proto );
%EXPORT_TAGS = ( FIELDS => [ @EXPORT_OK, @EXPORT ] );
}
use vars @EXPORT_OK;
-use Class::Template qw(struct);
+# Class::Struct forbids use of @ISA
+sub import { goto &Exporter::import }
+
+use Class::Struct qw(struct);
struct 'Net::protoent' => [
name => '$',
aliases => '@',
=head1 NOTE
-While this class is currently implemented using the Class::Template
+While this class is currently implemented using the Class::Struct
module to build a struct-like class, you shouldn't rely upon this.
=head1 AUTHOR
BEGIN {
use Exporter ();
- use vars qw(@ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
- @ISA = qw(Exporter);
+ use vars qw(@EXPORT @EXPORT_OK %EXPORT_TAGS);
@EXPORT = qw(getservbyname getservbyport getservent getserv);
@EXPORT_OK = qw( $s_name @s_aliases $s_port $s_proto );
%EXPORT_TAGS = ( FIELDS => [ @EXPORT_OK, @EXPORT ] );
}
use vars @EXPORT_OK;
-use Class::Template qw(struct);
+# Class::Struct forbids use of @ISA
+sub import { goto &Exporter::import }
+
+use Class::Struct qw(struct);
struct 'Net::servent' => [
name => '$',
aliases => '@',
=head1 NOTE
-While this class is currently implemented using the Class::Template
+While this class is currently implemented using the Class::Struct
module to build a struct-like class, you shouldn't rely upon this.
=head1 AUTHOR
=head1 NOTE
-While this class is currently implemented using the Class::Template
+While this class is currently implemented using the Class::Struct
module to build a struct-like class, you shouldn't rely upon this.
=head1 AUTHOR
=head1 NOTE
-While this class is currently implemented using the Class::Template
+While this class is currently implemented using the Class::Struct
module to build a struct-like class, you shouldn't rely upon this.
=head1 AUTHOR
package Time::tm;
use strict;
-use Class::Template qw(struct);
+use Class::Struct qw(struct);
struct('Time::tm' => [
map { $_ => '$' } qw{ sec min hour mday mon year wday yday isdst }
]);
BEGIN {
use Exporter ();
- use vars qw(@ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
- @ISA = qw(Exporter);
+ use vars qw(@EXPORT @EXPORT_OK %EXPORT_TAGS);
@EXPORT = qw(getgrent getgrgid getgrnam getgr);
@EXPORT_OK = qw($gr_name $gr_gid $gr_passwd $gr_mem @gr_members);
%EXPORT_TAGS = ( FIELDS => [ @EXPORT_OK, @EXPORT ] );
}
use vars @EXPORT_OK;
-use Class::Template qw(struct);
+# Class::Struct forbids use of @ISA
+sub import { goto &Exporter::import }
+
+use Class::Struct qw(struct);
struct 'User::grent' => [
name => '$',
passwd => '$',
=head1 NOTE
-While this class is currently implemented using the Class::Template
+While this class is currently implemented using the Class::Struct
module to build a struct-like class, you shouldn't rely upon this.
=head1 AUTHOR
BEGIN {
use Exporter ();
- use vars qw(@ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
- @ISA = qw(Exporter);
+ use vars qw(@EXPORT @EXPORT_OK %EXPORT_TAGS);
@EXPORT = qw(getpwent getpwuid getpwnam getpw);
@EXPORT_OK = qw(
$pw_name $pw_passwd $pw_uid
}
use vars @EXPORT_OK;
-use Class::Template qw(struct);
+# Class::Struct forbids use of @ISA
+sub import { goto &Exporter::import }
+
+use Class::Struct qw(struct);
struct 'User::pwent' => [
name => '$',
passwd => '$',
=head1 NOTE
-While this class is currently implemented using the Class::Template
+While this class is currently implemented using the Class::Struct
module to build a struct-like class, you shouldn't rely upon this.
=head1 AUTHOR
break;
gary[i] = I_V(atof(p));
}
- (void)setgroups(i, gary);
+ if (i)
+ (void)setgroups(i, gary);
}
#else /* HAS_SETGROUPS */
egid = SvIOK(sv) ? SvIVX(sv) : sv_2iv(sv);
END
while (<MINI>) {
- print;
+ print unless /dXSUB_SYS/;
}
close MINI;
my ($tail1,$tail2) = ( $tail =~ /\A(.*\n)(\s*\}.*)\Z/s );
print $tail1;
- print " char *file = __FILE__;\n";
+ print "\tchar *file = __FILE__;\n";
+ print "\tdXSUB_SYS;\n" if $] > 5.002;
+
foreach $_ (@exts){
my($pname) = canon('/', $_);
my($mname, $cname, $ccode);
/* #define PERL_SYS_TERM() STMT_START { \
if (Perl_HAB_set) WinTerminate(Perl_hab); } STMT_END */
-#define dXSUB_SYS int fake = OS2_XS_init()
+#define dXSUB_SYS OS2_XS_init()
#ifdef PERL_IS_AOUT
/* # define HAS_FORK */
#define Stat(fname,bufptr) os2_stat((fname),(bufptr))
#define Fstat(fd,bufptr) fstat((fd),(bufptr))
#define Fflush(fp) fflush(fp)
+#define Mkdir(path,mode) mkdir((path),(mode))
#undef S_IFBLK
#undef S_ISBLK
#define Stat(fname,bufptr) stat((fname),(bufptr))
#define Fstat(fd,bufptr) fstat((fd),(bufptr))
#define Fflush(fp) fflush(fp)
+#define Mkdir(path,mode) mkdir((path),(mode))
#endif
NULL
,"Dev97A - First development patch to 5.003_97"
,"Dev97B - Second development patch to 5.003_97"
+ ,"Dev97C - Third development patch to 5.003_97"
,NULL
};
#define BIT_BUCKET "/dev/null"
#define PERL_SYS_INIT(c,v)
-#define dXSUB_SYS int dummy
+#define dXSUB_SYS
#define PERL_SYS_TERM()
/*
#define Stat(fname,bufptr) stat((fname),(bufptr))
#define Fstat(fd,bufptr) fstat((fd),(bufptr))
#define Fflush(fp) fflush(fp)
+#define Mkdir(path,mode) mkdir((path),(mode))
/* getenv related stuff */
#define my_getenv(var) getenv(var)
beginning of your script, except that hyphens are optional. PERL5OPT
may only be used to set the following switches: B<-[DIMUdmw]>.
+=head2 Limitations on B<-M>, and C<-m>, and B<-T> options
+
+The C<-M> and C<-m> options are no longer allowed on the C<#!> line of
+a script. If a script needs a module, it should invoke it with the
+C<use> pragma.
+
+The B<-T> option is also forbidden on the C<#!> line of a script,
+unless it was present on the Perl command line. Due to the way C<#!>
+works, this usually means that B<-T> must be in the first argument.
+Thus:
+
+ #!/usr/bin/perl -T -w
+
+will probably work for an executable script invoked as C<scriptname>,
+while:
+
+ #!/usr/bin/perl -w -T
+
+will probably fail under the same conditions. (Non-Unix systems will
+probably not follow this rule.) But C<perl scriptname> is guaranteed
+to fail, since then there is no chance of B<-T> being found on the
+command line before it is found on the C<#!> line.
+
=head2 More precise warnings
If you removed the B<-w> option from your Perl 5.003 scripts because it
not. In Perl 5.002 and 5.003, both $a{b} and $a[2] would have existed
(but $a[2]'s value would have been undefined).
-=head2 C<$)> is writable
+=head2 Group vector changeable with C<$)>
The C<$)> special variable has always (well, in Perl 5, at least)
-reflected not only the current effective group, but also the group
-list as returned by the C<getgroups()> C function (if there is one).
-However, due to an oversight, assigning to C<$)> has not called
-C<setgroups()>, only C<setegid()>.
+reflected not only the current effective group, but also the group list
+as returned by the C<getgroups()> C function (if there is one).
+However, until this release, there has not been a way to call the
+C<setgroups()> C function from Perl.
-In Perl 5.004, assigning to C<$)> is exactly symmetrical with
-examining it: The first number in its string value is used as the
-effective gid, and all the others are passed to the C<setgroups()> C
-function (if there is one).
+In Perl 5.004, assigning to C<$)> is exactly symmetrical with examining
+it: The first number in its string value is used as the effective gid;
+if there are any numbers after the first one, they are passed to the
+C<setgroups()> C function (if there is one).
=head2 Fixed parsing of $$<digit>, &$<digit>, etc.
=head2 Changes to tainting checks
A bug in previous versions may have failed to detect some insecure
-conditions when taint checks are turned on. (Taint checks are used
+conditions when taint checks are turned on. (Taint checks are used
in setuid or setgid scripts, or when explicitly turned on with the
-C<-T> invocation option.) Although it's unlikely, this may cause a
+C<-T> invocation option.) Although it's unlikely, this may cause a
previously-working script to now fail -- which should be construed
as a blessing, since that indicates a potentially-serious security
hole was just plugged.
FindBin.pm Find path of currently executing program
- Class/Template.pm Structure/member template builder
- File/stat.pm Object-oriented wrapper around CORE::stat
- Net/hostent.pm Object-oriented wrapper around CORE::gethost*
- Net/netent.pm Object-oriented wrapper around CORE::getnet*
- Net/protoent.pm Object-oriented wrapper around CORE::getproto*
- Net/servent.pm Object-oriented wrapper around CORE::getserv*
- Time/gmtime.pm Object-oriented wrapper around CORE::gmtime
- Time/localtime.pm Object-oriented wrapper around CORE::localtime
- Time/tm.pm Perl implementation of "struct tm" for {gm,local}time
- User/grent.pm Object-oriented wrapper around CORE::getgr*
- User/pwent.pm Object-oriented wrapper around CORE::getpw*
+ Class/Struct.pm Declare struct-like datatypes as Perl classes
+ File/stat.pm By-name interface to Perl's built-in stat
+ Net/hostent.pm By-name interface to Perl's built-in gethost*
+ Net/netent.pm By-name interface to Perl's built-in getnet*
+ Net/protoent.pm By-name interface to Perl's built-in getproto*
+ Net/servent.pm By-name interface to Perl's built-in getserv*
+ Time/gmtime.pm By-name interface to Perl's built-in gmtime
+ Time/localtime.pm By-name interface to Perl's built-in localtime
+ Time/tm.pm Internal object for Time::{gm,local}time
+ User/grent.pm By-name interface to Perl's built-in getgr*
+ User/pwent.pm By-name interface to Perl's built-in getpw*
Tie/RefHash.pm Base class for tied hashes with references as keys
=item Too late for "B<-T>" option
(X) The #! line (or local equivalent) in a Perl script contains the
-B<-T> option, but Perl was not invoked with B<-T> in its argument
-list. This is an error because, by the time Perl discovers a B<-T> in
-a script, it's too late to properly taint everything from the
-environment. So Perl gives up.
+B<-T> option, but Perl was not invoked with B<-T> in its command line.
+This is an error because, by the time Perl discovers a B<-T> in a
+script, it's too late to properly taint everything from the environment.
+So Perl gives up.
If the Perl script is being executed as a command using the #!
mechanism (or its local equivalent), this error can usually be fixed
If the Perl script is being executed as C<perl scriptname>, then the
B<-T> option must appear on the command line: C<perl -T scriptname>.
+=item Too late for "-%s" option
+
+(X) The #! line (or local equivalent) in a Perl script contains the
+B<-M> or B<-m> option. This is an error because B<-M> and B<-m> options
+are not intended for use inside scripts. Use the C<use> pragma instead.
+
=item Too many ('s
=item Too many )'s
If you want to override a predefined function, such as open(),
then you'll have to import the new definition from a different
module. See L<perlsub/"Overriding Builtin Functions">. There's
-also an example in L<perltoot/"Class::Template">.
+also an example in L<perltoot/"Class::Struct">.
If you want to overload a Perl operator, such as C<+> or C<**>,
then you'll want to use the C<use overload> pragma, documented
warn of errors (from perspective of caller)
-=item Class::Template
+=item Class::Struct
-struct/member template builder
+declare struct-like datatypes
=item Config
=item $PERL5OPT environment variable
+=item Limitations on B<-M>, and C<-m>, and B<-T> options
+
=item More precise warnings
=item Deprecated: Inherited C<AUTOLOAD> for non-methods
=item Subroutine arguments created only when they're modified
-=item C<$)> is writable
+=item Group vector changeable with C<$)>
=item Fixed parsing of $$<digit>, &$<digit>, etc.
=item Standard Modules
AnyDBM_File, AutoLoader, AutoSplit, Benchmark, CPAN, CPAN::FirstTime,
-CPAN::Nox, Carp, Class::Template, Config, Cwd, DB_File, Devel::SelfStubber,
+CPAN::Nox, Carp, Class::Struct, Config, Cwd, DB_File, Devel::SelfStubber,
DirHandle, DynaLoader, English, Env, Exporter, ExtUtils::Embed,
ExtUtils::Install, ExtUtils::Liblist, ExtUtils::MM_OS2, ExtUtils::MM_Unix,
ExtUtils::MM_VMS, ExtUtils::MakeMaker, ExtUtils::Manifest,
=over
-=item Class::Template
+=item Class::Struct
=item Data Members as Variables
=item DESCRIPTION
-=head2 Class::Template - struct/member template builder
+=head2 Class::Struct - declare struct-like datatypes as Perl classes
=item SYNOPSIS
=item DESCRIPTION
+=over
+
+=item The C<struct()> function
+
+=item Element Types and Accessor Methods
+
+Scalar (C<'$'> or C<'*$'>), Array (C<'@'> or C<'*@'>), Hash (C<'%'> or
+C<'*%'>), Class (C<'Class_Name'> or C<'*Class_Name'>)
+
+=back
+
=item EXAMPLES
Example 1, Example 2
-=item NOTES
+=item Author and Modification History
=head2 Config - access Perl configuration information
=item METHODS
-$fh->getline, $fh->getlines, $fh->fdopen ( FD, MODE ), $fh->write ( BUF,
-LEN [, OFFSET }\] ), $fh->opened, $fh->untaint
+$fh->fdopen ( FD, MODE ), $fh->opened, $fh->getline, $fh->getlines,
+$fh->ungetc ( ORD ), $fh->write ( BUF, LEN [, OFFSET }\] ), $fh->flush,
+$fh->error, $fh->clearerr, $fh->untaint
=item NOTE
=item METHODS
-$fh->getline, $fh->getlines, $fh->fdopen ( FD, MODE ), $fh->write ( BUF,
-LEN [, OFFSET }\] ), $fh->opened, $fh->untaint
+$fh->fdopen ( FD, MODE ), $fh->opened, $fh->getline, $fh->getlines,
+$fh->ungetc ( ORD ), $fh->write ( BUF, LEN [, OFFSET }\] ), $fh->flush,
+$fh->error, $fh->clearerr, $fh->untaint
=item NOTE
Perl programmers have responded to this by creating several different
class construction classes. These metaclasses are classes
that create other classes. A couple worth looking at are
-Class::Template and Alias. These and other related metaclasses can be
+Class::Struct and Alias. These and other related metaclasses can be
found in the modules directory on CPAN.
-=head2 Class::Template
+=head2 Class::Struct
-One of the older ones is Class::Template. In fact, its syntax and
+One of the older ones is Class::Struct. In fact, its syntax and
interface were sketched out long before perl5 even solidified into a
real thing. What it does is provide you a way to "declare" a class
as having objects whose fields are of a specific type. The function
create a class to provide a record-like data object, you yourself have
to define a new() method, plus separate data-access methods for each of
that record's fields. You'll quickly become bored with this process.
-The Class::Template::struct() function alleviates this tedium.
+The Class::Struct::struct() function alleviates this tedium.
Here's a simple example of using it:
- use Class::Template qw(struct);
+ use Class::Struct qw(struct);
use Jobbie; # user-defined; see below
struct 'Fred' => {
printf "perl.com's real name is %s, address %s\n",
$h->name, inet_ntoa($h->addr);
-Here's how to do this using the Class::Template module.
+Here's how to do this using the Class::Struct module.
The crux is going to be this call:
struct 'Net::hostent' => [ # note bracket
addr_list => '@',
};
-and then Class::Template would have used an anonymous hash as the object
+and then Class::Struct would have used an anonymous hash as the object
type, instead of an anonymous array. The array is faster and smaller,
but the hash works out better if you eventually want to do inheritance.
Since for this struct-like object we aren't planning on inheritance,
BEGIN {
use Exporter ();
- use vars qw(@ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
- @ISA = qw(Exporter);
+ use vars qw(@EXPORT @EXPORT_OK %EXPORT_TAGS);
@EXPORT = qw(gethostbyname gethostbyaddr gethost);
@EXPORT_OK = qw(
$h_name @h_aliases
}
use vars @EXPORT_OK;
- use Class::Template qw(struct);
+ # Class::Struct forbids use of @ISA
+ sub import { goto &Exporter::import }
+
+ use Class::Struct qw(struct);
struct 'Net::hostent' => [
name => '$',
aliases => '@',
sub populate (@) {
return unless @_;
- my $hob = new(); # Class::Template made this!
+ my $hob = new(); # Class::Struct made this!
$h_name = $hob->[0] = $_[0];
@h_aliases = @{ $hob->[1] } = split ' ', $_[1];
$h_addrtype = $hob->[2] = $_[2];
We've snuck in quite a fair bit of other concepts besides just dynamic
class creation, like overriding core functions, import/export bits,
-function prototyping, and short-cut function call via C<&whatever>.
-These all mostly make sense from the perspective of a traditional module,
-but as you can see, we can also use them in an object module.
+function prototyping, short-cut function call via C<&whatever>, and
+function replacement with C<goto &whatever>. These all mostly make
+sense from the perspective of a traditional module, but as you can see,
+we can also use them in an object module.
You can look at other object-based, struct-like overrides of core
functions in the 5.004 release of Perl in File::stat, Net::hostent,
as with any other local().
It would be nice to combine Alias with
-something like Class::Template or Class::MethodMaker.
+something like Class::Struct or Class::MethodMaker.
=head2 NOTES
$< = $>; # set real to effective uid
($<,$>) = ($>,$<); # swap real and effective uid
-(Mnemonic: it's the uid you went I<TO>, if you're running setuid.) Note:
-"C<$E<lt>>" and "C<$E<gt>>" can be swapped on only machines supporting setreuid().
+(Mnemonic: it's the uid you went I<TO>, if you're running setuid.)
+Note: "C<$E<lt>>" and "C<$E<gt>>" can be swapped only on machines
+supporting setreuid().
=item $REAL_GROUP_ID
membership in multiple groups simultaneously, gives a space separated
list of groups you are in. The first number is the one returned by
getgid(), and the subsequent ones by getgroups(), one of which may be
-the same as the first number. (Mnemonic: parentheses are used to I<GROUP>
-things. The real gid is the group you I<LEFT>, if you're running setgid.)
+the same as the first number.
+
+However, a value assigned to "C<$(>" must be a single number used to
+set the real gid. So the value given by "C<$(>" should I<not> be assigned
+back to "C<$(>" without being forced numeric, such as by adding zero.
+
+(Mnemonic: parentheses are used to I<GROUP> things. The real gid is the
+group you I<LEFT>, if you're running setgid.)
=item $EFFECTIVE_GROUP_ID
supports membership in multiple groups simultaneously, gives a space
separated list of groups you are in. The first number is the one
returned by getegid(), and the subsequent ones by getgroups(), one of
-which may be the same as the first number. (Mnemonic: parentheses are
-used to I<GROUP> things. The effective gid is the group that's I<RIGHT> for
-you, if you're running setgid.)
+which may be the same as the first number.
+
+Similarly, a value assigned to "C<$)>" must also be a space-separated
+list of numbers. The first number is used to set the effective gid, and
+the rest (if any) are passed to setgroups(). To get the effect of an
+empty list for setgroups(), just repeat the new effective gid; that is,
+to force an effective gid of 5 and an effectively empty setgroups()
+list, say C< $) = "5 5" >.
+
+(Mnemonic: parentheses are used to I<GROUP> things. The effective gid
+is the group that's I<RIGHT> for you, if you're running setgid.)
Note: "C<$E<lt>>", "C<$E<gt>>", "C<$(>" and "C<$)>" can be set only on
machines that support the corresponding I<set[re][ug]id()> routine. "C<$(>"
-and "C<$)>" can be swapped on only machines supporting setregid(). Because
-Perl doesn't currently use initgroups(), you can't set your group vector to
-multiple groups.
+and "C<$)>" can be swapped only on machines supporting setregid().
=item $PROGRAM_NAME
TAINT_PROPER("mkdir");
#ifdef HAS_MKDIR
- SETi( mkdir(tmps, mode) >= 0 );
+ SETi( Mkdir(tmps, mode) >= 0 );
#else
SETi( dooneliner("mkdir", tmps) );
oldumask = umask(0);
while (*d == ' ' || *d == '\t') d++;
if (*d++ == '-') {
- while (d = moreswitches(d)) ;
+ do {
+ if (*d == 'M' || *d == 'm') {
+ char *m = d;
+ while (*d && !isSPACE(*d)) d++;
+ croak("Too late for \"-%.*s\" option",
+ (int)(d - m), m);
+ }
+ d = moreswitches(d);
+ } while (d);
if (perldb && !oldpdb ||
( minus_n || minus_p ) && !(oldn || oldp) )
/* if we have already added "LINE: while (<>) {",
#define Stat(fname,bufptr) stat((fname),(bufptr))
#define Fstat(fd,bufptr) fstat((fd),(bufptr))
#define Fflush(fp) fflush(fp)
+#define Mkdir(path,mode) mkdir((path),(mode))
#ifdef PERL_SCO5
# define PERL_SYS_INIT(c,v) fpsetmask(0)
} /* end of kill_file() */
/*}}}*/
+
+/*{{{int my_mkdir(char *,mode_t)*/
+int
+my_mkdir(char *dir, mode_t mode)
+{
+ STRLEN dirlen = strlen(dir);
+
+ /* CRTL mkdir() doesn't tolerate trailing /, since that implies
+ * null file name/type. However, it's commonplace under Unix,
+ * so we'll allow it for a gain in portability.
+ */
+ if (dir[dirlen-1] == '/') {
+ char *newdir = savepvn(dir,dirlen-1);
+ int ret = mkdir(newdir,mode);
+ Safefree(newdir);
+ return ret;
+ }
+ else return mkdir(dir,mode);
+} /* end of my_mkdir */
+/*}}}*/
+
+
static void
create_mbx(unsigned short int *chan, struct dsc$descriptor_s *namdsc)
{
# define my_gconvert Perl_my_gconvert
# define do_rmdir Perl_do_rmdir
# define kill_file Perl_kill_file
+# define my_mkdir Perl_my_mkdir
# define my_utime Perl_my_utime
# define rmsexpand Perl_rmsexpand
# define rmsexpand_ts Perl_rmsexpand_ts
#define BIT_BUCKET "_NLA0:"
#define PERL_SYS_INIT(c,v) getredirection((c),(v))
#define PERL_SYS_TERM()
-#define dXSUB_SYS int dummy
+#define dXSUB_SYS
#define HAS_KILL
#define HAS_WAIT
/* Ditto for sys$hash_passwrod() . . . */
#define crypt my_crypt
+/* Tweak arg to mkdir first, so we can tolerate trailing /. */
+#define Mkdir(dir,mode) my_mkdir((dir),(mode))
+
/* Use our own stat() clones, which handle Unix-style directory names */
#define Stat(name,bufptr) flex_stat(name,bufptr)
#define Fstat(fd,bufptr) flex_fstat(fd,bufptr)
char * my_gconvert _((double, int, int, char *));
int do_rmdir _((char *));
int kill_file _((char *));
+int my_mkdir _((char *, mode_t));
int my_utime _((char *, struct utimbuf *));
char * rmsexpand _((char *, char *, char *, unsigned));
char * rmsexpand_ts _((char *, char *, char *, unsigned));