[9561] in Perl-Users-Digest
Perl-Users Digest, Issue: 3155 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Jul 14 15:17:20 1998
Date: Tue, 14 Jul 98 12:00:51 -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 Tue, 14 Jul 1998 Volume: 8 Number: 3155
Today's topics:
"Telnet" Perl Script <v.baskot@hydro.on.ca>
Re: "The opposite of read()" <zenin@bawdycaste.org>
Re: .pm <rra@stanford.edu>
Re: attachment to email <maierc@chesco.com>
Re: Bar and Line Charts in Perl (Sitaram Chamarty)
Build problems with toke.c on OSF/1 bowler@eisner.decus.org
Re: Chomp() on win32 and unix perl <jdf@pobox.com>
Client/Server examples anyone? (Joseph M Carlton)
Re: Code for deciding week number? (Sitaram Chamarty)
Re: direct access? (Abigail)
eof condition not detected until too late... why? (Miguel Cruz)
file handle as string <xah@shell13.ba.best.com>
Re: First meeting of Dallas.pm (David Adler)
Re: Help - search table across network <rra@stanford.edu>
Re: HELP: Internet Database Design questions... <macdonaldrj@bv.com>
Re: HELP: Internet Database Design questions... <eppie@interport.net>
HELP: Programming Question <paul.hill@cas-inc.com>
Re: How can you encrypt a CGI script on a server so it (Eric Harley)
Re: HTTP POST format Please Help me! <Tony.Curtis+usenet@vcpc.univie.ac.at>
Re: Indentation <rra@stanford.edu>
Re: Indentation (Andre L.)
invoking href="www.mysite.com/cgi-bin/perl_script?$var <sirron@mail.mcoe.k12.ca.us>
Re: invoking href="www.mysite.com/cgi-bin/perl_script?$ <jgraham@uvic.ca>
Locking SDBM files <clint@netcomuk.co.ukXX>
Re: Locking SDBM files <clint@netcomuk.co.ukXX>
Re: Locking SDBM files (Michael J Gebis)
ODBC Access <lrouman@mediaone.net>
pattern matching with variables? <mike@umcs.maine.edu>
Re: pattern matching with variables? (Larry Rosler)
Re: portability of -s (Michael J Gebis)
Re: Trouble with AOL (brian d foy)
trying to install perl <yazan@natsys2.cceer.lsu.edu>
Undefined subroutine &main::parse_htmlfile <frankie@etsetb.upc.es>
Re: Undefined subroutine &main::parse_htmlfile <frankie@etsetb.upc.es>
Why the "};" on p.231 of PP (2)? <NOSPAMkEynOn@panix.comNOSPAM>
Win NT Perl 5.0 Y2K compliance <michael_yee@corp.disney.com>
Re: Win32 - SMTP <bowlin@sirius.com>
Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 14 Jul 1998 14:05:26 -0400
From: Vlado Baskot <v.baskot@hydro.on.ca>
Subject: "Telnet" Perl Script
Message-Id: <35AB9DE6.FF90D667@hydro.on.ca>
Could anyone please help me to find Perl "Script" to telnet and check if
process is running [ps -ef OR ps -ax]
Thanks Vlado [v.baskot@hydro.on.ca]
------------------------------
Date: 14 Jul 1998 17:56:57 GMT
From: Zenin <zenin@bawdycaste.org>
Subject: Re: "The opposite of read()"
Message-Id: <900439544.489625@thrush.omix.com>
M.J.T. Guy <mjtg@cus.cam.ac.uk> wrote:
: John Siracusa <macintsh@cs.bu.edu> wrote:
: >Oh, and while I'm here, word on the street (heh) is that
: >calling functions with &func is now deprecated. Why?
:
: I tend to avoid &func because it looks ugly. But that's something
: very different from being deprecated. And of course, there are cases
: where the & is essential. As "perldoc perlsub" says
Don't forget the fact that perl doesn't do prototype checks if
you prefix &, or that use strict can't check it for typos.
&foo(@args); ## No prototype check, no typo check
&foo; ## Ditto, but anything in @_ gets carried over
## implicitly, which can/will supprise you if that's
## not what you wanted! -Also see "goto &foo" syntax
## magic in perlsub.
foo(@args); ## Prototype checks (if foo() has been declared
## first!), but no use strict typo checks (at least
## not in 5.00404...
foo @args; ## Prototypes are checked, and use strict strict
## can check for typos ("use of bare word" errors)
## at compile time.
--
-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: 14 Jul 1998 10:04:58 -0700
From: Russ Allbery <rra@stanford.edu>
Subject: Re: .pm
Message-Id: <m3ww9ggy85.fsf@windlord.Stanford.EDU>
Susan Cheung <sschng6@ie.cuhk.edu.hk> writes:
> I'm now try to write a programe using .pm, however, the following errors
> found.
> Can't locate db_File.pm in @INC (@INC contains:
Try calling it "DB_File" instead and see if that works better. Perl is
case-sensitive.
--
#!/usr/bin/perl -- Russ Allbery, Just Another Perl Hacker
$^=q;@!>~|{>krw>yn{u<$$<[~||<Juukn{=,<S~|}<Jwx}qn{<Yn{u<Qjltn{ > 0gFzD gD,
00Fz, 0,,( 0hF 0g)F/=, 0> "L$/GEIFewe{,$/ 0C$~> "@=,m,|,(e 0.), 01,pnn,y{
rw} >;,$0=q,$,,($_=$^)=~y,$/ C-~><@=\n\r,-~$:-u/ #y,d,s,(\$.),$1,gee,print
------------------------------
Date: Tue, 14 Jul 1998 17:10:11 GMT
From: Charles Maier <maierc@chesco.com>
Subject: Re: attachment to email
Message-Id: <35AA0B9C.28AE@chesco.com>
Jim Bowlin wrote:
>
> kscope@the-city.com wrote:
>
> > charles - i tried this script, and what i got [after i remembered the back
> > ticks] was the contents of the .htm file printed at the end of the body of the
> > email message. i'm also on a unix box with apache - windows based mail client.
> > any thoughts?
>
> I can send you a module that will send email with attachments.
> It works on Unix and Windows.
>
> -- Jim Bowlin
If it is not too much trouble... could you send it to me??
Thnaks in advance...
--
Chuck Maier
CDM Consulting Services
http://www.cdmcon.com
(610) 943-2726
------------------------------
Date: 14 Jul 1998 17:28:05 GMT
From: sitaram@diac.com (Sitaram Chamarty)
Subject: Re: Bar and Line Charts in Perl
Message-Id: <slrn6ql20c.e6i.sitaram@ltusitaram.diac.com>
On 9 Jul 1998 00:49:43 GMT, Tom Christiansen <tchrist@mox.perl.com> wrote:
> [courtesy cc of this posting sent to cited author via email]
>
>In comp.lang.perl.misc, "Jim Babbington" <jwb79@mail.idt.net> writes
>using X-Newsreader: Microsoft Internet News 4.70.1155:
>
>(Innumerable bad wraps by a cruddy newsreader deleted.)
>
>:If I could do this with excess, I would run out and give MS my money
>:for a copy of excell!!
>
>I sincerely and totally hope you wouldn't get the same quality as the
>Gods of Redmond apparently gave you with your "newsreader".
I sincerely and totally hope he *does* get the same "quality".
Sitaram
------------------------------
Date: Tue, 14 Jul 1998 18:06:01 GMT
From: bowler@eisner.decus.org
Subject: Build problems with toke.c on OSF/1
Message-Id: <1998Jul14.140601.1@eisner>
I'm trying to install Perl 5.004_04 on a dec alpha running version 3.0c of
OSF/1. I know it's old, but I'm stuck there...
So far, all of the Perl modules compile OK except for toke.c which never seems
to complete.
The relavent output from make is
$ make
`sh cflags libperl.a toke.o` toke.c
CCCMD = cc -DPERL_CORE -c -std -D_INTRINSICS -D__LANGUAGE_C__ -O2
-Olimit 3200
Any ideas?
TIA,
Bruce
--
+---------------------+---------------------------------------+-------------+
| Bruce Bowler | He who laughs, lasts | Usual |
| 1.207.633.9600 | | Disclaimers |
| BBowler@Bigelow.org | Anonymous | Apply |
+---------------------+---------------------------------------+-------------+
------------------------------
Date: 14 Jul 1998 13:18:15 -0500
From: Jonathan Feinberg <jdf@pobox.com>
To: "S.Plant" <scp@cadcentre.co.uk>
Subject: Re: Chomp() on win32 and unix perl
Message-Id: <u34kcn4o.fsf@mailhost.panix.com>
"S.Plant" <scp@cadcentre.co.uk> writes:
> Jonathan Feinberg wrote in message ...
> > chomp() is documented to remove $/ from the end of a string. Here's
> >a hint:
>
> Aha, thats usefull, I can use that bit. (thinks . o 0 (Hmm must read
> that blue book more often)..)
You may leave the blue book in its place on your shelf for this bit of
info, as it's found in the docs that accompany perl.
perldoc -f chomp
--
Jonathan Feinberg jdf@pobox.com Sunny Brooklyn, NY
http://pobox.com/~jdf/
------------------------------
Date: 14 Jul 1998 18:48:35 GMT
From: carltjm@mail.auburn.edu (Joseph M Carlton)
Subject: Client/Server examples anyone?
Message-Id: <6og963$92p$1@ultranews.duc.auburn.edu>
Well, since I haven't gotten any response from my post yesterday, I would
like to say that I have read a lot of stuff about clients, servers, and
sockets in the last couple of days and I am blown away. I don't know
where to start. I need to get an id number from a user via web page form
and search a table with this id number on a different computer on the
network. I assume that I need to set up a client and a server to do
this. Does anyone know where I can find an example client and server
similar to what I am trying to do? Your help is much appreciated. I
don't know where to go from this point. Thanks in advance.
--
Joey Carlton
Senior, Computer Engineering
Auburn University
carltjm@mail.auburn.edu
------------------------------
Date: 14 Jul 1998 17:28:07 GMT
From: sitaram@diac.com (Sitaram Chamarty)
Subject: Re: Code for deciding week number?
Message-Id: <slrn6ql23o.e6i.sitaram@ltusitaram.diac.com>
On Mon, 13 Jul 1998 07:43:42 GMT,
root.noharvest.\@not_even\here.com <root.noharvest.\@not_even\here.com> wrote:
>Thomas Albech <thomas@provideo.dk> Said this:
>
>>How do you mathematically decide, which week number we are currently in?
>>Is there any expression for it
>>in combination with the Time module?
>>
>
>I bet there's some module already... try the CPAN.
>
>http://www.perl.org/CPAN
>
>Since i've never needed the week number, I am not aware of any
>explicit tool/feature/function/whatever but I suspect there is
>something, especially in unix, to get this info directly. I mean, for
>some financial stuff, this would be important, I would think.
Quick "man date" on Linux shows the %U and $W flags give you a
week number...
------------------------------
Date: 14 Jul 1998 17:21:13 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: direct access?
Message-Id: <6og429$7i4$3@client3.news.psi.net>
Jim Lewis (jrl@ast.cam.ac.uk) wrote on MDCCLXXVIII September MCMXCIII in
<URL: news:35AB7834.6C12@ast.cam.ac.uk>:
++ Hi,
++
++ Is there any way in perl to replace a line in a file without having
++ to recreate the whole file? (i.e. like a direct access file in
++ FORTRAN)
Yes, use lines all of the same length. Or store your file in a
database. Or install an OS that stores text files as a set of
records.
Abigail
--
perl5.004 -wMMath::BigInt -e'$^V=new Math::BigInt+qq;$^F$^W783$[$%9889$^F47$|88768$^W596577669$%$^W5$^F3364$[$^W$^F$|838747$[8889739$%$|$^F673$%$^W98$^F76777$=56;;$^U=substr($]=>$|=>5)*(q.25..($^W=@^V))=>do{print+chr$^V%$^U;$^V/=$^U}while$^V!=$^W'
------------------------------
Date: 14 Jul 1998 18:37:31 GMT
From: mnc@diana.law.yale.edu (Miguel Cruz)
Subject: eof condition not detected until too late... why?
Message-Id: <6og8hb$h3s$1@news.ycc.yale.edu>
I'm reposting this with a more businesslike Subject since this is such a
no-nonsense group.
>I guess it's easiest to start with this foreshortened snippet:
>
>128 sub do_command {
>129 local $cmd = pop (@_);
>130 open(PIPE, $cmd." 2>&1 |");
>131 while (<PIPE>) {
>132 print;
>133 }
>134 close PIPE;
>135 }
>
>I know that looks remarkably dangerous, but let's just assume for now that
>I've checked the input or only I will be able to execute the code or
>something.
>
>Anyway, what used to happen was that the command in the argument to the
>subroutine would be executed, and stdout/stderr would be printed, and Perl
>would happily continue its work.
>
>Now I've moved this to an object, and it works almost the same - EXCEPT that
>after the command terminates (and, in this case, produces 4 lines of
>output), I get these messages:
>
> Use of uninitialized value at /home/mnc/tmm//NS_System.pm line 132, <PIPE>
> chunk 4.
> Use of uninitialized value at /home/mnc/tmm//NS_System.pm line 132, <PIPE>
> chunk 4.
> Unable to create sub named "" at /home/mnc/tmm//NS_System.pm line 132,
> <PIPE> chunk 4.
>
>...and then the Perl program is dead. I'm particularly curious about the
>last of the three messages.
>
>I don't understand what's changed to make 'while' seemingly unable to detect
>the closure of the pipe from $cmd.
>
>In order to demonstrate my ignorance, I tried changing the print variously
>to:
>
> print if $_;
> print unless eof();
> print if -t PIPE;
>
>...but none of these helped.
>
>I would be very grateful for any tutelage or tips; I couldn't find anything
>quite like this in older postings here or in the web sites that Altavista
>turned up.
>
>miguel
------------------------------
Date: 14 Jul 1998 09:53:19 -0700
From: Xah Lee <xah@shell13.ba.best.com>
Subject: file handle as string
Message-Id: <yo3hg0k8jcv.fsf@shell13.ba.best.com>
I leared in the Advanced Perl Programming book (p.50), that file handles can be strings too. I thought this is great.
The book says using strings is a bit slower than barewords, but I guess the speed difference is probably too small to be noticeable in general.
Are there anything I need to watch out if I forthwith always use strings as file handles?
Xah
xah@best.com
http://www.best.com/~xah/SpecialPlaneCurves_dir/specialPlaneCurves.html
Linux penguins make way: GNU HURD is coming! <www.gnu.org>
------------------------------
Date: 14 Jul 1998 18:12:36 GMT
From: dha@panix.com (David Adler)
Subject: Re: First meeting of Dallas.pm
Message-Id: <6og72k$4tr@news1.panix.com>
On Sun, 12 Jul 1998 22:14:59 GMT, Randal Schwartz <merlyn@stonehenge.com> wrote:
>Yes, it's nice that all the new Perl Monger groups seem to be
>following that fine old tradition established by the prototype PM
>(NY.PM) of holding their meetings in a bar. :-)
Well, we have branched out since those early days... we're meeting
tomorrow in a workplace. Eek. Come back Randal, we need your
guidance!
:-)
--
David H. Adler - <dha@panix.com> - http://www.panix.com/~dha/
The Inferno video is really in colour.
------------------------------
Date: 14 Jul 1998 09:58:10 -0700
From: Russ Allbery <rra@stanford.edu>
Subject: Re: Help - search table across network
Message-Id: <m33ec4id3x.fsf@windlord.Stanford.EDU>
Joseph M Carlton <carltjm@mail.auburn.edu> writes:
> Hello, I'm fairly new to perl. I need to search a table that exists on
> a different computer on the network. Then I need to create a graph with
> the returned data. This script will be called from a web page with the
> user inputing the search value. Can anyone give me any advice/tell me a
> document that I need to read?
Well, how are you supposed to obtain the table? If it's via HTTP, you
probably want to use LWP, which should be available from your local CPAN
mirror and does all of the HTTP request stuff for you.
--
#!/usr/bin/perl -- Russ Allbery, Just Another Perl Hacker
$^=q;@!>~|{>krw>yn{u<$$<[~||<Juukn{=,<S~|}<Jwx}qn{<Yn{u<Qjltn{ > 0gFzD gD,
00Fz, 0,,( 0hF 0g)F/=, 0> "L$/GEIFewe{,$/ 0C$~> "@=,m,|,(e 0.), 01,pnn,y{
rw} >;,$0=q,$,,($_=$^)=~y,$/ C-~><@=\n\r,-~$:-u/ #y,d,s,(\$.),$1,gee,print
------------------------------
Date: Tue, 14 Jul 1998 13:48:53 -0500
From: "dogmat" <macdonaldrj@bv.com>
Subject: Re: HELP: Internet Database Design questions...
Message-Id: <6og8t2$48u$1@bvbsd2.kc.bv.com>
- wrote in message <35aa9523.19867848@nntp.idsonline.com>...
>
>Just because you've had a pc on your desk for a couple years does not
>make you technically literate. Using word, or netscape is not a
>computer skill, it's being a computer user. Being a computer user
>does not qualify you to make suggestions about network environments.
>
Such insight. You probably hang out with your other lonely guy colleagues
making fun of all those silly users.
Grow up. And if you have any brains, keep an eye on NT. It may not be better
than Unix, but it wasn't any better than the Mac either.
------------------------------
Date: Tue, 14 Jul 1998 10:29:48 -0400
From: Catherine Skidmore <eppie@interport.net>
Subject: Re: HELP: Internet Database Design questions...
Message-Id: <35AB6B5C.19D9@interport.net>
- wrote:
>
> Catherine Skidmore <eppie@interport.net> Said this:
> >> >ooh. Access and ASP. or Access and Cold Fusion.
> >>
> >> Oh my GOD. No.
> >
> >care to defend that?
>
> Sure. If you plan on having an internet server, and you choose NT,
> you are defeating yourself before you even start. Sure, you'll be
> able to get a room full of administrative and non-technical people to
> make up some nice looking pages and hook your database into it, and
> all kinds of things - but what will happen is that your NT server will
> end up being down more often than it is up. NT is unstable, it scales
> horribly, it cannot handle medium traffic loads (even with a dual
> pentium pro, which I've tried oh so hard to make work with NT)
thanks for playing, please try again. i've been working with NT servers
for several years now, and they're the most stable that i've run across.
and if you want to come over and call my coworkers 'non-technical,'
you're more than welcome to.
> Just because you've had a pc on your desk for a couple years does not
> make you technically literate. Using word, or netscape is not a
> computer skill, it's being a computer user. Being a computer user
> does not qualify you to make suggestions about network environments.
nor does it you. quit being so defensive.
-catherine
http://www.arcus.net <-- proud NT users
--
Catherine Skidmore
http://www.suck-my-big.org
"You can kiss my ass and go straight to hell bitch." - danbel
------------------------------
Date: Tue, 14 Jul 1998 13:53:04 -0500
From: "J. Paul Hill" <paul.hill@cas-inc.com>
Subject: HELP: Programming Question
Message-Id: <35ABA90F.E684F8A6@cas-inc.com>
I have just started playing with Perl and have been working through the
exercises in my Perl book. I wrote a short script to calculate the
circumference of a circle and decided to give it the option of repeating
this calculation more than once. Unfortunately, the logic statement
seems to only execute correctly the first time through. After that, it
either quits or repeats infinitely depending on which logic operator I'm
using. Here's the code:
#!/usr/bin/perl
$answer = "yes";
$pi = 3.141592654;
while ($answer eq "yes") {
print "Input radius of circle ";
$radius = <STDIN>;
(Then it calculates the circumference and prints out the results)
print "Would you like to compute another circumference? ";
$answer = <STDIN>;
}
With the "while" it executes once. If I use "while ($answer ne "no")",
it computes repeatedly. What am I doing wrong?
Thanks for your help!
------------------------------
Date: Tue, 14 Jul 1998 11:43:40 -0700
From: eharley@pacbell.net (Eric Harley)
Subject: Re: How can you encrypt a CGI script on a server so it will not get "stolen"?
Message-Id: <eharley-1407981143400001@ppp-207-214-149-51.snrf01.pacbell.net>
> >>What would be the best way to protect my assets? I guess I could encrypt
> >>the script on the server and have another password-protected script that
> >>would decode it and then run it. Any ideas would be gratefully accepted.
> >>I would imagine that this is an issue others have faced.
> >>
See the camel book about source filters Pg. 368.
--
Eric Harley
Freelance Programmer
You need it done, I'm your man.
eharley@pacbell.net
http://burn.victim.com/~eharley
------------------------------
Date: 14 Jul 1998 19:11:14 +0200
From: Tony Curtis <Tony.Curtis+usenet@vcpc.univie.ac.at>
Subject: Re: HTTP POST format Please Help me!
Message-Id: <7xpvf8ici5.fsf@fidelio.vcpc.univie.ac.at>
Re: HTTP POST format Please Help me!, John
<jrenna@bellsouth.net> said:
John> Hi, Does anyone know how to do an HTTP Post to a
John> search engine using the HTTP protocol. I know the
John> format is something like this but I am missing
John> something where $HTTPDEF is in the request string
John> below: This is an example tme trying to submit an URL
John> to excite, but of course the HTTPDEF needs
John> information. Can anyone help me please?
perldoc LWP::UserAgent
perldoc HTTP::Request
these 2 modules do it all for you.
hth
tony
--
Tony Curtis, Systems Manager, VCPC, | Tel +43 1 310 93 96 - 12; Fax - 13
Liechtensteinstrasse 22, A-1090 Wien, AT | http://www.vcpc.univie.ac.at/
"You see? You see? Your stupid minds! Stupid! Stupid!" ~ Eros, Plan9 fOS.
------------------------------
Date: 14 Jul 1998 10:03:25 -0700
From: Russ Allbery <rra@stanford.edu>
Subject: Re: Indentation
Message-Id: <m3zpecgyaq.fsf@windlord.Stanford.EDU>
Tushar Samant <scribble@pobox.com> writes:
> I am now confused about indentation. Here is what I do: always indent
> with a tab, no matter what. Never a space. On the other hand, I always
> use spaces to "line things up" among lines with the same indent. Maybe
> my first programming boss WAS particularly anal, but I agree with this
> specific decision.
Well, different people have different styles, but I'd dearly like it if
people would stop using tabs.
Period.
For anything.
See, the problem is that people set their tab stops to all sorts of
different things, and then lines end up far too long under different
settings, things don't print right, you can't easily tell the printing
length of lines because you have embedded characters that take up more
room than others....
It's a mess.
I have emacs configured to never use tabs for anything unless I manually
insert a literal tab (or unless I'm editing a Makefile). I'd never change
back.
> I wonder if I am missing the point of tabstop 8, shiftwidth 4...
That's default emacs behavior; people aren't doing it intentionally.
--
#!/usr/bin/perl -- Russ Allbery, Just Another Perl Hacker
$^=q;@!>~|{>krw>yn{u<$$<[~||<Juukn{=,<S~|}<Jwx}qn{<Yn{u<Qjltn{ > 0gFzD gD,
00Fz, 0,,( 0hF 0g)F/=, 0> "L$/GEIFewe{,$/ 0C$~> "@=,m,|,(e 0.), 01,pnn,y{
rw} >;,$0=q,$,,($_=$^)=~y,$/ C-~><@=\n\r,-~$:-u/ #y,d,s,(\$.),$1,gee,print
------------------------------
Date: Tue, 14 Jul 1998 13:07:27 -0500
From: alecler@cam.org (Andre L.)
Subject: Re: Indentation
Message-Id: <alecler-1407981307270001@dialup-631.hip.cam.org>
In article <6oetod$6sb@tekka.wwa.com>, scribble@pobox.com wrote:
> I am now confused about indentation. Here is what I do: always indent
> with a tab, no matter what. Never a space. On the other hand, I always
> use spaces to "line things up" among lines with the same indent. Maybe
> my first programming boss WAS particularly anal, but I agree with this
> specific decision.
>
> A lot of (e.g.) CPAN code has a common pattern -- the indents are tabs
> and 4 spaces. I think that's rather like writing browser-specific HTML,
> because I HAVE to set my tabstops to 8 to read it. I generally like
> them more cuddled, 3 or even 2. So, chalk me up as someone who doesn't
> understand why there are spaces in the initial indent, and why people
> set tabstops different from shiftwidths. (Sorry if I am using a vi-
> specific term here, but I think the meaning is clear.)
>
> On the other hand, there's code which uses tabs to line things up
> in the middles of lines! That is not very tabstop-friendly either.
> As for spaces-only indentation -- to continue the metaphor, that's
> like formatting an HTML page with pixel-width directives; you have
> to insist on Netscape ...
>
> I wonder if I am missing the point of tabstop 8, shiftwidth 4...
> why not use tabs only and let the reader decide what's good for
> her.
Because tab stops can be set any which way, I prefer to use spaces to
indent code. Using spaces, IMO, ensures that the code always looks the
same, whatever the editor used to display it (provided it uses a
fixed-width font, which should always be the case, no?).
My feeling is that tabs are useful only in the context of a file format
that has the ability to record the positions of the tab stops, not in a
text-only format. Am I wrong in thinking that way?
A.L.
------------------------------
Date: Tue, 14 Jul 1998 11:04:02 -0700
From: Joseph Norris <sirron@mail.mcoe.k12.ca.us>
Subject: invoking href="www.mysite.com/cgi-bin/perl_script?$var with out user click
Message-Id: <35AB9D92.E9A7EB79@mail.mcoe.k12.ca.us>
Hello group,
I need to invoke an href from my one perl script after I load the $var.
At this point, I force the user to another screen with this href line
and make them click on it. Is there any other way? Thanks.
--
Joseph Norris (Perl - what else is there?/Linux/CGI/Mysql)
print @c=map chr
$_+100,(6,17,15,16,-68,-3,10,11,16,4,1,14,-68,12,1,14,8,
-68,4,-3,-1,7,1,14,-68,6,11,15,1,12,4,-68,-22,11,14,14,5,15,-90);
------------------------------
Date: Tue, 14 Jul 1998 18:55:18 GMT
From: "Jonah Graham" <jgraham@uvic.ca>
Subject: Re: invoking href="www.mysite.com/cgi-bin/perl_script?$var with out user click
Message-Id: <qQNq1.3895$xs3.2510888@news.rdc1.bc.wave.home.com>
Check out the message thread further down that starts with "Run a new page
from the output of cgi script"
Jonah
>
>
Joseph Norris wrote in message <35AB9D92.E9A7EB79@mail.mcoe.k12.ca.us>...
>Hello group,
>
>I need to invoke an href from my one perl script after I load the $var.
>At this point, I force the user to another screen with this href line
>and make them click on it. Is there any other way? Thanks.
>--
>Joseph Norris (Perl - what else is there?/Linux/CGI/Mysql)
>print @c=map chr
>$_+100,(6,17,15,16,-68,-3,10,11,16,4,1,14,-68,12,1,14,8,
>-68,4,-3,-1,7,1,14,-68,6,11,15,1,12,4,-68,-22,11,14,14,5,15,-90);
>
>
------------------------------
Date: Tue, 14 Jul 1998 18:02:23 +0100
From: "Clinton Gormley" <clint@netcomuk.co.ukXX>
Subject: Locking SDBM files
Message-Id: <6og2v6$onr$1@taliesin.netcom.net.uk>
OK - I know this has been discussed before (in fact the only reason i though
it an issue was because i saw previous postings!)
I have looked through the faq's and past articles without getting the
answers i need, so please...
I am using an sdbm file to allow people to register user names and passwords
with a web site.
I need to lock the file before making changes.
How do I do this thing?
A previous discussion between Jxrn-Morten Innselset and Stas Bekman about
the berkley db included some code :
use Fcntl;
$db_obj = tie %wdb, 'MLDBM', $full_mldb_name, O_CREAT|O_RDWR,
$mldb_mode or die $!;
$fd = $db_obj->fd;
open DB_FH, "+<&=$fd" or die "dup $!";
# Get the exclusive write lock
unless (flock (DB_FH, LOCK_EX | LOCK_NB)) {
print "$$: CONTENTION; must have exclusive lock! Waiting for write
lock ($!) ...." if $debug;
unless (flock (DB_FH, LOCK_EX)) { die "flock: $!" }
}
# use unless (flock ($fh, LOCK_SH | LOCK_NB)) for read lock
# do the changes
# Release the dbm and lockfile
$db_obj->sync(); # to flush
undef $db_obj;
untie %wdb;
close DB_FH;
Now :
(1) I'm a newbie and don't understand some of the above code,
(2) I get the feeling the same thing doesn't apply to sdbm? and
(3) I have no idea where to find the much vaunted "Camel book".
please help
Clint
------------------------------
Date: Tue, 14 Jul 1998 18:22:37 +0100
From: "Clinton Gormley" <clint@netcomuk.co.ukXX>
Subject: Re: Locking SDBM files
Message-Id: <6og455$pp3$1@taliesin.netcom.net.uk>
Also, is there any need to lock the database if you are just reading? ( in
fact, what is a shared lock?)
and lastly, is there an NT port of the Berkley DB available?
thanks
------------------------------
Date: 14 Jul 1998 17:52:32 GMT
From: gebis@albrecht.ecn.purdue.edu (Michael J Gebis)
Subject: Re: Locking SDBM files
Message-Id: <6og5t0$37h@mozo.cc.purdue.edu>
"Clinton Gormley" <clint@netcomuk.co.ukXX> writes:
}Also, is there any need to lock the database if you are just reading? ( in
}fact, what is a shared lock?)
Do you want anybody else to obtain a write lock while you are reading?
Probably not. So that's why you need to get a read lock.
--
Mike Gebis gebis@ecn.purdue.edu mgebis@eternal.net
------------------------------
Date: Tue, 14 Jul 1998 17:44:06 GMT
From: Lee Rouman <lrouman@mediaone.net>
Subject: ODBC Access
Message-Id: <35AB97D5.4CE907B0@mediaone.net>
Anyone willing to forward me a few working examples of utilizing PERL to read from and write to common DB products using ODBC?
------------------------------
Date: Tue, 14 Jul 1998 13:48:18 -0400
From: Michael Fox <mike@umcs.maine.edu>
Subject: pattern matching with variables?
Message-Id: <Pine.GSO.3.95.980714134344.27736A-100000@gandalf.umcs.maine.edu>
I'm trying to write a script which involves checking a variable for
various patterns. Something like this:
if ($string =~ /$changing_variable/) {
...
}
Since $ in a pattern match matches the end of a line, this doesn't work.
Does anyone know a way around this? I've checked the rest of the code by
plugging in some constant patterns, but this is really holding me up. A
quick reply would be greatly appreciated!
Thanks!
Mike Fox
mike@umcs.maine.edu
------------------------------
Date: Tue, 14 Jul 1998 11:28:37 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: pattern matching with variables?
Message-Id: <MPG.1015432ee3a1120398970b@nntp.hpl.hp.com>
[This followup was posted to comp.lang.perl.misc and a copy was sent to
the cited author.]
In article <Pine.GSO.3.95.980714134344.27736A-
100000@gandalf.umcs.maine.edu> on Tue, 14 Jul 1998 13:48:18 -0400,
Michael Fox <mike@umcs.maine.edu> says...
> I'm trying to write a script which involves checking a variable for
> various patterns. Something like this:
>
> if ($string =~ /$changing_variable/) {
> ...
>
> }
>
> Since $ in a pattern match matches the end of a line, this doesn't work.
> Does anyone know a way around this? I've checked the rest of the code by
> plugging in some constant patterns, but this is really holding me up. A
> quick reply would be greatly appreciated!
'Escaping' metacharacters (i.e., using them literally intead of with
their special interpretations) is pretty fundamental to regex use. The
simplest solution to your problem is to precede the '$' with a backslash
'\'.
You should have looked at some documentation (for example, `perldoc
perlre`) before posting this question. I found it on the second page:
\ Quote the next metacharacter
It is mentioned in 'Learning Perl' but a bit hard to find.
--
Larry Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: 14 Jul 1998 17:43:18 GMT
From: gebis@albrecht.ecn.purdue.edu (Michael J Gebis)
Subject: Re: portability of -s
Message-Id: <6og5bm$307@mozo.cc.purdue.edu>
gabor@vmunix.com (Gabor) writes:
}In comp.lang.perl.misc, Yeoh Yiu <squid@panix.com> wrote :
}# Does the -s test for file size return the same number
}# for the same file if I copy this file to various file systems ?
}#
}# p85 of the blue camel doesn't say size is measured in bytes
}# but I assume it to be so.
}What else would it measure it in? Kilometres?
The HDD I just bought is a 3.5 inch 3 disk 6 head 4.3GB drive.
This leads me to the following calculation:
(3.5/2)*2.54 = 4.4450 cm radius = .00004445 km radius
.00004445km ^2 * 3.141592 = .00000000620716532758 km^2 area
.00000000620716532758 * 6 sides = .00000003724299196548 km^2 total area
4.3GB= 4300000000.0 bytes.
00000003724299196548 / 4300000000.0 =
.00000000000000000866116092220465116279069767441860 km^2/byte.
So the size of this so 933 byte (so far) post is about
.00000000000000808086314041693953488372093023255380 square kilometers.
--
Mike Gebis gebis@ecn.purdue.edu mgebis@eternal.net
------------------------------
Date: Tue, 14 Jul 1998 13:14:37 -0400
From: comdog@computerdog.com (brian d foy)
Subject: Re: Trouble with AOL
Message-Id: <comdog-ya02408000R1407981314370001@news.panix.com>
Keywords: from just another new york perl hacker
In article <ucVNP3zr9GA.184@upnetnews03>, "Kyle Taing" <Elohim23@email.msn.com> posted:
>People who submit forms using an AOL browser (or I.E.-based aol) seem to
>experience errors all the time. What is happening is that some form fields
>aren't being passed. For example, I have a mail program which is written in
>PERL. When some aol people try to submit through the form, it can't because
>the "@" in their email address isn't passed or recognized by the PERL
>program.
>
>Does anyone know a way to fix this?
it's not a CGI problem. i've found that AOL users typically don't
type out their full email address because they think that their
screen name is adequate.
this is not a technology (or Perl) problem.
--
brian d foy <comdog@computerdog.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
Comprehensive Perl Archive Network (CPAN) <URL:http://www.perl.com>
Perl Mongers Travel Deals! <URL:http://www.pm.org/travel.html>
------------------------------
Date: Tue, 14 Jul 1998 13:37:08 -0500
From: Yazan Moh'd Al-Issa <yazan@natsys2.cceer.lsu.edu>
Subject: trying to install perl
Message-Id: <Pine.OSF.3.96.980714133511.18706A-100000@natsys2.cceer.lsu.edu>
Hi,
I am trying to install perl on my digital dec alpha
machine(OSF"UNIX"). After runing configure, I don't know whether perl is
installed successfully or not, since I don't even know how the perl
interface looks like(if any). when i type the command perl I recieve a
blinking curser and that is it. I am gonna appreciate it if some one can
help.
------------------------------
Date: Wed, 15 Jul 1998 20:30:48 +0200
From: Francesc Guasch <frankie@etsetb.upc.es>
Subject: Undefined subroutine &main::parse_htmlfile
Message-Id: <35ACF558.50219482@etsetb.upc.es>
I wanted to print some text to a postcript printer, I found in
CPAN the LWP has some html->PS formatter, so I thought I could
do the text in html and make it print.
I downloaded and installed the libwww-perl-5.35
I searched the docs and found an example.
require HTML::FormatPS;
$html = parse_htmlfile("test.html");
$formatter = new HTML::FormatPS
FontFamily => 'Helvetica',
PaperSize => 'Letter';
print $formatter->format($html);
I tried that code in a script, changing the name
of the htmlfile, but I got :
Undefined subroutine &main::parse_htmlfile in line ...
I added to the file requires for all the HTML:: modules
I found but it keeps failing.
What's missing there ?
thank you
--
mailto:frankie@etsetb.upc.es http://www.etsetb.upc.es/~frankie
^-^.-----,
o o _ ) Linux, Windows 95, and Windows NT
Y (_, (__(Ssss (also known as the Good, the Bad, and the Ugly)
------------------------------
Date: Wed, 15 Jul 1998 20:47:02 +0200
From: Francesc Guasch <frankie@etsetb.upc.es>
Subject: Re: Undefined subroutine &main::parse_htmlfile
Message-Id: <35ACF926.23DC0568@etsetb.upc.es>
solved !
Francesc Guasch wrote:
>
> I wanted to print some text to a postcript printer, I found in
> CPAN the LWP has some html->PS formatter, so I thought I could
> do the text in html and make it print.
>
> I downloaded and installed the libwww-perl-5.35
> I searched the docs and found an example.
>
> require HTML::FormatPS;
> $html = parse_htmlfile("test.html");
> $formatter = new HTML::FormatPS
> FontFamily => 'Helvetica',
> PaperSize => 'Letter';
> print $formatter->format($html);
>
> I tried that code in a script, changing the name
> of the htmlfile, but I got :
>
> Undefined subroutine &main::parse_htmlfile in line ...
>
> I added to the file requires for all the HTML:: modules
> I found but it keeps failing.
>
I just changed
require HTML::Parse
by
use HTML::Parse
and it worked.
sorry
--
mailto:frankie@etsetb.upc.es http://www.etsetb.upc.es/~frankie
^-^.-----,
o o _ ) Linux, Windows 95, and Windows NT
Y (_, (__(Ssss (also known as the Good, the Bad, and the Ugly)
------------------------------
Date: 14 Jul 1998 18:54:33 GMT
From: k y n n <NOSPAMkEynOn@panix.comNOSPAM>
Subject: Why the "};" on p.231 of PP (2)?
Message-Id: <6og9h9$5ko@news1.panix.com>
Why is there a semicolon after the next-to-last "}" in the code below,
which appears on p. 231 of Programming Perl (2nd ed.)?:
$blksize = (stat FROM)[11] || 16384; # preferred block size?
while($len = sysread FROM, $buf, $blksize) {
if(!defined $len) {
next if $! =~ /^Interrupted/;
die "System read error: $!\n";
}
$offset = 0;
while($len) { # Handle partial writes.
$written = syswrite TO, $buf, $todo, $offset;
die "System write error: $!\n"
unless defined $written;
$len -= $written;
$offset += $written;
};
}
Is it just a typo? Just curious,
K.
--
To those who prefer to reply by e-mail, please remove the upper-case
letters from the return address in the header. Thank you. K.
------------------------------
Date: Tue, 14 Jul 1998 11:24:29 -0700
From: Michael Yee <michael_yee@corp.disney.com>
Subject: Win NT Perl 5.0 Y2K compliance
Message-Id: <35ABA25D.6689C6FE@corp.disney.com>
Hello,
Does anyone know if Perl 5.0 for Windows NT 4.0 (SP3) is Year 2000
compliant? Thanks,
Michael Yee
Disney Worldwide Services, Inc.
------------------------------
Date: Tue, 14 Jul 1998 11:01:16 -0700
From: Jim Bowlin <bowlin@sirius.com>
To: photuris@jehosophat.com
Subject: Re: Win32 - SMTP
Message-Id: <35AB9CEC.528F9E26@sirius.com>
photuris wrote:
>
> I am using ActiveState's Perl for Win32 ...
> what is the best way to have a script generate an
> email using SMTP?
>
> Thanks,
I have heard some people report problems trying to
use SMTP with ActiveState as CGI. It seemed to be
that sockets were not getting closed properly.
-- Jim Bowlin
------------------------------
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 3155
**************************************