[12186] in Perl-Users-Digest
Perl-Users Digest, Issue: 5786 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed May 26 10:07:24 1999
Date: Wed, 26 May 99 07:00:22 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Wed, 26 May 1999 Volume: 8 Number: 5786
Today's topics:
Re: ...SOLVED, but questions (LONG) <droby@copyright.com>
Re: [perlfunc][perldata] access to data structures (Larry Rosler)
ANNOUNCE: perl5.005_57 released! <tchrist@mox.perl.com>
Re: Calling a Perl script (Randal L. Schwartz)
Re: CC with smtp MODULE <jdporter@min.net>
Re: Get spaces off. <tchrist@mox.perl.com>
gettin a "file" argument in perl <olivier.maas@at-lci.com>
Re: How would you rewrite this piece of code? <pheuvel@optusnet.com.au>
Re: In favor of extending "my" to apply to subroutines <tchrist@mox.perl.com>
Re: More Oraperl pain <jhecker@iago.nac.net>
Newbie question <dude@hotmail.com>
Re: Newbie question <kensai@nortel.com>
Re: Newbie question <jdporter@min.net>
Password Protect <ex5316@netvigator.com>
Re: Password Protect <tchrist@mox.perl.com>
Re: Password Protect <daniel.vesma@thewebtree.com>
Re: Perl equivalent of c++ "struct" <tchrist@mox.perl.com>
Re: Perl equivalent of c++ "struct" <jhi@alpha.hut.fi>
Re: Perl equivalent of c++ "struct" (Larry Rosler)
Perl module for processing dates? lamj@softhome.net
Re: Perl on Win32 - How can I hide the process? <jwilson@ic.ac.uk>
perl script updating 2 frames? <olivier.maas@at-lci.com>
Simple com port access <tec@mountain.net>
Re: Split behaviour <tchrist@mox.perl.com>
Re: strange core dumping ARGV behaviour <this.is@not.my.address.ok>
Re: tool to trace #include statements in C/C++ <tchrist@mox.perl.com>
Re: why doesn't my first program work?? (ok , third or <tchrist@mox.perl.com>
Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 26 May 1999 12:57:43 GMT
From: Don Roby <droby@copyright.com>
Subject: Re: ...SOLVED, but questions (LONG)
Message-Id: <7igr46$mhu$1@nnrp1.deja.com>
In article <7ieqgu$1ni$1@shell13.ba.best.com>,
danielp@best.com (Daniel Parish) wrote:
<snip>
>
> Question: What are the potential pitfalls of using symbolic references
> to hashes?
>
For a really convincing argument to avoid symbolic references,
see the article http://www.plover.com/~mjd/perl/varvarname.html by
Mark-Jason Dominus.
> In my opinion the original script is easier to read and does
> what it is supposed to in a logical manner, while the 'corrected'
script
> seems to add an unneccessary level of convolution just for the sake of
> formalism. Am I missing something obvious here?
>
Actually, it's not adding any convolution. Soft references are just
hash lookups in the symbol table. And it's not for formalism, it's for
safety. And (IMHO), constructing and using your own hash instead of
using soft references makes the logic of a program much easier to
follow, rather than complicating it. Those double dollars are easy to
miss in a quick visual scan of a program.
--
Don Roby
--== Sent via Deja.com http://www.deja.com/ ==--
---Share what you know. Learn what you don't.---
------------------------------
Date: Wed, 26 May 1999 06:34:37 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: [perlfunc][perldata] access to data structures
Message-Id: <MPG.11b59836327b2726989afd@nntp.hpl.hp.com>
In article <x7wvxwe111.fsf@home.sysarch.com> on 26 May 1999 03:35:38 -
0400, Uri Guttman <uri@sysarch.com> says...
> >>>>> "DC" == Dave Cross <dave@dave.org.uk> writes:
> DC> On Tue, 25 May 1999 22:48:20 PDT, teqqus@asdf.engr.sgi.com wrote:
> >> so i have something like
> >> $a = "a b c d e f";
> >> and i want to access the start and end elements
>
> DC> my ($start, $end) = (split(/ /, $a))[0, -1];
>
> or why not use a different op:
>
> my ($start, $end) = ( substr($a, 0, 2), substr($a, -1) )
^
my ($start, $end) = ( substr($a, 0, 1), substr($a, -1) )
--
(Just Another Larry) Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: 26 May 1999 06:34:08 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: ANNOUNCE: perl5.005_57 released!
Message-Id: <374bea40@cs.colorado.edu>
On the road to this years major release of perl, the "five six" (5.006)
release, which is itself expected later this summer, several milestone
alpha-like releases must first be crossed. 5.005_57 is the latest of
these. This is a developer release, so is considered wholly experimental;
the usual caveats about its being for the brave or foolish continue
to apply. If you install this, make sure to read the INSTALL and README
files first.
But even if you won't care to be on the cutting edge, you might care
to pick this release up for the documentation alone. I've just spent a
couple weeks extending, correcting, clarifying, and wordsmithing about
80% of the standard docset.
http://www.perl.com/CPAN-local/src/ contains what you want.
Here are the release notes.
--tom
NAME
perldelta - what's new for perl5.006 (as of 5.005_57)
DESCRIPTION
This document describes differences between the 5.005 release
and this one.
Incompatible Changes
Perl Source Incompatibilities
None known at this time.
C Source Incompatibilities
`PERL_POLLUTE'
Release 5.005 grandfathered old global symbol names by
providing preprocessor macros for extension source
compatibility. As of release 5.006, these preprocessor
definitions are not available by default. You need to
explicitly compile perl with `-DPERL_POLLUTE' to get these
definitions. For extensions still using the old symbols,
this option can be specified via MakeMaker:
perl Makefile.PL POLLUTE=1
`PERL_POLLUTE_MALLOC'
Enabling Perl's malloc in release 5.005 and earlier caused
the namespace of system versions of the malloc family of
functions to be usurped by the Perl versions, since by
default they used the same names.
Besides causing problems on platforms that do not allow
these functions to be cleanly replaced, this also meant that
the system versions could not be called in programs that
used Perl's malloc. Previous versions of Perl have allowed
this behaviour to be suppressed with the HIDEMYMALLOC and
EMBEDMYMALLOC preprocessor definitions.
As of release 5.006, Perl's malloc family of functions have
default names distinct from the system versions. You need to
explicitly compile perl with `-DPERL_POLLUTE_MALLOC' to get
the older behaviour. HIDEMYMALLOC and EMBEDMYMALLOC have no
effect, since the behaviour they enabled is now the default.
Note that these functions do not constitute Perl's memory
allocation API. See the section on "Memory Allocation" in
the perlguts manpage for further information about that.
`PL_na' and `dTHR' Issues
The `PL_na' global is now thread local, so a `dTHR'
declaration is needed in the scope in which the global
appears. XSUBs should handle this automatically, but if you
have used `PL_na' in support functions, you either need to
change the `PL_na' to a local variable (which is
recommended), or put in a `dTHR'.
Compatible C Source API Changes
`PATCHLEVEL' is now `PERL_VERSION'
The cpp macros `PERL_REVISION', `PERL_VERSION', and
`PERL_SUBVERSION' are now available by default from perl.h,
and reflect the base revision, patchlevel, and subversion
respectively. `PERL_REVISION' had no prior equivalent, while
`PERL_VERSION' and `PERL_SUBVERSION' were previously
available as `PATCHLEVEL' and `SUBVERSION'.
The new names cause less pollution of the cpp namespace and
reflect what the numbers have come to stand for in common
practice. For compatibility, the old names are still
supported when patchlevel.h is explicitly included (as
required before), so there is no source incompatibility from
the change.
Binary Incompatibilities
This release is not binary compatible with the 5.005 release or
its maintenance versions.
Core Changes
Unicode and UTF-8 support
Perl can optionally use UTF-8 as its internal representation for
character strings. The `use utf8' pragma enables this support in
the current lexical scope. See the utf8 manpage for more
information.
Lexically scoped warning categories
You can now control the granularity of warnings emitted by perl
at a finer level using the `use warning' pragma. See the warning
manpage for details.
Binary numbers supported
Binary numbers are now supported as literals, in s?printf
formats, and `oct()':
$answer = 0b101010;
printf "The answer is: %b\n", oct("0b101010");
syswrite() ease-of-use
The length argument of `syswrite()' is now optional.
64-bit support
Better 64-bit support -- but full support still a distant goal.
One must Configure with -Duse64bits to get Configure to probe
for the extent of 64-bit support. Depending on the platform
(hints file) more or less 64-awareness becomes available. As of
5.005_54 at least somewhat 64-bit aware platforms are HP-UX 11
or better, Solaris 2.6 or better, IRIX 6.2 or better. Naturally
64-bit platforms like Digital Unix and UNICOS also have 64-bit
support.
Better syntax checks on parenthesized unary operators
Expressions such as:
print defined(&foo,&bar,&baz);
print uc("foo","bar","baz");
undef($foo,&bar);
used to be accidentally allowed in earlier versions, and
produced unpredictable behaviour. Some produced ancillary
warnings when used in this way; others silently did the wrong
thing.
The parenthesized forms of most unary operators that expect a
single argument now ensure that they are not called with more
than one argument, making the cases shown above syntax errors.
The usual behaviour of:
print defined &foo, &bar, &baz;
print uc "foo", "bar", "baz";
undef $foo, &bar;
remains unchanged. See the perlop manpage.
Improved `qw//' operator
The `qw//' operator is now evaluated at compile time into a true
list instead of being replaced with a run time call to
`split()'. This removes the confusing misbehaviour of `qw//' in
scalar context, which had inherited that behaviour from split().
Thus:
$foo = ($bar) = qw(a b c); print "$foo|$bar\n";
now correctly prints "3|a", instead of "2|a".
pack() format 'Z' supported
The new format type 'Z' is useful for packing and unpacking
null-terminated strings. See the section on "pack" in the
perlfunc manpage.
pack() format modifier '!' supported
The new format type modifier '!' is useful for packing and
unpacking native shorts, ints, and longs. See the section on
"pack" in the perlfunc manpage.
$^X variables may now have names longer than one character
Formerly, $^X was synonymous with ${"\cX"}, but $^XY was a
syntax error. Now variable names that begin with a control
character may be arbitrarily long. However, for compatibility
reasons, these variables *must* be written with explicit braces,
as `${^XY}' for example. `${^XYZ}' is synonymous with
${"\cXYZ"}. Variable names with more than one control character,
such as `${^XY^Z}', are illegal.
The old syntax has not changed. As before, `^X' may be either a
literal control-X character or the two-character sequence
`caret' plus `X'. When braces are omitted, the variable name
stops after the control character. Thus `"$^XYZ"' continues to
be synonymous with `$^X . "YZ"' as before.
As before, lexical variables may not have names beginning with
control characters. As before, variables whose names begin with
a control character are always forced to be in package `main'.
All such variables are reserved for future extensions, except
those that begin with `^_', which may be used by user programs
and is guaranteed not to acquire special meaning in any future
version of Perl.
Significant bug fixes
<HANDLE> on empty files
With `$/' set to `undef', slurping an empty file returns a
string of zero length (instead of `undef', as it used to) the
first time the HANDLE is read. Further reads yield `undef'.
This means that the following will append "foo" to an empty file
(it used to do nothing):
perl -0777 -pi -e 's/^/foo/' empty_file
The behaviour of:
perl -pi -e 's/^/foo/' empty_file
is unchanged (it continues to leave the file empty).
`eval '...'' improvements
Line numbers (as reflected by caller() and most diagnostics)
within `eval '...'' were often incorrect when here documents
were involved. This has been corrected.
Lexical lookups for variables appearing in `eval '...'' within
functions that were themselves called within an `eval '...''
were searching the wrong place for lexicals. The lexical search
now correctly ends at the subroutine's block boundary.
Parsing of here documents used to be flawed when they appeared
as the replacement expression in `eval 's/.../.../e''. This has
been fixed.
Automatic flushing of output buffers
fork(), exec(), system(), qx//, and pipe open()s now flush
buffers of all files opened for output when the operation was
attempted. This mostly eliminates confusing buffering mishaps
suffered by users unaware of how Perl internally handles I/O.
Supported Platforms
* VM/ESA is now supported.
* Siemens BS2000 is now supported under the POSIX Shell.
* The Mach CThreads (NEXTSTEP, OPENSTEP) are now supported by the
Thread extension.
* GNU/Hurd is now supported.
* Rhapsody is now supported.
New tests
op/io_const
IO constants (SEEK_*, _IO*).
op/io_dir
Directory-related IO methods (new, read, close, rewind, tied
delete).
op/io_multihomed
INET sockets with multi-homed hosts.
op/io_poll
IO poll().
op/io_unix
UNIX sockets.
op/filetest
File test operators.
op/lex_assign
Verify operations that access pad objects (lexicals and
temporaries).
Modules and Pragmata
Modules
Dumpvalue
Added Dumpvalue module provides screen dumps of Perl data.
Benchmark
You can now run tests for *n* seconds instead of guessing
the right number of tests to run: e.g. timethese(-5, ...)
will run each code for at least 5 CPU seconds. Zero as the
"number of repetitions" means "for at least 3 CPU seconds".
The output format has also changed. For example:
use Benchmark;$x=3;timethese(-
5,{a=>sub{$x*$x},b=>sub{$x**2}})
will now output something like this:
Benchmark: running a, b, each for at least 5 CPU seconds...
a: 5 wallclock secs ( 5.77 usr + 0.00 sys = 5.77 CPU) @
200551.91/s (n=1156516) b: 4 wallclock secs ( 5.00 usr +
0.02 sys = 5.02 CPU) @ 159605.18/s (n=800686)
New features: "each for at least N CPU seconds...",
"wallclock secs", and the "@ operations/CPU second
(n=operations)".
Devel::Peek
The Devel::Peek module provides access to the internal
representation of Perl variables and data. It is a data
debugging tool for the XS programmer.
Fcntl
More Fcntl constants added: F_SETLK64, F_SETLKW64,
O_LARGEFILE for large (more than 4G) file access (64-bit
support is not yet working, though, so no need to get overly
excited), Free/Net/OpenBSD locking behaviour flags F_FLOCK,
F_POSIX, Linux F_SHLCK, and O_ACCMODE: the mask of O_RDONLY,
O_WRONLY, and O_RDWR.
File::Spec
New methods have been added to the File::Spec module:
devnull() returns the name of the null device (/dev/null on
Unix) and tmpdir() the name of the temp directory (normally
/tmp on Unix). There are now also methods to convert between
absolute and relative filenames: abs2rel() and rel2abs().
For compatibility with operating systems that specify volume
names in file paths, the splitpath(), splitdir(), and
catdir() methods have been added.
File::Spec::Functions
The new File::Spec::Functions modules provides a function
interface to the File::Spec module. Allows shorthand
$fullname = catfile($dir1, $dir2, $file);
instead of
$fullname = File::Spec->catfile($dir1, $dir2, $file);
Math::BigInt
The logical operations `<<', `>>', `&', `|', and `~' are now
supported on bigints.
Math::Complex
The accessor methods Re, Im, arg, abs, rho, and theta can
now also act as mutators (accessor $z->Re(), mutator $z-
>Re(3)).
Math::Trig
A little bit of radial trigonometry (cylindrical and
spherical), radial coordinate conversions, and the great
circle distance were added.
SDBM_File
An EXISTS method has been added to this module (and
sdbm_exists() has been added to the underlying sdbm
library), so one can now call exists on an SDBM_File tied
hash and get the correct result, rather than a runtime
error.
Time::Local
The timelocal() and timegm() functions used to silently
return bogus results when the date exceeded the machine's
integer range. They now consistently croak() if the date
falls in an unsupported range.
Win32
The error return value in list context has been changed for
all functions that return a list of values. Previously these
functions returned a list with a single element `undef' if
an error occurred. Now these functions return the empty list
in these situations. This applies to the following
functions:
Win32::FsType
Win32::GetOSVersion
The remaining functions are unchanged and continue to return
`undef' on error even in list context.
The Win32::SetLastError(ERROR) function has been added as a
complement to the Win32::GetLastError() function.
The new Win32::GetFullPathName(FILENAME) returns the full
absolute pathname for FILENAME in scalar context. In list
context it returns a two-element list containing the fully
qualified directory name and the filename.
DBM Filters
A new feature called "DBM Filters" has been added to all the
DBM modules--DB_File, GDBM_File, NDBM_File, ODBM_File, and
SDBM_File. DBM Filters add four new methods to each DBM
module:
filter_store_key
filter_store_value
filter_fetch_key
filter_fetch_value
These can be used to filter key-value pairs before the pairs
are written to the database or just after they are read from
the database. See the perldbmfilter manpage for further
information.
Pragmata
`use utf8' to enable UTF-8 and Unicode support.
Lexical warnings pragma, `use warning;', to control optional
warnings.
`use filetest' to control the behaviour of filetests (`-r' `-w'
...). Currently only one subpragma implemented, "use filetest
'access';", that enables the use of access(2) or equivalent to
check permissions instead of using stat(2) as usual. This
matters in filesystems where there are ACLs (access control
lists): the stat(2) might lie, but access(2) knows better.
Utility Changes
Todo.
Documentation Changes
perlopentut.pod
A tutorial on using open() effectively.
perlreftut.pod
A tutorial that introduces the essentials of references.
perltootc.pod
A tutorial on managing class data for object modules.
New Diagnostics
/%s/: Unrecognized escape \\%c passed through
(W) You used a backslash-character combination which is not
recognized by Perl. This combination appears in an interpolated
variable or a `''-delimited regular expression.
Unrecognized escape \\%c passed through
(W) You used a backslash-character combination which is not
recognized by Perl.
Missing command in piped open
(W) You used the `open(FH, "| command")' or `open(FH, "command
|")' construction, but the command was missing or blank.
Obsolete Diagnostics
Todo.
Configuration Changes
You can use "Configure -Uinstallusrbinperl" which causes
installperl to skip installing perl also as /usr/bin/perl. This
is useful if you prefer not to modify /usr/bin for some reason
or another but harmful because many scripts assume to find Perl
in /usr/bin/perl.
BUGS
If you find what you think is a bug, you might check the headers
of articles recently posted to the comp.lang.perl.misc
newsgroup. There may also be information at
http://www.perl.com/perl/, the Perl Home Page.
If you believe you have an unreported bug, please run the
perlbug program included with your release. Make sure to trim
your bug down to a tiny but sufficient test case. Your bug
report, along with the output of `perl -V', will be sent off to
perlbug@perl.com to be analysed by the Perl porting team.
SEE ALSO
The Changes file for exhaustive details on what changed.
The INSTALL file for how to build Perl.
The README file for general stuff.
The Artistic and Copying files for copyright information.
HISTORY
Written by Gurusamy Sarathy <gsar@umich.edu>, with many
contributions from The Perl Porters.
Send omissions or corrections to <perlbug@perl.com>.
--
That means I'll have to use $ans to suppress newlines now.
Life is ridiculous.
--Larry Wall in Configure from the perl distribution
------------------------------
Date: 26 May 1999 05:21:11 -0700
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: Calling a Perl script
Message-Id: <m1hfp0rphk.fsf@halfdome.holdit.com>
>>>>> "MomLucie" == MomLucie <momlucie@aol.com> writes:
MomLucie> Is it possible to call a Perl script from a high level language?
Yes, Perl can call itself, and Perl is a high level language.
Perhaps you didn't ask the question you thought you were asking. :)
--
Name: Randal L. Schwartz / Stonehenge Consulting Services (503)777-0095
Keywords: Perl training, UNIX[tm] consulting, video production, skiing, flying
Email: <merlyn@stonehenge.com> Snail: (Call) PGP-Key: (finger merlyn@teleport.com)
Web: <A HREF="http://www.stonehenge.com/merlyn/">My Home Page!</A>
Quote: "I'm telling you, if I could have five lines in my .sig, I would!" -- me
------------------------------
Date: Wed, 26 May 1999 13:18:20 GMT
From: John Porter <jdporter@min.net>
Subject: Re: CC with smtp MODULE
Message-Id: <7igsaq$net$1@nnrp1.deja.com>
In article <374BDF86.936FE003@mmm.com>,
aamelin@mmm.com (Alexandre Amelin) wrote:
>
> Can Anyone tell me how to make a CC with Net::smtp module.
The lines that you put into the message, via the data() method,
are either header lines or body lines, depending on whether there
has been an empty line added yet. I.e. the lines you add are exactly
as they would appear in the raw smtp message. So you can simply do
this:
$smtp->data(
"To: list@net\n",
"From: myself@work\n",
"Cc: myself@home\n",
"Subject: forecast\n",
"\n",
"Looks like we're in for nasty weather.\n",
);
Notice where the blank line is. The lines before it should be
valid header lines; the lines after it are the body.
One thing to remember is that the mail() and recipient() methods
do not create header lines; they are written on the "envelope",
to be used by the mailing system.
--
John Porter
Put it on a plate, son. You'll enjoy it more.
--== Sent via Deja.com http://www.deja.com/ ==--
---Share what you know. Learn what you don't.---
------------------------------
Date: 26 May 1999 06:48:28 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Get spaces off.
Message-Id: <374bed9c@cs.colorado.edu>
[courtesy cc of this posting mailed to cited author]
Cursed by Forte Free Agent 1.11/32.235, in comp.lang.perl.misc
paul@vdkamer.nl (PaulK) writes:
:Probl. a simple question but, what is the easest way to get the spaces
:of at the end of a string ?
By searching the standard documentation that comes with every
installation of Perl, and mentions this in at least two distinct
places.
Search for "trim" in both the perlop and the perlfaq4 manpage.
Did you even bother to use Alta Vista or Deja News to find out whether
this question had come up lately, like about two days ago?
--tom
--
What about WRITING it first and rationalizing it afterwords? :-)
--Larry Wall in <8162@jpl-devvax.JPL.NASA.GOV>
------------------------------
Date: Wed, 26 May 1999 14:59:39 +0200
From: Olivier Maas <olivier.maas@at-lci.com>
Subject: gettin a "file" argument in perl
Message-Id: <374BF03B.578EFA1B@at-lci.com>
Hello,
I am trying to get a file from a form,
I use the
<INPUT NAME="FichierATraiter" TYPE="FILE" VALUE="">
syntax, but when trying to get this file (or file handle?) to a perl
script for further treatment, but when I use
$FichAT=CGI::param(FichierATraiter);
and try to print $FichAT ... nothing
the same with @FichAT
Any clues, or place to get doc on howto?
thank for any answer...
if you could send a copy of your reply to
maas@ensae.fr, it would be appreciated...
olivier
------------------------------
Date: Wed, 26 May 1999 23:02:12 +1000
From: Pat Heuvel <pheuvel@optusnet.com.au>
Subject: Re: How would you rewrite this piece of code?
Message-Id: <374BF0D4.D1C6EC0C@optusnet.com.au>
Gday Dan,
Dan Melomedman wrote:
>
> Hi. How would you rewrite this peice of code to make it more concise and
> optimized if possible:
>
> foreach $line (@state){
> if ($line =~/interfaces_impacts=/) {
> &split;
> push @interfaces_impacts, $value;
> }elsif ($line =~/documentation_deliverables=/){
> &split;
> push @documentation_deliverables, $value;
> }elsif ($line =~/engineering_controls=/){
> &split;
> push @engineering_controls, $value;
> }elsif ($line =~/safety_controls=/){
> &split;
> push @safety_controls, $value;
> } elsif ($line =~/required_procedures=/){
> &split;
> push @required_procedures, $value;
> }elsif ($line =~/required_testing=/){
> &split;
> push @required_testing, $value;
> }elsif ($line =~/other=/){
> &split;
> push @other, $value;
> }
>
> }
>
> sub split {
> ($variable, $value) = split /=/, $line;
> }
>
> Thanks a lot.
Not really knowing exactly what you're after, would this help any:
foreach $line (@state)
{
($keyword, $keyvalue) = split(/=/, $line, 2);
$allvalues{$keyword} = $keyvalue;
}
...I assume you want all values, this keeps them in an associative array
keyed by their keyword.
HTH
Pat Heuvel
--
+---------------------------------------------------------+
+ "Logic clearly dictates, that the strokes of the many +
+ outweigh the strokes of the two..." +
+ (Apologies to Mr Spock) +
+---------------------------------------------------------+
------------------------------
Date: 26 May 1999 07:06:36 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: In favor of extending "my" to apply to subroutines as well as variables
Message-Id: <374bf1dc@cs.colorado.edu>
[courtesy cc of this posting mailed to cited author]
In comp.lang.perl.misc, elliotsl@mindspring.com writes:
:> Have you read the new perltootc manpage?
:I just read it. As you point out it illustrates a few things that most C++
:programers have always have wanted to do, but couldn't.
Actually, it was meant to show things C++ programmers had never
wanted to do, but could. :-(
Which things were you thinking of?
--tom
--
Sun and MicroSoft and Netscape have the entire Internet by the short curlies. As long as
they throw enough marketing dollars at something, we all have to fall in line, regardless
of anything. So much for "open standards". -- Aaron Watters in <4d0c0d$9fr@mtinsc01-mgt.ops.worldnet.att.net>
------------------------------
Date: Wed, 26 May 1999 12:51:12 GMT
From: Jared Hecker <jhecker@iago.nac.net>
Subject: Re: More Oraperl pain
Message-Id: <47S23.75$m4.348@nntp1>
Thanks, guys, your help allowed me to correct the script.
Regards,
jh
Richard H <rhrh@hotmail.com> wrote:
> Jared Hecker wrote:
> >
> > Hi, all -
> >
> > Given the following snippet of code, I expected to retrieve all records
> > (up to 8 ) in the 'instance_name' and 'password' fields of the table
> > 'sid'. Instead, all I get back is the first record. Can anyone point me
> > to what I am doing wrong?
> >
> > #################
> >
> > eval 'use Oraperl; 1' ||die $@ if $] >= 5;
> > $ENV{TWO_TASK} = 'EMAN';
> > $lda = &ora_login('EMAN','username','password');
> >
> > $csr2 = &ora_open($lda,'select instance_name from sid',8);
> > @sid = &ora_fetch($csr2);
> > &ora_close($csr2);
> >
> > $csr = &ora_open($lda,'select password from sid',8);
> > @pw = &ora_fetch($csr);
> > &ora_close($csr);
> > &ora_logoff($lda);
> >
> Are you sure your use of the fetch method is correct??
> Unless DBI has differed significantly from Oraperl, I would imagine to
> fill up @sid with sids you will have to do a loop around your fetch
> while(&ora_fetch($csr2)) {
> push @sid, newsid;
> }
> most fetch'es ive ever done have to loop
> Richard H
--
Jared Hecker | HWA Inc. - Oracle architecture and Administration
jared@hwai.com | ** serving NYC and New Jersey **
------------------------------
Date: Wed, 26 May 1999 22:05:21 +1000
From: "Dude" <dude@hotmail.com>
Subject: Newbie question
Message-Id: <6pR23.816$PN5.3555@newsfeeds.bigpond.com>
Hi
I am trying to find a code sample that will illustrate how to get the
default web page from a server and return the HTML "title".
Can anyone suggest where I might find such a thing, or help me out in some
way?
Please email a copy of any responses.
Thanks
Andrew Stuart
astuart@mira.net
------------------------------
Date: Wed, 26 May 1999 08:25:38 -0400
From: digital kensai <kensai@nortel.com>
Subject: Re: Newbie question
Message-Id: <374BE842.F9900BAA@nortel.com>
Dude wrote:
> Hi
>
> I am trying to find a code sample that will illustrate how to get the
> default web page from a server and return the HTML "title".
>
> Can anyone suggest where I might find such a thing, or help me out in some
> way?
>
> Please email a copy of any responses.
>
> Thanks
>
> Andrew Stuart
> astuart@mira.net
I guess you mean you want to send a GET post to a server, and manipulate the
responce. Take a look at the lwp useragent. I think it provides you with
what you need.
------------------------------
Date: Wed, 26 May 1999 13:44:40 GMT
From: John Porter <jdporter@min.net>
Subject: Re: Newbie question
Message-Id: <7igts7$om8$1@nnrp1.deja.com>
In article <6pR23.816$PN5.3555@newsfeeds.bigpond.com>,
"Dude" <dude@hotmail.com> wrote:
>
> I am trying to find a code sample that will illustrate how to get the
> default web page from a server and return the HTML "title".
>
> Can anyone suggest where I might find such a thing, or help me out in
some
> way?
Here's one way; it uses LWP::UserAgent to retrieve the specified URL,
and HTML::Parser to extract the title text.
(Note that to save space, I re-defined three subs in HTML::Parser,
rather than subclass it. This would give a warning under -w, so
I have left off -w. Normally you would not do this!)
This program takes a URL on the command line, and prints the title
to stdout. Obviously you could modify it to get a URL from somewhere
else, and put the title somewhere else.
#!/usr/local/bin/perl
use LWP::UserAgent;
use HTML::Parser;
use HTML::Entities;
use strict;
my $in_title = 0;
sub HTML::Parser::start {
my( $self, $tag, $attr_hr, $attrseq_ar ) = @_;
lc($tag) eq 'title' and $in_title = 1;
}
sub HTML::Parser::text {
my( $self, $text ) = @_;
$in_title and print decode_entities( $text );
}
sub HTML::Parser::end {
my( $self, $tag ) = @_;
lc($tag) eq 'title' and $in_title = 0;
}
my $url = shift or die "Usage: $0 url\n";
my $res = LWP::UserAgent->new->request(
HTTP::Request->new( GET => $url ) );
$res->is_success or die $res->as_string;
HTML::Parser->new->parse( $res->content )->eof;
exit 0;
--
John Porter
Put it on a plate, son. You'll enjoy it more.
--== Sent via Deja.com http://www.deja.com/ ==--
---Share what you know. Learn what you don't.---
------------------------------
Date: Wed, 26 May 1999 21:05:46 +0800
From: Alex <ex5316@netvigator.com>
Subject: Password Protect
Message-Id: <374BF1A9.321206F6@netvigator.com>
Hi all,
I need to protect some .html pages so that only persons have correct
password can enter these pages.
There are some ready made scripts on internet on this topic. However, I
found out that they are not actually password protected !
For example, usually the scripts have a login.html where visitors can
enter the "protect.html" if the password you fill in the form of
login.html is correct. However, if you know the url of the
"protect.html", you can enter the "protect.html" directly !!!
Are there any real protect scripts ?
Thank you
alex
------------------------------
Date: 26 May 1999 07:28:08 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Password Protect
Message-Id: <374bf6e8@cs.colorado.edu>
[courtesy cc of this posting mailed to cited author]
Cursed by Mozilla 4.5 [en] (Win95; I),
in comp.lang.perl.misc Alex <ex5316@netvigator.com> writes:
:I need to protect some .html pages so that only persons have correct
:password can enter these pages.
Then perhaps you might post in a group devoted to the web.
You've come to the wrong place.
--tom
--
"Unix has its weak points, but its file system is not one of them." -Chris Torek
------------------------------
Date: Wed, 26 May 1999 14:38:17 +0100
From: "Daniel Vesma" <daniel.vesma@thewebtree.com>
Subject: Re: Password Protect
Message-Id: <7igtds$5ap$1@gxsn.com>
To do it securly, you shouldn't do it with CGI, but do it direct from the
server. If you run on apache, .htaccess is a quick and easy way of getting
your site secure.
Daniel Vesma
http://www.thewebtree.com
http://www.thewebtree.com/daniel-vesma
>Hi all,
>I need to protect some .html pages so that only persons have correct
>password can enter these pages.
>There are some ready made scripts on internet on this topic. However, I
>found out that they are not actually password protected !
>For example, usually the scripts have a login.html where visitors can
>enter the "protect.html" if the password you fill in the form of
>login.html is correct. However, if you know the url of the
>"protect.html", you can enter the "protect.html" directly !!!
>Are there any real protect scripts ?
>Thank you
>alex
>
------------------------------
Date: 26 May 1999 06:44:43 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Perl equivalent of c++ "struct"
Message-Id: <374becbb@cs.colorado.edu>
[courtesy cc of this posting mailed to cited author]
In comp.lang.perl.misc,
Jarkko Hietaniemi <jhi@alpha.hut.fi> writes:
:For binary data sysopen, sysseek, sysread, rather than the stdio-using
:open, seek, read.
Why??
--tom
--
"I have many friends who question authority. For some reason most of 'em
limit themselves to rhetorical questions."
--Larry Wall
------------------------------
Date: 26 May 1999 16:43:02 +0300
From: Jarkko Hietaniemi <jhi@alpha.hut.fi>
Subject: Re: Perl equivalent of c++ "struct"
Message-Id: <oeeemk4osk9.fsf@alpha.hut.fi>
Tom Christiansen <tchrist@mox.perl.com> writes:
> [courtesy cc of this posting mailed to cited author]
>
> In comp.lang.perl.misc,
> Jarkko Hietaniemi <jhi@alpha.hut.fi> writes:
> :For binary data sysopen, sysseek, sysread, rather than the stdio-using
> :open, seek, read.
>
> Why??
Oops, never mind my above advice. Thinko.
--
$jhi++; # http://www.iki.fi/jhi/
# There is this special biologist word we use for 'stable'.
# It is 'dead'. -- Jack Cohen
------------------------------
Date: Wed, 26 May 1999 06:40:31 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Perl equivalent of c++ "struct"
Message-Id: <MPG.11b5999bb13689e989afe@nntp.hpl.hp.com>
In article <oeeiu9gp40h.fsf@alpha.hut.fi> on 26 May 1999 12:35:42 +0300,
Jarkko Hietaniemi <jhi@alpha.hut.fi> says...
>
> dave@dave.org.uk (Dave Cross) writes:
> > You should probably be looking at the Perl documentation for details
> > of the following functions...
> >
> > perldoc -f open
> > perldoc -f seek
> > perldoc -f read
> > perldoc -f unpack
> > perldoc -f pack
>
> For binary data sysopen, sysseek, sysread, rather than the stdio-using
> open, seek, read.
perldoc -f binmode
perldoc -f binmode
perldoc -f binmode
perldoc -f binmode
perldoc -f binmode
perldoc -f binmode
perldoc -f binmode
perldoc -f binmode
perldoc -f binmode
perldoc -f binmode
--
(Just Another Larry) Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Wed, 26 May 1999 12:57:12 GMT
From: lamj@softhome.net
Subject: Perl module for processing dates?
Message-Id: <7igr37$mhn$1@nnrp1.deja.com>
Are there any Perl Module that test if a date is valid? Eg. 30th, Feb is
not valid and 30th, Apr is not valid.
The reason I am asking this is because I want to write a script that
will count things as a month, think of it as an accounting prog. Billing
date start on 31st of every month. Today is 31st and last month does not
have 31st but only 30th, so the billing starts on 1st of current month,
right?
I need some kind of module that tell me if that date last month is
valid, if not, jump to 1st of next month to process. Would there be any
smarter way to do this?
Jason Lam
--== Sent via Deja.com http://www.deja.com/ ==--
---Share what you know. Learn what you don't.---
------------------------------
Date: 26 May 1999 13:00:48 GMT
From: "Jeff Wilson" <jwilson@ic.ac.uk>
Subject: Re: Perl on Win32 - How can I hide the process?
Message-Id: <01bea777$c7237890$d53ec69b@leicester>
Create a shortcut to process and set minimized in the Run dialogue.
--
Jeff Wilson
London UK
Thomas/Shurflo <thomas@shurflo.com> wrote in article
<37477A2A.5A07C702@shurflo.com>...
> Anyone know how I can hide the process (dos box) that starts when I run
> a Perl script? It could take a while to run and I don't want users
> seeing it.
>
> I've been through the manuals and the newsgroups.
>
>
------------------------------
Date: Wed, 26 May 1999 14:23:37 +0200
From: Olivier Maas <olivier.maas@at-lci.com>
Subject: perl script updating 2 frames?
Message-Id: <374BE7C9.B0E8ADB2@at-lci.com>
Hello,
I would like a Perl script to modify 2 frames in the web page.
e.g. a page with 2 frames (Fram1 & Fram2)
I have a form being posted to a perl script in Fram2, Fram2 is modified
simply with:
$html=CGI->new; printing the header and printing the html page.
but how do I do to also modify Fram1?
thanks for your answers... if you could send a copy of your reply to
maas@ensae.fr, it would be appreciated...
olivier
------------------------------
Date: Wed, 26 May 1999 09:46:31 +0000
From: Tim Connolly <tec@mountain.net>
Subject: Simple com port access
Message-Id: <374BC2F6.D25817D9@mountain.net>
I'm trying to write a small CGI for alpha paging. The part of the
script I need help with is the part which uses the local com port
(ttyS1, Linux 2.0.36 Slackware, Perl5.004) and makes the call, waits on
a response, send the message, then returns a "good" or "no good"
response.
Any ideas ? I need the modem in 300,e,7,1 which seems to also
present another problem child. Any help would be greatly appreciated.
Thanks - Tim
-- Tim Connolly tec@nospam-mountain.net MountainNet, Inc.
-- Network Administrator 2816 Cranberry Square
-- (304) 594-9075/fax-9088 Morgantown, WV 26508
------------------------------
Date: 26 May 1999 06:46:12 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Split behaviour
Message-Id: <374bed14@cs.colorado.edu>
[courtesy cc of this posting mailed to cited author]
In comp.lang.perl.misc,
"Rod Munro" <Rod.Munro@ibm.net> writes:
:@x = split(/^([^:]+):\s*/m, "field: value here");
:Some examples of split seem to indicate that this would give 2 items not 3,
:the empty field being ignored.
The leading null field is ignored only with the special split argument of
a lone blank. Otherwise, you have to do it yourself. For example:
(undef,@x) = split(/^([^:]+):\s*/m, "field: value here");
--tom
--
/* dbmrefcnt--; */ /* doesn't work, rats */
--Larry Wall in hash.c from the v4.0 perl source code
------------------------------
Date: Wed, 26 May 1999 13:48:57 +0100
From: Bob MacCallum <this.is@not.my.address.ok>
Subject: Re: strange core dumping ARGV behaviour
Message-Id: <374BEDB9.EF86B68F@not.my.address.ok>
too much turnover in this group... :o(
going for a second bite at the cherry.
please see original post if the
subject line means anything to you
------------------------------
Date: 26 May 1999 06:20:15 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: tool to trace #include statements in C/C++
Message-Id: <374be6ff@cs.colorado.edu>
[courtesy cc of this posting mailed to cited author]
In comp.lang.perl.misc,
raypereda@my-dejanews.com writes:
:I once used a perl script that would print the include tree
:for a file that had nested includes. These are files that
:have other includes. I lost my copy and was wondering if
:anyone can send me a copy or suggest places to look.
Well, here's an ancient thing of mine you might look at.
Note that because Linux and gcc broke the Unix world, it doesn't
work so well there, but it's still fine on regular systems.
No complaints about this being a perl3 script.
--tom
#!/usr/bin/perl
# igrep - tchrist@perl.com
die "usage: $0 [-I path] pattern file ...\n" unless @ARGV > 1;
@ipath = ( '.', '/usr/include', '/sys/h');
while ($ARGV[0] =~ /^-I(.*)/) {
shift;
push(@ipath, $1 || shift);
}
$pattern = shift;
eval "/$pattern/"; # test her
die "$0: $@" if $@ =~ s/ at \(eval\).*//;
for (@ARGV) { &process($_); }
exit (!$ok);
sub process {
local($fname) = @_;
local(*FH);
return if $seen{$fname};
unless ($fname =~ m#^/# ? open(FH, $fname) : &iopen(FH, $fname)) {
warn "can't open $fname: $! called from "
. join(" from ", reverse @in) . "\n" if $DEBUG;
$seen{$fname}++; # sigh
return;
}
push(@in, $fname);
unless($seen{$fname}++) {
while (<FH>) {
#print "$fname: $.: $_" if /$pattern/o;
print join(" from ", reverse @in), ": $.: $_"
if /$pattern/o;
$ok++;
next unless /^\s*#\s*include\s*(["<])([^">]+)[">]/;
&process($2);
}
}
pop @in;
close(FH);
}
sub iopen {
local($fh, $path) = @_;
local($mypath) = $in[$#in]; # cpp extra inc path
$mypath = '' unless $mypath =~ s#/[^/]*$##;
for $dir ($mypath, @ipath) {
next if $dir eq '';
next unless open ($fh, "$dir/$path");
$_[1] = "$dir/$path"; # clobber caller ref for better msgs
return 1;
}
return 0;
}
--
"Software is like sex: It's better when it's free." (Linus Torvalds, from
FSF T-shirt)
------------------------------
Date: 26 May 1999 06:51:48 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: why doesn't my first program work?? (ok , third or something)
Message-Id: <374bee64@cs.colorado.edu>
[courtesy cc of this posting mailed to cited author]
Suffering under the ludicrous Microsoft Outlook Express 4.72.3110.5,
in comp.lang.perl.misc "Bastiaan S van den Berg" <office@asc.nl> writes:
: i made the following program :
I can't read that. It's very confusing. It has no indentation.
That's illegible. And you use local() a lot, including for typeglobs.
What's with that? Where's -w? Where's use strict? You load a library
whose suffix ends in ".cgi". That's highly non-standard: perl libraries
end in ".pl" -- obviously. But why are you using a simple library rather
than a module? Did you check CPAN for existing template libraries?
--tom
--
Besides, it's good to force C programmers to use the toolbox occasionally. :-)
--Larry Wall in <1991May31.181659.28817@jpl-devvax.jpl.nasa.gov>
------------------------------
Date: 12 Dec 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Special: Digest Administrivia (Last modified: 12 Dec 98)
Message-Id: <null>
Administrivia:
Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing.
]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body. Majordomo will then send you instructions on how to confirm your
]subscription. This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.
The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V8 Issue 5786
**************************************