[6702] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 327 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Apr 17 19:17:29 1997

Date: Thu, 17 Apr 97 16: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           Thu, 17 Apr 1997     Volume: 8 Number: 327

Today's topics:
     Re: "my" variable affects namespace "outside" block? <rra@stanford.edu>
     Re: [Q] How to capitilize beginning of words (Brian Lavender)
     [Q]: spawn multiple infinite loop programs? rgovoniii@atsva.com
     Re: Calling sendmail on a NT Machine ? (Neil Briscoe)
     Re: client timing out (Jeff Stampes)
     Re: conversion windows to unix <jpearson@ket.org>
     Re: convert a char into ASCII <gnat@elara.frii.com>
     Date::Convert 0.14: Convert between Gregorian, Hebrew,  (Mordechai T. Abzug)
     Re: DBM Obsolete? (Paul Marquess)
     Re: exec "exit" <rra@stanford.edu>
     getpw*() and getgr*() on an a non-standard file? <jdt@insight.att.com>
     Re: Help desperately needed.  Perl errors need decypher <gwhassan@prodigy.net>
     Re: Help with Math::BigFloat si vous plait <rra@stanford.edu>
     help-help <a.alonzi@sistemi.it>
     Re: How to direct screen output to a file ? (Andrew M. Langmead)
     Re: how to mask ctrl_c in client? <rra@stanford.edu>
     is there a perl equivalent of which or whence? <jte@maps-r-us.com>
     Re: is there a perl equivalent of which or whence? <tchrist@mox.perl.com>
     Re: Leap-year date routine needed <rra@stanford.edu>
     Mac version of Perl ... (Roger Balakrishnan )
     Perl DB Sort Question (Frank J. DeFalco)
     Perl script keeps coming up in Wordpad; why???????? <topcat1@primenet.com>
     Re: POP3 perl script <philipp@ntex.com>
     Re: POP3 perl script (Neil Briscoe)
     Re: reading in password file <gnat@elara.frii.com>
     Re: reading in password file <tchrist@mox.perl.com>
     Re: References question !!! (Steffen Beyer)
     Re: Reply to Ousterhout's reply (was Re: Ousterhout and (Thomas A. Russ)
     Re: Reply to Ousterhout's reply (was Re: Ousterhout and <jguthrie@brokersys.com>
     Simple Split Question <jeffe@FL.ENSCO.COM>
     unreading a line of input <rick.tan@Eng.Sun.COM>
     Re: What does "UNIX" stand for.. <ron@sensor.com>
     Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: 17 Apr 1997 13:00:42 -0700
From: Russ Allbery <rra@stanford.edu>
To: jfw@wral-tv.wral-tv.com (John F. Whitehead)
Subject: Re: "my" variable affects namespace "outside" block?
Message-Id: <qumhgh5a07p.fsf@cyclone.stanford.edu>

[ Posted and mailed. ]

John F Whitehead <jfw@wral-tv.wral-tv.com> writes:

> Could someone please explain the following to me?  (nicely?)  Why does
> the following program, which uses a "my" variable in a loop, not get
> confined to the block it's in, and instead affect the variable the next
> time it's used?

This sounds like it matches the profile of the my scoping bug which has
been corrected in 5.004beta.

-- 
Russ Allbery (rra@stanford.edu)         <URL:http://www.eyrie.org/~eagle/>


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

Date: Thu, 17 Apr 1997 22:02:35 GMT
From: brian@brie.com (Brian Lavender)
Subject: Re: [Q] How to capitilize beginning of words
Message-Id: <33569db8.588725@nntp.netcruiser>

The below is correct.

Brian

On 17 Apr 1997 11:35:19 -0400, Clark Dorman <dorman@s3i.com.anti-spam>
wrote:

>http://www.perl.org/CPAN/doc/manual/html/pod/#How_do_I_capitalize_al_the_word
>
>and this does not exist.  What you get is an html format of the
>results of "man perl", which is what I gather Brian was saying in his
>own manner.

----------------
Brian Lavender
Napa, CA
Brie Business Directory - Napa Valley     http://www.brie.com/bbd 
(707) 226-8891

"The world is a good place if you are in a good position."


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

Date: Thu, 17 Apr 1997 17:01:31 -0600
From: rgovoniii@atsva.com
Subject: [Q]: spawn multiple infinite loop programs?
Message-Id: <861313439.136@dejanews.com>

PLEASE, let me know of any problems you see in my understanding of the
syntax/semantics and inform me of possible other solutions.
-----

O.k. here goes- (And I thought this one was going to be REAL easy.)
I am trying to check multiple processes for existence and if they do not
exist(expired), restart them.

I am calling a perl program from a user based crontab file every 10
minutes. This program does a:
            @proceess = `ps -ef | grep ...blah, blah`;
and if not found it calls the program to start. (keep reading)

I am currently calling a C++ program which basically runs in an infinite
loop to process Queued requests from a middleware queueing software 24
hours a day. Since, I am calling them from cron I must set tons of
$ENV{'WHATEVER'} variables before hand that are required by the C++
prog's.

***NOW, tell me if I go wrong***
I figured out not to use EVAL or SYSTEM or DO or BACKTICKS becuase they
apparently wait for the processes (sp?) to complete so they can check
completion status. And since my programs are infinite this would be bad.
(I thought you said crossing the streams was bad Egon?)

I am using an EXEC call like:
       exec "$store &"; //store read from cron with full path
but as I understand it, exec transfers control over to the $store program
and never finishes. (Not sure if I need the & from a crontab file.)

*** My Question ***
1) So is there a way I can execute these inifinite programs in such a way
that I can continue processing and call multiple ones from a single perl
script?

2) Any other pitfalls you see I might avoid.

(perl 5.002, Solaris 5.5)
If anyone is interested or needs I will post the script.

-------------------==== Posted via Deja News ====-----------------------
      http://www.dejanews.com/     Search, Read, Post to Usenet


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

Date: 17 Apr 1997 20:41:16 GMT
From: neilb@zetnet.co.uk (Neil Briscoe)
Subject: Re: Calling sendmail on a NT Machine ?
Message-Id: <memo.19970417214132.51797E@skep.compulink.co.uk.cix.co.uk>

In article <334DB4E0.14A@acme-brain.com>, ken@acme-brain.com (Ken Hodges)
wrote:

> I have installed Perl5 with no difficulties, got the "Hello World" to
> working fine, can make a *.html form create and display another *.html
> file with no problems, but have run into a brick wall making scripts
> call sendmail and then mailing the form information.
>
> I keep getting the respomnse:
> could not exectute "C:\sendmail\sendmail"
>
> I've tried *.bat files, *.pl files (several of them) and still get this
> error message, or the message "...has caused an error, probably due to a
> misconfiguration....."
>
> I'm using metainfo's "sendmail" for windows NT.
>
> What am I missing ?

Well, I agree with the next poster in thread - post your script - but, I
would normally call it as :-

open (MAIL. "| c:\sendmail\sendmail.exe -t")  | die "Horribly: $!\n";

or similar.

Metainfo sendmail has always worked for me this way.

Regards
Neil



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

Date: 17 Apr 1997 20:04:04 GMT
From: stampes@xilinx.com (Jeff Stampes)
Subject: Re: client timing out
Message-Id: <5j5vnk$di$1@neocad.com>

Jeff Stampes (stampes@xilinx.com) wrote:
   [Request for help with a server]

Thanks to Edward Jajko for helping me out with some ideas that will
in all likelihood help me solve my own problems.

Instead of something messy like a kernel recompile, I'll try to queue
the request myself, instead of expecting the system to handle that for
me.

Jeff 

--
Jeff Stampes -- Xilinx, Inc. -- Boulder, CO -- jeff.stampes@xilinx.com


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

Date: Thu, 17 Apr 1997 16:07:33 -0400
From: Joe Pearson <jpearson@ket.org>
To: A magic Store <sales@amagicstore.com>
Subject: Re: conversion windows to unix
Message-Id: <33568305.5B33@ket.org>

A magic Store wrote:
> 
> Does anybody know where can I find a program to convert windows text
> into unix text (basically without the new-line caracter \n).
> I'm having problem uploading my cgi script to my unix server.
> 

I've been using HomeSite 2.0  While it's a program specifically for
writing web pages, it includes a good feature that allows you to save
all documents with UN*X line endings.  I defined all .pl and .cgi file
endings (inside the program) as web documents, and it works like a
charm.  It's nice to be able to edit web pages and CGI programs in the
same application.

BTW, UN*X uses \n as its line endings (newline), whereas DOS uses \r\n
(carriage return, line feed) for its line endings.

-- 
Joe Pearson
jpearson@ket.org
Distance Learning Web Developer
http://www.dl.ket.org/


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

Date: 17 Apr 1997 15:09:24 -0600
From: Nathan Torkington <gnat@elara.frii.com>
Subject: Re: convert a char into ASCII
Message-Id: <5qn2qx2w6z.fsf@elara.frii.com>

Nathan Torkington <gnat@elara.frii.com> writes:
>    print "Read", $sep, "The", $sep, "Manual,", $sep", "Rachel\n";
                                         delete this ^

Not as smart as I thought I was :-)

Nat


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

Date: 17 Apr 1997 21:50:54 GMT
From: mabzug1@umbc.edu (Mordechai T. Abzug)
Subject: Date::Convert 0.14: Convert between Gregorian, Hebrew, Julian. . .
Message-Id: <5j65vu$8bf$1@nadine.teleport.com>

Date::Convert-0.14.tgz does conversion between the Gregorian, Julian,
Hebrew, and "Astronomical day number" formats.  It should now be on its way
to a CPAN site near you, but if you're impatient, feel free to pull it off
of <http://umbc.edu/~morty/cs/DateConvert-latest.tar.gz>.

This software is very much pre-alpha, so use at your own risk.  Even more
than usual.  :)

-- 
			Mordechai T. Abzug
mabzug1@umbc.edu  finger -l mabzug1@umbc7.umbc.edu  http://umbc.edu/~mabzug1
>>>>> My employer ain't payin' for my opinions, so they must be *mine*. <<<<<
Condense soup, not books.




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

Date: 17 Apr 1997 20:32:28 GMT
From: pmarquess@bfsec.bt.co.uk (Paul Marquess)
Subject: Re: DBM Obsolete?
Message-Id: <5j61cs$ieq@pheidippides.axion.bt.co.uk>

Rob Huffstedtler (rob@netcentral.net.no.spam) wrote:

: You may not have the NDBM package for one reason or another.  I would
: try one of the others, like GDBM, which is available at sunsite.unc.edu,
: or BSD-DB (I really like this one, but they are changing the license, so
: if you are going to use it for a commercial product, it may not be the
: best choice for you).  It's available at 
: mongoose.bostic.com/db/,  the latest version is 2.02, but it's quite
: conceivable that you have a prior version already on your system.  for
: reference, check chapter 7 of the blue camel or your various man pages.

The DB_File module doesn't (yet) support version 2 of Berkeley DB. The
current recommended versions are either 1.85 or 1.86.

WRT the license changes to Berkeley DB version 2, as long as you use a
publicly available version of Perl with the new DB_File (when I finish
writing it), and don't make any private changes to the C source of
Perl, DB_File or Berkeley DB itself, you can use it commercially. The
important point about the new license is that if you make any changes
to the source of an application that uses Berkeley DB they must be
publically available. Importantly the Berkeley DB license does not mean
you have to make any Perl scripts that use DB_File publically
available, so you can compile them (once the compiler is finished) or
scramble them if you want.

: Parillo wrote:
: > 
: > My Perl Doc in HTML format appears to say the DBM is obsolete, and
: > has been replaced with tie and untie. However the example in the doc:
: >     # print out history file offsets
: >          tie(%HIST, NDBM_File, '/usr/lib/news/history', 1, 0);
: >          while (($key,$val) = each %HIST) {
: >              print $key, ' = ', unpack('L',$val), "\n";
: >          }
: >          untie(%HIST);
: > does not seem to work for me (I think it may be realted to NDBM_File),

Depends on your architecture. The only DBM guaranteed to work on Unix
platforms is SDBM, because it comes with Perl. Better implementations
are GDBM (via GDBM_File) and Berkeley DB (via DB_File), as Rob has
already mentioned.

Paul


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

Date: 17 Apr 1997 13:23:04 -0700
From: Russ Allbery <rra@stanford.edu>
Subject: Re: exec "exit"
Message-Id: <qum7mi19z6f.fsf@cyclone.stanford.edu>

Geoff Mottram <minaret@sprynet.com> writes:

> If I'm not mistaken, "exit" is not in itself a program.  Instead, it is
> a command to the shell.  The shell is fast asleep waiting for your perl
> script to exit.  You could kill your parent process (the shell) and then
> exit, but this will leave zombies running in your process table.

No, actually, it shouldn't.  If the parent of a process dies, its children
are reparented by init, which can handle their deaths without letting them
become zombies.  You only get zombies when the parent doesn't wait for the
death of children but also doesn't exit.

What *can* result, however, from killing the shell are runaways, since
some programs (Pine and trn's Pnews most notably) have been known to go
nuts when their controlling tty disappears rather than exit cleanly.

-- 
Russ Allbery (rra@stanford.edu)         <URL:http://www.eyrie.org/~eagle/>


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

Date: Thu, 17 Apr 1997 18:04:44 -0400
From: "J. Trudel" <jdt@insight.att.com>
Subject: getpw*() and getgr*() on an a non-standard file?
Message-Id: <33569E7C.59E2@insight.att.com>

I'm interested in maintaining a set of files that contain 
password and group information (missing the passwords,
presumably) for several types of systems - Sun, SGI, and HP,
to be precise.  I'd like to be able to control user UIDs
and GIDs to be common across these platforms, as much as 
possible.  I'm already doing it successfully for a while
with a shell script, but it's turned into a bit of a mess
when it comes to updates, account closures, etc.  

Rather than update the script to give it better functionality,
I want to rewrite it in Perl and I was hoping to use the 
getpw.../setpw... and getgr.../setgr... functions to do this, 
but it doesn't look like they can do what I need.  They appear
to only operate and/or manipulate the official system-based
data (/etc/passwd, ypcat, etc).

Is this possible to use these perl functions without rewriting
them myself, and if so, how is that done?  Alternately, has
anyone done this already?  I've searched the perlfaq and the
CPAN archive on www.perl.com, and I've come up empty.  
Suggestions, pointers, etc. are welcome.

						Jon


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

Date: Thu, 17 Apr 1997 13:09:20 +0000
From: Greg Hassan <gwhassan@prodigy.net>
To: Robert Pate <robert@ctllc.com>
Subject: Re: Help desperately needed.  Perl errors need decyphering.
Message-Id: <33562100.57BA8DB9@prodigy.net>

Robert Pate wrote:
> 
> Hello there.  I am pretty new to Web programming.  I have written many Perl
> scripts that run perfectly in the NT world but I have now put them on my
> new ISP's server which is Linux and they don't work right.  I get the error
> "errno is 2" and "Premature end of script header".  Can anybody give me a
> hand at figuring out what this means and a way to fix it???  I would be
> very appreciative.  Thanks

probably the backslashes and the reference to perl
at the beginning.  The first line should be like:

#!/usr/local/bin/perl

and then you need to fix the backslashes:

perl -pi -e 's/\\/\//g' filename

There shouldn't be too many any problems.

-Greg
-- 
============================================
                Greg Hassan
          The Independent Solution
 Web Developer (CGI, Java, C, Perl, Oracle)
           http://www.hassan.com/        
    gwhassan@prodigy.net, 1-415-969-5856
============================================


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

Date: 17 Apr 1997 13:24:14 -0700
From: Russ Allbery <rra@stanford.edu>
To: Sysop <sysop@gbfcu.reno.nv.us>
Subject: Re: Help with Math::BigFloat si vous plait
Message-Id: <qum4td59z4h.fsf@cyclone.stanford.edu>

[ Posted and mailed. ]

In comp.lang.perl.misc, Sysop <sysop@gbfcu.reno.nv.us> writes:

> When I check it with perl -cw I get this ugly message:

> "use" may clash with future reserved word at order.cgi line 48.
> syntax error in file order.cgi at line 48, next 2 tokens "use Math"
> syntax error in file order.cgi at line 51, next 2 tokens "Math:"
> syntax error in file order.cgi at line 52, next 2 tokens "->"

You're using Perl 4.  You'll need to upgrade to Perl 5 to be able to use
modules.

-- 
Russ Allbery (rra@stanford.edu)         <URL:http://www.eyrie.org/~eagle/>


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

Date: 17 Apr 1997 22:17:26 GMT
From: "Antonello Alonzi" <a.alonzi@sistemi.it>
Subject: help-help
Message-Id: <01bc4b7d$50017800$d218b8c2@sistemi.stt>

I would call a system command ( at.... for launc one application at this
time)from a perl program.......
How do I do?
				Please help me				
			Antonello mailto:a.alonzi@sistemi.it


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

Date: Thu, 17 Apr 1997 22:33:46 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: How to direct screen output to a file ?
Message-Id: <E8t00A.2AB@world.std.com>

"Dipti V. Sonak" <dsonak@us.oracle.com> writes:

>Hi,

>I want to re-direct the output[ all of it ] produced by a command to a
>file. This is what I did : 


>system("make demo >& $outputFile );

The system command spawns a bourne shell. You are giving it csh syntax.

You want:

system("make demo > $outputFile 2>&1");

The man pages aren't quite as clear as they could be on
this. Actually, they're clear, they are just not very direct. The
perlfunc entry for system() says that it does an exec(), and the entry
for exec() says that that it calls "/bin/sh -c " if there are any
shell metacharacters.
 
Perl probably does it this way because the c library function system()
does it this way. The C library does it this way, because it really is
a smart idea. (Programs don't change behavior when the user changes
their shell, the syntax is less limiting, and it is available on all
unix platforms. Probably some of the information in
<http://www.perl.org/CPAN/doc/FMTEYEWTK/versus/csh.whynot> has some
relevance too.)
-- 
Andrew Langmead


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

Date: 17 Apr 1997 13:03:28 -0700
From: Russ Allbery <rra@stanford.edu>
To: bxing@cs.uno.edu (Banghe Xing)
Subject: Re: how to mask ctrl_c in client?
Message-Id: <qumd8rta033.fsf@cyclone.stanford.edu>

[ Posted and mailed. ]

Banghe Xing <bxing@cs.uno.edu> writes:

> I have written a server and client program. The server surpports more
> than one clients. So that if one client enters ctrl_c should not cause
> the termination of the server.  Question: How can I provent from this?
> That is, the server should not affect by client's ctrl_c?

If the server and client programs are separate processes, a SIGINT
(Ctrl-c) sent to the client shouldn't affect the server at all, although
the server will get a SIGCHLD that you should probably catch and handle.
See man perlipc for more details (look for the REAPER function).

-- 
Russ Allbery (rra@stanford.edu)         <URL:http://www.eyrie.org/~eagle/>


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

Date: Thu, 17 Apr 1997 15:38:55 -0400
From: Yash Khemani <jte@maps-r-us.com>
Subject: is there a perl equivalent of which or whence?
Message-Id: <33567C4F.55DC@maps-r-us.com>

hi folks,

is there a perl equivalent of whence or which?

thanks!
yash

-- 
+-------------------------------------------------------------------+
|  Yash L. Khemani             |  E-Mail:  khemani@plexstar.com     |
|  Plexstar, Inc., Reston, VA  |  WWW:     http://www.plexstar.com  |
+-------------------------------------------------------------------+


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

Date: 17 Apr 1997 22:48:14 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: is there a perl equivalent of which or whence?
Message-Id: <5j69be$fkg$1@csnews.cs.colorado.edu>

 [courtesy cc of this posting sent to cited author via email]

In comp.lang.perl.misc, 
    Yash Khemani <jte@maps-r-us.com> writes:
:is there a perl equivalent of whence or which?

foreach $file (@ARGV) {
    for $dir (split(/:/,$ENV{'PATH'})) {
	print $path,"\n" if -f ($path="$dir/$file") && -f _;
    } 
}
-- 
	Tom Christiansen	tchrist@jhereg.perl.com
And don't tell me there isn't one bit of difference between null and space,
because that's exactly how much difference there is.  :-)
        --Larry Wall in <10209@jpl-devvax.JPL.NASA.GOV>


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

Date: 17 Apr 1997 13:29:08 -0700
From: Russ Allbery <rra@stanford.edu>
To: rdd@access2.digex.net (R. D. Davis)
Subject: Re: Leap-year date routine needed
Message-Id: <qumzpux8kbv.fsf@cyclone.stanford.edu>

[ Posted and mailed. ]

R D Davis <rdd@access2.digex.net> writes:

> Does anyone know where I can find a Perl script which can be used to
> determine which years are leap-years?  I need to write a script which
> determines if the present day is the last day of the month; hence, the
> script would be much more accurate with leap-years taken into
> consideration.

$isleap = ($year % 400 == 0) || ($year % 4 == 0 && $year % 100 != 0);

-- 
Russ Allbery (rra@stanford.edu)         <URL:http://www.eyrie.org/~eagle/>


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

Date: 17 Apr 1997 19:10:48 GMT
From: brodger@bnr.ca (Roger Balakrishnan )
Subject: Mac version of Perl ...
Message-Id: <5j5sjo$nil@bmerhc5e.bnr.ca>


Hi,

Where (FTP sites etc) can I get a Mac version
of perl. 

BTW I am using a Mac SE, I dont think its using 
system 7 (Its been so long since Ive powered it
up !!!)


thanks,

roger


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

Date: 17 Apr 1997 16:15:03 -0400
From: merlin7@rci.rutgers.edu (Frank J. DeFalco)
Subject: Perl DB Sort Question
Message-Id: <5j60c7$gl6@toolbox.rutgers.edu>

I'm having a problem in my attempts to sort a simple database with according to a particular field. Much in the same way one would do so with Excel. The importance lying in the full DB entry being kept intact through the sort.

For Example if the DB looked as such:

yay:me:1:me
boo:foo:5:bland
gee:yay:3:yippie
foo:no:2:ok

Sorted result would be:
yay:me:1:me
foo:no:2:ok
gee:yay:3:yippie
boo:foo:5:bland

As apparent (hopefully) the db was sorted by the 3 field. Any help would be appreciated.


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

Date: 17 Apr 1997 13:29:03 -0700
From: John Carruthers <topcat1@primenet.com>
Subject: Perl script keeps coming up in Wordpad; why????????
Message-Id: <33565E4E.18F@primenet.com>

  Can anyone tell me please what is happening.  When my HTML script
calls my Perl program, the program is brought up in WordPad.  WHY
???????????
I would love to know.

If anyone can help me I will be very grateful !

John Carruthers
topcat1@primenet.com



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

Date: Thu, 17 Apr 1997 12:31:12 -0700
From: "Philip A. Prindeville" <philipp@ntex.com>
Subject: Re: POP3 perl script
Message-Id: <33567A80.133D@ntex.com>

Generic Blues wrote:
> 
> I want to write a perl script that will make a connection to a POP3
> server, login, etc. and grab any new mail I have and move it to
> /var/spool/mail. While I can handle most of this, what I don't know how to
> do is establish the network connection and communicate over it. Can
> someone give me an example of a) establishing the connection, b) sending
> something (i.e. "USER gblues") over that connection, and c) recieving
> data over it as well? I'd appreciate it.
> 
> -- Nathan Strong
> gblues@gstis.net

You can use libnet (the Net:: class), or (if you are masochistic
enough ;-) rewrite POP3 to use chat2.pl -- both of these will
manage your network connections.  The first will implement the
protocol for you as well.

-Philip


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

Date: 17 Apr 1997 20:41:18 GMT
From: neilb@zetnet.co.uk (Neil Briscoe)
Subject: Re: POP3 perl script
Message-Id: <memo.19970417214135.51797F@skep.compulink.co.uk.cix.co.uk>


In article <Pine.LNX.3.95.970415005913.218A-100000@gblues.grey.org>,
root@gblues.grey.org (Generic Blues) wrote:

>
> I want to write a perl script that will make a connection to a POP3
> server, login, etc. and grab any new mail I have and move it to
> /var/spool/mail. While I can handle most of this, what I don't know how
> to
> do is establish the network connection and communicate over it. Can
> someone give me an example of a) establishing the connection, b) sending
> something (i.e. "USER gblues") over that connection, and c) recieving
> data over it as well? I'd appreciate it.
>

If you're using Perl5 - then do get the mailtools and libnet archives from
the CPAN archive which includes the Net::POP3 module.  That does nearly
all the work for you.

Regards
Neil
 



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

Date: 17 Apr 1997 13:01:45 -0600
From: Nathan Torkington <gnat@elara.frii.com>
Subject: Re: reading in password file
Message-Id: <5qohbd323q.fsf@elara.frii.com>

lloyd@cs.fsu.edu (Justin C Lloyd) writes:
> Is there a way to make it more efficient?  Also, would it be better
> to return the array or a reference to the array?

A sexier approach, I'd say, is to use User::pwent and let it take care
of all that messy reference crud.  You just store your User::pwent
objects in a quick-lookup hash and you're done.  Here's some sample
happy code (tested).

    use User::pwent;

    # gather every user in the database
    while (defined ($pw = getpwent)) {
        $name{$pw->name} = $pw;
        $uid{$pw->uid} = $pw;
        push(@everyone, $pw);
    }
    
    $news = $name{news};
    printf("news has home directory: %s\n", $news->dir);
    
    $root = $uid{0};
    printf("root has home directory: %s\n", $root->dir);

Nat


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

Date: 17 Apr 1997 21:47:03 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: reading in password file
Message-Id: <5j65on$cdf$1@csnews.cs.colorado.edu>

 [courtesy cc of this posting sent to cited author via email]

In comp.lang.perl.misc, Nathan Torkington <gnat@elara.frii.com> writes:
:    while (defined ($pw = getpwent)) {

You don't need the defined check -- don't let 5.004 badger you into
silliness.  A reference is always true.  getpwent returns undef when it
runs out, and a boolean sense doesn't care about definedness ramblings
even under -w (module the <> and readdir hacks), so

    while ($pw = getpwent) {

is good enough.

--tom
-- 
	Tom Christiansen	tchrist@jhereg.perl.com
    "That's okay.  Anyone whose opinion he cares about already knows that
    he doesn't care about their opinion."
    	--Larry Wall


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

Date: 17 Apr 1997 17:17:47 GMT
From: sb@en.muc.de (Steffen Beyer)
Subject: Re: References question !!!
Message-Id: <5j5lvr$r6j$1@en1.engelschall.com>

Joe McGuckin <joe@via.net> wrote:

> $foo = "joe";
> $$foo{"foo"} = "foo";
> $$foo{"bar"} = "bar";

That's not working because $$foo is no lvalue here.

>From your example, I can't figure out what you are actually trying to do.
Can you be more specific?

My guess #1:

#!/sw/bin/perl -w

use strict;
no strict "vars";

$foo = "joe";
$bar = "bill";

$foobar{'foo'} = \$foo;
$foobar{'bar'} = \$bar;

foreach $key (keys %foobar)
{
    $ref = $foobar{$key};
    $val = ${$ref};
    print "\$key = '$key' \$val = '$val'\n";
}

which prints

$key = 'foo' $val = 'joe'
$key = 'bar' $val = 'bill'

My guess #2:

%foo = ( "joe"  => 1, "bill" => 2 );
%bar = ( "jeff" => 3, "sam"  => 4 );

$foo = \%foo;
$bar = \%bar;

${$bar}{"jack"} = 5;
${$foo}{"nick"} = 6;

foreach $key (keys %{$foo})
{
    $val = ${$foo}{$key};
    print "\$key = '$key' \$val = '$val'\n";
}

which prints

$key = 'bill' $val = '2'
$key = 'nick' $val = '6'
$key = 'joe' $val = '1'

> How do I say %$$foo, so I can foreach over the keys in the
> $$foo reference?

> I'd like to be abe to say

>   foreach $i (keys(%$$foo)){
>   }

> But that's not correct syntax.

In either case: "use strict" and "-w" when experimenting with references!
They'll indicate you the correct way!

Hope this helps.

Yours,
-- 
    |s  |d &|m  |    Steffen Beyer <sb@sdm.de> (+49 89) 63812-244 fax -150
    |   |   |   |    software design & management GmbH & Co. KG
    |   |   |   |    Thomas-Dehler-Str. 27, 81737 Munich, Germany.
                     "There is enough for the need of everyone in this world,
                     but not for the greed of everyone." - Mahatma Gandhi


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

Date: 17 Apr 1997 11:58:22 -0700
From: tar@ISI.EDU (Thomas A. Russ)
Subject: Re: Reply to Ousterhout's reply (was Re: Ousterhout and Tcl ...)
Message-Id: <ymi2089fpdd.fsf@hobbes.isi.edu>

In article <s6ypvvukubq.fsf@aalh02.alcatel.com.au> Chris.Bitmead@alcatel.com.au (Chris Bitmead uid(x22068)) writes:

 > 
 > Now Aristotle wrote in Greek, the characters of which you cannot
 > represent in an ascii string.

"Now <Alpha><rho><iota><sigma><tau><omega><tau><lambda><epsilon> wrote in..."

-- 
Thomas A. Russ,  USC/Information Sciences Institute          tar@isi.edu    


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

Date: 17 Apr 1997 21:19:15 GMT
From: Jonathan Guthrie <jguthrie@brokersys.com>
Subject: Re: Reply to Ousterhout's reply (was Re: Ousterhout and Tcl ...)
Message-Id: <5j644j$h97$1@news.hal-pc.org>

In comp.lang.scheme Cyber Surfer <cyber_surfer@gubbish.wildcard.demon.co.uk> wrote:

> > > If I had the time, I'd write a "Lisp for Dummies" book. At least, I'd 
> > > attempt it. The result probably wouldn't get published, as I doubt 
 
> > Isn't this basically what the "Little Lisper" is?

> I've yet to read it, alas, but from what I've read _about_ it, I 
> suspect this is true. Certainly a number of people who could easily be 
> described as "sceptics" have made favourable comments about this book.

> Yes, it's on my list of "books to get". The trouble is, there are so 
> many books on that list, and most of them are about Lisp. ;-) Still, 
> I'll get there someday.

The title is now "The Little Schemer".  I recently bought a copy of it
but I'd call it "LISP for nonprogrammers" rather than "LISP for dummies."
It certainly has a light, conversational style all the while it's 
introducing concepts like S-expressions and abstraction.

One thing about that book is that you really need to work through it.
One day, I expect to finish working through my copy.

-- 
Jonathan Guthrie (jguthrie@brokersys.com)
Information Broker Systems   +281-895-8101   http://www.brokersys.com/
12703 Veterans Memorial #106, Houston, TX  77014, USA

We sell Internet access and commercial Web space.  We also are general
network consultants in the greater Houston area.



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

Date: Thu, 17 Apr 1997 18:52:49 GMT
From: Jeff Etrick <jeffe@FL.ENSCO.COM>
Subject: Simple Split Question
Message-Id: <33567181.1CFB@FL.ENSCO.COM>

I have a variable that is set to 0.0, I would like to parse this
into two variables, but the split function always treats the variable
as a float. How do I tell perl to treat this as a string?

Ex:

my $STRTIM  =  0.0;
($H, $M) = split/\./,$STRTIM;

-------------------
Yields: $H =0 and $M=UNDEF


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

Date: Thu, 17 Apr 1997 15:22:23 -0700
From: Rick Tan <rick.tan@Eng.Sun.COM>
Subject: unreading a line of input
Message-Id: <3356A29F.3870@Eng.Sun.COM>

Is there a module that does this kind of stuff?  

Thanks.


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

Date: Thu, 17 Apr 1997 16:34:26 -0400
From: Ron Natalie <ron@sensor.com>
Subject: Re: What does "UNIX" stand for..
Message-Id: <33568952.2458@sensor.com>

Douglas Seay wrote:

> And if I remember my folklore correctly, they only had 64K segments to
> work with.  I've surely never used a PDP-7, so I can't say for sure.
> This encouraged small tools, or at least not hogs (cough *emacs*).  I
> believe that is why the C preprocessor is a separate executable.

PDP-11's only had 64K segments.  And UNIX was what the Intel community
call SMALL model for most of the early versions.  Couple that with the
fact that MEMORY was expensive back them.  My first UNIX system had
less than 128K of memory on it.  It only had about 8.5 MEG of disk.
Still it was pretty powerful as UNIX systems went in '77.

Other than the size issues, CPP is syntactically easier to implement
as a separate pass, frankly I think it was an afterthought to the C
language.

-Ron


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

Date: 8 Mar 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 8 Mar 97)
Message-Id: <null>


Administrivia:

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 327
*************************************

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