[8287] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1904 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Feb 16 16:10:15 1998

Date: Mon, 16 Feb 98 13:00:45 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Mon, 16 Feb 1998     Volume: 8 Number: 1904

Today's topics:
    Re: "Teach Yourself Perl in 21 days" (Was: Re: substitu <agr30@uni-koeln.de>
        .rc file parser, anyone? (EXCHANGE:CAR:5J42)
    Re: .rc file parser, anyone? <tchrist@mox.perl.com>
    Re: ? Regular Expressions ? <merlyn@stonehenge.com>
    Re: A Pubilc Apology. (Abigail)
    Re: A Pubilc Apology. (Chip Salzenberg)
    Re: A Pubilc Apology. (Michael Schuerig)
    Re: A Pubilc Apology. <tchrist@mox.perl.com>
        Berkeley DB for Win32, where, how, etc? <Paul.Makepeace@POBox.com>
    Re: Clearing all variables (Martien Verbruggen)
    Re: Curiosity? -w doesn't catch typo in first line (Michael Fuhr)
    Re: Curiosity? -w doesn't catch typo in first line <chris@ixlabs.com>
    Re: Embending perl into c <agr30@uni-koeln.de>
    Re: FAQless Forays (was: Code Example Needed) (Bart Lateur)
    Re: FAQless Forays (was: Code Example Needed) (Bart Lateur)
        German umlauts with perl <leo@evolution.org>
    Re: German umlauts with perl <tchrist@mox.perl.com>
        Guestbook <bytsma@iaehv.nl>
    Re: Help wanted with loop problem. Please. (Jonathan Feinberg)
    Re: Help: "use strict" & passing variables to subroutin (Martien Verbruggen)
        inet_ntoa <tkimball@siliconbeach.com>
        inet_ntoa <tkimball@siliconbeach.com>
    Re: Interpeter For The PC <chris@ixlabs.com>
    Re: Is It Possible? <chris@ixlabs.com>
    Re: Is It Possible? (Jonathan Feinberg)
        Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: 15 Feb 1998 16:14:32 +0100
From: Martin Bialasinski <agr30@uni-koeln.de>
Subject: Re: "Teach Yourself Perl in 21 days" (Was: Re: substitute...)
Message-Id: <87u3a0yk6f.fsf@haitech.internet-treff.de>

Chipmunk <rjk@coos.dartmouth.edu> writes:

> Tom Christiansen wrote:
> > 
> > In comp.lang.perl.misc, Martin Bialasinski <agr30@uni-koeln.de> writes:
> > :Anyway, the Panther book is better then both books. Never seen a technical
> > :book that good (although the erratum is quite long already :-( ).
> > 
> > (In English, like Latin, we tend to say "errata are" for a list of them, and
> >  "erratum is" for just one.)
> 
> Actually, each individual erratum is probably fairly short.  It would be more
> accurate to say "the list of errata is quite long".  :-)

Yes, just what I meant. I just abbreviated a bit ;-)

And in Latin one would also rather say "sunt" and "est", not "are" and "is"
:-) But I appreciate any corrections which make me improve my english.

Ciao,
	Martin




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

Date: Sun, 15 Feb 1998 10:55:21 -0500
From: "Grant Totten (EXCHANGE:CAR:5J42)" <grantt@americasm01.nt.com>
To: grantt@nortel.ca
Subject: .rc file parser, anyone?
Message-Id: <34E70FE8.908C9969@americasm01.nt.com>

Hi all,

Has anyone written a 'run command' file parser?  Are there any libraries
availabe to do this?

I would like to be able to have a .rc file like this:

 .sderc:

[defaults]
default_view = grantt
default_umask = 002


[view grantt]
umask = 022
directory = /home/grantt/test
 ...

and have my program read the values into a hash or something that I can
then work wtih.

I'll write my own routines if I have to but I would just as soon avoid
re-inventing this particular wheel.

Thanks in advance,

Grant Totten
Nortel Public Data Networks
grantt@nortel.ca




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

Date: 15 Feb 1998 16:54:55 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: .rc file parser, anyone?
Message-Id: <6c76kv$qkd$1@csnews.cs.colorado.edu>

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

In comp.lang.perl.misc, 
    "Grant Totten (EXCHANGE:CAR:5J42)" <grantt@americasm01.nt.com> writes:
:Has anyone written a 'run command' file parser?  Are there any libraries
:availabe to do this?

I've always found that there is nothing so simple, powerful,
and flexible as using a simple require.

Look on CPAN for ineffably complex "solutions" by those who eschew the
power of simplicity.  Search for config in the modules list.

For example, here's my /etc/keepalive.conf file:

    $PHONE	= 'XXX-XXXX';
    $ACCOUNT	= 'somelogin';
    $PASSWORD	= 'somepasswd';
    $LOCAL	= '199.45.135.9';
    $NETMASK	= '255.255.255.0';
    $MTU	= 296;
    $DEVICE	= 'cua1';
    $RATE	= 115200;
    $MODE	= 'adaptive'

I believe it is fundamnetall wrong to mollycoddle those can cannot cope
with punctuation.   For those, however, I have also seen this strategy:

    PHONE	XXX-XXXX
    ACCOUNT	somelogin
    PASSWORD	somepasswd
    LOCAL	199.45.135.9
    NETMASK	255.255.255.0
    MTU	        296
    DEVICE	cua1
    RATE	115200
    MODE	adaptive

And then 

    while (<CONFIG>) {
	chomp;
	($key, $value) = split(' ', $_, 2);
	$Config{$key} = $value;
    } 

--tom
-- 
	Tom Christiansen	tchrist@jhereg.perl.com


There is a need to keep from being locked into Open Systems. --IBM sales rep


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

Date: 16 Feb 1998 09:58:10 -0700
From: Randal Schwartz <merlyn@stonehenge.com>
To: Bob Sparks <Sparks@Sourceworks.com>
Subject: Re: ? Regular Expressions ?
Message-Id: <8c4t1z1o7x.fsf@gadget.cscaper.com>

>>>>> "Bob" == Bob Sparks <Sparks@Sourceworks.com> writes:

Bob> At home I have a lovely awk, yes awk, script man2html, that at
Bob> least puts the man into a semi up todate interface. At work I
Bob> don't have the web server to run the cgi script so a have the
Bob> perldocs in one big html document. You will never use man pages
Bob> again once you are set up properly.

Bob> A decent perl version of man2html would cross reference the text
Bob> and have a hot linked index. Examples would be available for down
Bob> load. Not to mention a search engine with some logic. The man
Bob> thing is it would have option of saving the processing to disk to
Bob> a web server would not be required.

Bob> But I guess perl programmers are too busy trying to out do each
Bob> other with clever with regexp than to be clever at making their
Bob> life easier. Work Harder NOT smarter seems to be their motto.

You know not of what you speak.

The distribution comes with pod2html, which makes decent HTML pages
(with cross references that work) from the original POD.  These pages
for the most recent supported version of Perl are also accessible
online in the CPAN, available for download in case you choose not to
learn about pod2html.

Please check your facts before you flame.  It makes the debate more
interesting that way.  Instead, you get dismissed as someone who
hasn't really looked around much.

And, as a data point, I much prefer a manpage (or even POD) to HTML.
I can grep it nicely.  I can look at it without firing up a web
browser.  I don't have to stare at bold and fonts that make me gag.

To each his or her own, I guess.

print "Just another Perl hacker," # but not what the media calls "hacker!" :-)
## legal fund: $20,990.69 collected, $186,159.85 spent; just 196 more days
## before I go to *prison* for 90 days; email fund@stonehenge.com for details

-- 
Name: Randal L. Schwartz / Stonehenge Consulting Services (503)777-0095
Keywords: Perl training, UNIX[tm] consulting, video production, skiing, flying
Email: <merlyn@stonehenge.com> Snail: (Call) PGP-Key: (finger merlyn@teleport.com)
Web: <A HREF="http://www.stonehenge.com/merlyn/">My Home Page!</A>
Quote: "I'm telling you, if I could have five lines in my .sig, I would!" -- me


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

Date: 15 Feb 1998 07:44:47 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: A Pubilc Apology.
Message-Id: <6c66df$5re$2@client2.news.psi.net>

Joseph N. Hall (joseph@5sigma.com) wrote on 1629 September 1993 in
<URL: news:34E654F9.60B2CC67@5sigma.com>:
++ I find most followups to my posts these days with DejaNews.  Too much
++ crap to sift through otherwise.

I use my mailreader to score articles based on article headers.
Giving followups on your postings based on the References header
isn't hard at all. It isn't 100% accurate, but I can live with
the one false positive or negative a month.



Abigail
-- 
perl -wle 'print "Prime" if (1 x shift) !~ /^1?$|^(11+?)\1+$/'


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

Date: Sun, 15 Feb 1998 23:54:37 GMT
From: chip@mail.atlantic.net (Chip Salzenberg)
Subject: Re: A Pubilc Apology.
Message-Id: <6c7vbd$vbv$1@cyprus.atlantic.net>

According to doswald@xmission.com:
> ... in a group such as this one where 200 new messages come in every
> day it is easy to miss a followup.

Any newsreader worth the bits it's recorded on has a search feature.
For example, in trn, I say:

    /salzenberg/a
    /chip@/a

Then I can read any article in which I or my login name is mentioned.
Surely similar searches serve for all practical purposes.  I don't
like mailed copies of Usenet articles cluttering my mailbox.  Not one
bit.
-- 
Chip Salzenberg                - a.k.a. -                <chip@pobox.com>
      "Hoist the failure sails, men!  We're goin' home!"  // MST3K
           ->  Ask me about Perl training and consulting  <-
     Like Perl?  Want to help out?  The Perl Institute: www.perl.org


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

Date: Sun, 15 Feb 1998 15:20:58 +0100
From: schuerig@acm.org (Michael Schuerig)
Subject: Re: A Pubilc Apology.
Message-Id: <1d4huis.1waikol1kbgy2wN@rhrz-ts2-p2.rhrz.uni-bonn.de>

David Oswald <doswald@xmission.com> wrote:

> But in a group such as this one
> where 200 new messages come in every day it is easy to miss a
> followup.

If that's really a problem for you, then you're definitely using one of
the wrong newsreaders. ;-) 

Michael

-- 
Michael Schuerig
mailto:schuerig@acm.org
http://www.uni-bonn.de/~uzs90z/


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

Date: 15 Feb 1998 23:21:14 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: A Pubilc Apology.
Message-Id: <6c7t9a$o0i$2@csnews.cs.colorado.edu>

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

In comp.lang.perl.misc, les@MCS.COM (Leslie Mikesell) writes:
:I know how to track followups after finding the parent article,
:but how do you make trn notice that there is a new article
:and the parent is 'yours'?

Use the '-p' flag.

--tom
-- 
	Tom Christiansen	tchrist@jhereg.perl.com
"Espousing the eponymous /cgi-bin/perl.exe?FMH.pl execution model is like 
reading a suicide note -- three days too late."
	    --Tom Christiansen <tchrist@mox.perl.com>


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

Date: Sun, 15 Feb 1998 16:16:29 -0000
From: "Paul Makepeace" <Paul.Makepeace@POBox.com>
Subject: Berkeley DB for Win32, where, how, etc?
Message-Id: <887559164.18577.0.nnrp-11.9e98490c@news.demon.co.uk>

Does anyone use DB_File under Win32? I've spent quite some time trying to
get hold of info on this and with little luck. Following from the win32 FAQ
to http://www.sleepycat/com/db/ through to their only link to Win32 material
at Microsoft left me wondering whether anything beyond MS's vintage '94
version 1.72 exists. There seems to be precious little info elsewhere;
either that or my otherwise fine web-searching skills are failing....

In the meantime, SDBM is fine, although I'm wondering how well this scales.
Most of the data doesn't need to be accessed in realtime and the web-pages
are being batch processed so it's not a major big deal. Any
experience/wisdom appreciated!

Cheers, Paul.
--
"Here's one I prepared earlier....": http://www.cartoon-network.co.uk/game/





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

Date: 15 Feb 1998 22:42:02 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Clearing all variables
Message-Id: <6c7qvq$r8n$2@comdyn.comdyn.com.au>

[Courtesy CC to quoted poster]

In article <34e496d3.0@myth.vianet.on.ca>,
	"Lainer" <elaine@lainer.com> writes:

> Why are some people so damned rude to others in here?  Nowhere did I see in
> the FAQ that you had to be an expert in Perl to post to this NG.  Perhaps
> you should refrain from posting replies if you can't take a lighter tone
> with people and be a little more helpful.


Lainer,

As other people already pointed out: it was not my intention to be
rude. Short, yes. But I don't consider that rude. The reason my posts
often are short, is that I do answer other posts as well. Since I also
have work to do, I try to minimise the amount of time I spend
answering posts.

I hope this clears things up a bit.

Martien
-- 
Martien Verbruggen                  | 
Webmaster www.tradingpost.com.au    | I took an IQ test and the results were
Commercial Dynamics Pty. Ltd.       | negative.
NSW, Australia                      | 


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

Date: 14 Feb 1998 23:56:43 -0700
From: mfuhr@dimensional.com (Michael Fuhr)
Subject: Re: Curiosity? -w doesn't catch typo in first line
Message-Id: <6c63jb$881@flatland.dimensional.com>

sase@sasezdesyn.com (SasEz! Publications and Design) writes:

>    In one of my blonde mode moments, I accidentally transposed the #
> and ! in my first line of a new program. I had !#/usr/bin/perl
> instead of #!/usr/bin/perl   Now, the curious part is that running
> the program from the command line with the -w switch did not give me
> any indication that the first line had a problem. Running from the
> web of course did, it gave me a "premature end of script errors
> (errno=8)" message. Can anyone fill me in on why -w didn't tell me?

What version of Perl are you running?  5.004_04 reports a "Useless
use of not in void context" warning.  Here's the program:

    !#/usr/bin/perl -w
    print "test\n";

Here's what happens when you run it:

    $ perl -w foo
    Useless use of not in void context at foo line 2.
    test

The line number is off because Perl doesn't recognize that the ! is
useless until it sees the print statement on the following line.

-- 
Michael Fuhr
http://www.dimensional.com/~mfuhr/


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

Date: Sun, 15 Feb 1998 16:10:06 -0800
From: Chris Schoenfeld <chris@ixlabs.com>
To: "SasEz! Publications and Design" <sase@sasezdesyn.com>
Subject: Re: Curiosity? -w doesn't catch typo in first line
Message-Id: <34E783DE.CD26E060@ixlabs.com>

#!/usr/bin/perl

Is UNIX (shell?) syntax, not perl syntax.

#!command tells the shell to run that command, and pipe the rest of the
file into that program's standard input. It doesn't matter *what* that
command is - for you it happens to be Perl, but it could be bash or sh.

So if you screw up this line, perl -w will never know, because the shell
does not even know to send it to perl yet.

In this case, your shell will probably attempt to interpret the file as
a shell script, which will result in very different errors!

HTH
Chris






SasEz! Publications and Design wrote:
> 
> Hi all,
>    In one of my blonde mode moments, I accidentally transposed the #
> and ! in my first line of a new program. I had !#/usr/bin/perl
> instead of #!/usr/bin/perl   Now, the curious part is that running
> the program from the command line with the -w switch did not give me
> any indication that the first line had a problem. Running from the
> web of course did, it gave me a "premature end of script errors
> (errno=8)" message. Can anyone fill me in on why -w didn't tell me?
> Thanks,
> Kathy
> -
> SasEz! Publications and Design ~ Kathy Burns
> Professional Web Design, Hosting, and Maintenance
> http://www.sasezdesyn.com  mailto:sase@sasezdesyn.com
> ICQ #828499 ~Check out our Free web design planning guide!~
> -

-- 
---
Chris Schoenfeld
IX Development Laboratories
Santa Rosa, California


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

Date: 15 Feb 1998 18:09:24 +0100
From: Martin Bialasinski <agr30@uni-koeln.de>
Subject: Re: Embending perl into c
Message-Id: <87ra54yeuz.fsf@haitech.internet-treff.de>

Martin Bialasinski <agr30@uni-koeln.de> writes:

No answers far, no remark to RTFM, so there must be something difficult
about this.

I would appreciate *any* answers.

If this is not possible, please tell me so. Then I have to bow towards tcl
and think of something else.

If this is possible and you have done this before, but it is too hard or
too much (or whatever) to write about, please make the C code sniplet
available to me, so that I have something to start with. I then can figure
out what to change and how to change it on my own.

Thanks,
	Martin

: I have found a ISDN voicebox application which when called starts a tcl
: script. Well, tcl and me, we are no friends somehow, so I want to use Perl
: instead. (Minor Problem: I can't do c as well :-)
: 
: The programm (vbox.c) does:
: 
:  a) create a tcl interpreter
:  b) make a connection between some variables defined in vbox.c and the tcl
:     interpreter 
:  c) make a connection between some functions defined in vbox.c and the tcl
:     interpreter
:  d) calls a script in the generated interpreter
: 
: So the script can use and alter some variables in vbox.c and it can call
: some functions defined in vbox.c
: 
: Thanks to Advanced Perl Programming, creating a perl interpreter and
: calling a script in it looks easy.
: 
: But I have no clue how to do b) and c).
: 
: The explanations in perlxs, perlxstut, perlguts and the panther book seem
: only to deal with creating a glue between a C library and a perl script,
: not with the problem I have.



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

Date: Sun, 15 Feb 1998 15:24:04 GMT
From: bart.mediamind@tornado.be (Bart Lateur)
Subject: Re: FAQless Forays (was: Code Example Needed)
Message-Id: <34ebed99.7760682@news.tornado.be>

gabor@vmunix.com (Gabor) wrote:

># >local ($/) = undef;
># 
># Two nits.  First, parens on local and my are not required if there's
># only one variable.  Thus:
># 
>#     local $/ = undef;
>
>I know that.  I always put my variables declared with 'my' or 'local'
>into parens, well most of the time.  It looks better to me. ;-)
>TMTOWTDI

It doesn't just look better. It's safer too! 

This bit me once. I thought I'd share it.

	my $a, $b;

IT's a very silly example. But, countrary to what it looks like, it WILL
compile, but it WILL NOT do what I expected: only $a is local. $b is
still global. The effect is like
	
	(my $a), $b;

so the comma is interpreted as the comma operator. I don't understand
the reasoning behind this, but it sure doesn't make sense to me.

There you have it. I will ALWAYS use parens with local and my. I won't
ever let this bite me again.

	Bart.


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

Date: Sun, 15 Feb 1998 20:33:13 GMT
From: bart.mediamind@tornado.be (Bart Lateur)
Subject: Re: FAQless Forays (was: Code Example Needed)
Message-Id: <34ea4fef.4522854@news.tornado.be>

Tom Christiansen <tchrist@mox.perl.com> wrote:

>Then you get bitten by other things instead: the ones where list
>context versus scalar context is a concern:
>
>    my ($x) = @array;
>    my  $x  = @array;

etc.

Sure. But if that's what I want, I can still resort to "scalar".

    my($x) = scalar @array;

which problably is clearer also.

	Bart.


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

Date: Sun, 15 Feb 1998 15:39:28 +0100
From: Leo Betz <leo@evolution.org>
Subject: German umlauts with perl
Message-Id: <34E6FE20.7BB45721@evolution.org>

Hello all,

I use Perl for Win32 and have problems with german umlauts. Is it
possible to print these country-specific characters with a perl-script?
I get only strange characters on my screen, when I want to print a "ue"
or something else.

Please replie via email!

bye, Leo
leo@evolution.org


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

Date: 15 Feb 1998 14:50:18 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: German umlauts with perl
Message-Id: <6c6vba$iha$1@csnews.cs.colorado.edu>

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

In comp.lang.perl.misc, Leo Betz <leo@evolution.org> writes:
:I use Perl for Win32 and have problems with german umlauts. Is it
:possible to print these country-specific characters with a perl-script?
:I get only strange characters on my screen, when I want to print a "ue"
:or something else.

Here's a table I made for HTML entity conversion to standard
Latin-1 (ISO-8859-1) ASCII.

Tsch|_

--tom

    chr 160	no-break space
    chr 161	inverted exclamation mark
    chr 162	cent sign
    chr 163	pound sterling sign CURRENCY NOT WEIGHT
    chr 164	general currency sign
    chr 165	yen sign
    chr 166	broken (vertical) bar
    chr 167	section sign
    chr 168	umlaut (dieresis)
    chr 169	copyright sign
    chr 170	ordinal indicator, feminine
    chr 171	angle quotation mark, left
    chr 172	not sign
    chr 173	soft hyphen
    chr 174	registered sign
    chr 175	macron
    chr 176	degree sign
    chr 177	plus-or-minus sign
    chr 178	superscript two
    chr 179	superscript three
    chr 180	acute accent
    chr 181	micro sign
    chr 182	pilcrow (paragraph sign)
    chr 183	middle dot
    chr 184	cedilla
    chr 185	superscript one
    chr 186	ordinal indicator, masculine
    chr 187	angle quotation mark, right
    chr 188	fraction one-quarter
    chr 189	fraction one-half
    chr 190	fraction three-quarters
    chr 191	inverted question mark
    chr 192	capital A, grave accent
    chr 193	capital A, acute accent
    chr 194	capital A, circumflex accent
    chr 195	capital A, tilde
    chr 196	capital A, dieresis or umlaut mark
    chr 197	capital A, ring
    chr 198	capital AE diphthong (ligature)
    chr 199	capital C, cedilla
    chr 200	capital E, grave accent
    chr 201	capital E, acute accent
    chr 202	capital E, circumflex accent
    chr 203	capital E, dieresis or umlaut mark
    chr 204	capital I, grave accent
    chr 205	capital I, acute accent
    chr 206	capital I, circumflex accent
    chr 207	capital I, dieresis or umlaut mark
    chr 208	capital Eth, Icelandic
    chr 209	capital N, tilde
    chr 210	capital O, grave accent
    chr 211	capital O, acute accent
    chr 212	capital O, circumflex accent
    chr 213	capital O, tilde
    chr 214	capital O, dieresis or umlaut mark
    chr 215	multiply sign
    chr 216	capital O, slash
    chr 217	capital U, grave accent
    chr 218	capital U, acute accent
    chr 219	capital U, circumflex accent
    chr 220	capital U, dieresis or umlaut mark
    chr 221	capital Y, acute accent
    chr 222	capital THORN, Icelandic
    chr 223	small sharp s, German (sz ligature)
    chr 224	small a, grave accent
    chr 225	small a, acute accent
    chr 226	small a, circumflex accent
    chr 227	small a, tilde
    chr 228	small a, dieresis or umlaut mark
    chr 229	small a, ring
    chr 230	small ae diphthong (ligature)
    chr 231	small c, cedilla
    chr 232	small e, grave accent
    chr 233	small e, acute accent
    chr 234	small e, circumflex accent
    chr 235	small e, dieresis or umlaut mark
    chr 236	small i, grave accent
    chr 237	small i, acute accent
    chr 238	small i, circumflex accent
    chr 239	small i, dieresis or umlaut mark
    chr 240	small eth, Icelandic
    chr 241	small n, tilde
    chr 242	small o, grave accent
    chr 243	small o, acute accent
    chr 244	small o, circumflex accent
    chr 245	small o, tilde
    chr 246	small o, dieresis or umlaut mark
    chr 247	divide sign
    chr 248	small o, slash
    chr 249	small u, grave accent
    chr 250	small u, acute accent
    chr 251	small u, circumflex accent
    chr 252	small u, dieresis or umlaut mark
    chr 253	small y, acute accent
    chr 254	small thorn, Icelandic
    chr 255	small y, dieresis or umlaut mark
-- 
	Tom Christiansen	tchrist@jhereg.perl.com

*bp++ = i;      /* now go back to screaming loop */
    --Larry Wall, from perl/sv.c in the v5.0 perl distribution


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

Date: 16 Feb 1998 19:46:58 GMT
From: "Bob Ytsma" <bytsma@iaehv.nl>
Subject: Guestbook
Message-Id: <01bd0280$2d404ca0$d44e97c2@Bob>

I need a guestbook for my homepage. But i don`t now anything about cgi, can
anyone help me ?
I don`t wan`t to write the script myself. But i just want it working on my
homepage !

mailto: bytsma@IAEhv.nl
homepage : http://www.IAEh.nl/users/bytsma/


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

Date: Sun, 15 Feb 1998 02:51:08 -0500
From: jdf@pobox.com (Jonathan Feinberg)
Subject: Re: Help wanted with loop problem. Please.
Message-Id: <MPG.f506877637f5fbf9896d1@news.concentric.net>

[This followup was posted to comp.lang.perl.misc and a copy was sent to the 
cited author.]

networks@skynet.co.uk said...
> or $e eq $find)	{	push @url, $name, $link;	}

What you want is a hash.

   $url{$name} = $link;

> foreach $found (@url)
> {print "<a href=\"",$found,"\">",$found,"</a><BR>";}

   foreach $name (keys %url) {
      print found_line( $name, $url{name} );
   }

Now, I've given you some free help.  To pay me back, please read the section 
of your perl documentation entitled "perldata."  You'll learn a lot more than 
I can teach you here.

-- 
Jonathan Feinberg    jdf@pobox.com    Sunny Brooklyn, NY


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

Date: 15 Feb 1998 22:51:17 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Help: "use strict" & passing variables to subroutine
Message-Id: <6c7rh5$r8n$3@comdyn.comdyn.com.au>

[If you post as well as email, please say so at the beginning of your
post. That prevents the receiver of the email from having to type his
or her answer twice.]

In article <34E4F4F5.2988623C@technologist.com>,
	Tommy <tkho@technologist.com> writes:

> Thank you for your help. I believe I have to study more to fix it.
> 
> Correct me if I am wrong. To do a variable passing between main and
> subroutine, the structure for Perl 4 is something like this:
> 
> #!/usr/local/bin/perl
> use strict;
> my (@global_var);     # Global variables such as folder's name
> ...
> @result_var= &routine(%passing_var);     # Passing variables such as filename
> ...
> 
> sub routine {
>   %Q= @_;
>   my (@routine_var, @result);    # temporary variable such as $i
>   &DoSomething if (@global_var);
>   ...
>   return @result;
> }
> 
> So, how is Perl 5 look like?

This is already perl 5, since you use my :)

I was mainly referring to your use of soft references to get access to
the members of the array you passed in.

The way subs work in perl4 and perl5 is largely the same, and you
should call them the same way. The main difference lies in the way you
_can_ pass variables to subroutines. You can now pass a hard reference
to an array, for example, and use it sort of like you'd use a pointer
in C.

my %hash = ();
my @array = ();
my $var = 1;
my @other_array = ();

my $result = sub_name(\%hash, \@array, $var, @other_array);

sub sub_name
{
	my $hash_ref = shift;
	my $array_ref = shift;
	my $var_here = shift;
	my @rest = @_;
}

This gives you a reference to %hash and @array (you will be
manipulating the original data, NOT a copy), a copy of $var and a copy
of the contents of @other_array.

> My main question is "How can I run strict and use hash ref together?" i.e
> 
> #!/usr/local/bin/perl
> use strict;
> my $VAL= &RetVal5( ARRAY => "TEST", POS => "FIRST" );
> print $VAL;    # exactly equal to print $TEST{FIRST};
> 
> sub RetVal5 {
> # for Perl 5
>   my %Q= @_;
>   my $A= "TEST";
>   $A->{FIRST}= 1;    # equals to $$A{FIRST}= 1; I guess

$A is a variable (string) here, not a reference to a hash. I think you
want something slightly different.


#!/usr/local/bin/perl -w
# use that -w flag, it will warn you about lots of things in your
# script.

use strict;

my @ARRAY = ();
my %HASH = ();
my $i = 0;

retval5( \@ARRAY, \%HASH );

foreach (@ARRAY)
{
	print "el: ", $i++, ", val: $_\n";
}

foreach my $key (keys %HASH)
{
	print "key: $key, val: $HASH{$key}\n";
}

sub retval5
{
	my $array_ref = shift;
	my $hash_ref = shift;

	foreach (0..5)
	{
		$array_ref->[$_] = $_;
	}

	foreach (qw(first second third fourth))
	{
		$hash_ref->{$_} = reverse($_);
	}
}

The documentation that I suggested gives more examples, especially the
perlsub pages.

Martien
-- 
Martien Verbruggen                  | 
Webmaster www.tradingpost.com.au    | Advertising:  The science of arresting
Commercial Dynamics Pty. Ltd.       | the human intelligence long enough to
NSW, Australia                      | get money from it.
-- 
Martien Verbruggen                  | My friend has a baby. I'm writing down
Webmaster www.tradingpost.com.au    | all the noises the baby makes so later
Commercial Dynamics Pty. Ltd.       | I can ask him what he meant - Steven
NSW, Australia                      | Wright


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

Date: Sun, 15 Feb 1998 16:28:48 -0800
From: Timothy Kimball <tkimball@siliconbeach.com>
Subject: inet_ntoa
Message-Id: <34E78840.70B5@siliconbeach.com>

My platform: Win32 (sorry in advance to all unix gurus..)
My perl interperter: Both Activeware 5.003xxx build 315
                      AND the freeware 5.004_02 build for win32.. 

The script:

use Socket;

$test = inet_aton("157.22.208.5");

Details:
"157.22.208.5" is the IP address of my ethernet card.
I also have 2 other modems installed for network access.
My ethernet card is not connected to any network.

When I run this code with no internet connection on any
of my devices, the command blocks forever. It never
returns. When I dial out on one of my modems,
it works fine. 

I was under the impression that this command should work
without an internet connection, and, in fact, it works
find in Visual C++ without one. Now, I could simply
right it myself, granted, but this leads to my second
question.

I have designed a perl client that talks to a Visual C++
server that I have written. The perl client is designed
to open a connection to the server, talk to it, and close
the connection, repeating this over and over again,
tell I say stop. (basically, testing the server to make sure
it cleans up after itself..). Now, after a while, the machine
runs out of network resources. I quit the perl client, 
and restart, everything starts up fine. 

I have also tested this with a Visual C++ client as well, which
can run forever, and not have any problems..


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

Date: Sun, 15 Feb 1998 16:37:03 -0800
From: Timothy Kimball <tkimball@siliconbeach.com>
Subject: inet_ntoa
Message-Id: <34E78A2F.1749@siliconbeach.com>

Platform: Win32

Perl interpter: ActiveWare 5.003_07 build 315.
            and freeware perl 5.004_02 for win32
Script:
use Socket;
$test = inet_ntoa("157.22.208.5");

Machine:
I have 3 internet devices. 1 Ethernet card, and 2 modems.
The IP address 157.22.208.5 is the address of my 
ethernet card. The ethernet card is not connected to
a LAN. 

Problem:
When I establish a internet connection with
one of my modems, the above works fine. If I do
not have an active connection, the command inet_ntoa
blocks indefintely. I have tried this with both the activeware
and the new 5.004_02 release from Gurusamy Sarathy. 
Both have the same behavior.
I was under the impression that inet_ntoa did not
require a network connection (all it does is move
bits around, right?). In fact, I have a Visual C++ client
I wrote that works just fine.. 
I could write this myself, but I think I might be missing
a bit of the picture?

-Tim


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

Date: Sun, 15 Feb 1998 16:00:29 -0800
From: Chris Schoenfeld <chris@ixlabs.com>
To: Eric Umehara <momiji@slip.net>
Subject: Re: Interpeter For The PC
Message-Id: <34E7819D.A997C796@ixlabs.com>

You will need to install a webserver on your PC - I don't know of any
free ones offhand but I know there are some fine ones which do exist.

Get to work setting that up first.

This document will tell you what you need to know to get a perl
interpreter on your Win95 box:

http://www.endcontsw.com/people/evangelo/Perl_for_Win32_FAQ.html

If you have questions about Perl CGI, here are some great resources:

http://reference.perl.com/query.cgi?cgi

If you have questions about CGI (ho CGI programs ork, but necessarily
Perl-specific), check the CGi resources first - if you can't find the
answer, try asking in comp.infosystems.www.authoring.cgi .

If you have a Perl-specific question, check llama and FAQ, then post
here if you still need help.

HTH

Chris




Eric Umehara wrote:
> 
> I'm a novice Perl programmer. Meaning that I just started today. I bought a
> book called Learning Perl. I guess it is commonly known as the lamma book.
> My question is, is their a way of testing perl scripts on my Win95 PC. My
> goal for learning Perl is so I can write CGI scripts for my web page. I
> know this is probaly the wrong place to post this but this was the closest
> newsgroup to comp.lang.perl I could find. If you could answer my question
> along with redirecting me to a more appropriate newsgroup I would
> appreciate it.
> 
> Thanks
> Momiji@Slip.Net

-- 
---
Chris Schoenfeld
IX Development Laboratories
Santa Rosa, California


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

Date: Sun, 15 Feb 1998 15:49:06 -0800
From: Chris Schoenfeld <chris@ixlabs.com>
To: Tony Kenny <tony@furness.co.uk>
Subject: Re: Is It Possible?
Message-Id: <34E77EF2.9E43B66F@ixlabs.com>

You may be able to get this to work, but Perl would definitely *not* tbe
the best tool for this job. You'd probably be better off with VB or
Macromedia Director.

You would also be doing a good deal of groundbreaking and are unlikely
to be able to get much help on such a project.

-Chris

Tony Kenny wrote:
> 
> I was wondering what the furthest limit is of perl.  Is it possile with
> current libraries and modules available to write a stand alone program with
> perl that includes a GUI etc.  Such as a front end to a CDROM training
> product. ?
> 
> Also, is it possible to turna perl program into a single exe file, embedding
> commands that would normally only work with UNIX so that they will work on
> Win95 / NT ?
> 
> Thanks for any help.
> 
> Tony Kenny
> tony@furness.co.uk

-- 
---
Chris Schoenfeld
IX Development Laboratories
Santa Rosa, California


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

Date: Sun, 15 Feb 1998 10:43:30 -0500
From: jdf@pobox.com (Jonathan Feinberg)
Subject: Re: Is It Possible?
Message-Id: <MPG.f50d72f9d32f2439896d4@news.concentric.net>

[This followup was posted to comp.lang.perl.misc and a copy was sent to the 
cited author.]

tony@furness.co.uk said...
> I was wondering what the furthest limit is of perl.  Is it possile with
> current libraries and modules available to write a stand alone program with
> perl that includes a GUI etc.  Such as a front end to a CDROM training
> product. ?
> 
> Also, is it possible to turna perl program into a single exe file, embedding
> commands that would normally only work with UNIX so that they will work on
> Win95 / NT ?

Sure, you could use a variety of GUI toolkits with perl, but why hammer a nail 
with a chainsaw?  Since (as you imply) you're targeting Win32, why not use one 
of the several very capable multimedia authoring tools that already exist on 
that platform?  Any one of them will give you a quick developent cycle, with a 
finished product that'll most likely be cross-platform (in the PC world).

Yes, you can embed the perl interpreter in any arbitrary program that's 
compilable in an environment that can compile Perl.  I'm almost certain that 
this is not what you want to do.

-- 
Jonathan Feinberg    jdf@pobox.com    Sunny Brooklyn, NY


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

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

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