[15851] in Perl-Users-Digest
Perl-Users Digest, Issue: 3264 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Jun 6 14:06:58 2000
Date: Tue, 6 Jun 2000 11:05:31 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <960314731-v9-i3264@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Tue, 6 Jun 2000 Volume: 9 Number: 3264
Today's topics:
'can' oddity (Bart Lateur)
Re: [Q] access remote oracle in perl madsere@my-deja.com
Activeware perl 313 and makemake.pm <pds@x-datcon.co.uk>
Best way to randomize array <dimitrio@perlnow.com>
Re: Best way to randomize array (Ala Qumsieh)
Re: Best way to randomize array <dimitrio@perlnow.com>
Re: Best way to randomize array <red_orc@my-deja.com>
Re: Can't Write Binary File <grichard@uci.edu>
Re: CGI Forms: Save File Dialog instead of processing f <khera@kciLink.com>
counter script in Perl <eldridgem@ihorizons.net>
Re: counter script in Perl (John Gehman)
Re: counter script in Perl <red_orc@my-deja.com>
Re: debug perl script called by webserver (Andrew E Page)
fetching web pages (CARROT7362)
Re: fetching web pages <tony_curtis32@yahoo.com>
Re: fetching web pages (John Gehman)
Finding partial match (Csaba Raduly)
FTP Question <steve@gte.net>
Re: good perl coding style <tcuffel@exactis.com>
Re: good perl coding style (Greg Snow)
Re: good perl coding style <lauren_smith13@hotmail.com>
HELP error message <gl17@home.com>
Re: HELP error message <care227@attglobal.net>
Re: HELP error message <lauren_smith13@hotmail.com>
Re: HELP error message <red_orc@my-deja.com>
Re: Help! perl cgi with Apache/Unix versus Netscape/NT <neil@mythologics.com.invalid>
Re: Help: OOPS Inheritance... (Ala Qumsieh)
Re: hidden field problem and multi-page CGI.pm script (Mark P.)
Re: How to copy Data structures? <tina@streetmail.com>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 06 Jun 2000 13:59:52 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: 'can' oddity
Message-Id: <393e0082.5865275@news.skynet.be>
Newer versions of the module GD.pm switched from GIF support to png
support. However, I'd like my programs that use GD, automatically select
the output method appropriate for the module version, and either
generate a GIF or a PNG file.
So I tried this little program. I must say the results surprised me.
use GD;
print "$GD::VERSION\n";
foreach my $method (qw'gif jpeg png') {
my $can = GD->can($method)?'yes':'no';
print "$method:\t$can\n";
}
Result:
1.27
gif: yes
jpeg: no
png: no
Eh? This was not what I expected!
I modified the code, which gives exactly opposite results:
use GD;
print "$GD::VERSION\n";
my $im = new GD::Image(100,100);
foreach my $method (qw'gif jpeg png') {
my $can = $im->can($method)?'yes':'no';
print "$method:\t$can\n";
}
Result:
1.27
gif: no
jpeg: yes
png: yes
That's more like it. But since when did Perl start to differentiate
between object and class methods? Or is this typical for XS based
modules?
I can't say I've seen this documented anywhere. "perldoc UNIVERSAL" is
remarkably silent about the difference between the two.
--
Bart.
------------------------------
Date: Tue, 06 Jun 2000 14:14:27 GMT
From: madsere@my-deja.com
Subject: Re: [Q] access remote oracle in perl
Message-Id: <8hj0vk$h8$1@nnrp1.deja.com>
I have Machine A and B as you describe below, but both with Oracle
*installed* - however on machine A nothing is active, i.e. the
Oralistener is shut down - and it still works fine connecting from A
to the DB on B.
I now need to install DBD::Oracle on "C" - a machine that doesnt have
Oracle installed (and that I can't install Oracle to) so I have same
question as you in point 1. No answers though.
In article <akGW4.2017$%E1.29383@news2.bora.net>,
"±èµ¿¿í" <baksoo@serome.co.kr> wrote:
> We have a problem with accessing remote oracle DB from perl script in
> another machine
> Our system configuration is as follows:
> site A : linux, apache web server, perl scripts running here
> site B : solaris, oracle database server
>
> We have to access oracle(site B) from perl script(site A).
> I am told that DBI and DBD are required.
> My question arises at this point.
>
> Question 1. Does Oracle have to be installed in site A to install DBD?
> 1-1. Is it possible that DBD binary is built in another
machine and
> moved to site A?
>
> Question 2. After DBD is built successfully, sql*net is still
required in
> site A?
>
> Any comments about this would be a great help for us.
> Thanks in advance.
> --
> -----------------------------------------------------
>
>
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Tue, 6 Jun 2000 16:20:30 +0100
From: "Paul D.Smith" <pds@x-datcon.co.uk>
Subject: Activeware perl 313 and makemake.pm
Message-Id: <8hj4sk$ls4$1@soap.pipex.net>
Anyone hit this? I have tried to install some Perl libraries (libnet) but
have found that ExtUtils/MakeMaker.pm is absent. This is with the Windows
NT Activeware port of Perl (build 313). Anyone know the "correct" solution
to this?
FYI: I cannot upgrade as this is the "official and supported" version of
Perl which we currently use. No doubt in time we'll upgrade but for now,
this is what I have :-).
Thanks,
Paul DS.
--
Please remove the "x-" if replying to sender.
------------------------------
Date: Tue, 06 Jun 2000 14:05:09 GMT
From: "Dimitri Ostapenko" <dimitrio@perlnow.com>
Subject: Best way to randomize array
Message-Id: <py7%4.31893$dK2.708974@news20.bellglobal.com>
I wonder what would be most efficient way to change order of elements in an
array to random?
given @a = (1,2,3,4,5); I would like to get something like @b = [1,3,5,4,2];
Number of elements is typically less than 10;
Code I came up with requires more iterations than are really necessary:
my @a=(1,2,3,4,5);
my $rnd = srand;
my %is_there =();
my $n = scalar @a;
while (@b < $n) {
$rnd = int(rand($n)+1);
push @b, $rnd unless $is_there{$rnd}++;
}
print join ":", @b;
Thanks,
Dimitri
------------------------------
Date: Tue, 06 Jun 2000 14:26:06 GMT
From: aqumsieh@hyperchip.com (Ala Qumsieh)
Subject: Re: Best way to randomize array
Message-Id: <8F4B6B26Baqumsiehhyperchipcom@198.235.216.4>
dimitrio@perlnow.com (Dimitri Ostapenko) wrote in
<py7%4.31893$dK2.708974@news20.bellglobal.com>:
>I wonder what would be most efficient way to change order of
>elements in an array to random?
The best way, hands down, is to read the FAQs!
From perlfaq4:
How do I shuffle an array randomly?
--Ala
------------------------------
Date: Tue, 06 Jun 2000 15:04:52 GMT
From: "Dimitri Ostapenko" <dimitrio@perlnow.com>
Subject: Re: Best way to randomize array
Message-Id: <oq8%4.33095$dK2.712241@news20.bellglobal.com>
Ala Qumsieh <aqumsieh@hyperchip.com> wrote in message
news:8F4B6B26Baqumsiehhyperchipcom@198.235.216.4...
> dimitrio@perlnow.com (Dimitri Ostapenko) wrote in
> <py7%4.31893$dK2.708974@news20.bellglobal.com>:
>
> >I wonder what would be most efficient way to change order of
> >elements in an array to random?
>
> The best way, hands down, is to read the FAQs!
> From perlfaq4:
>
> How do I shuffle an array randomly?
>
> --Ala
fair enough -:)
------------------------------
Date: Tue, 06 Jun 2000 15:39:53 GMT
From: Rodney Engdahl <red_orc@my-deja.com>
Subject: Re: Best way to randomize array
Message-Id: <8hj605$4ns$1@nnrp1.deja.com>
In article <py7%4.31893$dK2.708974@news20.bellglobal.com>,
"Dimitri Ostapenko" <dimitrio@perlnow.com> wrote:
> I wonder what would be most efficient way to change order of elements
in an
> array to random?
>
> given @a = (1,2,3,4,5); I would like to get something like @b =
[1,3,5,4,2];
> Number of elements is typically less than 10;
>
have you checked out perlfaq4?
"How do I shuffle an array randomly?"
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Tue, 6 Jun 2000 09:30:36 -0700
From: "Gabe" <grichard@uci.edu>
Subject: Re: Can't Write Binary File
Message-Id: <8hj96b$nkt$1@news.service.uci.edu>
W Kemp <bill.kemp@wire2.com> wrote in message
news:960279838.669.0.nnrp-07.c3ad6973@news.demon.co.uk...
>
> Gabe wrote in message ...
> >No dice, file still has zero bytes. Ack! Help!
> <SNIP>
>
> zero bytes on a file upload- check the HTML page that send the data.
> Is the form multipart enctype ?
Well, of course it isn't!!! If it were, then everything would've worked and
I wouldn't have wasted so many hours trying to fix it!
No, but seriously, thank you, I had totally forgotten about enctype...
Gabe
------------------------------
Date: 06 Jun 2000 12:33:35 -0400
From: Vivek Khera <khera@kciLink.com>
Subject: Re: CGI Forms: Save File Dialog instead of processing form data
Message-Id: <x7d7lu3h28.fsf@onceler.kcilink.com>
>>>>> "9" == 9jerry9 <9jerry9@my-deja.com> writes:
9> Any ideas why the browser presents a "Save File" dialog box when I try
9> to submit form data instead running the perl script?
9> print "Content-type: text/plain.\n\n" ;
Because your browser doesn't know what a "text/plain." type is.
Please use a well known content type; perhaps "text/plain" will work
for you.
--
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Vivek Khera, Ph.D. Khera Communications, Inc.
Internet: khera@kciLink.com Rockville, MD +1-301-545-6996
GPG & MIME spoken here http://www.khera.org/~vivek/
------------------------------
Date: Tue, 6 Jun 2000 11:52:04 -0400
From: "M.E." <eldridgem@ihorizons.net>
Subject: counter script in Perl
Message-Id: <na9%4.375$yW2.10545@nnrp1.uunet.ca>
I've posted this to alt.html.tags to see if it was something I was missing
in the html coding. I've also posted this in the
alt.uu.comp.os.linux.questions newsgroup to see if it was something I was
missing that I should do in linux. But I haven't received any comments. SO -
I'm trying here to see if there's something I should be doing in perl:
-----------------------------------------------------------
I'm trying to use a simple graphical counter on a web page on a linux box.
The html I'm using to call the counter program is:
<IMG SRC="cgi-bin/counter.pl">
All that shows up is a broken graphic icon and not the counter images.
I'm wondering if there's something I'm missing in regards to the above tag.
Should it be coded differently? Has anyone had success with such a thing?
Thanks in advance for any help you may give.
------------------------------
Date: 6 Jun 2000 16:51:56 GMT
From: jdg28@pantheon.yale.edu (John Gehman)
Subject: Re: counter script in Perl
Message-Id: <8hja7c$ipf$2@news.ycc.yale.edu>
Search for Matt's Script Archive. Download his counter. No sense in
reinventing a perfectly round wheel
j
M.E. (eldridgem@ihorizons.net) wrote:
: I've posted this to alt.html.tags to see if it was something I was missing
: in the html coding. I've also posted this in the
: alt.uu.comp.os.linux.questions newsgroup to see if it was something I was
: missing that I should do in linux. But I haven't received any comments. SO -
: I'm trying here to see if there's something I should be doing in perl:
: -----------------------------------------------------------
: I'm trying to use a simple graphical counter on a web page on a linux box.
: The html I'm using to call the counter program is:
: <IMG SRC="cgi-bin/counter.pl">
: All that shows up is a broken graphic icon and not the counter images.
: I'm wondering if there's something I'm missing in regards to the above tag.
: Should it be coded differently? Has anyone had success with such a thing?
: Thanks in advance for any help you may give.
------------------------------
Date: Tue, 06 Jun 2000 16:58:53 GMT
From: Rodney Engdahl <red_orc@my-deja.com>
Subject: Re: counter script in Perl
Message-Id: <8hjak2$8ld$1@nnrp1.deja.com>
In article <na9%4.375$yW2.10545@nnrp1.uunet.ca>,
"M.E." <eldridgem@ihorizons.net> wrote:
> I've posted this to alt.html.tags to see if it was something I was
missing
> in the html coding. I've also posted this in the
> alt.uu.comp.os.linux.questions newsgroup to see if it was something I
was
> missing that I should do in linux. But I haven't received any
comments. SO -
> I'm trying here to see if there's something I should be doing in perl:
> -----------------------------------------------------------
>
> I'm trying to use a simple graphical counter on a web page on a linux
box.
> The html I'm using to call the counter program is:
>
> <IMG SRC="cgi-bin/counter.pl">
regardless of what's in the counter.pl script, you are probably better
off putting the full path to the script here.
>
> All that shows up is a broken graphic icon and not the counter images.
>
> I'm wondering if there's something I'm missing in regards to the above
tag.
> Should it be coded differently? Has anyone had success with such a
thing?
>
> Thanks in advance for any help you may give.
>
>
--
Some drink at the fountain of knowledge...others just gargle.
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Tue, 6 Jun 2000 18:00:34 GMT
From: aep@world.std.com (Andrew E Page)
Subject: Re: debug perl script called by webserver
Message-Id: <FvqvCy.J9r@world.std.com>
In article <8h374r$95r$1@nnrp1.deja.com>, <eastking@my-deja.com> wrote:
>I am developing CGI application by perl under linux/Apache. Is there
>any one know how to debug perl script called by webserver. It means
>that I type a request in browser and want to debug my perl script which
>response to this request in server.Thank in advance.
>
>
>Sent via Deja.com http://www.deja.com/
>Before you buy.
Try ptkdb (Perl Tk Debugger). This is a perl debugger with a
perlTk GUI. There is a chapter in the pod doc that comes with it that
describes how to debug web scripts.
http://world.std.com/~aep/ptkdb
--
Andrew E. Page (Warrior Poet) | Decision and Effort The Archer and Arrow
Software Engineering Consultant | The difference between what we are
Unix, Mac, C/C++/Java, Perl, NT | and what we want to be.
------------------------------
Date: 06 Jun 2000 16:34:15 GMT
From: carrot7362@aol.com (CARROT7362)
Subject: fetching web pages
Message-Id: <20000606123415.15503.00000875@ng-cp1.aol.com>
Hello,
perhaps someone can help me out with this? What I would like to do is specify
to a Perl script a web page URL. I would like it to fetch that page, and
display only the information between the <.BODY> and <./BODY> tags, using a
single <.BODY> tag I specify. Does anyone know how to do this, or already have
a script that does this?
tia
carrot7362@aol.com
------------------------------
Date: 06 Jun 2000 11:44:45 -0500
From: Tony Curtis <tony_curtis32@yahoo.com>
Subject: Re: fetching web pages
Message-Id: <87aegy4v42.fsf@limey.hpcc.uh.edu>
>> On 06 Jun 2000 16:34:15 GMT,
>> carrot7362@aol.com (CARROT7362) said:
> Hello, perhaps someone can help me out with this? What I
> would like to do is specify to a Perl script a web page
> URL. I would like it to fetch that page, and display
> only the information between the <.BODY> and <./BODY>
> tags, using a single <.BODY> tag I specify. Does anyone
> know how to do this, or already have a script that does
> this?
A combination of LWP::UserAgent, HTTP::Request,
HTML::Parser / HTML::TokeParser is probably the most
robust way to go about it.
"perldoc lwpcook" to get started.
hth
t
--
"Trying is the first step towards failure"
Homer Simpson
------------------------------
Date: 6 Jun 2000 16:50:05 GMT
From: jdg28@pantheon.yale.edu (John Gehman)
Subject: Re: fetching web pages
Message-Id: <8hja3t$ipf$1@news.ycc.yale.edu>
This is some abridged code that I wrote for daily submissions to a
www.thelinuxstore.com contest. I think it's what you want if you
omit everything except $net in $string. LWP is the key.
use LWP::UserAgent;
my $ua = new LWP::UserAgent;
$ua->agent("Mozilla/4.03 [en] (X11; I; IRIX 5.3 IP12)");
$net="http://www.thelinuxstore.com/perl-bin/contest.pl?";
# [declarations for variables used in $string omitted]
$string=$net.$pre.$name.$comp.$add.$city.$state.$zip.$phone.$email.$last;
my $req = HTTP::Request->new( 'GET'=>"$string");
$req->content_type('application/x-www-form-urlencoded');
my $resp = $ua->request($req);
$response = $resp->content;
# $response is the HTML source code of the page
CARROT7362 (carrot7362@aol.com) wrote:
: Hello,
: perhaps someone can help me out with this? What I would like to do is specify
: to a Perl script a web page URL. I would like it to fetch that page, and
: display only the information between the <.BODY> and <./BODY> tags, using a
: single <.BODY> tag I specify. Does anyone know how to do this, or already have
: a script that does this?
: tia
: carrot7362@aol.com
------------------------------
Date: 6 Jun 2000 16:33:22 GMT
From: csaba_r@my-deja.com (Csaba Raduly)
Subject: Finding partial match
Message-Id: <8F4BBF7D1quuxi@193.82.145.131>
Is it possible to find out where a RE stopped matching ?
I'm writing a script to parse the logfiles produced by our virus
scanners.
A log has basically this format:
\tfilename <- a clean file
\tfilename <- an infected file
>>> Virus 'Melissa' found in file filename
\tfilename
...
Before I knew better, I used a RE like this:
if( s/.* (Virus|Virus fragment|Identity) [\'`\[]([^\'\]]).*/$2/ )
#
# This is meant to replace a virus report (>>> line)
# with just the name of the virus, which can be
# 'name', `name' or [name]
#
# Of course, the literal spaces are now \s+
#
{
# do some processing
}
Unfortunately, there are subtle differences between the output of the
actual product(s) and various test harnesses (virus names are quoted
with '', `' or [], some use spaces, some use tabs). Because of this,
a number of lines got misidentified. And I stare at $_ and the RE in
the debugger, wondering why it didn't match. Of course I can print
matches of shorter and shorter regexps until it does match, after
which it's usually easy to figure out exactly which part of the RE is
the culprit. What I was looking for is an easy way out :-) It's kinda
$', except there was no match, so $' is empty. Is this possible at
all ?
--
Csaba Raduly, Software Developer (OS/2), Sophos Anti-Virus
mailto:csaba.raduly@sophos.com http://www.sophos.com/
US Support +1 888 SOPHOS 9 UK Support +44 1235 559933
Life is complex, with real and imaginary parts.
------------------------------
Date: Tue, 06 Jun 2000 18:00:44 GMT
From: "SteveSingletary" <steve@gte.net>
Subject: FTP Question
Message-Id: <g%a%4.1185$ee7.95872@dfiatx1-snr1.gtei.net>
I'm relatively new to Perl, but very familiar with UNIX- so with that in
mind here's the problem. I need to FTP a file away to another server. I am
on a UNIX server. Here is the code that I use in UNIX:
/usr/bin/ftp -nv << EOF >>./$scriptName.log 2>&1
open $target_server
user $target_userid $target_pswd
$target_function $XL_INFNAME $target_filename_snd
bye
EOF
I'm not sure if I need to use the exec command or not, and I'm not sure
about the exact syntax for the "`' characters. Can somebody help???
Thanks,
Steve
------------------------------
Date: Tue, 6 Jun 2000 09:50:10 -0500
From: "Tim" <tcuffel@exactis.com>
Subject: Re: good perl coding style
Message-Id: <5Q8%4.7284$Rx.695193@den-news1.rmi.net>
eastking@my-deja.com wrote in message <8hhudb$85k$1@nnrp1.deja.com>...
>I am leading a team to develop a CGI application by perl. Because
>almost every member of this team is C programer,I need a coding
>sytle/rule. Although perl doc have some suggestion, I'd rather to
>listen more advise here. Thank in advance.
Good stuff for C programmers:
man perlstyle
man perltrap, and check out the C section
Learn how to write for loops without index variables
Learn how to use logic operators outside of conditionals
Learn regex
------------------------------
Date: 6 Jun 2000 16:55:58 GMT
From: snow@statsci.com (Greg Snow)
Subject: Re: good perl coding style
Message-Id: <8hjaeu$aq2$1@junior.statsci.com>
In article <960279422.516.0.nnrp-07.c3ad6973@news.demon.co.uk>,
W Kemp <bill.kemp@wire2.com> wrote:
>I think I read that thread, but an extra question comes to mind.
>A C++ programmer commented that 'perl is all the wrong way round'.
>Meaning he doesn't like this type of syntax:-
>
>"do something" if "test condition"
>
>rather than
>
>if (test condition){
> "do something";
>}
>
>I suppose the second looks more like what a C programmer would expect.
>My question is - where did the first style come from? (is it in other
>languages). does it have any real advantages?
The other language that it comes from is English (Larry tried to make Perl
flow like a natural language).
Any time that you read code (yours or someone elses) there are 2
influences on how it reads, what the designer of the language was thinking
when he/she designed the language and what the programmer was thinking
when he/she wrote the program. The more syntatically strict the language
them more that the first one will dominate. Perl was designed with a lot
more flexibility so that there is more of the second available. I
consider this a good thing because I want to know what the programmer was
thinking, I assume that he/she knows more about the immediate problem than
the language designer.
There are several options for conditionals that will all give the same
result when run, the differences are for human understanding. Consider
the following short program:
#!/usr/local/bin/perl -w
use strict;
open(IN, "/path/to/file.txt") or die("couldn't open it: $!");
my ($c1, $c2, $c3);
while(<IN>){
if( /\S/ ){
$c1++;
}
$c2++ if /\S/;
$c3++ unless /^\s*$/;
}
# now do something with $c1, $c2, and $c3
The first conditional is the or after the open function, this is a Perl
idiom. It could be replaced with:
if( !open(IN, "/path/to/file") ){
die "oooops: $!";
}
but that is much uglier, besides how do you read each of those? in the
original we first read the open statement then see and or and know that
the exception is taken care of. The first couple times through a program
we can completely ignore the right side of that or, it take care of the
special case and we care about the general case for understanding the
first couple of times.
With the if statement we first read the if and are primarily concerned
with a conditional, is this true or false? what do we do if it is true?
When we get to the die we realize that this is just the error checking,
but then need to backtrack in our minds to see the true effect of the open
statement (before we were mostly concerned about it's return value, which
is pretty uninteresting if everything goes according to plan).
So which do you think better conveys the intent of the coder?
Inside the loop we have three conditionals, at the end of the loop $c1,
$c2, and $c3 should all contain the number of non-blank lines in the file
(blank meaning nothing or just white space). But in reading the lines,
each suggests a little bit different emphasis.
For $c1 we have an if(){}, this suggests that the conditional is most
important. We first care if there is a non-whitespace character, if there
is do something about it, in this case increment $c1.
For $c2 and $c3 we first see the increment command, then a conditional on
it, putting the emphasis on the increment. We can read these 2 lines as
plain english:
Increment $c2 if there are any non-whitespace characters on the line.
Increment $c3 unless the line contains only whitespace.
To me, the $c2 line implies that most of the lines will be blank and that
we should only increment in the rare non-whitespace cases. The $c3 line
says that incrementing is the standard thing to do, there are just a few
exceptions where we don't want to.
All three conditionals are legitimate and can be used in different
circumstances. Which is used gives us an idea of what the programmer
considered most important and what they expected the data to be like.
hope this helps,
--
-------------------------------------------------------------------------------
Gregory L. Snow | Inertia makes the world go round,
(Greg) | Love makes the trip worth taking.
gsnow@splus.mathsoft.com |
------------------------------
Date: Tue, 6 Jun 2000 09:57:41 -0700
From: "Lauren Smith" <lauren_smith13@hotmail.com>
Subject: Re: good perl coding style
Message-Id: <8hjagr$bch$1@brokaw.wa.com>
W Kemp <bill.kemp@wire2.com> wrote in message
news:960279422.516.0.nnrp-07.c3ad6973@news.demon.co.uk...
> "do something" if "test condition"
>
> rather than
>
> if (test condition){
> "do something";
> }
>
> I suppose the second looks more like what a C programmer would expect.
> My question is - where did the first style come from? (is it in other
> languages). does it have any real advantages?
I'd answer this question if I could think of any languages where this
construct was frequently used.
Lauren
------------------------------
Date: Tue, 06 Jun 2000 16:02:47 GMT
From: "G. Lee" <gl17@home.com>
Subject: HELP error message
Message-Id: <393D1C77.C2964010@home.com>
I have a HTML simple testing page with a POST inside.
HTML looks okay, however I get the following message after clicking on
SEND.
---------------------------------------------
Method Not Allowed
The requested method POST is not allowed for the URL /p/guestbook.cgi.
---------------------------------------------
It seems to have located the CGI file but then indicates POST not
allowed, what might be wrong?
G. Lee
mailto:gl17@home.com
------------------------------
Date: Tue, 06 Jun 2000 12:22:24 -0400
From: Drew Simonis <care227@attglobal.net>
Subject: Re: HELP error message
Message-Id: <393D2540.E73B03C@attglobal.net>
> It seems to have located the CGI file but then indicates POST not
> allowed, what might be wrong?
web server config most likely.
------------------------------
Date: Tue, 6 Jun 2000 09:27:42 -0700
From: "Lauren Smith" <lauren_smith13@hotmail.com>
Subject: Re: HELP error message
Message-Id: <8hj8oh$c02$1@brokaw.wa.com>
G. Lee <gl17@home.com> wrote in message news:393D1C77.C2964010@home.com...
> I have a HTML simple testing page with a POST inside.
>
> HTML looks okay, however I get the following message after clicking on
> SEND.
>
> ---------------------------------------------
> Method Not Allowed
>
> The requested method POST is not allowed for the URL /p/guestbook.cgi.
>
> ---------------------------------------------
>
> It seems to have located the CGI file but then indicates POST not
> allowed, what might be wrong?
It sounds like a CGI problem, I would check out the
comp.infosystems.authoring.cgi newsgroup. They would be better equipped to
answer this type of question.
Lauren
------------------------------
Date: Tue, 06 Jun 2000 17:04:35 GMT
From: Rodney Engdahl <red_orc@my-deja.com>
Subject: Re: HELP error message
Message-Id: <8hjaum$8q1$1@nnrp1.deja.com>
In article <393D1C77.C2964010@home.com>,
"G. Lee" <gl17@home.com> wrote:
> I have a HTML simple testing page with a POST inside.
>
> HTML looks okay, however I get the following message after clicking on
> SEND.
>
> ---------------------------------------------
> Method Not Allowed
>
> The requested method POST is not allowed for the URL /p/guestbook.cgi.
>
> ---------------------------------------------
>
this is a web server configuration issue, and you should bring it to the
attention of whoever administers your web server.
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Tue, 06 Jun 2000 09:43:20 -0400
From: Neil <neil@mythologics.com.invalid>
Subject: Re: Help! perl cgi with Apache/Unix versus Netscape/NT
Message-Id: <393CFFF8.48C5@mythologics.com.invalid>
mike wrote:
>
> Hi Neil,
> what is your Perl cgi script?
Here's an even simpler example:
use FindBin;
#
#---try to find where we're executing
my $curdir = $FindBin::Bin;
print "\nCurrently running perl script in: $curdir\n\n";
If I put this into the cgi-shell directory of a Netscape web server
running on NT, and access it across the web with a browser, it will
print the desired information, but if you save it to a file and then
look with a hex editor, you find that each instance of "\n" has been
replaced with 0xd 0xd 0xa (i.e. CR/CR/LF) rather than the expected CR/LF
pair.
Running the same script on a website served by Apache/Unix results in
normal CR/LF pairs.
I don't know if it's a Win32 perl issue or a Netscape-webserver-on-NT
issue, but it's really making me crazy by this point!
Neil
MythoLogics
------------------------------
Date: Tue, 06 Jun 2000 14:23:38 GMT
From: aqumsieh@hyperchip.com (Ala Qumsieh)
Subject: Re: Help: OOPS Inheritance...
Message-Id: <8F4B6DDDFaqumsiehhyperchipcom@198.235.216.4>
bart.lateur@skynet.be (Bart Lateur) wrote in
<394ba652.2984899@news.skynet.be>:
>That's the trouble with Perl's handcrafted OOP. You can easily
>forget one of the several steps necessary. Maybe a combined keyword,
>e.g. "inherit", would be nice.
>
> inherit HTML::Parser;
>
>which would simply, similar in spirit to "use", combine
>
> require HTML::Parser;
> push @ISA, HTML::Parser;
Hmmm ... you mean something like the base pragma?
(perldoc base)
use base qw/HTML::Parser/;
but the OP already did this. So his module is supposed to inherit from
HTML::Parser.
--Ala
------------------------------
Date: Tue, 06 Jun 2000 17:35:28 GMT
From: perl@imchat.com (Mark P.)
Subject: Re: hidden field problem and multi-page CGI.pm script
Message-Id: <393d3583.13950840@news.ionet.net>
On Mon, 5 Jun 2000 23:52:07 -0400, "Phil R Lawrence"
<prlawrence@lehigh.edu> wrote:
>> >I have succesfuly made a script that has a logon screen, and then uses
>the
>> >user and password params to set up and display the second screen. I
>can't
>> >go on to the third screen, though, because the user and pass aren't being
>> >passed in again. So, I thought I'd use
>> > $query->save(\*FILE)
>> >and
>> > $query = CGI->new(\*FILE)
>>
Instead of saving a file why don't you just pass the values to
the next page as hidden fields?
foreach (grep !/submit_/,$query->param) {
print hidden($_);
}
MP
------------------------------
Date: 6 Jun 2000 16:32:23 GMT
From: Tina Mueller <tina@streetmail.com>
Subject: Re: How to copy Data structures?
Message-Id: <8hj92m$32k52$1@fu-berlin.de>
hi,
Stefan Etschberger <Stefan.Etschberger@hl.siemens.de> wrote:
> I have a data structure like e.g.
> $a = {
> "key1" => {
> "k1" => "string",
> "k2" => [0,1,2]
> },
> "key2" => [
> {"a" => "b"},
> [0,1,2]
> ]
> }
> Is there an easy way (not traversing the whole
> structure's hierarchy) to copy the structure
> (building a new structure with the same contents
> but not using the old adresses)?
perldoc -q copy:
=head2 How do I print out or copy a recursive data structure?
The Data::Dumper module on CPAN (or the 5.005 release of Perl) is great
for printing out data structures. The Storable module, found on CPAN,
provides a function called C<dclone> that recursively copies its argument.
use Storable qw(dclone);
$r2 = dclone($r1);
Where $r1 can be a reference to any kind of data structure you'd like.
It will be deeply copied. Because C<dclone> takes and returns references,
you'd have to add extra punctuation if you had a hash of arrays that
you wanted to copy.
%newhash = %{ dclone(\%oldhash) };
...
tina
--
http://www.tinita.de \ enter__| |__the___ _ _ ___
tina's moviedatabase \ / _` / _ \/ _ \ '_(_-< of
search & add comments \ \ _,_\ __/\ __/_| /__/ perception
------------------------------
Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 16 Sep 99)
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.
| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.
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.
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 V9 Issue 3264
**************************************