[9918] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 3511 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Aug 22 16:07:27 1998

Date: Sat, 22 Aug 98 13:00:19 -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           Sat, 22 Aug 1998     Volume: 8 Number: 3511

Today's topics:
    Re: Array element var in a "foreach" loop? or an exhanc (Mark-Jason Dominus)
    Re: Can I use postgresql of redhat5.1 with perl ? PLeas <bob@vpdev.com>
    Re: Code Style (Was: How to sort this associative array (Ronald J Kimball)
    Re: Getting dialup dynamic IP (Maurice Aubrey)
        Help!..re: secure sendmail question <leegala@nospam.ican.net>
        Help!..re: secure sendmail question <leegala@nospam.ican.net>
        In-place editing and file locking <ketanp@NOSPAMxwebdesign.com>
        In-place editing and file locking <ketanp@NOSPAMxwebdesign.com>
        In-place editing and file locking <ketanp@NOSPAMxwebdesign.com>
        In-place editing and file-locking? <ketanp@NOSPAMxwebdesign.com>
        Looking for part time help <melyas@aol.com>
    Re: NEWBIE Question: Perl Script in Unix vs. NT <mjcarman@zeus.ia.net>
    Re: Perl Docs.. forget the original post (C. Abney)
        Perl documentation (David Hawker)
    Re: Perl documentation <tchrist@mox.perl.com>
    Re: Perl documentation (Larry Rosler)
    Re: Perl documentation (Michael Fuhr)
    Re: Perl documentation (Ronald J Kimball)
    Re: Perl documentation (Larry Rosler)
    Re: Perl documentation (Larry Rosler)
    Re: Perl documentation (Craig Berry)
    Re: Perl documentation (Craig Berry)
        script redirect: downloading file through browser <stathy@jaske.com>
        Sending file to browser <stathy@jaske.com>
    Re: Sending file to browser (Maurice Aubrey)
        tie %h, 'DB_File'... complains about invalid arg ? <alex@kawo2.rwth-aachen.de>
    Re: Warnings when dereferencing hashes? (Ronald J Kimball)
    Re: Warnings when dereferencing hashes? (Ronald J Kimball)
    Re: Why dont people read the FAQs (Ronald J Kimball)
    Re: Why dont people read the FAQs (Craig Berry)
        Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: 22 Aug 1998 12:14:52 -0400
From: mjd@op.net (Mark-Jason Dominus)
Subject: Re: Array element var in a "foreach" loop? or an exhanced grep ?
Message-Id: <6rmqps$fqp$1@monet.op.net>


In article <35D8551B.3701@min.net>, John Porter  <jdporter@min.net> wrote:
>No, but it allows you to "expose" a method which you can call
>to get the current index from the tied object.
>
>	tie @a, ...
>	for ( @a ) { ...
>		$i = tied(@a)->index;
>	}

How would such a method work?  The way you show it, it doesn't have an
argmuent, so it must depend on some internal state.  But there's
nothing int the code you showed that could leave the object in the
appropriate internal state.

I think you'd have to use something like:
while (($_) = $mylist->each) {
  $i = $mylist->index;
  ...


------------------------------

Date: Sat, 22 Aug 1998 18:40:34 GMT
From: "Bob Parker" <bob@vpdev.com>
Subject: Re: Can I use postgresql of redhat5.1 with perl ? PLease help
Message-Id: <CgED1.629$MS.654754@news.rdc1.sdca.home.com>


cadic wrote in message <6ri2j8$f2j$1@platane.wanadoo.fr>...
>I instaleld redhat 5.1 with postgresql.
>I'm looking for a good place to find a PERL interface.
>
>I found a lot of perl interface but none is working (most of them are for
>postgresql95...)
>
>Does any one know a freeware interface to use SQL databases with postgresql
>with the PERL5 language.
>
>Help
>
>PLease reply to ccadic@cadic.com
>
>Thanks so much


You need the DBI and DBD::Pg modules - I use them very extensively at work
and on my own server. If you have root access on your machine to install
modules system wide, you can just type:

perl -MCPAN -e shell

then when you get to the "cpan>" prompt, type:

install DBI
install DBD::Pg

and that will take care of everything you need. Make sure you read the docs
for DBI and DBD::Pg very well - DBI is not exactly a beginner's tool in
Perl, and there are lots of things to stumble over :)

HTH,

Bob Parker
VP Developing - www.vpdev.com               The QueerZone -
www.queerzone.com
ManCards - http://www.queerzone.com/mancards
The Banner Creator - www.bannercreator.nu       Coming Soon:
www.postcards.cc
----------------------------------------------------------------------------
-
Member, International Guild of Gay Webmasters Board of Directors
Chair, IGGW Public Relations Committee              www.iggw.org




------------------------------

Date: Sat, 22 Aug 1998 12:14:23 -0400
From: rjk@coos.dartmouth.edu (Ronald J Kimball)
Subject: Re: Code Style (Was: How to sort this associative array?)
Message-Id: <1de5w1n.4nnddz1y8cnnkN@bay2-95.quincy.ziplink.net>

Zenin <zenin@bawdycaste.org> wrote:

> Larry Rosler <lr@hpl.hp.com> wrote:
>         >snip<
> : Does either of you believe in balancing parentheses also? :-)
> 
>         Oh yes, normally to the next tab stop too, just because it's
>         easier to quickly align that way.

Hehe...  That's not what he meant.  Both code samples, yours and John's,
had two open parentheses and only one close parenthesis.  Not
intentionally, of course.  :-)

-- 
 _ / '  _      /         - aka -         rjk@coos.dartmouth.edu
( /)//)//)(//)/(     Ronald J Kimball      chipmunk@m-net.arbornet.org
    /                                  http://www.ziplink.net/~rjk/
        "It's funny 'cause it's true ... and vice versa."


------------------------------

Date: Sat, 22 Aug 1998 16:10:40 GMT
From: maurice@hevanet.com (Maurice Aubrey)
Subject: Re: Getting dialup dynamic IP
Message-Id: <slrn6ttrc2.dt3.maurice@localhost.localdomain>

On Sat, 22 Aug 1998 14:24:47 GMT, David Hawker <dhawker@bigfoot.com> wrote:
>Is there any way I can get my perl script to automatically obtain my
>dynamic IP address whenever I dialup? Perhaps a winsock call? I'm running
>Windows 95 and perl 5.004_02 for DOS.
>
>Currently I'm using a cgi script to send me the $ENV{REMOTE_HOST} data
>which I then paste into the local perl script as my hostname.

I'm not sure if this will work under 95. 

# getsockname() to find out what our IP address is.
# The remote host doesn't even need to exist, since
# a UDP connect doesn't actually send anything; it
# just determines what interface is needed to get out.
# If there's no route outside, we die.
sub _determine_ip {
  my $self = shift;
  my($raddr, $myaddr, $socket);

  $socket = new FileHandle;
  $raddr = sockaddr_in(80, '1.1.1.1');
  socket($socket, PF_INET, SOCK_DGRAM, getprotobyname('udp'))
    or die "create socket: $!";
  connect($socket, $raddr)
    or die "connect: $!";
  $myaddr = (unpack_sockaddr_in(getsockname($socket)))[1];
  close $socket;
  return inet_ntoa $myaddr;
}                      

-- 
Maurice Aubrey <maurice@hevanet.com>

Real programmers don't comment their code. It was hard to write,
it should be hard to understand. 


------------------------------

Date: Sat, 22 Aug 1998 11:57:38 -0400
From: "Mr. mister" <leegala@nospam.ican.net>
Subject: Help!..re: secure sendmail question
Message-Id: <35DEEA72.64719364@nospam.ican.net>

Hi folks,
If anybody can help me, I'd really appreciate it.
Here's the situtation, I'm trying to secure my sendmail transaction
using 'formmail.cgi' in the backend. When a visitor fills out my  my web
form, the data gets sent off for massaging by formmail, then a returned
'dynamically' created html page gets sent back to the viewer.

Here's what I'd like to do: I would like the returned html page to be
secure ie. using the SSL.
To my knowledge, all references to the http server must rather point to
the https server, thus using the netscape certificate as well and
subsequently the SSL.

I have done this but it doesn't work, I get a returned message after
posting the data: "the server must be down or there is an internal
error, contact your administrator".

To see the actual problem visit:
https://home.ican.net/~leegala/service/market/ROF/ROFs.html

Thanks for your help.
reply email to leegala@ican.net

--
********* please remove "nospam" from reply to email address, if
replying ***********

http://home.ican.net/~leegala   For some Free stuff
http://home.ican.net/~leegala   For free Online Order Forms!




------------------------------

Date: Sat, 22 Aug 1998 11:57:38 -0400
From: "Mr. mister" <leegala@nospam.ican.net>
Subject: Help!..re: secure sendmail question
Message-Id: <35DEEA73.64719334@nospam.ican.net>

Hi folks,
If anybody can help me, I'd really appreciate it.
Here's the situtation, I'm trying to secure my sendmail transaction
using 'formmail.cgi' in the backend. When a visitor fills out my  my web
form, the data gets sent off for massaging by formmail, then a returngd
'dynamically' created html page gets sent back to the viewer.

Here's what I'd like to do: I would like the returned html page to be
secure ie. using the SSL.
To my knowledge, all references to the http server must rather point to
the https server, thus using the netscape certificate as well and
subsequently the SSL.

I have done this but it doesn't work, I get a returned message after
posting the data: "the server must be down or there is an internal
error, contact your administrator".

To see the actual problem visit:
https://home.ican.net/~leegala/service/market/ROF/ROFs.html

Thanks for your help.
reply email to leegala@ican.net

--
********* please remove "nospam" from reply to email address, if
replying ***********

http://home.ican.net/~leegala   For some Free stuff
http://home.ican.net/~leegala   For free Online Order Forms!




------------------------------

Date: Sat, 22 Aug 1998 14:57:19 -0400
From: Ketan Patel <ketanp@NOSPAMxwebdesign.com>
Subject: In-place editing and file locking
Message-Id: <35DF148F.986BCC9D@NOSPAMxwebdesign.com>

I am using @ARGV and $^I to edit a very frequently accessed file
'in-place' for speed purposes... I was wondering, will simultaneous
accesses to this file cause problems?

#Sample of code that will run every time a website gets a hit (avg
30,000+/day)

@ARGV = ("sites.txt");
$^I = ".bak";
while(<>) {
	[stuff]
}

I am concerned because there is no place to flock(), or is there?


------------------------------

Date: Sat, 22 Aug 1998 14:59:28 -0400
From: Ketan Patel <ketanp@NOSPAMxwebdesign.com>
Subject: In-place editing and file locking
Message-Id: <35DF1510.322948CA@NOSPAMxwebdesign.com>

I am using @ARGV and $^I to edit a very frequently accessed file
'in-place' for speed purposes... I was wondering, will simultaneous
accesses to this file cause problems?

#Sample of code that will run every time a website gets a hit (avg
30,000+/day)

@ARGV = ("sites.txt");
$^I = ".bak";
while(<>) {
	[stuff]
}

I am concerned because there is no place to flock(), or is there?


------------------------------

Date: Sat, 22 Aug 1998 14:55:50 -0400
From: Ketan Patel <ketanp@NOSPAMxwebdesign.com>
Subject: In-place editing and file locking
Message-Id: <35DF1436.4E9FF236@NOSPAMxwebdesign.com>

I am using @ARGV and $^I to edit a very frequently accessed file
'in-place' for speed purposes... I was wondering, will simultaneous
accesses to this file cause problems?

#Sample of code that will run every time a website gets a hit (avg
30,000+/day)

@ARGV = ("sites.txt");
$^I = ".bak";
while(<>) {
	[stuff]
}

I am concerned because there is no place to flock(), or is there?


------------------------------

Date: Sat, 22 Aug 1998 14:59:52 -0400
From: Ketan Patel <ketanp@NOSPAMxwebdesign.com>
Subject: In-place editing and file-locking?
Message-Id: <35DF1528.2F9D65EE@NOSPAMxwebdesign.com>

I am using @ARGV and $^I to edit a very frequently accessed file
'in-place' for speed purposes... I was wondering, will simultaneous
accesses to this file cause problems?

#Sample of code that will run every time a website gets a hit (avg
30,000+/day)

@ARGV = ("sites.txt");
$^I = ".bak";
while(<>) {
	[stuff]
}

I am concerned because there is no place to flock(), or is there?


------------------------------

Date: 22 Aug 1998 18:04:13 GMT
From: "Joe" <melyas@aol.com>
Subject: Looking for part time help
Message-Id: <01bdcded$ba162a80$bae36dd1@default>

Hello,

Please forgive me if this is not the appropriate place for this post.  I am
looking for someone who can help me write a couple of small scripts in
exchange for posters we sell.  We have three stores in Manhattan, NY and a
Web Site where you can pick your posters from.  Please email me and I will
give you the site's address.  You know I don't want this to look like an
advertising in a newsgroup.

Thanks Again

Joe Elyas 


------------------------------

Date: Sat, 22 Aug 1998 12:27:20 -0500
From: "Michael J. Carman" <mjcarman@zeus.ia.net>
Subject: Re: NEWBIE Question: Perl Script in Unix vs. NT
Message-Id: <6rmv12$45q$1@composer.inav.net>

>>You'll have to check in what format your script is: MSDOS (CRLF at end of
>>each line) or Unix (LF at end of each line
[...]
>>Get a descent editor (i recommand TextPad) that can do the conversion for
>>you, or a utility to do the conversion.
>
>TextPad is MAC, no? Anyone know a format to save in from Windows that
>will avoid the ^M problem?


In response to both this and the other "what's the best editor" thread, I'll
make this recommendation -
GWD Text Editor. (Available at http://www.iridis.com/gwd/) It's shareware
(only $20 to register), which makes it a better option for the "recreational
coder" than programs like Multi-Edit. (Also a nice editor.) It allows syntax
highlighting (Perl is pre-defined so you don't have to enter all the
keywords yourself), and supports DOS/Unix/Mac file formats so you can
read/write in those native formats.

There is another way to get around the ^M problem, though, if you don't want
to get a new editor. If you're writing your code on a PC and want to run it
on Unix, make sure that you transfer the file in ASCII mode (not binary)
when you FTP it to the Unix box. This should translate the CRLF to plain LF.
(And vice-versa when transferring the other way.)

--
Michael J. Carman / mjcarman@zeus.ia.net




------------------------------

Date: 22 Aug 1998 17:45:12 GMT
From: cabneySP4M@SP4M.SP4Mcyberpass.net (C. Abney)
Subject: Re: Perl Docs.. forget the original post
Message-Id: <6rn038$4g9$1@news.infonex.net>

In article <645CAC0140CED111AF1500805FEDDB8AA41D@ns.new-mediacom.co.uk>,
	Simon Wistow <simon@new-mediacom.com> writes:
> I'm a complete newbie myself and I found CLPM a bit diconcerting to
> start off with however now that I know MO ...

It's a pretty effective system if you accept the correlation.  I'll
admit there is a problem with the correlation (you won't
see the rawest of new users in clp* that you will in col*) but the
information posted with the flame is at least available to anyone
willing to poke around in the group long enough to see the range of
topics being discussed.

> One thing puzzles me though, you advocate ignoring 'FAQless newbies' yet
> admit that you 'first learned of the perl faqs' this way.

Now, hold on.  not the initial inquiry, that's not what I meant (I thought
it was clear) by 'squealing.'  I was referring to those with a magnified
sensitivity and hyperawareness of any criticisms against themselves, 
while ignoring the completely legitimate complaints of the regulars 
in the group, clutching desperately to their newbie status as sufficient
justification for selfish (and completely unneeded) behavior.  That was
the play on 'feckless' I hoped would carry the meaning across.  RTFM, 
I mean the Usenet Faq, and it becomes clear why such behavior is
unnecessary, and hurts others (even if it stands a good chance of
helping yourself).  The easiest way to ease in is to lurk.

> Some of us with window boxes don't have grep either (now there's an
> idea, hmmmm);

Wingrep.  Some guy in the UK.  Shareware.  Worth the US$20.  I don't
know if he's ported to W95+, I don't do that anymore. :)

Sorry I took so long to respond, my news server is really flaky.

-C
-- 
 ...if we truly desire world domination, we've got to get our LSD into
the corporate elite's conceptual water supply and alter the beast's
consciousness. -ESR                                           C. Abney



------------------------------

Date: Sat, 22 Aug 1998 16:03:18 GMT
From: dhawker@removethis.bigfoot.com (David Hawker)
Subject: Perl documentation
Message-Id: <35dfe53d.4765271@news.cableol.net>

1. Why is for/foreach/etc never included in the perl docs?

2. I'm after a complete documentation in one package. One thing that annoys
me is when the perl docs just say 'does the same thing as the system call'
and i have no idea what the system call does. I'd like everything to be
present in one giant package, without the need for me to go online and try
to track down other documentation. Has this been done?

--
dhawker@bigfoot.com | ICQ 7222349
http://dhawker.home.ml.org


------------------------------

Date: 22 Aug 1998 16:46:18 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Perl documentation
Message-Id: <6rmskq$eq1$1@csnews.cs.colorado.edu>

 [courtesy cc of this posting denied to cited author as a
  penalty for address mutilation]

In comp.lang.perl.misc, david.hawker@removethis.cableol.co.uk writes:
:1. Why is for/foreach/etc never included in the perl docs?

It is.  You didn't look hard enough.  It's in the REMOVE THIS manpage.

:2. I'm after a complete documentation in one package. One thing that annoys
:me is when the perl docs just say 'does the same thing as the system call'
:and i have no idea what the system call does. I'd like everything to be
:present in one giant package, without the need for me to go online and try
:to track down other documentation. Has this been done?

That can't happen, because the system call's behaviour varies
depending on the system.

--tom
-- 
    "Yes, you can think of almost everything as a function, but this may upset
    your wife." --Larry Wall


------------------------------

Date: Sat, 22 Aug 1998 09:51:03 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Perl documentation
Message-Id: <MPG.104896cdcc9be3f99897dd@nntp.hpl.hp.com>

In article <35dfe53d.4765271@news.cableol.net> on Sat, 22 Aug 1998 
16:03:18 GMT, David Hawker <dhawker@removethis.bigfoot.com> says...
> 1. Why is for/foreach/etc never included in the perl docs?

'for' and 'foreach' are discussed fully in `perldoc perlsyn` (though a 
grep for 'for' might get far more than you want).  I'm not sure about 
'etc'. :-)

> 2. I'm after a complete documentation in one package. One thing that annoys
> me is when the perl docs just say 'does the same thing as the system call'
> and i have no idea what the system call does. I'd like everything to be
> present in one giant package, without the need for me to go online and try
> to track down other documentation. Has this been done?

When I asked a similar question some months ago, I was flamed for not 
using a web search for, as I recall, 'man crypt'.  With so much 
Unix/POSIX documentation readily available online, it seems inappropriate 
to repackage it all with the Perl docs.

-- 
(Yet Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


------------------------------

Date: Sat, 22 Aug 1998 16:59:32 GMT
From: mfuhr@dimensional.com (Michael Fuhr)
Subject: Re: Perl documentation
Message-Id: <6rmtdd$pl9@flatland.dimensional.com>

dhawker@removethis.bigfoot.com (David Hawker) writes:

> 1. Why is for/foreach/etc never included in the perl docs?

Eh?  They've been in every set of Perl documentation I've seen.
Try starting with the perl or perltoc manual page if you can't
seem to find something.

> 2. I'm after a complete documentation in one package. One thing that annoys
> me is when the perl docs just say 'does the same thing as the system call'
> and i have no idea what the system call does. I'd like everything to be
> present in one giant package, without the need for me to go online and try
> to track down other documentation. Has this been done?

Your system should have documentation on what each system call does.
For example, if you're using some flavor of Unix try "man foo"[1] to
find out about the foo() system call.  Perhaps the Perl documentation
authors prefer not to spend time writing about something that's already
documented elsewhere; besides, if foo() has any OS-specific behavior
then you'll have to refer to your local docs anyway.

[1] Or some variant like "man 2 foo" or "man -s 2 foo".
-- 
Michael Fuhr
http://www.fuhr.net/~mfuhr/


------------------------------

Date: Sat, 22 Aug 1998 13:17:11 -0400
From: rjk@coos.dartmouth.edu (Ronald J Kimball)
Subject: Re: Perl documentation
Message-Id: <1de5zeb.m2w57z14ksddvN@bay2-95.quincy.ziplink.net>

David Hawker <dhawker@removethis.bigfoot.com> wrote:

> 1. Why is for/foreach/etc never included in the perl docs?

Remember, for/foreach/etc aren't functions, so if you're looking in
perlfunc, you won't find them.  Try perlsyn (for syntax) instead.

-- 
 _ / '  _      /         - aka -         rjk@coos.dartmouth.edu
( /)//)//)(//)/(     Ronald J Kimball      chipmunk@m-net.arbornet.org
    /                                  http://www.ziplink.net/~rjk/
        "It's funny 'cause it's true ... and vice versa."


------------------------------

Date: Sat, 22 Aug 1998 10:23:39 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Perl documentation
Message-Id: <MPG.10489e729f769c159897de@nntp.hpl.hp.com>

[Posted to comp.lang.perl.misc and copy mailed.]

In article <6rmskq$eq1$1@csnews.cs.colorado.edu> on 22 Aug 1998 16:46:18 
GMT, Tom Christiansen <tchrist@mox.perl.com> says...
 ...
> That can't happen, because the system call's behaviour varies
> depending on the system.

Not so much as it might have in the past.  A great deal of Section 2 has 
been incorporated into the POSIX standard (where the P means 'Portable') 
and has been replicated on 'POSIX-conforming' non-Unix systems (which 
shall remain nameless here because I don't want to violate *your* 
obscenity standards).

On the systems in question, these 'system calls' are documented as part 
of the Standard C Library, which is not available locally to many users 
of perl binaries on those systems.  But the Web solution seems 
appropriate (and doesn't require the Perl documenters to focus on 
anything but Perl -- a Good Thing).

-- 
(Yet Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


------------------------------

Date: Sat, 22 Aug 1998 10:31:04 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Perl documentation
Message-Id: <MPG.1048a02dd0b7f4049897df@nntp.hpl.hp.com>

[Posted to comp.lang.perl.misc and copy mailed.]

In article <6rmtdd$pl9@flatland.dimensional.com> on Sat, 22 Aug 1998 
16:59:32 GMT, Michael Fuhr <mfuhr@dimensional.com> says...
 ...
> Your system should have documentation on what each system call does.
> For example, if you're using some flavor of Unix try "man foo"[1] to
> find out about the foo() system call.  Perhaps the Perl documentation
> authors prefer not to spend time writing about something that's already
> documented elsewhere; besides, if foo() has any OS-specific behavior
> then you'll have to refer to your local docs anyway.
> 
> [1] Or some variant like "man 2 foo" or "man -s 2 foo".

Not at all.  See my response to Tom C.  The term 'system call' in many 
environments means 'call to behavior implemented in and documented with 
the C library', and such documentation does not come with the operating 
system.

But it *is* readily available on the Web.

-- 
(Yet Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


------------------------------

Date: 22 Aug 1998 19:02:22 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: Perl documentation
Message-Id: <6rn4ju$7bg$3@marina.cinenet.net>

David Hawker (dhawker@removethis.bigfoot.com) wrote:
: 1. Why is for/foreach/etc never included in the perl docs?

/usr2/people/cberry > perldoc perlsyn | grep foreach            
         LABEL foreach VAR (LIST) BLOCK                         
     The foreach loop iterates over a normal list value and sets
     The foreach keyword is actually a synonym for the for      
     keyword, so you can use foreach for readability or for for 
     foreach loop index variable is an implicit alias for each  
         foreach my $elem (@elements) {                         
         foreach $item (split(/:[\\\n:]*/, $ENV{TERMCAP})) {    
         OUTER: foreach my $wid (@ary1) {                       
         INNER:   foreach my $jet (@ary2) {                     
     executes a foreach statement more rapidly than it would the
     A common idiom for a switch statement is to use foreach's  
     subroutine or a foreach loop.  It also can't be used to go 

And that's just perlsyn; it may well pop up elsewhere.

: 2. I'm after a complete documentation in one package. One thing that annoys
: me is when the perl docs just say 'does the same thing as the system call'
: and i have no idea what the system call does.

  perldoc -f system

: I'd like everything to be
: present in one giant package, without the need for me to go online and try
: to track down other documentation. Has this been done?

Well, define 'one giant package'.  It's all there on your hard disk,
albeit in a group of several files.  This modularity is often considered a
feature rather than a bug.  Alternatively, the Camel book provides one
giant (physical) package *and* entirely eliminates the need to go online.

You can't grep paper.  You (usually) can't flip through man pages in the
bathroom.  Each format has its advantages.

---------------------------------------------------------------------
   |   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: 22 Aug 1998 19:31:18 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: Perl documentation
Message-Id: <6rn6a6$7bg$4@marina.cinenet.net>

(Following up my own post...)

Craig Berry (cberry@cinenet.net) wrote:
: David Hawker (dhawker@removethis.bigfoot.com) wrote:
: : 2. I'm after a complete documentation in one package. One thing that annoys
: : me is when the perl docs just say 'does the same thing as the system call'
: : and i have no idea what the system call does.
: 
:   perldoc -f system

My apologies on this part; I read too hastily, and didn't see the
"system() in perl" vs. "external C-lib system() function" distinction
implicit here.

---------------------------------------------------------------------
   |   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: Sat, 22 Aug 1998 11:33:54 -0500
From: Stathy Touloumis <stathy@jaske.com>
Subject: script redirect: downloading file through browser
Message-Id: <35DEF2F2.85961A3E@jaske.com>

I need to send a file to a user accessing the script through the web. 
The file is in a directory not accessible by anyone over the web (except
through this script).  Is there an easy way to do this?  (no sym links)

Thanks,


------------------------------

Date: Sat, 22 Aug 1998 11:29:44 -0500
From: Stathy Touloumis <stathy@jaske.com>
Subject: Sending file to browser
Message-Id: <35DEF1F8.D4704BF9@jaske.com>

I need to send a file to a user accessing the script through the web. 
The file is in a directory not accessible by anyone over the web (except
through this script).  Is there an easy way to do this?  (no sym links)

Thanks,


------------------------------

Date: Sat, 22 Aug 1998 16:32:22 GMT
From: maurice@hevanet.com (Maurice Aubrey)
Subject: Re: Sending file to browser
Message-Id: <slrn6ttskn.dvt.maurice@localhost.localdomain>

On Sat, 22 Aug 1998 11:29:44 -0500, Stathy Touloumis <stathy@jaske.com> wrote:
>I need to send a file to a user accessing the script through the web. 
>The file is in a directory not accessible by anyone over the web (except
>through this script).  Is there an easy way to do this?  (no sym links)

This is not a Perl question.  This question should have been directed to
a CGI or webserver newsgroup.

You need to password protect the directory.  Your script can do that, or
you can configure your webserver to do so.

-- 
Maurice Aubrey <maurice@hevanet.com>

The man who asks of freedom anything other than itself is born to 
be a slave. 
  - Alexis de Tocqueville


------------------------------

Date: Sat, 22 Aug 1998 19:58:22 +0000
From: Alex Farber <alex@kawo2.rwth-aachen.de>
Subject: tie %h, 'DB_File'... complains about invalid arg ?
Message-Id: <35DF22DE.10C89CAE@kawo2.rwth-aachen.de>

Hi,

I have a strange situation, when using DB_File module
at my RedHat 5.1 Linux with Perl 5.004 patch 04:

I can use tie only once. When my script is called next time,
I get an "invalid argument" message. I wonder what could be
the reason and would appreciate any ideas. The perldoc DB_File
says, that there should be no references to the data-base
or the destructor won't be called on it. But I undef $dbh,
please see the code snippet below:

Greetings
Alex

--
http://www.simplex.ru/pref.html


########################################
    if (param ('button') eq 'Remove')
    {
	if (not $dbh = tie (%dbm, 
	    'DB_File', 
	    $DIR . param ('dbm')))
        { 
	    print 'can`t tie ' . $!; 
	}
	elsif (not open DBM, '>>&=' . $dbh -> fd) 
        { 
	    print 'can`t write';
	}
	elsif (not flock DBM, LOCK_EX)
	{
	    print 'can`t lock';
	}
	else
        {
	    delete $dbm{$url};

	    $dbh -> sync;
	    flock DBM, LOCK_UN;
	    close DBM;
	    undef $dbh;
	    untie %dbm;

	    print "Okay, removed http://$url !\n";
	}
    }
################################################
   elsif (param ('button') eq 'Store')
    {
	if (length (param ('name')) < 2)
	{
	    print 'wWEDITE NAZWANIE!';
	}
        elsif (not $dbh = tie %dbm, 
	                   'DB_File', 
                           $DIR . param ('dbm'))
	{ 
	    print 'can`t tie'; 
	}
	elsif (not open DBM, '>>&=' . $dbh -> fd) 
	{
	    print 'can`t write';
	}
	elsif (not flock DBM, LOCK_EX)
	{
	    print 'can`t lock';
	}
	else
        {
	    $dbm{$url} = join "\n", 
	    param ('name'), 
	    param ('period'), 
	    param ('class'), 
	    param ('clicks'), 
	    param ('probs');

	    $dbh -> sync;
	    flock DBM, LOCK_UN;
	    close DBM;
	    undef $dbh;
	    untie %dbm;

	    print "Okay, stored http://$url !\n";
	}
    }


------------------------------

Date: Sat, 22 Aug 1998 12:14:25 -0400
From: rjk@coos.dartmouth.edu (Ronald J Kimball)
Subject: Re: Warnings when dereferencing hashes?
Message-Id: <1de5wco.1644peviktjjiN@bay2-95.quincy.ziplink.net>

Jeffery Cann <jc_cann@ix.netcom.com> wrote:

> print "Name entered: $jeff{'NAME'}\n";

The problem is that you are interpolating an undefined value into a
string, as $jeff{'NAME'} is undefined.

To make sure $jeff{'NAME'} gets defined, you could do this:

if (not defined $jeff{'NAME'}) {
  $jeff{'NAME'} = '';  # or 'undefined' or whatever
}

-- 
 _ / '  _      /         - aka -         rjk@coos.dartmouth.edu
( /)//)//)(//)/(     Ronald J Kimball      chipmunk@m-net.arbornet.org
    /                                  http://www.ziplink.net/~rjk/
        "It's funny 'cause it's true ... and vice versa."


------------------------------

Date: Sat, 22 Aug 1998 13:17:14 -0400
From: rjk@coos.dartmouth.edu (Ronald J Kimball)
Subject: Re: Warnings when dereferencing hashes?
Message-Id: <1de5zfv.5rxq2e9f81h8N@bay2-95.quincy.ziplink.net>

Jonathan Feinberg <jdf@pobox.com> wrote:

> Jeffery Cann <jc_cann@ix.netcom.com> writes:
> 
> > Use of uninitialized value at ./deref.pl line 12 (#1)
> 
> You didn't make clear which line in your program was generating that
> error.  However, it seems to be the case that you're using $jeff{NAME}
> as if it were defined, and it's not.  To check the existence of a hash
> key, use exists(), like so:
> 
>    if (exists $jeff{NAME}) {
>      # use $jeff{NAME} somehow
>    }

Of course, you can still get the warning if $jeff{NAME} exists but is
not defined.  It would be better to simply call defined there instead of
exists.

> Or you can supply $jeff{NAME} with a default value:
> 
>    $jeff{NAME} ||= 'default value';

Note that this will also replace the defined values '' and 0, which may
be okay in most cases, but it's worth keeping in mind.

-- 
 _ / '  _      /         - aka -         rjk@coos.dartmouth.edu
( /)//)//)(//)/(     Ronald J Kimball      chipmunk@m-net.arbornet.org
    /                                  http://www.ziplink.net/~rjk/
        "It's funny 'cause it's true ... and vice versa."


------------------------------

Date: Sat, 22 Aug 1998 12:14:27 -0400
From: rjk@coos.dartmouth.edu (Ronald J Kimball)
Subject: Re: Why dont people read the FAQs
Message-Id: <1de5wh2.1wuvez81h0j93xN@bay2-95.quincy.ziplink.net>

<lvirden@cas.org> wrote:

> According to Craig Berry <cberry@cinenet.net>:
> :Larry Rosler (lr@hpl.hp.com) wrote:
> :: Owen Cook <rcook@pcug.org.au> says...
> :: > unless((length($CCNumber) == 16) && ($CCNumber=~ /\d{16}/))
> ::   unless ($CCNumber =~ /^\d{16}$/)
> :If, as was discussed under a different topic a couple of weeks ago, you
> :either know $CCNumber has no trailing newline, or don't mind one if it's
> :there.
> 
> So length ignores the newline?  The original code shows clearly the variable
> is to match only if there are only the 16 digits of the credit card number
> in the field.  So the original would also fail with a training newline.

No, length doesn't ignore the newline.  That's the point.  If the length
of $CCNumber is 16, *including a newline*, then obviously /\d{16}/ will
not match.  Thus, using length ensures the exact number of digits.

-- 
 _ / '  _      /         - aka -         rjk@coos.dartmouth.edu
( /)//)//)(//)/(     Ronald J Kimball      chipmunk@m-net.arbornet.org
    /                                  http://www.ziplink.net/~rjk/
        "It's funny 'cause it's true ... and vice versa."


------------------------------

Date: 22 Aug 1998 18:47:12 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: Why dont people read the FAQs
Message-Id: <6rn3ng$7bg$2@marina.cinenet.net>

lvirden@cas.org wrote:
: According to Craig Berry <cberry@cinenet.net>:
: :Larry Rosler (lr@hpl.hp.com) wrote:
: :: In article <35db0173.1744952@newshost.pcug.org.au> on Tue, 18 Aug 1998 
: :: 23:13:38 GMT, Owen Cook <rcook@pcug.org.au> says...
: :: > unless((length($CCNumber) == 16) && ($CCNumber=~ /\d{16}/))
: ::   unless ($CCNumber =~ /^\d{16}$/)
: :If, as was discussed under a different topic a couple of weeks ago, you
: :either know $CCNumber has no trailing newline, or don't mind one if it's
: :there.
: 
: So length ignores the newline?

No; I was commenting on Larry's version:

  unless ($CCNumber =~ /^\d{16}$/)

which uses only the {16} quantifier and explicit start- and end-anchors to
bound the length.  The tricky part is that the end-anchor can match at
actual end of string *or* before a trailing newline.

---------------------------------------------------------------------
   |   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: 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 3511
**************************************

home help back first fref pref prev next nref lref last post