[9796] in Perl-Users-Digest
Perl-Users Digest, Issue: 3389 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Aug 7 12:07:45 1998
Date: Fri, 7 Aug 98 09:00:26 -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, 7 Aug 1998 Volume: 8 Number: 3389
Today's topics:
Re: ' (quote) characters making problems <joneil@cks.ssd.k12.wa.us>
Re: Access, ODBC and Linux <dtauzel@uswest.com>
Re: ANNOUNCE: Free Perl Books for 5.005 - CRC Errors in (Clinton Pierce)
Re: Anybody know what the valid parameters to Ev() are? <jdporter@min.net>
Are my posts getting thru? Was: Scoping question. <webmaster@fccj.org>
Re: Autoincrement with hashes (Mark-Jason Dominus)
Re: Bug in while-loops? (M.J.T. Guy)
Re: Calculate Date in Perl <joneil@cks.ssd.k12.wa.us>
Re: cgi (Plamen Petkov)
Re: Directory size (including all clilt files / dirs) - (Andrew M. Langmead)
Re: File already opened by another process? (Bart Lateur)
Re: Help Help Please Help ! (Neil Kandalgaonkar)
HELP WANTED: Problems with Servers Side Includes (SSI) <Ronald.vanGogh@nl.origin-it.com>
illegal seek error message pdalton@my-dejanews.com
Installing Perl 5.004_04 on SCO Unixware 2.x <colin@softc.co.uk>
Re: MAJOR PROBLEMS <thomas@daimi.aau.dk>
oraperl rook_ki@hotmail.com
Re: Perl Docs.. forget the original post (Andrew M. Langmead)
Re: Perl Docs.. forget the original post <tchrist@mox.perl.com>
Re: perl PARSER (Neil Kandalgaonkar)
Re: perlfaq - frequently asked questions about Perl (pa (Chris Nandor)
Re: perlfaq - frequently asked questions about Perl (pa <tchrist@mox.perl.com>
Re: perlfaq - frequently asked questions about Perl (pa <jdporter@min.net>
Re: perlfaq - frequently asked questions about Perl (pa (Mark-Jason Dominus)
Re: perlfaq - frequently asked questions about Perl (pa (Chris Nandor)
Re: perlfaq - frequently asked questions about Perl (pa (John Moreno)
Re: perlfaq - frequently asked questions about Perl (pa <jdporter@min.net>
Re: perlfaq - frequently asked questions about Perl (pa <zenin@bawdycaste.org>
Re: perltoot q: overriding new method and calling super <tchrist@mox.perl.com>
Re: Possible to pass Associative Arrays to Subroutines? (M.J.T. Guy)
Re: Retrieving file from REMOTE_ADDR ... HELP! (Hector Catre)
Scoping Question sneaker@fccj.org
system command <rkim@temple.edu>
Re: Teaching Perl <jdporter@min.net>
Re: Teaching Perl <jdporter@min.net>
Underwood Typewriter and the backslash (Clinton Pierce)
Re: wildcards don't work with link function? (Brett Goldstock)
Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Fri, 07 Aug 1998 08:21:51 -0700
From: Jerome O'Neil <joneil@cks.ssd.k12.wa.us>
To: vanja@siamrelay.com
Subject: Re: ' (quote) characters making problems
Message-Id: <35CB1B8F.8DB93BE3@cks.ssd.k12.wa.us>
vanja@siamrelay.com wrote:
>
> I have a small problem. Here is the problematic line:
>
> -----------------------------------------------------------------------
> print "<input type='text' name='something' value='$message'>";
> -----------------------------------------------------------------------
>
> $message is a long string. However, sometimes it contains quote ('), and only
> part of the message (before appearance of ') will fill the textbox. I presume
> that apperance of ' "substitutes" the 2nd quote in perl code, and the rest of
> the message is lost.
>
> (in example, message can be: "Mike's car". And only "Mike" will appear in
> textbox).
>
> Is there any way to solve this?
Use quote metacharacters qq and q.
For example your statement could be converted to
print qq{<input type='text' name='something' value='$message'>};
qq will interpolate variables, and is equivlant to double quotes.
q will not interpolate, and is equivlant to single quotes.
See "Quote and Quote Like Operators" in the perlop section of the
documentation for more detail.
Good Luck!
Jerome O'Neil
Seattle Public Schools
Information Services
------------------------------
Date: Fri, 07 Aug 1998 09:07:41 -0500
From: David Tauzell <dtauzel@uswest.com>
Subject: Re: Access, ODBC and Linux
Message-Id: <35CB0A2D.6E52912D@uswest.com>
You can purchase (for a hefty price) a generic ODBC proxy from
www.ensodex.com. With this situation, you would use the ODBC proxy
client on linux and the ODBC proxy server on NT. I'm not sure, though,
if the ODBC proxy client has been ported to Linux.
Dave.
------------------------------
Date: 7 Aug 1998 14:28:47 GMT
From: cpierce1@cp500.fsic.ford.com (Clinton Pierce)
To: "Curtis Jewell / Dennis Whalen" <cjdpcssd@ims-1.com>
Subject: Re: ANNOUNCE: Free Perl Books for 5.005 - CRC Errors in text version archive?
Message-Id: <6qf2uv$3nd8@eccws1.dearborn.ford.com>
In article <6qe0dm$975@enews1.newsguy.com>,
"Curtis Jewell / Dennis Whalen" <cjdpcssd@ims-1.com> writes:
>I'm forced into Windows... (I'd use Linux if I had the HD room!)
>
For a cause this worthy, I think we should take up donations. I've
got a 660MB SCSI or a 120MB IDE you can have.
Clinton "Pass the Hat" Pierce
--
+------------------------------------------------------------------------+
| Clinton A. Pierce | "If you rush a Miracle Man, | http://www. |
| cpierce1@ford.com | you get rotten miracles" | dcicorp.com/ |
| fubar@ameritech.net |--Miracle Max, The Princess Bride| ~clintp |
+------------------------------------------------------------------------+
GCSd-s+:+a-C++UALIS++++P+++L++E---t++X+b+++DI++++G++e+>++h----r+++y+++>y*
------------------------------
Date: Fri, 07 Aug 1998 11:53:02 -0400
From: John Porter <jdporter@min.net>
Subject: Re: Anybody know what the valid parameters to Ev() are?
Message-Id: <35CB22DE.44B9@min.net>
Mark J. Seger wrote:
>
> The "Advanced Perl Programming" book tells me on pages 249-250 that
> there are over 30 to choose from but them only teases me with a couple.
> I've looked in a number of places and couldn't find any lists,
> anywhere. I'd even write the author if I knew his address...
I found the info in the following file on my system:
.cpan/build/Tk402.004/doc/bind.htm
Of course, on your system the Tk version may be different,
and it might not be under the .cpan directory. Do this:
cd /usr/local/lib/perl # or whatever
find . -name 'bind.*' -print
and see what turns up.
--
John Porter
------------------------------
Date: Fri, 07 Aug 1998 11:13:46 -0400
From: FCCJ Webmaster <webmaster@fccj.org>
Subject: Are my posts getting thru? Was: Scoping question.
Message-Id: <35CB19AA.C197414A@fccj.org>
why does
open (outfile, "mytest") or die "can't: $!";
{ # some block
s/olddata/newdata/;
print outfile;
}
close (outfile) or die "can't: $!";
Truncates the data prior to match, and
{ # some block
open (outfile, "mytest") or die "can't: $!";
s/olddata/newdata/;
print outfile;
close (outfile) or die "can't: $!";
}
Doesn't? Any ideas, thoughts, cussin' & discussin' ?
Hmmm,
-Sneex- :]
------------------------------
Date: 7 Aug 1998 11:25:20 -0400
From: mjd@op.net (Mark-Jason Dominus)
Subject: Re: Autoincrement with hashes
Message-Id: <6qf690$abr$1@monet.op.net>
In article <35CA7E6F.5CE6@mail.localaccess.com>,
Mark Lybrand <maryesme@mail.localaccess.com> wrote:
>grep($ALL_FIELDS{$_}++,@$_);
>But what does the ++ do for us with hashes???
++ is not incrementing a hash; it is incrementing a hash element.
A hash is a table with two columns. In this case, the left column has
some kind of data in it, and in the right column, there is a number
associated with each item, which represents the number of times the
item appeared in the input. ++ increments this number.
------------------------------
Date: 7 Aug 1998 14:32:14 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: Bug in while-loops?
Message-Id: <6qf35e$rir$1@pegasus.csx.cam.ac.uk>
Heiko Klein <hklein@ikp.uni-koeln.de> wrote:
>Hi,
>
>I have a program with a global variabel @Files.
>
>In a subroutine, I don't use this variable, but with a while-loop over
>an input-file, this @Files is changed.
>########################################################################
># foreach $_ (<TVOUT>) {
> while (defined($_ = <TVOUT>)) {
> }
>############################################################
>
>After the while-loop between the #####-lines, I have undefined entries
>in @Files.
>
>When I change from while to foreach $_ ..., everything runs as it
>should.
I'll guess that your subroutine is being called within a loop that
looks something like
foreach (@Files) {
...
tv_peaks($some_arg);
...
};
In a loop like that, the controlled variable ($_) is *aliased* to each
element of @Files in turn. See perldoc perlsyn.
The while loop is changing $_ and hence changes the corresponding element
of @Files. This does not happen with foreach because foreach localises
its controlled variable. Again see perldoc perlsyn. While cannot be
protected in this way, because in general it doesn't have a "controlled
variable".
Moral #1: Avoid use of $_ as the controlled variable in a for loop.
Use an explicit lexical variable instead.
Moral #2: If you are writing code which may change $_ (i.e. any use
of $_ except the special case as the controlled variable
of a foreach), always protect it by putting a C<local $_;>
first.
Actually, that last piece of advice applies to almost *all* the Perl
special "punctuation" variables.
Mike Guy
------------------------------
Date: Fri, 07 Aug 1998 08:23:40 -0700
From: Jerome O'Neil <joneil@cks.ssd.k12.wa.us>
To: ngong@my-dejanews.com
Subject: Re: Calculate Date in Perl
Message-Id: <35CB1BFC.E66564AF@cks.ssd.k12.wa.us>
ngong@my-dejanews.com wrote:
>
> I wanna know how I can calculate a new date in Perl or Shell Script, given an
> initial date and an offset which may be positive or negative in days, in
> order to answer questions like "today plus 90 days -- what date gives that ?
Use the Date::Manip module available on CPAN. Works like a charm,
understands several input formats, and outputs in any format you can
think up.
Good Luck!
Jerome O'Neil
>
> PS. I can't use command like "make install" module in my server.
>
> -----== Posted via Deja News, The Leader in Internet Discussion ==-----
> http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum
------------------------------
Date: Fri, 7 Aug 1998 16:59:01 +0300
From: plamendp@techno-link.com (Plamen Petkov)
Subject: Re: cgi
Message-Id: <MPG.103534a1138f8096989686@news.techno-link.com>
In article <6qds78$d00$1@perki.connect.com.au>
Date: 7 Aug 1998 03:27:36 GMT
Dean McDonald wrote:
>
> $tmpfile = "/tmp/uuser";
> require "cgi-lib.pl" || die "cannot open cgi-lib.pl!";
>
> if ($username ne 0){
> &input;
> } else {
> &input;
> &output;
> }
>
>
I assume using ($username ne 0) you mean "if $username is not empty
string", am I right ?
The statement ($username ne 0) is always "true" (i.e. 1) if $username is
ANY (including EMPTY) string with ONE exception: $username = "0". I tried
this (well, here is my W95 box at office, didn't try at home - FreeBSD).
So, instead you must use ($username ne "").
BTW, I'd suggest the following structure:
### parse-form-data
if ($username ne ""){
&output;
&input;
exit;
} else {
&input;
exit;
}
--
=== PLEASE REMOVE ## FROM MY EMAIL ADDRESS! GUESS WHY :-) ===
Plamen Petkov
mailto:plamendp##@techno-link.com
http://bgbook.hypermart.net
------------------------------
Date: Fri, 7 Aug 1998 14:06:59 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: Directory size (including all clilt files / dirs) - help
Message-Id: <ExBoJn.FCI@world.std.com>
"Jason Morehouse" <jm@interlog.net> writes:
>Anyone know the quickest way using non system calls to get the size of a
>directory and all of its contents (including all child directories / files)?
[You've already got some other answers, so I don't feel to bad about
giving you this non-answer.]
Be careful of your terminology. Most people dealing with computer
programming consider the term "system call" to mean "a call to the
operating system", not "a call to the system() function". There may be
ways of determining the size of a file system hierarchy without
calling another program via system() or the backtick operator, but I
doubt there is any way of finding it out without making calls to the
operating system.
--
Andrew Langmead
------------------------------
Date: Fri, 07 Aug 1998 15:07:10 GMT
From: bart.mediamind@tornado.be (Bart Lateur)
Subject: Re: File already opened by another process?
Message-Id: <35d017d9.11737582@news.tornado.be>
Tom Christiansen wrote:
>(You have queer ^M's in your message. Better fix that.)
>
>You'll need the cooperation of your operating system -- you _^Hd_^Ho have
>one of those, don't you?
You have queer ^H's in your message. Better fix that.
:-)
Besides, RFC-821 (SMTP) constantly mentions CRLF as line terminators.
It's not because YOUR news reader software falls over them...
Bart.
------------------------------
Date: 7 Aug 1998 15:32:40 GMT
From: neil@domingo.concordia.ca (Neil Kandalgaonkar)
Subject: Re: Help Help Please Help !
Message-Id: <6qf6mo$625$1@newsflash.concordia.ca>
>Wei-Jen Chang wrote;
>#
># The result is: 11234566
># but I image the result should be : 112233445566
>
This will also do what you want:
@x = (0,1,2,3,4,5);
@xx = map (($_, $_), @x);
print join ("", @xx) . "/n";
Even if you're a beginner, you should learn to use map() -- truly one of
the coolest built-in functions. (man perlfunc for the syntax.)
------------------------------
Date: Fri, 7 Aug 1998 17:40:14 +0200
From: "Ronald van Gogh" <Ronald.vanGogh@nl.origin-it.com>
Subject: HELP WANTED: Problems with Servers Side Includes (SSI) on IIS 4.
Message-Id: <6qf841$pd@dibbs1.mpn.cp.philips.com>
I have installed the IIS webserver of Microsoft release 4 and installed Perl
as well.
I modified the registry file as described so many times, but if i try to use
a perl script as a SSI (Server Side Include) i do get the following message:
Failed to execute script '/Scripts/uuu.pl': Win32 Error Code = 3
If i run the perl script manually i see no problems.
Can anybody help me with this ?
Kind regards, Ronald van Gogh
------------------------------
Date: Fri, 07 Aug 1998 14:37:17 GMT
From: pdalton@my-dejanews.com
Subject: illegal seek error message
Message-Id: <6qf3eu$5g$1@nnrp1.dejanews.com>
Hi,
I am using these lines in a script to add a user to a system from
a www form.
!/usr/bin/perl -w
# A script to add a new user.
$date = `/bin/date +%m%Y`;
print $!;
print $date;
chomp($date);
use CGI qw(:standard);
$query = new CGI;
... some stuff
Here is the error I am getting from the shell. It manifests itself in the
operation of the script by not finding the date and printing out a newline.
I cannot foigure out what the problem is. Permissions look ok,
and its kind of sporadic. I can run it a few times, no prob, then the above
starts to happen.
Any ideas gratefully accepted!
Paul.
Name "main::pass" used only once: possible typo at ./add line 56.
Name "main::uname" used only once: possible typo at ./add line 56.
Illegal seek081998
(offline mode: enter name=value pairs on standard input)
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum
------------------------------
Date: Fri, 7 Aug 1998 11:29:16 +0100
From: "Colin J Denman" <colin@softc.co.uk>
Subject: Installing Perl 5.004_04 on SCO Unixware 2.x
Message-Id: <35cafde3.0@nnrp1.news.uk.psi.net>
Can anyone help:
I'm having problems with the 'make test' phase of installation.
The test "lib/io_sel.t" fails after 10 items, complaining that:
"select not implemented at ../lib/IO/Select.pm line 259"
"FAILED at test 11"
Running the harness test yields:
"Test returned status 2 (wstat 512, 0x200)"
"DIED. Failed tests 11-21"
Is this an interface to the select(3) clib function?
Is this a significant problem?
Is it fixable?
TIA
Colin J Denman
colin@softc.co.uk
------------------------------
Date: Fri, 07 Aug 1998 16:55:41 +0200
From: Thomas Jespersen <thomas@daimi.aau.dk>
Subject: Re: MAJOR PROBLEMS
Message-Id: <35CB156D.C5664AFD@daimi.aau.dk>
marlee wrote:
>
> I'm working on a simple email form script the entir script looks correct
> but when i submit the form on the webpage netscape come back and displays
> an error message that says "Out of Memory!" does anyone know what this
> problem could be
It means that netscape is out of memory.
Sorry, we can only give a good answer if you post some of your code.
(especially what is happening after submitting).
------------------------------
Date: Fri, 07 Aug 1998 15:20:30 GMT
From: rook_ki@hotmail.com
Subject: oraperl
Message-Id: <6qf5vu$2tj$1@nnrp1.dejanews.com>
Hi,
Does anyone know what is the latest version of oraperl is and where I can
download it. Please reply to me at rook_ki@hotmail.com. I do not read this
newsgroup very often. Thank you.
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum
------------------------------
Date: Fri, 7 Aug 1998 14:01:05 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: Perl Docs.. forget the original post
Message-Id: <ExBo9t.B98@world.std.com>
pudge@pobox.com (Chris Nandor) writes:
>In article <6qcdja$3hp$3@csnews.cs.colorado.edu>, tchrist@mox.perl.com
>(Tom Christiansen) wrote:
># If one were to run vi or emacs under OS/2, would that act ipso facto
># make them `OS/2 tools'? I'm not sure I agree.
>Yes, it would. Else I don't know what an OS/2 tool is, let alone a Unix tool.
I'd call something a "Unix tool" if it worked according to the "Unix
Philosophy". A simple program that does one thing and does it well;
expect its inputs and outputs to be connected to other tools; etc.
And by that criteria, "emacs" is not a unix tool, and "vi" may just
barely make it.
--
Andrew Langmead
------------------------------
Date: 7 Aug 1998 14:20:40 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Perl Docs.. forget the original post
Message-Id: <6qf2fo$9hv$1@csnews.cs.colorado.edu>
[courtesy cc of this posting sent to cited author via email]
In comp.lang.perl.misc, aml@world.std.com (Andrew M. Langmead) writes:
:I'd call something a "Unix tool" if it worked according to the "Unix
:Philosophy".
True. But remember this one?
"The UNIX Way of doing something [...] is to make it look as much like
a filter as possible." --Richard O'Keefe
--tom
--
I dunno, I dream in Perl sometimes...
--Larry Wall in <8538@jpl-devvax.JPL.NASA.GOV>
------------------------------
Date: 7 Aug 1998 15:21:10 GMT
From: neil@domingo.concordia.ca (Neil Kandalgaonkar)
Subject: Re: perl PARSER
Message-Id: <6qf616$6m4$1@newsflash.concordia.ca>
In article <35CADE1C.D02D9D48@tech.eurodyn.com.gr>,
Jean-Michel Hemstedt <djinn@tech.eurodyn.com.gr> wrote:
>Hi
>
>Is there a perl parser that we can use to extract some statements from a
>script ?
>I think about all "print" statements or all text/string assignments.
>
>The debugger seems not convenient since I don't want to run the script
>to get those statements.
You could try using perl.
open (MYSCRIPT, 'myscript.pl');
while (<MYSCRIPT>) {
print if /print/;
}
------------------------------
Date: Fri, 07 Aug 1998 10:05:42 -0400
From: pudge@pobox.com (Chris Nandor)
Subject: Re: perlfaq - frequently asked questions about Perl (part 0 of 9)
Message-Id: <pudge-0708981005420001@192.168.0.3>
In article <6qeu7b$6ls$2@csnews.cs.colorado.edu>, tchrist@mox.perl.com
(Tom Christiansen) wrote:
# [courtesy cc of this posting sent to cited author via email]
#
# In comp.lang.perl.misc, pudge@pobox.com (Chris Nandor) writes:
# :In addition to perldoc on Win32 and Shuck on Mac OS, POD is just a very
# :simple text markup and is easily readable with any text editor.
#
# Er, don't you mean pager? Why are you editing?
Pager? What's a pager?
No, on our GUI platforms we often use editors for viewing arbitrary text files.
--
Chris Nandor mailto:pudge@pobox.com http://pudge.net/
%PGPKey = ('B76E72AD', [1024, '0824090B CE73CA10 1FF77F13 8180B6B6'])
------------------------------
Date: 7 Aug 1998 14:22:03 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: perlfaq - frequently asked questions about Perl (part 0 of 9)
Message-Id: <6qf2ib$9hv$2@csnews.cs.colorado.edu>
[courtesy cc of this posting sent to cited author via email]
In comp.lang.perl.misc, pudge@pobox.com (Chris Nandor) writes:
:No, on our GUI platforms we often use editors for viewing arbitrary text files.
That's a silly idea. Why would you use an editor when you aren't editing?
That's as stupid as using a web browser to read mail. Of course, I guess
on those platforms, you do that, too. :-(
--tom
--
Pointers are sharp tools, and like any such tool, used well they can
be delightfully productive, but used badly they can do great damage
(I sunk a wood chisel into my thumb a few days before writing this).
--Rob Pike
------------------------------
Date: Fri, 07 Aug 1998 11:15:05 -0400
From: John Porter <jdporter@min.net>
Subject: Re: perlfaq - frequently asked questions about Perl (part 0 of 9)
Message-Id: <35CB19F9.680C@min.net>
Tom Christiansen wrote:
>
> [courtesy cc of this posting sent to cited author via email]
>
> In comp.lang.perl.misc, pudge@pobox.com (Chris Nandor) writes:
> :In addition to perldoc on Win32 and Shuck on Mac OS, POD is just a very
> :simple text markup and is easily readable with any text editor.
>
> Er, don't you mean pager? Why are you editing?
I think he said that because editors are FAR more abundant than
"pagers" on gui-only pseudo-OS's.
--
John Porter
------------------------------
Date: 7 Aug 1998 11:17:47 -0400
From: mjd@op.net (Mark-Jason Dominus)
Subject: Re: perlfaq - frequently asked questions about Perl (part 0 of 9)
Message-Id: <6qf5qr$a8j$1@monet.op.net>
In article <6qf2ib$9hv$2@csnews.cs.colorado.edu>,
Tom Christiansen <tchrist@mox.perl.com> wrote:
> [courtesy cc of this posting sent to cited author via email]
>
>In comp.lang.perl.misc, pudge@pobox.com (Chris Nandor) writes:
>:No, on our GUI platforms we often use editors for viewing arbitrary text files.
>
>That's a silly idea. Why would you use an editor when you aren't editing?
Because an editor has two functions: To display the contents of a file
and to allow you to edit it. Good editors are very good at displaying
files.
Followups to comp.misc.
------------------------------
Date: Fri, 07 Aug 1998 11:20:45 -0400
From: pudge@pobox.com (Chris Nandor)
Subject: Re: perlfaq - frequently asked questions about Perl (part 0 of 9)
Message-Id: <pudge-0708981120450001@192.168.0.3>
In article <6qf2ib$9hv$2@csnews.cs.colorado.edu>, tchrist@mox.perl.com
(Tom Christiansen) wrote:
# [courtesy cc of this posting sent to cited author via email]
#
# In comp.lang.perl.misc, pudge@pobox.com (Chris Nandor) writes:
# :No, on our GUI platforms we often use editors for viewing arbitrary
text files.
#
# That's a silly idea. Why would you use an editor when you aren't editing?
Why not? I don't see why it makes one jot of difference.
# That's as stupid as using a web browser to read mail. Of course, I guess
# on those platforms, you do that, too. :-(
No, I don't. But it not similar, anyway. Web sites and mail are two
different things. Text and text are the same thing.
--
Chris Nandor mailto:pudge@pobox.com http://pudge.net/
%PGPKey = ('B76E72AD', [1024, '0824090B CE73CA10 1FF77F13 8180B6B6'])
------------------------------
Date: Fri, 7 Aug 1998 11:23:17 -0400
From: phenix@interpath.com (John Moreno)
Subject: Re: perlfaq - frequently asked questions about Perl (part 0 of 9)
Message-Id: <1dde26h.149hp571h2se3qN@roxboro0-001.dyn.interpath.net>
Tom Christiansen <tchrist@mox.perl.com> wrote:
> [courtesy cc of this posting sent to cited author via email]
>
> In comp.lang.perl.misc, pudge@pobox.com (Chris Nandor) writes:
> :No, on our GUI platforms we often use editors for viewing arbitrary text
> :files.
>
> That's a silly idea. Why would you use an editor when you aren't editing?
But you do edit - you copy the interesting tibit that explains just why
this'n'that doesn't do what you want it to. You may even add comments
saying what a idiot you were for not getting it the first time.
(all theoretical examples - I never do any of that stuff :) ).
--
John Moreno
------------------------------
Date: Fri, 07 Aug 1998 11:27:43 -0400
From: John Porter <jdporter@min.net>
Subject: Re: perlfaq - frequently asked questions about Perl (part 0 of 9)
Message-Id: <35CB1CEF.458@min.net>
Curtis Jewell / Dennis Whalen wrote:
>
> Peter A Fein wrote in message ...
> >I guess it's ok (like I'm some authority or something? Sheesh). I
> >would have thought a pointer to those docs (in the form of see 'man
> >perlfaq') would have been sufficient. But hey if it works, whatever.
>
> What about those unlucky ones who do not have a man (Win32, Mac)? I've been
> looking for a man variant at all (much less that RUNS) on Win95 for a YEAR.
>
> Maybe someone should send me the markup language used and I'll write a
> graphical one!
A. If you're on Windows, you don't need man. If you have perl, then you
have the pod (plain ol' documentation) files, and the standard pod
viewer, perldoc (which you run at the command prompt).
Peter should have said "perldoc perlfaq".
B. If you are inclined to make a better pod viewer, the format is
documented the same place everything else about perl is documented:
in/under your perl's installation directory. Also, included in the
perl distribution are some modules which make it easy to parse pod
files.
C. If you are actually inclined to make a manpage viewer, the format
is usually nroff or troff. You didn't find that out, in a year of
searching?
hth,
--
John Porter
------------------------------
Date: 7 Aug 1998 15:50:08 GMT
From: Zenin <zenin@bawdycaste.org>
Subject: Re: perlfaq - frequently asked questions about Perl (part 0 of 9)
Message-Id: <902505625.856430@thrush.omix.com>
[posted & mailed]
Tom Christiansen <tchrist@mox.perl.com> wrote:
>snip<
: That's a silly idea. Why would you use an editor when you aren't editing?
Better search abilities (ok, so less can probably beat vi here,
but not if you don't have /usr mounted), side by side viewing of
multiple files at once or the same file at multiple places (such as
example and synopsis sections at once (in editors that can handle
split-screen), ability to highlight and print blocks of a page,
etc...
There are very few Unix based editors that do not have a "read
only" mode (vi -R (aka "view"), etc) for just this kind of use.
-
-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: 7 Aug 1998 12:59:45 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: perltoot q: overriding new method and calling superclass' new
Message-Id: <6qeto1$6ls$1@csnews.cs.colorado.edu>
[courtesy cc of this posting sent to cited author via email]
In comp.lang.perl.moderated, Chris Sidi <sidi@gt.ed.net> writes:
:* Why do we bless $self after it's already been
:blessed by Person using the double-argument form of
:bless (with the same class Employee uses).
Due to unmerited paranoia on my part. The base class constructor should
do the right thing. Reblessing is nearly always a bad idea, although
Gisle has been do so rather cleverly in the new LWP.
:* On the call to SUPER::new(), why not pass in @_?
:That way if the superclass you're inheriting from
:ever needs arguments, there they are.
Because in this particular case, one "knew" that the base class didn't
need such. Certainly it's an odd mix of code. The example in the Perl
Cookbook for this is:
sub new {
my $classname = shift; # What class are we constructing?
my $obref = $classname->SUPER::new(@_);
$obref->_init(@_);
return $obref; # And give it back
}
sub _init {
my $self = shift;
$self->{START} = time(); # init data fields
$self->{AGE} = 0;
$self->{EXTRA} = { @_ }; # anything extra
}
Both SUPER::new and _init have been called with any remaining
arguments. That way the user might pass other field initializers in,
as in:
$ob = Widget->new( haircolor => red, freckles => 121 );
Whether you store these user parameters in their own extra hash or
not is up to you.
Note that SUPER only works on the first overridden method. If your
@ISA array has several classes, it only gets the first one. A manual
traversal of @ISA is possible, but probably not worth the hassle.
I haven't gone back and retrofitted perltoot with my seasoned perscpetive.
For most constructors (allocators), the canonical
sub new {
my $class = shift;
my $self = { };
bless($self, $class);
return $self;
}
should do just fine. Rarely do you need something more complicated.
Sometimes you find yourself needing another object of the same type
as the current one. You could do this:
$ob1 = SomeClass->new();
# later on
$ob2 = (ref $ob1)->new();
But that's not very clear. It's clearer to have a single constructor
that can be called on the class or an existing object. As a
class method, it should return a new object with the default
initialization. As an instance method, it should return a new object
initialized from the object it was called on.
$ob1 = Widget->new();
$ob2 = $ob1->new();
Here's a version of new that takes this into consideration:
sub new {
my $proto = shift;
my $class = ref($proto) || $proto;
my $parent = ref($proto) && $proto;
my $self;
# check whether we're shadowing a new from @ISA
if (@ISA && $proto->SUPER::can('new') {
$self = $proto->SUPER::new(@_);
} else {
$self = {};
bless ($self, $parent);
}
$self->{PARENT} = $parent;
$self->{START} = time(); # init data fields
$self->{AGE} = 0;
return $self;
}
Initializing doesn't have to mean simply copying values from the
parent. If you're writing a linked list or binary tree class, your
constructor can return a new object linked into the list or tree,
when called as an instance method.
But now we're getting into some design issues where other approaches
might quite reasonably have merit as well.
--tom
PS: That was pinched (and touched up) from the Perl Cookbook. See
http://perl.oreilly.com/cookbook/ for details.
--
If you want to see useful Perl examples, we can certainly arrange to have
comp.lang.misc flooded with them, but I don't think that would help the
advance of civilization. :-) --Larry Wall in <1992Mar5.180926.19041@netlabs.com>
------------------------------
Date: 7 Aug 1998 14:16:55 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: Possible to pass Associative Arrays to Subroutines??
Message-Id: <6qf28n$qsj$1@pegasus.csx.cam.ac.uk>
Ben Howe <benhowe51-NO@SPAM-hotmail.com> wrote:
>Does anybody out there know how to pass associative arrays to subroutines
>without having do deal with resorting everything when it arrives?
Hashes (formerly known as associative arrays) are essentially unordered.
So there's no question of (re)sorting. You can pass a hash to a
subroutine directly:
sub direct {
my %hash = @_;
print $hash{a};
};
my %h = ( a => 1, b => 2 );
direct(%h);
Or you can pass it more efficiently as a reference:
sub byref {
my $hashref = shift;
print $hashref->{a}
};
my %h = ( a => 1, b => 2 );
byref(\%h);
Mike Guy
------------------------------
Date: Fri, 07 Aug 1998 18:59:39 GMT
From: hector@followme.com (Hector Catre)
Subject: Re: Retrieving file from REMOTE_ADDR ... HELP!
Message-Id: <6qf7qj$5bf$1@demon.uunet.ca>
In article <Pine.HPP.3.95a.980806112953.18593A-100000@hpplus01.cern.ch>, "Alan J. Flavell" <flavell@mail.cern.ch> wrote:
>> >Of course, there's nothing Perl-specific about this. If your problem is
>> >with the CGI interface, perhaps the docs, FAQs, and newsgroups about the
>> >CGI interface and related topics would help you. Good luck!
>
>Which you apparently were too stubborn to pay attention to.
>
Excuse me but PERL's main usefulness is as a server side scripting language. I
just figured you guys would know just as much about CGI programming with Perl.
Apparently, I stand corrected so sorry for the inconvience but I thought you
guys knew more then you actually do.
------------------------------
Date: Fri, 07 Aug 1998 15:17:57 GMT
From: sneaker@fccj.org
Subject: Scoping Question
Message-Id: <6qf5r5$2rh$1@nnrp1.dejanews.com>
why does
open (outfile, "mytest") or die "can't: $!";
{ # some block
s/olddata/newdata/;
print outfile;
}
close (outfile) or die "can't: $!";
Truncates the data prior to match, and
{ # some block
open (outfile, "mytest") or die "can't: $!";
s/olddata/newdata/;
print outfile;
close (outfile) or die "can't: $!";
}
Doesn't? Any ideas, thoughts, cussin' & discussin' ?
Hmmm,
-Sneex- :]
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum
------------------------------
Date: Fri, 7 Aug 1998 11:09:04 -0400
From: Richard Kim <rkim@temple.edu>
Subject: system command
Message-Id: <Pine.OSF.3.91.980807110716.7758A-100000@thunder.ocis.temple.edu>
Is there any reason why I can't do this?
system("cp", "*.whatever", "/tmp/whatever/");
If I use individual files it seems to work fine, but I can't seem to use
the wild card.
Any suggestions?
Rich
[5;1m rkim@temple.edu [0m
------------------------------
Date: Fri, 07 Aug 1998 11:34:10 -0400
From: John Porter <jdporter@min.net>
Subject: Re: Teaching Perl
Message-Id: <35CB1E72.3F00@min.net>
David Cantrell wrote:
>
> Jaime Metcher <metcher@spider.herston.uq.edu.au>:
> >`net config` =~ /User name\s*(\S*)\n/; $username = $1;
>
> It would appear that 'net config' only tells you about usernames when
> on 9x and not on NT.
What? You didn't try `net config workstation` ???
--
John Porter
------------------------------
Date: Fri, 07 Aug 1998 11:35:21 -0400
From: John Porter <jdporter@min.net>
Subject: Re: Teaching Perl
Message-Id: <35CB1EB9.D0@min.net>
Jaime Metcher wrote:
>
> John Porter wrote:
> >
> > and a mere smattering of simple regexes.
>
> From an advocacy point of view (if we're trying to "sell" perl as well
> as teach it), regexes are vital. Complex data structures are always
> going to look complex. Something like:
>
> print if /something/;
> `net config` =~ /User name\s*(\S*)\n/; $username = $1;
This is the sort of thing I had in mind when I said "simple regexes".
--
John Porter
------------------------------
Date: 7 Aug 1998 14:20:55 GMT
From: cpierce1@cp500.fsic.ford.com (Clinton Pierce)
Subject: Underwood Typewriter and the backslash
Message-Id: <6qf2g7$3nd7@eccws1.dearborn.ford.com>
I like the new cover to The Perl Journal, with the attempted run
of ./Configure on the Underwood, but I have a question. Since the
Underwood Typewriter has no backslash key (\), does Perl now support
trigraphs for those architectures?
Thus:
$aref=\@ARRAY;
s/\W\w+\W//;
print "Hello, World.\n";
Become:
$aref=??/@ARRAY;
s/??/W??/w+??/W//;
print "Hello, World.??/n";
--
+------------------------------------------------------------------------+
| Clinton A. Pierce | "If you rush a Miracle Man, | http://www. |
| cpierce1@ford.com | you get rotten miracles" | dcicorp.com/ |
| fubar@ameritech.net |--Miracle Max, The Princess Bride| ~clintp |
+------------------------------------------------------------------------+
GCSd-s+:+a-C++UALIS++++P+++L++E---t++X+b+++DI++++G++e+>++h----r+++y+++>y*
------------------------------
Date: Fri, 07 Aug 1998 11:30:26 -0500
From: brett@tvdata.com.nospam.please (Brett Goldstock)
Subject: Re: wildcards don't work with link function?
Message-Id: <brett-ya02408000R0708981130260001@news.tvdata.com>
In article <Pine.GSO.4.02.9808061843590.74-100000@user2.teleport.com>, Tom
Phoenix <rootbeer@teleport.com> wrote:
> On Thu, 6 Aug 1998, Brett Goldstock wrote:
>
> > It looks like the link function will accept neither wildcards nor
> > directories (without a file) as arguments. Is there a way around this?
>
> You can't make arbitrary hard link to a fileglob or a directory on a Unix
> type filesystem. Maybe you want to make a symbolic link? But I'm not sure
> why you'd want a symlink to (or from?) a fileglob.
Sure I can, as long as it's the same file system.
e.g.
ln /usr/local/stuff/abc* /usr/local/morestuff
The above will make hard links to everything that matches the wilcard into
the directory "morestuff".
> > Alternatively, is there some code lying around somewhere to take a
> > wildcard filename and return the real filenames?
>
> It sounds as if you want the glob function. Hope this helps!
Where is this documented? Is it part of the standard perl distribution?
--
|Brett M. Goldstock brett@tvdata.com|
|Senior Technical Analyst/Sys Admin http://www.tvdata.com|
|TVData 800/833-9581|
| "We tell the world what's on TV." |
------------------------------
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 3389
**************************************