[9984] in Perl-Users-Digest
Perl-Users Digest, Issue: 3577 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Aug 28 16:03:42 1998
Date: Fri, 28 Aug 98 13:00:21 -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 Fri, 28 Aug 1998 Volume: 8 Number: 3577
Today's topics:
Re: "+<" vs "+>>" (was Re: Opening a file as "+>>file") (Alan Barclay)
Re: A legal newbie question (I hope). <jdporter@min.net>
Re: COBOL and Perl <jdporter@min.net>
Re: Function Prototypes and Missing Arguments (Josh Kortbein)
Re: Help - Perl security problem! (Doug)
Re: Help Please! HTML Address translation filter <ludlow@us.ibm.com>
Re: How do I take out tags? (Patrick Timmins)
How do you debug Perl scripts on an ISP? <rhunnic@ainet.com>
Re: Misinterpreted => why no true/false keywords? <zenin@bawdycaste.org>
Re: pack and unpack big float (Tye McQueen)
Re: Perl compiler (John Stanley)
Re: Perl Cookbook, does anyone have it? (Tom Vaughan)
Re: Perl Cookbook, does anyone have it? <digital_puer@hotmail.com>
Re: problem with substr function <daniel@NOSPAMstridhammar.pp.se>
Re: round (Craig Berry)
Re: session id (Mark-Jason Dominus)
Re: Trouble with getc()... (Mark-Jason Dominus)
Re: Trouble with getc()... (Larry Rosler)
Re: typeglobs and references... (re: Prog Perl, p 117) (Mark-Jason Dominus)
Re: Unreadable Scripts? (Norman UNsoliciteds)
Re: using ioctl under WinNT (Tye McQueen)
Re: what's wrong with this statement? (Patrick Timmins)
Re: Windows95, Perl, PWS (IIS) <daniel@NOSPAMstridhammar.pp.se>
Re: Windows95, Perl, PWS (IIS) scott@softbase.com
Re: Y2K Date Support (Craig Berry)
Re: Y2K Date Support (Craig Berry)
{n} quantifier question rowlands@my-dejanews.com
Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 28 Aug 1998 18:21:43 GMT
From: gorilla@elaine.drink.com (Alan Barclay)
Subject: Re: "+<" vs "+>>" (was Re: Opening a file as "+>>file")
Message-Id: <904328486.249523@elaine.drink.com>
In article <genepoolExyHt7.JFq@netcom.com>,
Jim Michael <genepool@netcom.com> wrote:
>Scratchie (upsetter@ziplink.net) wrote:
>: Just what is the [practical] difference between opening a file
>: with a mode of "+<" and "+>>" ?? (and where, if not in the perl docs, is
>: is it documented?)
>
>When trying to crack the append to top of file question I first tried the
>+>> open since I was 'appending' and I wanted to open for r/w. What I found
>was that after seeking to the 0 position, my append still ended up on the
>tail of the file. The +< open allowed me to seek to the 0 position and
>write a record there. Perhaps someone would provide a more clueful
>explanation of why.
Well it's documented in perlfunc under open, but it's expressed in a way
that you really need to understand C's fopen(3) function, or at least
read an explination of fopen()'s modes.
Under Unix, and other systems which have a comptabile IO Model (IE anything
you're likely to see perl running under), there are basically 3 modes a
file can be in, open for reading, writing or both reading & writing.
If a file is open for writing, then there is another twist, writes
to the file can either happen whereever, or they can be enforced to
always happen at the end.
This gives us 5 different modes that a file usefully can be opened in:
mode perl C
Read < "r"
Write at the current file location, > "w"
which is initially the start of file*
Write at the end of file >> "a"
Both Read & Write at the current file locationn +< "r+"
Both Read & Write at the end of the file +>> "a+"
The last mode is most useful when you're reading & writing to a log file,
and don't want to overwrite any existing data. If it didn't have the
special 'always write at the end' mode, then it would be possible for
one program to overwrite anothers data:
program1 program2
open(file)
open(file)
seek to end
seek to end
write data
write data
program2 has now written over the data written by program1, as the end
of file moved while the program is running.
* = Strictly speaking this isn't what is happening here, the mechanism
which a bare > or C's "w" truncates a file is different to the
append mode in +>> & "a+". This is why there is a sixth mode of
"+>" or "w", when both the flags for truncate & append are set.
This mode is rarely used though, as it's not terribly useful.
------------------------------
Date: Fri, 28 Aug 1998 14:15:11 -0400
From: John Porter <jdporter@min.net>
Subject: Re: A legal newbie question (I hope).
Message-Id: <35E6F3AF.3E52@min.net>
Bob Trieger wrote:
>
> The best thing you could do if you want to learn perl is to:
>
> 1. Run, not walk to the book store and buy `Learning Perl' (The Llama
> Book). If they don't carry it at your local bookstore, it is available
> from many online bookstores or the publisher at http://www.ora.com .
>
> 2. Download perl 5.004_02 for win32 from http://langauge.perl.com/ and
> install it.
>
> 3. Read the book cover to cover being sure to do every exercise until
> you fully understand what every line of code in the exercise is doing.
A better book recommendation might be "Learning Perl on Win32 Systems",
which is considered by many to be a jot superior to the Llama.
It also might be a jot more relevant for Hauk's purposes.
--
John Porter
------------------------------
Date: Fri, 28 Aug 1998 14:26:18 -0400
From: John Porter <jdporter@min.net>
Subject: Re: COBOL and Perl
Message-Id: <35E6F64A.247E@min.net>
David Coldrick wrote:
>
> However, I picked up a book in Singapore by one of your countrymen, one
> Nigel Chapman, that really blew me away (PERL The Programmer's Guide,
> John Wiley and Son). It reveals to an experienced programmer how...
"Perl: The Programmer's Companion"
by Nigel Chapman
1997, John Wiley & Sons
0-471-97563-X
--
John Porter
------------------------------
Date: 28 Aug 1998 19:18:15 GMT
From: kortbein@iastate.edu (Josh Kortbein)
Subject: Re: Function Prototypes and Missing Arguments
Message-Id: <6s6vpn$1sl$1@news.iastate.edu>
David Coppit (dwc3q@mamba.cs.virginia.edu) wrote:
: Any suggestions?
What about passing undef or some other pleasing value for an unused
argument?
Josh
--
"...sex is perhaps more effective than mathematics when it comes to
persuading or driving the common man to do anything."
- Plato
------------------------------
Date: 28 Aug 1998 17:07:08 GMT
From: dmr@doug.fc.hp.com (Doug)
Subject: Re: Help - Perl security problem!
Message-Id: <slrn6udp0t.h53.dmr@doug.fc.hp.com>
In article <6s5cvk$54k$1@monet.op.net>, Mark-Jason Dominus wrote:
>
>In article <35e6422b.14272636@news.netcom.ca>,
>Ben Duncan <ben@smartservers.com> wrote:
>>I've fixed my problem by writing a c-wrapper which calls setuid/setgid
>>& then exec's the perl script.
>
>Oh, good! Now you have the problem without the warning.
That isn't a warning, is it? I think it's an error.
------------------------------
Date: Fri, 28 Aug 1998 12:58:39 -0500
From: anonymous <ludlow@us.ibm.com>
Subject: Re: Help Please! HTML Address translation filter
Message-Id: <35E6EFCF.6DC1F079@us.ibm.com>
paul wrote:
>
> Hello all,
> I am a perl beginner who has recently written a program using the Net::NNTP
> class to post to usenet. Problem is, the source that I want to post is in
> simple html including <a href=www.whatever.com>Whatever</a> text.
> I am trying to write a filter than transforms the following:
> text text <a href=address.com>English Description</a> text text
> to:
> text text English Description (address.com) text text
> and making little progress. I have to perl books (camel & llama), so any
> pointers to where to look or anything would be most useful.
> Thanks!
> Paul
In your documentation, look for:
- regular expressions (regex)
- backreferences
And check out:
http://www.perl.com/CPAN-local/doc/FAQs/FAQ/PerlFAQ.html#How_do_I_remove_HTML_from_a_stri
--
James Ludlow (ludlow@us.ibm.com)
Disclaimer: This isn't technical support, and all opinions are my own.
------------------------------
Date: Fri, 28 Aug 1998 18:21:09 GMT
From: ptimmins@netserv.unmc.edu (Patrick Timmins)
Subject: Re: How do I take out tags?
Message-Id: <6s6sek$cc$1@nnrp1.dejanews.com>
In article <Pine.BSF.4.02A.9808280941300.16874-100000@schultz.io.com>,
Chocolate <poohba@io.com> wrote:
> How do I remove tags from a file? I want to remove all html tags from a
> html doc that I have. How would I do this?
[snip]
lynx
Patrick Timmins
U. Nebraska Medical Center
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum
------------------------------
Date: Fri, 28 Aug 1998 12:35:24 -0700
From: Roger Hunnicutt <rhunnic@ainet.com>
Subject: How do you debug Perl scripts on an ISP?
Message-Id: <35E7067C.CC631B0D@ainet.com>
I use a standard ISP to host my website. They allow scripts. I created a
simple HELLO script, a link to it from a web page, clicked on the link
and am getting errors.
And then I realized I had absolutely no idea how to debug this script
from a remote computer. I don't have a regular UNIX account, and the FTP
account only allows the following commands:
! delete literal prompt send
? debug ls put status
append dir mdelete pwd trace
ascii disconnect mdir quit type
bell get mget quote user
binary glob mkdir recv verbose
bye hash mls remotehelp
cd help mput rename
close lcd open rmdir
First, I don't see a command that runs programs
Second, I don't think this debug command is what I want.
How do you debug Perl scripts from your PC using only an FTP account and
a standard www website account?
Thanks
Roger Hunnicutt
rhunnic@ainet.com
------------------------------
Date: 28 Aug 1998 18:36:35 GMT
From: Zenin <zenin@bawdycaste.org>
Subject: Re: Misinterpreted => why no true/false keywords?
Message-Id: <904329231.851606@thrush.omix.com>
Mark-Jason Dominus <mjd@op.net> wrote:
>snip<
: I'm very glad you showed this, because it is wearing a shirt that says
: `Hi! I am the final nail in the coffin of constant.pm!''
:-)
: > your advice to subvert constant.pm is flawed.
: Really? I found your one-line argument above to be very persuasive.
Duh! :-)
: constant.pm is a cute and clever piece of syntactic sugar, but that's all.
True, but then so is base.pm, enum.pm, vars.pm, subs.pm, tied
classes, etc. There is power in sugar.
: That example was specifically discussing a module whose *only* purpose
: was to define and export a certain function; it said so right up
: front. If you didn't want the function, you wouldn't use the module.
There are many times one wants access to a module's functions
without forcing them into there own name space. If Foo's foo()
was only going to be called once, it is common to do:
use Foo ();
Foo::foo();
: It was either careless or dishonest of you to ignore this.
IMHO, tutorials that show potentially dangerous or ill advised
practices without any mention of such hazards does no one much
good.
The reader that can make use of the tutorial by definition can't be
expected to know what the hazards are (they wouldn't be reading the
tutorial if they knew the subject already, right?), and by omitting
them gives the reader the warm fuzzy that if they use the example
that they are doing it the Right Way[tm]. This does neither the
reader or anyone that needs to use or support the reader's code
any good.
: The purpose of the example is to present the simplest possible
: demonstration of exporting, to set up discussion of better, more
: complete methods later on.
Which is fine, but it's still hazardous code with no mention
of such. TMTOWTDI, but tutorials need to point out not only
the pros, but also more importantly the cons of a method.
"Using an electric razor in the bath can be very useful"
But without, "Just make sure you don't drop it or you could
die" is asking for trouble.
: Short code when warranted; longer code when appropriate. 458 lines is
: too big to replace `sub true () { 1 }', as I'm sure you agree.
Yes and no. I don't think of it as 458 lines of code, I think
of it as 21 lines. The rest of that bulk is almost guaranteed to
be loaded by something else anyway in any application much larger
then grep(1).
While I don't agree with writing general code so that newbies to
the language can read it without needing a manual, I do agree with
syntactic suger that drives my code design home. Constant.pm,
base.pm, vars.pm, subs.pm, enum.pm, et al do a fine job of this.
>snip<
: The @{[]} trick also
: has the possibly surprising and probably undesirable property of
: evaluating the expression in list context:
To flip that around, what if you wanted list context from
a call to $eval{code()}? $eval{'@{[code()]}'} ?
:-)
>snip<
: print "The time is now @{[scalar localtime()]}\n";
: print "The time is now ${\do {localtime()}}\n";
: print "The time is now $eval{localtime()}\n";
: Of course, your preference may very, but I find the last version the
: best here.
If you're calling it a lot, sure. If you're calling it once,
you're creating unneeded code bulk. This is the same argument
to use constant.pm or not.
: The technique I showed is also more flexible and more generally useful
: than the @{[]} trick, because the `fetch' routine can format the
: result in an arbitrarily useful way:
: $INCOME = -37092.5;
: print "Total income: $dollars{$INCOME}\n"
: # prints Total income: ($37,092.50)
True, but without the syntactic suger of your notably cool
Interpolation module this can get ugly fast. :-)
Interpolation is a prime example of code "bulk" for the sake of
simple syntactic suger, so I fail to see how you find constant.pm
so horrid. :-)
: But finally, I think your question is misguided. ``Why not just do
: this'' is very nice, if you already know the trick.
This argument applies to using a tied hash even more so. I find
it much easier to teach someone "@{[code]}" then potentially
OOP, perl objects, tied objects, and proper use of eval()...
: > Or, we could learn to use open(2) flags and sysopen() correctly.
:
: What's your complaint here? That I didn't present the Ultimate Guide
: to File Locking?
That you're offering lock files as a general Better Way[tm], when
there main use is only a kluge to handle broken NFS systems.
: The solution I presented is more flexible
How? Sysopen() is light years more flexible then open(). Open()
is only syntactic suger, and it doesn't let you get interesting easily.
: and more portable than yours;
I mentioned O_EXLOCK, but it's far from required to avoid an
unneeded secondary lock file.
: it's simple and straightforward, involves no new knowledge at
: all
Ditto for below.
: and doesn't depend on system-dependent features of `sysopen'.
Sysopen() is only system-dependent if you ask it to be. This
example below doesn't ask it to be:
$FILE = "foobar";
use Fcntl qw(:DEFAULT :flock);
sub something { shift @ARGV }
if (something()) {
sysopen F, $FILE, O_RDWR, 0644
or die $!;
flock F, LOCK_SH
or die $!;
print while <F>;
}
else {
sysopen F, $FILE, O_RDWR|O_CREAT|O_TRUNC, 0644
or die $!;
flock F, LOCK_EX
or die $!;
my $data = qx{date};
print F $data
or die $!;
}
: As usual, there's more than one way to do it. I showed one way. Your
: complaint that I didn't show *your* way is irrelevant.
"It's dumb to use the same file for two unrelated purposes. Just do
it this way; you'll be glad."
Hmm, and what happened to TMTOWTDI again?
"All sorts of problems just go away when the semaphore file is
unrelated to the data file."
You "solved" a number of "problems" that don't exist, nore is your
solution simpler. The only advantage offered is the ability to
store your pid and such in the file, but in practice this is
rarely the best method of IPC.
--
-Zenin (zenin@archive.rhps.org) From The Blue Camel we learn:
BSD: A psychoactive drug, popular in the 80s, probably developed at UC
Berkeley or thereabouts. Similar in many ways to the prescription-only
medication called "System V", but infinitely more useful. (Or, at least,
more fun.) The full chemical name is "Berkeley Standard Distribution".
------------------------------
Date: 28 Aug 1998 14:07:58 -0500
From: tye@fumnix.metronet.com (Tye McQueen)
Subject: Re: pack and unpack big float
Message-Id: <6s6v6e$4bd@fumnix.metronet.com>
scott@iastate.edu (Dave Scott) writes:
) I would like to pack and unpack 4-byte floating point data.
) Is there a way to do this? "d" seems too small :).
On most systems, "d" would be too large. "f" might work,
depending on your system.
print length pack("d",0.0), "\n";
print length pack("f",0.0), "\n";
On a lot of systems this prints 4 then 8.
--
Tye McQueen Nothing is obvious unless you are overlooking something
http://www.metronet.com/~tye/ (scripts, links, nothing fancy)
------------------------------
Date: 28 Aug 1998 18:31:12 GMT
From: stanley@skyking.OCE.ORST.EDU (John Stanley)
Subject: Re: Perl compiler
Message-Id: <6s6t1g$d7s$1@news.NERO.NET>
In article <6s5hi1$q3n@mozo.cc.purdue.edu>,
Michael J Gebis <gebis@fee.ecn.purdue.edu> wrote:
>Peter A Fein <p-fein@uchicago.edu> writes:
>}stanley@skyking.OCE.ORST.EDU (John Stanley) writes:
>}> In article <opgr9y2dphv.fsf@harper.uchicago.edu>,
>}> Peter A Fein <p-fein@uchicago.edu> wrote:
>}I thought you were logging in to a server to grab log files. Oh well.
>
>There are several different ways to interpret "server."
The "server" has internally a separate computer monitoring temps and
system function. The "server" does not log this data nor does the
status computer. What you get to do is log in to the status computer
(via telnet over its own network interface) and ask for current data.
That requires a password. Then YOU get to write the data to a log
file.
Logging in to the server does not get you access to the monitoring
system. Even if it did, you would have a very hard time logging system
status during a failure if the system that was logging was the one that
failed.
I don't believe I ever said I was trying to "grab log files" or log in
to a server. I am trying to log data. And trying to get an answer to
the question "how do you do it without hardcoding passwords".
------------------------------
Date: 28 Aug 1998 18:23:59 GMT
From: vaughan@itdc.edu (Tom Vaughan)
Subject: Re: Perl Cookbook, does anyone have it?
Message-Id: <6s6sjv$b2a$1@malgudi.oar.net>
It is a good book that was available at the Perl conference last week in San Jose. Well worth
the wait if you could't get there for a copy.
Tom
Scott Boss (Scott.Boss@bridge.bellsouth.com) wrote:
: Well I just heard from Amazon that they have shipped all the pre-orders for
: "Perl Cookbook" this morning. Their website reflects their statement. So
: within a few days I will be a very happy camper.
: Scott Boss
------------------------------
Date: Fri, 28 Aug 1998 12:14:26 -0700
From: Digital Puer <digital_puer@hotmail.com>
Subject: Re: Perl Cookbook, does anyone have it?
Message-Id: <35E70192.B32DFB53@hotmail.com>
Michael J Gebis wrote:
> ------------------------------------------------------------------
> Ordered Title Price Shipped Subtotal
> ------------------------------------------------------------------
> 1 The Perl Cookbook 31.96 1 31.96
The Bookpool (www.bookpool.com) *always* has lower prices than any other
bookstore. They're selling it for $26.50. I've been a very satisfied
customer for the last 2 years.
------------------------------
Date: Fri, 28 Aug 1998 21:44:20 +0200
From: Daniel Stridhammar <daniel@NOSPAMstridhammar.pp.se>
Subject: Re: problem with substr function
Message-Id: <35E70894.73403AC7@NOSPAMstridhammar.pp.se>
Use something like this:
if(length($line) < 105 ) {
push 0 into @array...
} elsif(length($line >= 117) {
push substring into @array...
} else {
push 0 or do something else if $line is 105 up to 116
}
/Daniel
> push @array, (split ' ', substr ($line, 105, 12);
>
> In this example, this works fine as long as $line is at least 117 characters,
> but if it is only 100 characters @array doesn't get anything pushed into it.
> I would like @array to get a value of "0" or at least undef if $line is
> shorter than 105 characters. Any suggestion would be greatly appreciated!
> TIA!
------------------------------
Date: 28 Aug 1998 18:34:34 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: round
Message-Id: <6s6t7q$im1$3@marina.cinenet.net>
Cattle (cattle@hongkong.com) wrote:
: Sorry I know it's a very silly question, but I'm a very new newbie... :(
: Hope you can help me. I want to know is there a function for rounding
: numbers? I only know int() which only chop the non-integer part... :(
There is/are. See the FAQ.
---------------------------------------------------------------------
| Craig Berry - cberry@cinenet.net
--*-- Home Page: http://www.cinenet.net/users/cberry/home.html
| "Ripple in still water, when there is no pebble tossed,
nor wind to blow..."
------------------------------
Date: 28 Aug 1998 14:32:35 -0400
From: mjd@op.net (Mark-Jason Dominus)
Subject: Re: session id
Message-Id: <6s6t43$9bs$1@monet.op.net>
In article <6s6ln2$44v$1@shadow.skypoint.net>,
Jonathan A. Laub <lakesoft@skypoint.com> wrote:
>i need to create a uniquely-named file for use with a clipper polling app.
Concatenating the current time, the process id, and the hostname is
probably sufficient. If the files are not network-mounted, the
hostname is probably unnecessary.
$sess_id = time . ".$$';
This will fail if your system the same process ID number more than
once in the same second.
------------------------------
Date: 28 Aug 1998 14:03:12 -0400
From: mjd@op.net (Mark-Jason Dominus)
Subject: Re: Trouble with getc()...
Message-Id: <6s6rd0$95b$1@monet.op.net>
In article <35E6BB41.18C57DEF@mindspring.com>,
Peter Smith <psmith01@mindspring.com> wrote:
>while(getc(IN))
You've used the wrong test. If the character is '0', the loop will
terminate prematurely.
You need
while(getc(IN) ne '')
------------------------------
Date: Fri, 28 Aug 1998 11:36:38 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Trouble with getc()...
Message-Id: <MPG.1050989341adc492989772@nntp.hpl.hp.com>
In article <6s6rd0$95b$1@monet.op.net> on 28 Aug 1998 14:03:12 -0400,
Mark-Jason Dominus <mjd@op.net> says...
> In article <35E6BB41.18C57DEF@mindspring.com>,
> Peter Smith <psmith01@mindspring.com> wrote:
> >while(getc(IN))
>
> You've used the wrong test. If the character is '0', the loop will
> terminate prematurely.
>
> You need
>
> while(getc(IN) ne '')
Either of these draws a "Use of uninitialized value ..." warning at end
of file. I think the best approach is this:
while (defined($x = getc(IN))) ...
where I've added the store of the characters read, which presumably is of
interest. The nice thing about this form is that in addition to being
quiet, it also Benchmarks about 10% *faster* than the non-empty test (or
the 'while (length($x = getc(IN))) ...' equivalent not mentioned above).
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: 28 Aug 1998 13:53:19 -0400
From: mjd@op.net (Mark-Jason Dominus)
Subject: Re: typeglobs and references... (re: Prog Perl, p 117)
Message-Id: <6s6qqf$93a$1@monet.op.net>
In article <35E61CB2.A128ABDB@unsw.edu.au>,
Benjamin Low <b.d.low@unsw.edu.au> wrote:
>Is there any way of determining what a typeglob aliases to, when it is
>used as a glob for a reference?
I'm not exactly sure what you mean, but if you're asking how you can
tell what happens when you do
*glob = $ref
the answer is to use
ref $ref
first to see what kind of reference is in $ref. Example's below.
>sub func
>{
> local (*e, *f) = @_;
> # stuff done with @e and @f, (\@e, \@f) returned
>}
>
>In the example func assumes you're passing it refs to arrays,
Right. This is may be a bad move, because if the caller passed in
refs to hashes instead, it would end up aliasing %e and %f instead of
@e and @f, and then presumably the function would go ahead and try to
use @e and @f anyway, even though those arrays weren't the ones it
thought they were going to be.
Better:
my ($eref, $fref) = @_;
unless (ref $eref eq 'ARRAY' &&
ref $fref eq 'ARRAY) {
# your choice of die, croak, warn, return, etc.
}
local (*e, *f) = ($eref, $fref);
...
This may be the answer to your question; I'm not sure.
>I note that I can say
>
>defined($e) && print "scalar ref";
Oh, you don't want to do that. There might be a totally unrelated $e
variable in another part of the program that you would incorrectly
notice by doing this. See:
$e = 'ha ha!';
%snonk = ( x => y, p => q) ;
func(\%snonk, \%ENV);
sub func {
local (*e, *f) = @_;
defined($e) && print "scalar ref";
}
Even though you passed a hash ref to `func', so that it made %e the
same as %snonk, your test thinks that it was a scalar ref, because it
mistakenly noticed the $e that happened to be defined elsewhere.
------------------------------
Date: Sat, 29 Aug 1998 03:18:28 +0900
From: No.unsoiliciteds@dead.end (Norman UNsoliciteds)
Subject: Re: Unreadable Scripts?
Message-Id: <No.unsoiliciteds-2908980318280001@cs11i30.ppp.infoweb.or.jp>
Nathan V. Patwardhan
> You silly kid.
frightening display of intellectual superiority there Nat.
--
*plonk*
------------------------------
Date: 28 Aug 1998 14:27:45 -0500
From: tye@fumnix.metronet.com (Tye McQueen)
Subject: Re: using ioctl under WinNT
Message-Id: <6s70bh$and@fumnix.metronet.com>
"Joerg Weigang" <joerg.weigang@amd.com> writes:
) What do I have to do to use the ioctl function under WinNT?
) I try to read one character from STDIN and I don't want to press "Enter". So
) I have to change the input mode to raw with the ioctl function. But it
) doesn't work.
) Does someone know why?
Win32 has IOCTL's and you can call them with my Win32API::File (the
latest version is at http://www.metronet.com/~tye/alpha/Win32API/,
and it will be uploaded to CPAN in another version or so).
But for the problem you wish to solve you should instead use
Win32::Console that comes as part of winlib32 which is available
on CPAN.
Or, even better, use Term::ReadKey 2.10 or greater. Quoting it's readme:
New in version 2.10 is support for Win32. This has only been
tested with one particular binary distribution and compiler,
so it may need a bit of exercise. There is are also some
limitations, with the ReadLine call being unavailable, and
ReadKey possibly generating bad results if you are reading
from multiple consoles, and key repeat is used.
Getting a binary for ReadKey *might* be harder than getting one for
Win32::Console, depending on a lot of things.
--
Tye McQueen Nothing is obvious unless you are overlooking something
http://www.metronet.com/~tye/ (scripts, links, nothing fancy)
------------------------------
Date: Fri, 28 Aug 1998 18:14:01 GMT
From: ptimmins@netserv.unmc.edu (Patrick Timmins)
Subject: Re: what's wrong with this statement?
Message-Id: <6s6s18$vlk$1@nnrp1.dejanews.com>
In article <6s6bif$dtk$2@ligarius.ultra.net>,
sowmaster@juicepigs.com (Bob Trieger) wrote:
[snip]
> If you don't stop backwhacking, you'll go blind.
That's just a myth.
Patrick Timmins
U. Nebraska Medical Center
(with vision correctable to 20/20)
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum
------------------------------
Date: Fri, 28 Aug 1998 21:26:15 +0200
From: Daniel Stridhammar <daniel@NOSPAMstridhammar.pp.se>
Subject: Re: Windows95, Perl, PWS (IIS)
Message-Id: <35E70457.41F613D3@NOSPAMstridhammar.pp.se>
The following steps require that PWS already is installed. There is
nothing strange with this installation.
The setup contains two main steps. First you have to install Perl which is
a very straightforwrd process. I run the setup twice because I wished to
have both the default .pl extension and .cgi, registered as Perl
extensions.
The second thing is almost as esay as the first step. You have to create a
virtual CGI-BIN directory located under the home (root). Choose Advanced
and type in something like this:
Directory: C:\www\wwwroot\cgi-bin
Alias: cgi-bin
and check Execute and Scripts in the Acccess area. That's all it is about
it...
Good luck Angel!
/Daniel
> Can someone please point me to any article at any location that
> explains how to setup Perl to work for cgi on a windows 95 machine
> running Personal Web Server.
>
> I want to develop here and later upload the code to an NT4 Server that
> is already setup to run perl.
>
> I have Article ID: Q150629 (Configuring and Testing PERL Scripts with
> IIS, but am not sure if windows95 and PWS is configured the same way.
>
> Thanx in advance
> Angel
------------------------------
Date: 28 Aug 1998 19:49:23 GMT
From: scott@softbase.com
Subject: Re: Windows95, Perl, PWS (IIS)
Message-Id: <35e709c3.0@news.new-era.net>
Angel Leyva (aleyva@erols.com) wrote:
> I have Article ID: Q150629 (Configuring and Testing PERL Scripts with
> IIS, but am not sure if windows95 and PWS is configured the same way.
It is. The easiest thing to do is install the ActiveState ISAPI
DLL version of Perl and let it configure the web server for you.
Scott
--
Look at Softbase Systems' client/server tools, www.softbase.com
Check out the Essential 97 package for Windows 95 www.skwc.com/essent
All my other cool web pages are available from that site too!
My demo tape, artwork, poetry, The Windows 95 Book FAQ, and more.
------------------------------
Date: 28 Aug 1998 18:30:22 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: Y2K Date Support
Message-Id: <6s6svu$im1$2@marina.cinenet.net>
Patrick Timmins (ptimmins@netserv.unmc.edu) wrote:
: How is it a problem with time_t (not that I am at all familiar with time_t)?
: On a 32 bit system in early 2038, the number of seconds since Jan 1, 1970
: will reach 2**31. A 32 bit CPU, bus, etc will not be able to work with
: anything larger. How is this a software problem, as opposed to a hardware
: problem?
A processor can work with quantities having more bits than its own natural
word size; note that old 8-bit processors could deal with 16 and 32 bit
words. The operations are just slower, as one must shuffle the component
chunks of the 'unnaturally long' values through the bus and CPU one at a
time, preserving enough local state in the CPU to handle (e.g.) carry
properly.
Unix system designers were free to specify time_t as a 64-bit quantity
(hiding it in a struct or the like if necessary, and providing manipulator
methods to do math on it); they decided to take the optimization of using
a more natural word size instead, sacrificing representation range for
performance and ease of use. Hence, it's a software problem.
---------------------------------------------------------------------
| Craig Berry - cberry@cinenet.net
--*-- Home Page: http://www.cinenet.net/users/cberry/home.html
| "Ripple in still water, when there is no pebble tossed,
nor wind to blow..."
------------------------------
Date: 28 Aug 1998 18:25:15 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: Y2K Date Support
Message-Id: <6s6smc$im1$1@marina.cinenet.net>
Norman UNsoliciteds (No.unsoiliciteds@dead.end) wrote:
: In article <6s59lr$1kf$1@marina.cinenet.net>, cberry@cinenet.net (Craig
: Berry) wrote:
: > As a result of sloppy math and historical research by Dennis
: > the Little, our calendar has no year zero,
:
: so what happened 1,998 years ago?
That question is ambiguous, so I'll answer it both ways I can interpret
it:
a) The common civil calendar is also the Christian 'Anno Domini' calendar.
A monk named Dennis the Little constructed it in the 8th Century
(IIRC), thinking he was counting years starting with AD 1 being the
birth of Jesus. Unfortunately, modern scholarship indicates that said
birth almost certainly happened 4 to 7 years earlier.
b) The civil calendar does not have a year 0. December 31, 1 BC is
followed by January 1, AD 1.
: why are we counting from such a
: relatively recent date and not from the dawn of the eistence of the earth?
Because that's such a poorly defined time. At what stage of accretion did
the earth come into existence? Also, such an ancient epoch leads to
incoveniently large numbers for current times.
The Julian Day system attempts to strike a compromise, putting Day 0
thousands of years ago. This has proved very convenient for many
purposes, though note that many applications use a modified JD system
counting days from some more recent epoch. Note also that getting sub-day
resolution in the JD system requires a bit of extra work (floating point
math, or an added integer seconds-within-the-day count, or the like).
: Granted the _exact_ dates of the death (and birth for that matter) of
: Christ is none are lost somewhere between the heresay of what went into
: writing the bible several hundreds of years after the events it describes,
: and the addtional months added by the roman emperors to the callendar and
: the decision to revise the callendar in the middle ages however a zero
: year there is (appromimateit may be).
No, there really isn't. 1 BC is followed by AD 1. It's annoying and
inconvenient, but there it is.
: > Nuclear energy, harnessed properly, is as safe a technology as we've ever
: > had for power production.
:
: If it was used exlcusively for producing energy you'd be right, but much
: in the same way firing monkeys into space was a way of getting spy
: sattelites into orbit, nuclear power is used for the production of nuclear
: weapons, which I think you'll agree are _not_ terribly safe things to have
This is (I promise!) the last I'll say on this off-topic branch of the
thread, but note that *any* power production technology can be used as a
weapon (if only by using the power to electrocute people :). Note also
that nuclear power plants and nuclear bombs are related in the same way
that your car's gas tank and a Molotov cocktail are related. 'Nuff said.
---------------------------------------------------------------------
| Craig Berry - cberry@cinenet.net
--*-- Home Page: http://www.cinenet.net/users/cberry/home.html
| "Ripple in still water, when there is no pebble tossed,
nor wind to blow..."
------------------------------
Date: Fri, 28 Aug 1998 19:21:13 GMT
From: rowlands@my-dejanews.com
Subject: {n} quantifier question
Message-Id: <6s6vv8$4j1$1@nnrp1.dejanews.com>
Apologies if I'm being dense, but can anyone explain why
"ab" =~ /(a*[^b]*b){2}/
is true? I expect it to match only strings with at least two b's.
--
Stephen Rowland
Stephen.Rowland@rebus.co.uk
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum
------------------------------
Date: 12 Jul 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 Mar 98)
Message-Id: <null>
Administrivia:
Special notice: in a few days, the new group comp.lang.perl.moderated
should be formed. I would rather not support two different groups, and I
know of no other plans to create a digested moderated group. This leaves
me with two options: 1) keep on with this group 2) change to the
moderated one.
If you have opinions on this, send them to
perl-users-request@ruby.oce.orst.edu.
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 3577
**************************************