! t/op/grent.t t/op/pwent.t
____________________________________________________________________________
[ 6049] By: jhi on 2000/05/02 19:06:02
- Log: Test both the scalar and array contexts.
+ Log: Test both the scalar and list contexts.
Branch: cfgperl
! t/op/grent.t t/op/pwent.t
____________________________________________________________________________
From: Chip Salzenberg
Files: pp_hot.c
- Title: "Fix grep() with refs in array context"
+ Title: "Fix grep() with refs in list context"
From: Chip Salzenberg
Files: pp.c
localtime) supply adequate information to determine the
year well beyond 2000 (2038 is when trouble strikes for
32-bit machines). The year returned by these functions
- when used in an array context is the year minus 1900. For
+ when used in a list context is the year minus 1900. For
years between 1910 and 1999 this happens to be a 2-digit
decimal number. To avoid the year 2000 problem simply do
not treat the year as a 2-digit number. It isn't.
L<perlcall>.
=for apidoc AmU||G_ARRAY
-Used to indicate array context. See C<GIMME_V>, C<GIMME> and
+Used to indicate list context. See C<GIMME_V>, C<GIMME> and
L<perlcall>.
=for apidoc AmU||G_VOID
?PATTERN? One-time pattern match.
@ARGV Command line arguments (not including the command name - see $0).
@INC List of places to look for perl scripts during do/include/use.
-@_ Parameter array for subroutines. Also used by split unless in array context.
+@_ Parameter array for subroutines. Also used by split unless in list context.
\\ Creates reference to what follows, like \$var, or quotes non-\w in strings.
\\0 Octal char, e.g. \\033.
\\E Case modification terminator. See \\Q, \\L, and \\U.
}
pp_range is a LOGOP.
-In array context, it just returns op_next.
+In list context, it just returns op_next.
In scalar context it checks the truth of targ and returns
op_other if true, op_next if false.
flip is an UNOP.
It "looks after" its child which is always a pp_range LOGOP.
-In array context, it just returns the child's op_other.
+In list context, it just returns the child's op_other.
In scalar context, there are three possible outcomes:
(1) set child's targ to 1, our targ to 1 and return op_next.
(2) set child's targ to 1, our targ to 0, sp-- and return child's op_other.
Returns the stringified form of the values stored in the object (preserving
the order in which they were supplied to C<new>), subject to the
-configuration options below. In an array context, it returns a list
+configuration options below. In a list context, it returns a list
of strings corresponding to the supplied values.
The second form, for convenience, simply calls the C<new> method on its
Expects a anonymous hash of name => value pairs. Same rules apply for names
as in C<new>. If no argument is supplied, will return the "seen" list of
-name => value pairs, in an array context. Otherwise, returns the object
+name => value pairs, in a list context. Otherwise, returns the object
itself.
=item I<$OBJ>->Values(I<[ARRAYREF]>)
Returns the stringified form of the values in the list, subject to the
configuration options below. The values will be named C<$VAR>I<n> in the
output, where I<n> is a numeric suffix. Will return a list of strings
-in an array context.
+in a list context.
=back
=item $io->getline
This works like <$io> 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.
+except that it's more readable and can be safely called in a
+list context but still returns just one line.
=item $io->getlines
-This works like <$io> when called in an array context to
-read all the remaining lines in a file, except that it's more readable.
+This works like <$io> when called in a list 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.
=item $io->ungetc ( ORD )
new object will be created in the same class as the listen socket, unless
C<PKG> is specified. This object can be used to communicate with the client
that was trying to connect. In a scalar context the new socket is returned,
-or undef upon failure. In an array context a two-element array is returned
+or undef upon failure. In a list context a two-element array is returned
containing the new socket and the peer address; the list will
be empty upon failure.
=item sockaddr_in SOCKADDR_IN
-In an array context, unpacks its SOCKADDR_IN argument and returns an array
+In a list context, unpacks its SOCKADDR_IN argument and returns an array
consisting of (PORT, ADDRESS). In a scalar context, packs its (PORT,
ADDRESS) arguments as a SOCKADDR_IN and returns it. If this is confusing,
use pack_sockaddr_in() and unpack_sockaddr_in() explicitly.
=item sockaddr_un SOCKADDR_UN
-In an array context, unpacks its SOCKADDR_UN argument and returns an array
+In a list context, unpacks its SOCKADDR_UN argument and returns an array
consisting of (PATHNAME). In a scalar context, packs its PATHNAME
arguments as a SOCKADDR_UN and returns it. If this is confusing, use
pack_sockaddr_un() and unpack_sockaddr_un() explicitly.
parameters' values. The Vars() method does this. Called in a scalar
context, it returns the parameter list as a tied hash reference.
Changing a key changes the value of the parameter in the underlying
-CGI parameter list. Called in an array context, it returns the
+CGI parameter list. Called in a list context, it returns the
parameter list as an ordinary hash. This allows you to read the
contents of the parameter list, but not to change it.
When using this, the thing you must watch out for are multivalued CGI
parameters. Because a hash cannot distinguish between scalar and
-array context, multivalued parameters will be returned as a packed
+list context, multivalued parameters will be returned as a packed
string, separated by the "\0" (null) character. You must split this
packed string in order to get at the individual values. This is the
convention introduced long ago by Steve Brenner in his cgi-lib.pl
$value = $c->value;
@new_value = $c->value(['a','b','c','d']);
-B<value()> is context sensitive. In an array context it will return
+B<value()> is context sensitive. In a list context it will return
the current value of the cookie as an array. In a scalar context it
will return the B<first> value of a multivalued cookie.
sub tmpfile {
- # Simply call tmpnam() in an array context
+ # Simply call tmpnam() in a list context
my ($fh, $file) = tmpnam();
# Make sure file is removed when filehandle is closed
=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.
+except that it's more readable and can be safely called in a
+list context but still returns just one line.
=item $fh->getlines
-This works like <$fh> when called in an array context to
+This works like <$fh> when called in a list 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.
vec Binary test or set particular bits in a string
wait Process wait for any child process to die
waitpid Process wait for a particular child process to die
-wantarray Misc,Flow get list vs array context of current subroutine call
+wantarray Misc,Flow get void vs scalar vs list context of current subroutine call
warn I/O print debugging info
write I/O print a picture record
y/// String transliterate a string
my $position = $pod_para->file_line();
Returns the current filename and line number for the paragraph
-object. If called in an array context, it returns a list of two
+object. If called in a list context, it returns a list of two
elements: first the filename, then the line number. If called in
a scalar context, it returns a string containing the filename, followed
by a colon (':'), followed by the line number.
my $position = $pod_seq->file_line();
Returns the current filename and line number for the interior sequence
-object. If called in an array context, it returns a list of two
+object. If called in a list context, it returns a list of two
elements: first the filename, then the line number. If called in
a scalar context, it returns a string containing the filename, followed
by a colon (':'), followed by the line number.
is popped from the stack. The array will be empty if no
lists are active.
-Returns array of list information in array context
+Returns array of list information in list context
Returns array ref in scalar context
=cut
can be assigned to C<$soundex_nocode>.
In scalar context C<soundex> returns the soundex code of its first
-argument, and in array context a list is returned in which each element is the
+argument, and in list context a list is returned in which each element is the
soundex code for the corresponding argument passed to C<soundex> e.g.
@codes = soundex qw(Mike Stok);
B<V> [I<pkg> [I<vars>]] List some (default all) variables in package (default current).
Use B<~>I<pattern> and B<!>I<pattern> for positive and negative regexps.
B<X> [I<vars>] Same as \"B<V> I<currentpackage> [I<vars>]\".
-B<x> I<expr> Evals expression in array context, dumps the result.
-B<m> I<expr> Evals expression in array context, prints methods callable
+B<x> I<expr> Evals expression in list context, dumps the result.
+B<m> I<expr> Evals expression in list context, prints methods callable
on the first element of the result.
B<m> I<class> Prints methods callable via the given class.
B<|>[B<|>]I<db_cmd> Send output to pager B<$psh>\[B<$psh>\] I<syscmd> Run cmd in a subprocess
B<q> or B<^D> Quit B<R> Attempt a restart
I<Data Examination:> B<expr> Execute perl code, also see: B<s>,B<n>,B<t> I<expr>
- B<x>|B<m> I<expr> Evals expr in array context, dumps the result or lists methods.
+ B<x>|B<m> I<expr> Evals expr in list context, dumps the result or lists methods.
B<p> I<expr> Print expression (uses script's current package).
B<S> [[B<!>]I<pat>] List subroutine names [not] matching pattern
B<V> [I<Pk> [I<Vars>]] List Variables in Package. Vars can be ~pattern or !pattern.
/*
=for apidoc Amn|U32|GIMME_V
The XSUB-writer's equivalent to Perl's C<wantarray>. Returns C<G_VOID>,
-C<G_SCALAR> or C<G_ARRAY> for void, scalar or array context,
+C<G_SCALAR> or C<G_ARRAY> for void, scalar or list context,
respectively.
=for apidoc Amn|U32|GIMME
# trans not OK (dTARG; TARG = sv_newmortal();)
# ucfirst etc not OK: TMP arg processed inplace
# quotemeta not OK (unsafe when TARG == arg)
-# each repeat not OK too due to array context
+# each repeat not OK too due to list context
# pack split - unknown whether they are safe
# sprintf: is calling do_sprintf(TARG,...) which can act on TARG
# before other args are processed.
((CPerlObj*)pPerl)->Perl_gv_efullname3(sv, gv, prefix);
}
+#undef Perl_gv_efullname4
+void
+Perl_gv_efullname4(pTHXo_ SV* sv, GV* gv, const char* prefix, bool keepmain)
+{
+ ((CPerlObj*)pPerl)->Perl_gv_efullname4(sv, gv, prefix, keepmain);
+}
+
#undef Perl_gv_fetchfile
GV*
Perl_gv_fetchfile(pTHXo_ const char* name)
((CPerlObj*)pPerl)->Perl_gv_fullname3(sv, gv, prefix);
}
+#undef Perl_gv_fullname4
+void
+Perl_gv_fullname4(pTHXo_ SV* sv, GV* gv, const char* prefix, bool keepmain)
+{
+ ((CPerlObj*)pPerl)->Perl_gv_fullname4(sv, gv, prefix, keepmain);
+}
+
#undef Perl_gv_init
void
Perl_gv_init(pTHXo_ GV* gv, HV* stash, const char* name, STRLEN len, int multi)
=item SvLEN
-Returns the size of the string buffer in the SV. See C<SvCUR>.
+Returns the size of the string buffer in the SV, not including any part
+attributable to C<SvOOK>. See C<SvCUR>.
STRLEN SvLEN(SV* sv)
FILEHANDLE,FUNCTION,SCALAR, join EXPR,LIST, keys HASH, kill SIGNAL, LIST,
last LABEL, last, lc EXPR, lc, lcfirst EXPR, lcfirst, length EXPR, length,
link OLDFILE,NEWFILE, listen SOCKET,QUEUESIZE, local EXPR, localtime EXPR,
-lock, log EXPR, log, lstat FILEHANDLE, lstat EXPR, lstat, m//, map BLOCK
-LIST, map EXPR,LIST, mkdir FILENAME,MASK, mkdir FILENAME, msgctl
-ID,CMD,ARG, msgget KEY,FLAGS, msgrcv ID,VAR,SIZE,TYPE,FLAGS, msgsnd
-ID,MSG,FLAGS, my EXPR, my EXPR : ATTRIBUTES, next LABEL, next, no Module
-LIST, oct EXPR, oct, open FILEHANDLE,MODE,LIST, open FILEHANDLE,EXPR, open
-FILEHANDLE, opendir DIRHANDLE,EXPR, ord EXPR, ord, our EXPR, pack
-TEMPLATE,LIST, package, package NAMESPACE, pipe READHANDLE,WRITEHANDLE, pop
-ARRAY, pop, pos SCALAR, pos, print FILEHANDLE LIST, print LIST, print,
-printf FILEHANDLE FORMAT, LIST, printf FORMAT, LIST, prototype FUNCTION,
-push ARRAY,LIST, q/STRING/, qq/STRING/, qr/STRING/, qx/STRING/, qw/STRING/,
-quotemeta EXPR, quotemeta, rand EXPR, rand, read
-FILEHANDLE,SCALAR,LENGTH,OFFSET, read FILEHANDLE,SCALAR,LENGTH, readdir
-DIRHANDLE, readline EXPR, readlink EXPR, readlink, readpipe EXPR, recv
-SOCKET,SCALAR,LENGTH,FLAGS, redo LABEL, redo, ref EXPR, ref, rename
-OLDNAME,NEWNAME, require VERSION, require EXPR, require, reset EXPR, reset,
-return EXPR, return, reverse LIST, rewinddir DIRHANDLE, rindex
-STR,SUBSTR,POSITION, rindex STR,SUBSTR, rmdir FILENAME, rmdir, s///, scalar
-EXPR, seek FILEHANDLE,POSITION,WHENCE, seekdir DIRHANDLE,POS, select
-FILEHANDLE, select, select RBITS,WBITS,EBITS,TIMEOUT, semctl
-ID,SEMNUM,CMD,ARG, semget KEY,NSEMS,FLAGS, semop KEY,OPSTRING, send
+lock, log EXPR, log, lstat EXPR, lstat, m//, map BLOCK LIST, map EXPR,LIST,
+mkdir FILENAME,MASK, mkdir FILENAME, msgctl ID,CMD,ARG, msgget KEY,FLAGS,
+msgrcv ID,VAR,SIZE,TYPE,FLAGS, msgsnd ID,MSG,FLAGS, my EXPR, my EXPR :
+ATTRIBUTES, next LABEL, next, no Module LIST, oct EXPR, oct, open
+FILEHANDLE,MODE,LIST, open FILEHANDLE,EXPR, open FILEHANDLE, opendir
+DIRHANDLE,EXPR, ord EXPR, ord, our EXPR, pack TEMPLATE,LIST, package,
+package NAMESPACE, pipe READHANDLE,WRITEHANDLE, pop ARRAY, pop, pos SCALAR,
+pos, print FILEHANDLE LIST, print LIST, print, printf FILEHANDLE FORMAT,
+LIST, printf FORMAT, LIST, prototype FUNCTION, push ARRAY,LIST, q/STRING/,
+qq/STRING/, qr/STRING/, qx/STRING/, qw/STRING/, quotemeta EXPR, quotemeta,
+rand EXPR, rand, read FILEHANDLE,SCALAR,LENGTH,OFFSET, read
+FILEHANDLE,SCALAR,LENGTH, readdir DIRHANDLE, readline EXPR, readlink EXPR,
+readlink, readpipe EXPR, recv SOCKET,SCALAR,LENGTH,FLAGS, redo LABEL, redo,
+ref EXPR, ref, rename OLDNAME,NEWNAME, require VERSION, require EXPR,
+require, reset EXPR, reset, return EXPR, return, reverse LIST, rewinddir
+DIRHANDLE, rindex STR,SUBSTR,POSITION, rindex STR,SUBSTR, rmdir FILENAME,
+rmdir, s///, scalar EXPR, seek FILEHANDLE,POSITION,WHENCE, seekdir
+DIRHANDLE,POS, select FILEHANDLE, select, select RBITS,WBITS,EBITS,TIMEOUT,
+semctl ID,SEMNUM,CMD,ARG, semget KEY,NSEMS,FLAGS, semop KEY,OPSTRING, send
SOCKET,MSG,FLAGS,TO, send SOCKET,MSG,FLAGS, setpgrp PID,PGRP, setpriority
WHICH,WHO,PRIORITY, setsockopt SOCKET,LEVEL,OPTNAME,OPTVAL, shift ARRAY,
shift, shmctl ID,CMD,ARG, shmget KEY,SIZE,FLAGS, shmread ID,VAR,POS,SIZE,
=item Command Switches
-B<-0>[I<digits>], B<-a>, B<-C>, B<-c>, B<-d>, B<-d:>I<foo>,
+B<-0>[I<digits>], B<-a>, B<-C>, B<-c>, B<-d>, B<-d:>I<foo[=bar,baz]>,
B<-D>I<letters>, B<-D>I<number>, B<-e> I<commandline>, B<-F>I<pattern>,
B<-h>, B<-i>[I<extension>], B<-I>I<directory>, B<-l>[I<octnum>],
B<-m>[B<->]I<module>, B<-M>[B<->]I<module>, B<-M>[B<->]I<'module ...'>,
=over
+=item Formatted Printing of IVs and UVs
+
=item Source Documentation
=back
print "not " if @r != $r;
print "ok 4\n";
-# check if array context works
+# check if list context works
@r = ();
for (<*/a*.t>) {
print "# $_\n";
print "# TMPNAM file name: $tmpnam\n";
-# TMPNAM array context
+# TMPNAM list context
# Not strict posix behaviour
(my $fh, $tmpnam) = tmpnam();
-print "# TMPNAM: in array context: $fh $tmpnam\n";
+print "# TMPNAM: in list context: $fh $tmpnam\n";
# File is opened - make sure it exists
ok( (-e $tmpnam ));
print "not " if @r != $r;
print "ok 5\n";
-# check if array context works
+# check if list context works
@r = ();
for (<*/*.t>) {
#print "# $_\n";
print "\t# (not necessarily serious: run t/op/grent.t by itself)" if $not;
print "\n";
-# Test both the scalar and array contexts.
+# Test both the scalar and list contexts.
my @gr1;
print "\t# (not necessarily serious: run t/op/pwent.t by itself)" if $not;
print "\n";
-# Test both the scalar and array contexts.
+# Test both the scalar and list contexts.
my @pw1;
If called in a scalar context, C<getsym> returns the value of the symbol whose
name is given as the argument to the call, or C<undef> if no such symbol
exists. Symbols in the local symbol table are always used in preference to
-symbols in the global symbol table. If called in an array context, C<getsym>
+symbols in the global symbol table. If called in a list context, C<getsym>
returns a two-element list, whose first element is the value of the symbol, and
whose second element is the string 'GLOBAL' or 'LOCAL', indicating the table
from which the symbol's value was read.