[10115] in Perl-Users-Digest
Perl-Users Digest, Issue: 3708 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Sep 14 06:07:27 1998
Date: Mon, 14 Sep 98 03:00:23 -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 Mon, 14 Sep 1998 Volume: 8 Number: 3708
Today's topics:
Re: ANN: Backwards.pm (Leslie Mikesell)
evaling user-supplied regexes (Cookbook 6.11) (Carl Brock Sides)
Help me... <mattias@mjolby.nu>
How get form data (perl variable) forwarded to http://? (Andre' Bell)
Re: Memory considerations with PERL <sugalskd@netserve.ous.edu>
Re: Perl & Java - differences and uses <zenin@bawdycaste.org>
Re: Perl & Java - differences and uses <zenin@bawdycaste.org>
Perl 's Help wanted <chongmc@pc.jaring.my>
Perl for Win32 Problems <mod@vei.net>
Re: Perl for Win32 Problems (Sam Holden)
Perl4/Perl5 (Owen Cook)
Problem with print" Location: <bobby@alpstreet.ie>
Serial IO in Perl? <bigbro@dmrt.nl>
Web Chat <mlopez@greenbit.es>
Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 14 Sep 1998 01:57:19 -0500
From: les@MCS.COM (Leslie Mikesell)
Subject: Re: ANN: Backwards.pm
Message-Id: <6tieof$rlc$1@Mercury.mcs.net>
In article <x73e9vzy7o.fsf@sysarch.com>, Uri Guttman <uri@sysarch.com> wrote:
>>>>>> "MD" == Mark-Jason Dominus <mjd@op.net> writes:
>
> MD> In article <35fbaaa2.3365144@news.btinternet.com>, Jonathan Stowe
> MD> <Gellyfish@btinternet.com> wrote:
> >> And I just thought MJD's proposal was a joke ;-}
>
> MD> Nope.
>
> MD> When I propose Sideways.pm, that's a joke.
>
>well, Backwards.pm is no joke but my code can occassionally be funny :-)
>
>now that i published it, will you who asked for it test it and help me
>CPAN it? i have never submitted to CPAN and i need to know what high
>standards of code quality, documentation and API it needs to pass
>muster? :-)
How does it compare speed-wise to reading 'tail -r' (bsd) or the
gnu 'tac' program on a pipe?
Les Mikesell
les@mcs.com
------------------------------
Date: Mon, 14 Sep 1998 01:04:10 -0500
From: opus@magibox.net (Carl Brock Sides)
Subject: evaling user-supplied regexes (Cookbook 6.11)
Message-Id: <opus-1409980104100001@demeter-43.magibox.net>
In th Perl Cookbook, Tom and Nat recommend evaling user-supplied patterns
prior to use thus:
eval { "" =~ /$pattern/ };
warn "INVALID PATTERN: $@" if $@;
They give dire warnings about using the following:
eval "/$pattern/";
warn "INVALID PATTERN: $@" if $@;
The example they (without any elaboration) give as dangerous is:
$pattern = "You lose @{[ system('rm -rf *')]} big here";
I think I understand the nature of the problem, but I fail to understand
why the first code is safe from this problem, but the second is not.
Anyone care to enlighten me?
Brock Sides
opus@magibox.net
------------------------------
Date: Mon, 14 Sep 1998 09:32:44 +0200
From: "Mattias Kristoffersen" <mattias@mjolby.nu>
Subject: Help me...
Message-Id: <6tig6d$6ke$1@cubacola.tninet.se>
Soon im going nuts!
Whats wrong, this scrip doesn4t work as it should.
The allready voted function dosent work...
Mattias
#!/usr/bin/perl
#
$ip = $ENV{REMOTE_ADDR};
$filen = "resultat.dat";
if ($ENV{'REQUEST_METHOD'} eq 'GET') {
$buffer = $ENV{'QUERY_STRING'};
}
else {
read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
}
@pairs = split(/&/, $buffer);
foreach $pair (@pairs) {
($name, $value) = split(/=/, $pair);
# Un-Webify plus signs and %-encoding
$value =~ tr/+/ /;
$value =~ tr/\|/ /;
$value =~ s/\r//g;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$value =~ s/<!--(.|\n)*-->//g;
$value =~ s/<([^>]|\n)*>//g;
$value =~ s/\n/\\n/g;
$FORM{$name} = $value;
}
&error unless $FORM{'name'};
# Vppna filen
$i =0;
open(FILE, ">>resultat.dat") || die "Can't open resultat.dat: $!\n";
$i+=s/$ip//g;
# Stdng filen
close (FIL);
if ($i ==0) {
open(FILE, ">>resultat.dat") || die "Can't open resultat.dat: $!\n";
flock(FILE, 2);
print FILE "$ip|$FORM{'name'}|$FORM{'vote'}|\n";
flock(FILE, 8);
close(FILE);
# Startvdrde 0
$rader = 0;
$ja = 0;
$nej = 0;
# Vppna filen
open (FIL,"$filen");
# Lds en rad i taget
while (<FIL>) {
# Rdkna upp antalet rader
$rader++;
$ja++ if /Ja/;
$nej ++ if /Nej/;
}
# Stdng filen
close (FIL);
print "Content-type: text/html\n\n";
print "Thanks for voting<br>";
print "$rader har rvstat<br>";
print "$ja har rvstat ja<br>";
print "$nej har rvstat Nej<br>";
}
else
print "Content-type: text/html\n\n";
print "You have allready voted!<br>"; }
exit;
sub error {
print "Content-type: text/html\n\n";
print "ERROR<br>";
exit;}
------------------------------
Date: Sun, 13 Sep 1998 08:00:16 GMT
From: careermngr@aol.com (Andre' Bell)
Subject: How get form data (perl variable) forwarded to http://?
Message-Id: <6tiig2$hfm@dfw-ixnews8.ix.netcom.com>
I'm just learning how to use perl5 programs and need to know how best to send
form data to http://[whatever]... from within my cgi. I already know how to
send stuff to my cgi script like this:
FORM action="http://domainname/cgi-bin/formmail.pl" method="POST"
INPUT type="hidden" name="recipient" value="myemail@address"
...so I'm not a total dummy. What I don't know how to do is get the form data
forwarded to an http server attached to a http address instead of email.
For example, an html form field could ask for username and I want username
sent to my variable "http://myweb/[username]" based on the info they enter
into the form. Whether it's username or some other data entered into the form
I want the data parsed directly to http://myweb/[form data], not to my email.
This would send the data to the http server I've set up in my variables the
same as if the person using my forms were to enter http://myweb/[form data]
directly into a browser. The server will do it's part with the information as
it should with no further intervention from me or the person submitting the
data, the trouble I'm having is getting the data to the server.
I've downloaded about 50 cgi/perl scripts and form tools but they all have an
emphasis on creating mailforms, not sending data to http servers from cgi :(
Maybe I'm missing the point and maybe the mailforms can also send directly to
http://servers using variables. I'm not sure of how to go about getting
this form data sent to the server since so many examples in these books I'm
reading deal with getting form data added to databases or to email programs
rather than sent to http://...
If you know how I might best accomplish this or know of a win95 application
that can help me understand this process please let me know.
Thanks in advance for your help.
Andre'
p.s. Hopefully my explanation makes sense...
------------------------------
Date: 14 Sep 1998 07:07:32 GMT
From: Dan Sugalski <sugalskd@netserve.ous.edu>
Subject: Re: Memory considerations with PERL
Message-Id: <6tifbk$cqg$1@news.NERO.NET>
Nitin Gupta <niting@raleigh.ibm.com> wrote:
: Does PERL return all the memory (real) it takes up during execution once
: the script has ended? I have a script which creates arrays with a large
: number of elements (running into hundreds and possibly thousands) and I
: wanted to know whether I need to do some kind of "garbage collection" at
: the end of the script so that all the memory is freed up.
Maybe--depends on the OS you're running on. Does with VMS. Doesn't on
Unix, but since most of the time the shell spawns off a subprocess to
actually run the script, it doesn't matter, as the process immediately
exits.
The only place I can think of where it might be an issue is with embedded
perl, where you don't get a process rundown when the script ends. In that
case, the answer's no, it doesn't.
Dan
------------------------------
Date: 14 Sep 1998 06:36:23 GMT
From: Zenin <zenin@bawdycaste.org>
Subject: Re: Perl & Java - differences and uses
Message-Id: <905754700.613359@thrush.omix.com>
George Reese <borg@imaginary.com> wrote:
: Though it's "function pointers" use very different, and, IMHO, more
: powerful semantics.
>snip<
How so, exactly?
: In my experience, the regular expressions in both languages are
: identical in function.
Has Python finally developed zero-width lookahead and lookbehind,
assertion, both positive and negative? Interlaced code in both
the search and replace constructs? Subexpressions? Conditional
expressions? Inlined modifiers?
I'm sure Python has built some of the higher level functionality
of Perl pattern matching, but it's not "identical". Not by a
long shot.
: The Python version just meshes better into a
: the Python semantics. The Perl version, IMHO, seems like a grafting
: of line noise into line noise :)
That's form, not function. Perl's patterns mesh better with the
1000's of other programs that use regular expressions and pattern
matching.
You claim that because there is "so much" talk about Perl being hard
to read that maybe the Perl people should take note. By the same
token, since pretty much no one has found any pattern syntax to
compare to standard regular expressions, should't Python take note?
: As a C programmer, you had an advantage--you were used to dealing
: with hard to maintain code.
Since when is C by definition hard to maintain? Try telling that
to anyone on the core team for FreeBSD, Linux, Apache, etc. You'd
be laughed out of the room.
Good programmers write good code. Bad programmers write crap,
regardless of the language. One can create write only code in
any language with the same ease.
In fact, it takes quite the experienced Perl programmer to write
really hard to read code. This is the basis of the obfusted Perl
contests. Of course no one does that in production code. Such
code is for fun and not for practicality.
: Furthermore, my claim comes from
: discussing this with people skilled at both perl and python
: programming and with experience at getting people who know neither to
: learn them.
I picked up the core of the Java language in a week of reading a
book just on my train ride to work. I've been programming Perl
for the better part of the decade and still don't know all the
power it holds. But guess what, I don't need to know all of it
to write good, clean, and productive code. One doesn't even need
to know most of it. They can "baby talk" small useful programs
if they don't want to pick it all up. That's a big difference
from most other languages, Python included. You need to learn
much more before you can do much of any use beyond "hello world".
Just because some something is "simple" (GUIs, AOL, toasters, etc),
or easy to understand without looking anything up in a manual at
all, does not in any way make it more *efficient* to use. MS
Wordpad is by far one of the easiest to use editors around, however
it is also one of the most inefficient. The same holds true for
computer languages and spoken languages.
: While that is not a formal study, I have quite honestly
: never met someone who was experienced with both languages who did not
: think the difference in maintainability between the two was like night
: and day.
Perl requires more self control then other languages, I'll give
you that. IMHO that's a small price to pay for the extra power
and freedom Perl provides. This goes back to my "simple vs
efficient" arguments above. It is no harder to write highly
maintainable code in Perl then it is Python or nearly any other
language for that matter. Your only valid argument is it also
gives the user quite a bit of rope to hang themself with. To
quote Larry Wall:
"Many computer scientists have fallen into the trap of trying to
define languages like George Orwell's Newspeak, in which it is
impossible to think bad thoughts. What they end up doing is killing
the creativity of programming."
: On the defensive? Why would you get defensive about a programming
: language?
Emacs is a religion, so why can't languages be? ;-)
: Something that would work for perl developers? I don't think so. But
: I do think the degree to which perl is disaparaged foor its
: unreadability should be something that strikes you like a neon sign in
: the dead of night.
And I think the massive degree to which Perl is used in every
fascet of the industry should be something that strikes you
like a neon sign in the dead of night that maybe, just maybe,
it's doing something right.
: You are terribly wrong. A programming language is a construct to
: formalize human desires so that they can be translated into a form
: understandable by machines.
Human desires can not be directly translated into machine
understandable form. If they could, anyone could be a programmer.
Programming has very little to do with typical human thought,
simply because humans are anything but logical.
: The ideal programming language would be a human language at a 5th
: grade reading level.
No, it wouldn't.
: Unfortunately, human languages are notoriously ambiguous and hard to
: compute.
Which is exactly why it wouldn't. Human thought and the best
procedure to get a particular task done are quite different.
: Perl is often a string of non-alphabetic characters that have contextual
: meaning
Real World Perl code is anything close to this.
: (often used without any respect to how we use them in normal discourse)
In what language? If Python used Chinese symbols instead of English
words, would it still be so "easy to read and maintain"? Not for
me, and probably not for you, but it would for 2 billion people that
probably would find { block } a lot easier to read then begin/end
or similar English words.
These 2 billion people are going to have just as much if not more
of a problem with Python's constructs then the meening of {}, (),
et al that don't even have a "normal discourse" of use for them.
: and laced with implied behaviour. That you cannot deny. And all of
: those things renders it hard to read.
Quite a huge user base, including myself, would argue that the
implied behaviour you hate makes both reading and writing programs
much, much easier.
: Excessive whitespace? Only someone who believes in terseness would argue
: that.
"Conciseness is a virtue, when maintaining code at 3am".
Magic whitespace is pure evil. Look at makefiles if you don't
believe that. There are very, very good reasons why almost no
common computer languages use it, at least not extensively.
>snip<
: periods, but anyone with any programming experience should be able to
>snip< ^^^^^^^^^^^^^^^^^^^^^^^^^^
: If it comes out looking like something only a perl expert could read,
: it is no good. ^^^^^^ ^^^^^^
You're contradicting yourself, badly. Either the code should
be readable my a monkey that only knows sign language, or it
only needs to be readable by someone with experience and teachings
in it. It could be a gray area in the middle somewere, but that
is not the argument you are presenting. Please make up your mind.
: (and, as I pointed out, easier for a non-python/non-perl programmer to
: read).
But probably not for the assembly or BASIC programmer.
: Python has tons of modules as well.
Quite true. The integration system however, leaves much to be
desired. It has nothing even remotely close to the power of
PAUSE and CPAN.pm, but then, nothing else on the planet currently
comes close to them.
: And software reuse does not make something OO.
Quite correct. The only correct thing I've seen you write, but
it is correct. :-)
And on the flip side, OO does not make something reusable.
: Perl IS NOT OO.
You're right, it's not OO in the pure sense, but then neither is
Python and neither is Java. Probably because every "pure" OO
language that has come around isn't flexible enough for the real
world (sorry, but SmallTalk is dieing out). OO is a tool, and
just a tool. It is not in anyway the end all be all best way
to program everything, nore is it even the best way *most* of
the time.
While Perl is not pure OO, it is very easy to write highly OO
Perl code. Just as easy infact as Python and just as "OO" as
Python, if not more so. The arguable over use of OO code at CPAN
can prove that without a doubt.
Perl gives you the freedom to take or leave OO at any time as best
fits the particular part of the task at hand.
: It just added some OO constructs as an afterthought.
So is C++. Some, myself included, would call this "afterthought" an
extremely good example of "reuse" in real use. Why reinvent the
wheel when you've got a perfectly good one already? If you insist
on reinventing the wheel, at least try to invent a better one. As
many of us would argue, Python, of all languages, has not done that.
: I invite you to check out http://www.python.org.
Been there, done that, gut the T-shirt. :-)
Python is getting better, but it still has a *huge* game of catchup
to play.
--
-Zenin (zenin@archive.rhps.org) From The Blue Camel we learn:
BSD: A psychoactive drug, popular in the 80s, probably developed at UC
Berkeley or thereabouts. Similar in many ways to the prescription-only
medication called "System V", but infinitely more useful. (Or, at least,
more fun.) The full chemical name is "Berkeley Standard Distribution".
------------------------------
Date: 14 Sep 1998 07:31:22 GMT
From: Zenin <zenin@bawdycaste.org>
Subject: Re: Perl & Java - differences and uses
Message-Id: <905757998.909140@thrush.omix.com>
bjohnsto_usa_net <bjohnsto_usa_net@my-dejanews.com> wrote:
: Zenin <zenin@bawdycaste.org> wrote in article <905553026.251116@thrush.omix.com>...
>snip<
Please learn to cut your quoting down, thanks.
>snip<
: Local processes can use shared memory.
And this helps, how? Unix domain connections are used locally for
most all databases. To allow shared memory access ala X in leu of
a private connection is to invite huge security holes.
: High Volume connections can use a persistent connection.
As is done now.
: Low volume connections can use http/http style connections.
This requires a secondary, "middleware" or "application" server
for most larger databases to be efficient at all. -You can actually
do it now, it's just expensive.
You can not do this directly inside the database without likely
dumbing down the entire access control system. Should the
database ship with a "generic" middleware server? Maybe, maybe not.
When one scales to the point they need such access methods at high,
there are more often then not other issues that are best handled
at the server/database because this is where the data is after all.
In such common cases, "generic" gets thrown out the window as the
application server needs to be be tuned more closely to the
particular app it's severing.
: The key is to get applications programmers writing good servers.
Unlikely to happen in the large I fear. Anyone studying to write
applications in school is likely being led down the "well, everyone
has 10 Gigs of RAM and terabite drives now so don't worry about
efficiency issues" path. If they are focusing on MS platforms, this
is even more so.
: This is part tools and architectures part education.
Yes. It's the education part that is lacking, badly.
: In general I try to architect systems which don't need anything more.
In general I try to architect systems which can scale to anything,
up or down. :-)
: There are plenty of people who do pretty good stuff on NT.
And as soon as they do, MS blows them away or buys them. :-)
: A very small NT/IIS box can deliver enough static web pages to saturate
: virtually any existing internet link.
See, that's the mistake I see a lot of people making. Static pages
are dead. By there very nature they don't change. Nearly everyone
is getting tired of them very quickly.
My Apple ][ could likely saturate a T1 with static content without
too much work. -Yes, there were ethernet cards for Apple ][s.
Anyway, as soon as one starts serving dynamic content, it's another
world.
: > I've yet to see the NT box that can touch the mid to high end
: > Sun boxes, and I'm nothing close to a Solaris fan.
:
: This may change with IA64 arround 2002.
: But right now sure.
3 years might as well be 3000 in this industry. :-)
: However Intel servers are more powerful than Unix boxes of not very long
: ago.
: I believe that all sites *can* be architected to work on Intel NT Servers.
HotMail. Even Microsoft themselfs couldn't do it, so I question
your beliefs here. :-)
There is also the question of which is easier, more efficient to
build, and lower in overall costs. If someone has already made a
pretty little button to click on that does *exactly* what you want,
NT might be better. If you want to do anything even the slightest
bit out of the norm, NT is a *nightmare* compared to Unix, at any
and all levels.
Unix understands that different people want to do different things
in different ways, if only slightly. NT thinks everyone should be
happy with the pretty buttons they make and if you don't like
it you're just wrong.
: > It depends. If the tools lack the primitives required to build a
: > good architecture, you have to make do with kluges and then hope
: > no one will ask you to scale them too big. Thus is the case with
: > NT and Java for server use. Great for clients, trash for servers.
: You might have to scale by spreading accross more servers and be more
: creative.
Sure, you can start farming servers under nearly any OS. There are
still limitations with this route. Also, there are large costs per
extra box far beyond just the cost of the raw hardware. Admin costs
are not cheep, and if two Unix boxes can do the work of six NT boxes
you've probably just saved $300k a year in admin costs. -Last I
checked MS still recommend one admin per NT server... I don't
think I've *ever* met a Unix admin that only was responsible for a
single machine unless the company only had a single machine total.
>snip<
: Hopefully with Java leaks of resources can be controlled by the virtual
: machine without using processes.
"Hopefully"...
: I have seen many systems which do the aspects of what RDMS's do,
: transaction support and recovery, they did it alot faster than relational
: databases. They are simpler and much less full featured. They were custom
: designed to solve speed problems for a limited set of tasks.
Quite true. I've built a few myself, but not too much anymore that
the hardware most databases run on has been upgraded to a point that
its speed isn't as much of a problem.
>snip<
: I spent 95% of my time coding Java and C++ not worrying about performance.
Server, or client side?
: I worried about clean, correct design, and code.
Which is good, but the above goals and performance issues are not
unmixable. IMHO, there is no "correct" design, just a "good"
design. -A reason of many I don't like Python. Part of a good
design takes performance into account.
: The speed of the underlying language got around the inefficiecies in my
: code.
To rely on this is what I would call, "sloppy" code myself. "I'll
just do whatever I want and if they don't like it they can just
upgrade there hardware" doesn't work with me.
: Every operation on an RDMS seems to have an effect on performance. I have
: to reduce them to an absolute minimum.
This has been an issue for all kinds of systems since the beginning
of computing. If it wasn't RDMS systems vs disk it was disk vs
RAM. If it wasn't RAM vs disk it was RAM vs registers.
: The server was not under heavy load (most likely no other users). It was a
: $600,000 AIX server.
: We are talking about 10,000 rows.
: We are talking about:
: INSERT INTO TABLE (COL, COL, ..., COL8) VALUES (VAL1, VAL2, ..., VAL8);
: I had not dropped the two indexes.
: There was one commit at the end.
: The database was probably not particularly overworked.
: It is more the overhead of each statement going to the server, the client,
: (SQLPLUS) waiting for the reply, then sending the next line.
Ouch. This really sounds like something is funky somewere. We're
talking about a pathetic 1,000 inserts a minute in this case. I
honestly find it hard to believe that something isn't misconfigured
or else slowing down the system.
: People are moving more code to servers, to serve the increasing online
: population, and to reduce support costs associated with client
: configuration.
It's not just that issue. It's also the simple fact that work
should be done where the data is.
: The cost of coding these systems is higher than development for clients.
Simply because the programmers have to actually start to care
about performance, something they were not tought in school. ;-)
: I believe that improvements in computing science and tools will reduce this
: gap.
The computer science is there now, and has been for ages. More
tools will surface, but I still think the teaching good CS will
play a much larger role. I don't think most general computer
science programs actually do anything close to a good job. I
base this on the fact that most of the best software engineers
I've worked with have had anything but CS degrees. The few
that do have CS degrees are more often then not the ones that
I've seen problems with. This also goes to show that
programmers, like artists, are born not schooled.
--
-Zenin (zenin@archive.rhps.org) From The Blue Camel we learn:
BSD: A psychoactive drug, popular in the 80s, probably developed at UC
Berkeley or thereabouts. Similar in many ways to the prescription-only
medication called "System V", but infinitely more useful. (Or, at least,
more fun.) The full chemical name is "Berkeley Standard Distribution".
------------------------------
Date: 14 Sep 1998 06:28:50 GMT
From: "Michael" <chongmc@pc.jaring.my>
Subject: Perl 's Help wanted
Message-Id: <01bddfa8$dda4b260$6aad8ea1@jaring.jaring.my>
I don't know perl.
I installed perl program on my pc, windows 95.
I tried the typical example, hello.pl
The script run well in the command line itself. (I typed perl hello.pl,
OK!)
But I do not know how to run the script in IE3.
Can someone tell me, HOW?
Thanks in advance.
------------------------------
Date: Mon, 14 Sep 1998 00:31:00 -0700
From: Mickey Frklic <mod@vei.net>
Subject: Perl for Win32 Problems
Message-Id: <35FCC634.A9BCE347@vei.net>
Hello Perl World,
My name is Mickey and I am planning on doing some CGI routines with Perl
in the near future. I am using Windows 98 and have downloaded Perl for
Win32
from Activesite. I am having a couple problems with some of the
functions that
I can not find help for on thier web site.
When i create an associated array such as
%weekdays = (
'1', 'Monday',
'2', 'Tuesday',
'3', 'Wednesday',
'4', 'Thursday',
'5', 'Friday',
);
and try to use the keys or values function:
foreach $key ( keys(%weekday)) {print "$key";}
print "\n";
foreach $value ( values(%weekday)) {print "$value;}
I get nothing for a response... just a blank line.. and if i try to use
the printf fucntion to
print a character:
printf("Hello there... print this char %c", 'W');
everything but the W is printed... anyone have any ideas? I am running
these all
through .pl scripts with the latest version of Perl for Win32. If anyone
can help.. please ICQ me or E-mail me... thanks
--
Mickey Frklic / Programmer
--------------------------------------
ICQ: 6837268 - AIM: AOHell MoD
Web Page: http://users.vei.net/mod
--------------------------------------
------------------------------
Date: 14 Sep 1998 07:54:11 GMT
From: sholden@pgrad.cs.usyd.edu.au (Sam Holden)
Subject: Re: Perl for Win32 Problems
Message-Id: <slrn6vpit3.4sm.sholden@pgrad.cs.usyd.edu.au>
On Mon, 14 Sep 1998 00:31:00 -0700, Mickey Frklic <mod@vei.net> wrote:
>Hello Perl World,
>
>My name is Mickey and I am planning on doing some CGI routines with Perl
>
>in the near future. I am using Windows 98 and have downloaded Perl for
>Win32
>from Activesite. I am having a couple problems with some of the
>functions that
>I can not find help for on thier web site.
>
>When i create an associated array such as
>
>%weekdays = (
> '1', 'Monday',
> '2', 'Tuesday',
> '3', 'Wednesday',
> '4', 'Thursday',
> '5', 'Friday',
>);
>
>and try to use the keys or values function:
>
>foreach $key ( keys(%weekday)) {print "$key";}
>print "\n";
>foreach $value ( values(%weekday)) {print "$value;}
>
>I get nothing for a response... just a blank line.. and if i try to use
>the printf fucntion to
>print a character:
>
>printf("Hello there... print this char %c", 'W');
>
>everything but the W is printed... anyone have any ideas? I am running
>these all
>through .pl scripts with the latest version of Perl for Win32. If anyone
>can help.. please ICQ me or E-mail me... thanks
The first thing you need to do is read the documentation that comes with perl...
No I _really_ mean it - _read_the_documentation_...
Using perl -w will tell you the answer to the first question...
I won't because that will just encourage you to post without trying to
find the answer yourself...
As an aside that gets the award for dumbest use of a hash I've seen this week,
maybe an array would be nicer.
As for the seconds problem perl is not c... 'W' is the same as "W" for this
case anyway... What does %c want in C : a <find out for yourself>. What does
'W' evaluate to in this case <read the perl docs>. Which prints out a character
you will never see...
Anyway read the docs before you post and you will find that perl people are
very helpful indeed. Don't read the docs and you will think they are a
bunch of psychpaths...
Also your missing a " but I assume that was a typo (copy code - don't retype).
--
Sam
There's no such thing as a simple cache bug.
-Rob Pike
------------------------------
Date: Mon, 14 Sep 1998 07:56:01 GMT
From: rcook@pcug.org.au (Owen Cook)
Subject: Perl4/Perl5
Message-Id: <35fdca76.9683009@newshost.pcug.org.au>
My ISP seems to have several versions of perl. The program below works
( through a cgi wrapper) in perl5 but not perl4. Take the four lines
of the while statement out and the three DATA lines, and it works in
perl4.
Why?
Now that I have found perl5, the question is academic, but as I can
find no clues in the "differences between 4 and 5", either in the
Camel book or a document called perl425.html, I was wondering if it
is me, the version, or the ISP. I suspect it is something to do with
the DATA filehandle and the data token
Owen
#!/opt/contrib/bin/perl5 -- -*- C -*-
# Change perl5 to perl for perl4
print "Content-type: text/html\n\n";
print "<html><head><title>Test</title><body>\n";
while (<DATA>){
@array=split;
print"$array[1]<p>";
}
print "Hi \n";
print "</body></html>\n";
__DATA__
1998 Aug 27 11:29:56 xxx yyy 11:26:53 Thu 27 Aug 1998 zzz
1998 Aug 28 1:30:18 xxx yyy 9:56:56 Thu 27 Aug 1998 zzz
------------------------------
Date: Mon, 14 Sep 1998 10:44:11 -0700
From: Bob Mc Mahon <bobby@alpstreet.ie>
Subject: Problem with print" Location:
Message-Id: <35FD55EA.CC15215C@alpstreet.ie>
Hi
I'm running a perl script , the script itself works fine but
at the end of it I have
eg......
{
print "Location: http://www.netscape.com\n\n";
}
The problem is that it print the location on
screen intead of actually taking you there.
I think it is still using the Content-type header, if it
is does anybody know how to end headers so that you can start a new one?
------------------------------
Date: 14 Sep 1998 09:46:56 GMT
From: "Vincent Verhagen" <bigbro@dmrt.nl>
Subject: Serial IO in Perl?
Message-Id: <01bddfc4$54290380$640aa8c0@situtr666>
Hi.
I'm looking at perl to write a little program that will run on my Linux
machine and will control an LCD "terminal". To do this I have to be able to
read from and write to ttyS1 but I'm not sure how this can be done within
Perl (5.005_2)?
Can anyone point me to/mail me some examples, please?
Thanks in advance!
Vincent Verhagen
mailto:bigbro@dmrt.nl
------------------------------
Date: Mon, 14 Sep 1998 09:53:07 +0200
From: Marc Lopez <mlopez@greenbit.es>
Subject: Web Chat
Message-Id: <35FCCB63.1390BC1D@greenbit.es>
Hi All!
Where I can find a Web-based chat in perl that it allows 30 people to
talk and the rest only can read the conversation?
Thanks in advance and sorry about my poor english
------------------------------
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 3708
**************************************