[13837] in Perl-Users-Digest
Perl-Users Digest, Issue: 1247 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Nov 1 18:10:38 1999
Date: Mon, 1 Nov 1999 15:10:25 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <941497825-v9-i1247@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Mon, 1 Nov 1999 Volume: 9 Number: 1247
Today's topics:
Newbie help kb9nvh@my-deja.com
Re: Newbie help (Kragen Sitaker)
Re: Newbie help <lr@hpl.hp.com>
Re: Newbie help <lr@hpl.hp.com>
Re: Non-ASCII report output <aqumsieh@matrox.com>
parsing a directory content <cle1dav@club-internet.fr>
Re: Perl & Excel FitToPages Settings (Jan Dubois)
Re: Perl4 and Y2K (Paul Kimoto)
Re: Perl4 and Y2K (Bart Lateur)
Re: Perl4 and Y2K (Craig Berry)
Re: Perl4 and Y2K <lr@hpl.hp.com>
please explain ${1+"$@"} <Chicheng_Zhang-P29601@email.mot.com>
Re: please explain ${1+"$@"} (Kragen Sitaker)
Problem with File Handles using CGI.pm <@mdo.net>
Problems with sockets <nesta@superhost.com.mx>
Re: Remember Me Option <AgitatorsBand@yahoo.com>
Re: Scripts that invoke one another via Location: and/o <lr@hpl.hp.com>
Sending html email traviscook@my-deja.com
Re: SGML/HTML parsing tool (Bennett Todd)
Re: Survey form, return multiple checkboxes sleepernyc@my-deja.com
Re: Survey form, return multiple checkboxes <lr@hpl.hp.com>
system commands <amwalker@gate.net>
the "??" operator (was: Re: perl double-split) (Bart Lateur)
Re: the "??" operator <dan@tuatha.sidhe.org>
UPS Perl code <kole@arialnet.net>
Re: UPS Perl code <jtolley@bellatlantic.net>
Re: Weird uninitailized value <bivey@teamdev.com>
Re: Weird uninitailized value <johnny@my-deja.com>
Re: Weird uninitailized value (Kragen Sitaker)
Re: What makes the web go? (Bennett Todd)
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Mon, 01 Nov 1999 20:26:54 GMT
From: kb9nvh@my-deja.com
Subject: Newbie help
Message-Id: <7vkt29$ik8$1@nnrp1.deja.com>
The code below prints the $i variable and then the text "+1". I want 1
to be added to $i and the sum printed. What do I do Please?
Any help is appreciated...
Todd Snyder
print <<EndOfHTML;
<table border=0 width=650>
<tr>
<td>
<form action="../cgi-bin/review.cgi" method="POST">
Item ($i+1)<br>
<input name=box($i+1) type=checkbox value=Select>
</td>
<td>
IN STOCK?<br>
YES
</td>
<td>
<A HREF="mailto:webmaster\@home-fires.com">Webmaster\@home-fires.com</A>
</td>
<td>
<IMG SRC="../THEME/eye1.gif" border=0>
</td>
</tr>
</table>
EndOfHTML
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Mon, 01 Nov 1999 21:23:09 GMT
From: kragen@dnaco.net (Kragen Sitaker)
Subject: Re: Newbie help
Message-Id: <1xnT3.17889$23.963974@typ11.nn.bcandid.com>
In article <7vkt29$ik8$1@nnrp1.deja.com>, <kb9nvh@my-deja.com> wrote:
>The code below prints the $i variable and then the text "+1". I want 1
>to be added to $i and the sum printed. What do I do Please?
my $iplusone = $i + 1;
print <<EndOfHTML;
...
Item ($iplusone)<br>
...
EndOfHTML
Only variable refs and ${} refs interpolate inside strings. You can do
ugly stuff to force expressions to interpolate inside strings but it is
not advisable.
--
<kragen@pobox.com> Kragen Sitaker <http://www.pobox.com/~kragen/>
Mon Nov 01 1999
7 days until the Internet stock bubble bursts on Monday, 1999-11-08.
<URL:http://www.pobox.com/~kragen/bubble.html>
------------------------------
Date: Mon, 1 Nov 1999 13:49:30 -0800
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: Newbie help
Message-Id: <MPG.1287aac5441a731f98a174@nntp.hpl.hp.com>
In article <7vkt29$ik8$1@nnrp1.deja.com> on Mon, 01 Nov 1999 20:26:54
GMT, kb9nvh@my-deja.com <kb9nvh@my-deja.com> says...
> The code below prints the $i variable and then the text "+1". I want 1
> to be added to $i and the sum printed. What do I do Please?
...
> print <<EndOfHTML;
...
> Item ($i+1)<br>
> <input name=box($i+1) type=checkbox value=Select>
...
> EndOfHTML
The most obvious approach to this simple task is to set a variable ahead
of the print statement to $i+1, then interpolate the variable into the
string.
my $x = $i + 1;
print <<EndOfHTML;
...
Item ($x)<br>
<input name=box($x) type=checkbox value=Select>
Less obvious (and much 'noisier') is interpolating an expression
directly into the string:
Item (${\($i+1)})<br>
<input name=box(${\($i+1)}) type=checkbox value=Select>
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Mon, 1 Nov 1999 14:48:34 -0800
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: Newbie help
Message-Id: <MPG.1287b8a258cb720598a179@nntp.hpl.hp.com>
In article <1xnT3.17889$23.963974@typ11.nn.bcandid.com> on Mon, 01 Nov
1999 21:23:09 GMT, Kragen Sitaker <kragen@dnaco.net> says...
> In article <7vkt29$ik8$1@nnrp1.deja.com>, <kb9nvh@my-deja.com> wrote:
> >The code below prints the $i variable and then the text "+1". I want 1
> >to be added to $i and the sum printed. What do I do Please?
>
> my $iplusone = $i + 1;
> print <<EndOfHTML;
> ...
> Item ($iplusone)<br>
> ...
> EndOfHTML
>
> Only variable refs and ${} refs interpolate inside strings.
^ and @{[]} refs.
> You can do
> ugly stuff to force expressions to interpolate inside strings but it is
> not advisable.
A matter of opinion, obviously.
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Mon, 1 Nov 1999 15:25:09 -0500
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: Non-ASCII report output
Message-Id: <x3yd7tut0wq.fsf@tigre.matrox.com>
Don Thomson <dthomson@zack.fammed.wisc.edu> writes:
> I'm in the process of replacing a Microsoft Access application with a
> Perl script running on a UNIX box. The end users are used to report
> output that looks a bit fancier than the plain ASCII output that I
> already know how to produce. Any suggestions for modules that would
> allow me to produce graphical lines/boxes/etc. while writing a report?
Sure. Use the Tk module.
(I might even consider gnuplot)
HTH,
--Ala
------------------------------
Date: Mon, 01 Nov 1999 22:50:18 GMT
From: davidh <cle1dav@club-internet.fr>
Subject: parsing a directory content
Message-Id: <381E19C8.1D5051D0@club-internet.fr>
Hi folks.
I am not a programmer but I need some help to build a function that
parses the content of a directory.
I am actually trying to build a cgi index file that would read the
content of a directory, extract some data such as what is between the
<title> and <meta> tags, and finally parse a dynamic index.
If anyone knew an existing program, it would be very helpful :)
David
http://www.bibelec.com
------------------------------
Date: Mon, 01 Nov 1999 22:19:26 +0100
From: jand@activestate.com (Jan Dubois)
Subject: Re: Perl & Excel FitToPages Settings
Message-Id: <3826019b.9722289@news3.ibm.net>
[mailed & posted]
morgand@att.com wrote:
>Can anyone suggest a reason why the FitToPagesWide and FitToPagesTall
>settings in the perl code below aren't effective in Excel 97? The
>effect is that the appropriate values are plugged into the "wide"
>and "tall" boxes in the PageSetup dialog, but the radio button next to
>"Adjust to:" (as opposed to the one next to "Fit to:") remains checked,
>causing the FitToPages settings to be ignored.
>
># Create the Excel object
>use OLE;
>$application = CreateObject OLE 'Excel.Application' || die $!;
Can I recommend to use Win32::OLE instead? OLE.pm is deprecated:
use Win32::OLE;
You'll need the Variant module later:
use Win32::OLE::Variant;
my $application = Win32::OLE->new('Excel.Application') or
die Win32::OLE->LastError;
$! doesn't show the OLE errors, it only contains errors from the C runtime
library. Win32::OLE->LastError returns also a dual-valued scalar: a
number in numeric context and a string otherwise.
I would also recommend to make all OLE object lexicals (my variables).
Otherwise you might get bitten by the non-deterministic global object
destruction phase of Perl (don't ask).
># Make it visible for debugging purposes.
>$application->{'Visible'} = 1;
>
># Create a new workbook.
>$testworkbook = $application->Workbooks->Add();
>
># Make an object of the first worksheet.
>$testsheet = $testworkbook->Worksheets(1);
>
># Turn zoom off so we can use FitToPages
>$testsheet->PageSetup->{'Zoom'} = 0;
This is your problem. The Zoom properties takes either a numeric zoom
factor a boolean value to turn it off. Win32::OLE will autotranslate the
0 above into a VT_I4 integer value, which Excel will interpret as an
invalid zoom factor. You have to explicitly specify a boolean VARIANT
here:
$testsheet->PageSetup->{'Zoom'} = Variant(VT_BOOL, 0);
># Set to 1 page wide by 1 page tall
>$testsheet->PageSetup->{'FitToPagesWide'} = 1;
>$testsheet->PageSetup->{'FitToPagesTall'} = 2;
>
>The VBA equivalent of this code seems to work, so I suspect this is
>either an OLE problem, a perl problem, or a me problem.
I would say it was the 'me' problem, but I admit, it is tricky. :-) I
cannot remember if it would have helped in this case, but running under
"perl -w" gives much better error messages from Win32::OLE.
-Jan
------------------------------
Date: 1 Nov 1999 15:53:59 -0500
From: kimoto@lightlink.com (Paul Kimoto)
Subject: Re: Perl4 and Y2K
Message-Id: <slrn81rvf7.gv1.kimoto@adore.lightlink.com>
In article <RwlT3.17135$23.943005@typ11.nn.bcandid.com>, Kragen Sitaker wrote:
> In article <s1riot4fqof80@corp.supernews.com>,
> Craig Berry <cberry@cinenet.net> wrote:
>> *We* know that 'there are no plans'
>> because there don't *need* to be any plans. They don't. :)
> If someone doesn't want to upgrade software on the merits of the facts,
> it is dishonest to try to get them to believe falsehoods in order to
> manipulate them into doing what you want. This is true regardless of
> whether or not the victim is your boss.
> I define 'deception' as 'an attempt to cause someone to believe
> something that is not true'. It is true that Randal did not say
> anything that was false, but he was nevertheless practicing deception.
Didn't Knuth write, "Beware of bugs in the above code; I have only proved
it correct, not tried it"? It is possible that perl4 has a year-2000 bug,
even though it is hard to imagine how. But what if someone finds one? No
one will fix it. The perl developers will just say, "so what?"
--
Paul Kimoto <kimoto@lightlink.com>
------------------------------
Date: Mon, 01 Nov 1999 16:14:18 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: Perl4 and Y2K
Message-Id: <381dbc23.1575413@news.skynet.be>
Philip 'Yes, that's my address' Newton wrote:
>On 31 Oct 1999 23:42:39 -0800, merlyn@stonehenge.com (Randal L.
>Schwartz) wrote:
>>Kragen> But what's wrong with Perl4 Y2K-wise?
>>
>>See Deja for "perl4" and "y2k" posted by me.
>
>That found only the message that started this thread.
You didn't look back far enough in time, did you? Look at least, ooh,
one year ago.
--
Bart.
------------------------------
Date: Mon, 01 Nov 1999 21:37:57 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: Perl4 and Y2K
Message-Id: <s1s21lhhqof58@corp.supernews.com>
Kragen Sitaker (kragen@dnaco.net) wrote:
: In article <s1riot4fqof80@corp.supernews.com>,
: Craig Berry <cberry@cinenet.net> wrote:
: ><mode audience=techies-only>
: >sssshhhhh...read the above carefully. It is a lovely piece of FUD aimed
: >at providing us poor engineers with a lever with which to force our bosses
: >to authorize an upgrade to Perl 5. *We* know that 'there are no plans'
: >because there don't *need* to be any plans. They don't. :)
: ></mode>
:
: If someone doesn't want to upgrade software on the merits of the facts,
: it is dishonest to try to get them to believe falsehoods in order to
: manipulate them into doing what you want. This is true regardless of
: whether or not the victim is your boss.
First, the infamous Perl4 Y2K meme is indeed 'dishonest' on its face.
Understand that it was and is intended *largely* for its humor value; I
personally have been fortunate enough to work in environments where the
bosses were enlightened enough or the MIS department autonomous enough to
make language version upgrades noncontroversial.
: I am quite surprised that Randal would do such a thing, but he has
: confirmed it beyond any reasonable doubt.
As Randal points out, he didn't author this, but he and others have indeed
delighted in repeating it.
: I understand that many companies have incompetent people in positions
: of power, and that this is frustrating to those who are subject to
: those people's whims. I have worked with some of them myself. I do
: not believe that attempting to influence these people by deception is
: likely to cause the situation to change for the better.
The question in such cases is whether *anything* is likely to change such
situations for the better. With certain people, reason appears to have no
effect. If, after a patient and prolonged effort to apply reason to such
an individual, no progress is being made, it seems practical and useful to
"flip the bozo bit" on that individual, regarding him or her from that
point forward as an obstacle to be circumvented by any means necessary,
rather than a productive member of the company.
In an ethical or moral sense, practicing deception to obtain a greater
good may be worthy of argument, it's true. But out here in the real
world, it's rather tragic to see a good company die and dozens of good
people on the streets because a few idiots in corner offices couldn't
grasp technical concepts. And I've seen that happen around me, twice.
: Manipulating incompetent decision-makers to do the right thing by means
: of deception enables those decision-makers to remain decision-makers,
And if I get in a toe-to-toe with an incompetent and defensive senior VP
over an issue like this, where will you place your bets on who will be
polishing his resume next week?
: and worse, it
: inculcates a habit of deception among those who advise them and makes
: them dependent upon it.
It's true when this sort of thing occurs frequently, it's one of the
primary Bad Signs and should indicate that it's time to polish that resume
in any case. But a little "managing the managers" falls into the "white
lie" category in my view. It's more a matter of shielding them from
having to deal with stuff that will only make them nervous and afraid and
overwhelmed than anything else.
--
| Craig Berry - cberry@cinenet.net
--*-- http://www.cinenet.net/users/cberry/home.html
| "They do not preach that their God will rouse them
a little before the nuts work loose." - Kipling
------------------------------
Date: Mon, 1 Nov 1999 14:29:03 -0800
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: Perl4 and Y2K
Message-Id: <MPG.1287b406e9835f1f98a177@nntp.hpl.hp.com>
In article <s1s21lhhqof58@corp.supernews.com> on Mon, 01 Nov 1999
21:37:57 GMT, Craig Berry <cberry@cinenet.net> says...
...
> ... But a little "managing the managers" falls into the "white
> lie" category in my view. It's more a matter of shielding them from
> having to deal with stuff that will only make them nervous and afraid and
> overwhelmed than anything else.
I doubt that the contributors to this thread have much experience at
managing a shared computing utility. Having been a PHB in that
situation, I can tell you that your assessments are completely unfair,
indeed bogus.
From the point of view of the comp-center manager, upgrading software --
for example from Perl 4 to Perl 5 -- is all risk and no gain. The
existing programs run for the users, who aren't complaining. So why
rock the boat?
The *correct* solution isn't upgrading from Perl 4 to Perl 5, but
installing Perl 5 as another facility. Leave /usr/local/bin/perl
pointing at perl4.036 or whatever. Tell users who want Perl 5 to aim at
/usr/local/bin/perl5.
Nothing could be simpler or more transparent.
Ask again, though, when it is time to upgrade from perl5.005_03 to perl
5.6. :-(
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Mon, 01 Nov 1999 13:18:56 -0700
From: Chicheng Zhang <Chicheng_Zhang-P29601@email.mot.com>
Subject: please explain ${1+"$@"}
Message-Id: <381DF5B0.E3BF5901@email.mot.com>
what does perl -x $0 ${1+"$@"} mean?
I know the difference between $@ and $*, but why need ${1+"$@"} anyway?
Please explain.
------------------------------
Date: Mon, 01 Nov 1999 21:20:52 GMT
From: kragen@dnaco.net (Kragen Sitaker)
Subject: Re: please explain ${1+"$@"}
Message-Id: <UunT3.17884$23.964623@typ11.nn.bcandid.com>
In article <381DF5B0.E3BF5901@email.mot.com>,
Chicheng Zhang <Chicheng_Zhang-P29601@email.mot.com> wrote:
>what does perl -x $0 ${1+"$@"} mean?
>
>I know the difference between $@ and $*, but why need ${1+"$@"} anyway?
>Please explain.
When there are no args, "$@" is "" -- a single arg of the null string.
${1+"$@"} gives you the args that were passed to the shell script, even
if there aren't any.
--
<kragen@pobox.com> Kragen Sitaker <http://www.pobox.com/~kragen/>
Mon Nov 01 1999
7 days until the Internet stock bubble bursts on Monday, 1999-11-08.
<URL:http://www.pobox.com/~kragen/bubble.html>
------------------------------
Date: Mon, 1 Nov 1999 17:57:07 -0500
From: "CS" <@mdo.net>
Subject: Problem with File Handles using CGI.pm
Message-Id: <fSoT3.18028$23.978170@typ11.nn.bcandid.com>
When I do this:
use CGI qw(:standard);
use CGI::Carp qw(fatalsToBrowser);
$q=new CGI;
$FH=param('upload');
Instead of getting a file handle to work with, my web server gives me this
message:
CGI open of C:\temp\CGItemp3360001: Permission denied
And why on earth would the above script try to create a temporary file on
the host without me wanting to do that?
Thanx in advance, Chris S.
------------------------------
Date: Mon, 01 Nov 1999 15:29:59 -0600
From: Victor Rivera <nesta@superhost.com.mx>
Subject: Problems with sockets
Message-Id: <381E0657.A9610593@superhost.com.mx>
I make a request directly to the socket and everything is okay but, when
a i take out a line of code (that i think is an extra line) it doesn't
work, wath's wrong. Could you help me please ?. Here you are the code.
#!/usr/bin/perl
use Socket;
require "tcp.pl"; # This file open the socket an make the connection.
if ($#ARGV){
print "Usage: $0 [IP Address] [Domain]\n";
print "This program return the HTTP code.\n";
exit (-1);
}
if (open_TCP(F, $ARGV[0], 80) == undef) {
print "Error at $ARGV[0]\n";
exit(-1);
}
print F "GET / HTTP/1.0\n\n";
@back=<F>; # I store all the information returned by the socket in an
array
print " The server says : "; # If i take out this line the program it's
ok, the program run
# with out any problem, if do it
from the command line
# but if i do this at the browser
alway return an error page.
print (@back); # I do this in order to retrieve the document at the
browser.
close(F);
Is the colon necessary ? or what's wrong ?
The Usage is : \home\example\cgi\ ./socket.pl www.yahoo.com
From the Browser : http:\\www.example.com\cgi\socket.pl?www.yahoo.com
------------------------------
Date: Mon, 01 Nov 1999 20:07:56 GMT
From: Scratchie <AgitatorsBand@yahoo.com>
Subject: Re: Remember Me Option
Message-Id: <wqmT3.379$Yr1.80207@news.shore.net>
rancorr@hotmail.com wrote:
: I want to implement a "remember me" option on my website -- where users
: don't have to log-on again in order to enter premium services on my
: site taht usually require a password. what's the best way to do this?
Cookie. Check CGI.pm.
--Art
--
--------------------------------------------------------------------------
National Ska & Reggae Calendar
http://www.agitators.com/calendar/
--------------------------------------------------------------------------
------------------------------
Date: Mon, 1 Nov 1999 13:33:59 -0800
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: Scripts that invoke one another via Location: and/or URI: - environment persistence?
Message-Id: <MPG.1287a71ffcb71eb498a172@nntp.hpl.hp.com>
In article <381DD62A.E3C42CFD@vpservices.com> on 1 Nov 1999 18:05:25
GMT, Jeff Zucker <jeff@vpservices.com> says...
> Larry Rosler wrote:
> > When the need arose, I set up a sophisticated webcounting system that
> > now has several hundred satisfied users. It uses various techniques to
> > deal with proxying and caches -- the things that folklore here says make
> > counters useless.
>
> Can you give some hints/samples/code showing your approach? So many
> have said so loudly that it ain't worth the effort that I am intrigued.
>
> > > [$counters ne 'useless']
> >
> > Right on! I would have commented on this prejudice long sooner, but it
> > is really off-topic for a Perl newsgroup. And it still is.
>
> Gee, I'd sure like to hear your thinking on this, I have yet to hear
> that side of the argument from someone as in-the-know as you. Here,
> even if OT? In another NG? Email?
Email it will be, as it is still off-topic and I won't add to the N-to-S
ratio here.
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Mon, 01 Nov 1999 22:54:44 GMT
From: traviscook@my-deja.com
Subject: Sending html email
Message-Id: <7vl5nj$p8c$1@nnrp1.deja.com>
I have a custom program that handles the smtp conversation on port 25.
I had to do a custom one for a variety of reasons. I can send a
regular 'text/plain' email with no problems. What isn't working
correctly is sending out a 'text/html' email. The email is arriving
fine, but I see all the header info and the html tags. So, obviously,
the email type isn't being recognized. Can anyone help me with this?
Travis
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Mon, 01 Nov 1999 20:35:21 GMT
From: bet@network.rahul.net (Bennett Todd)
Subject: Re: SGML/HTML parsing tool
Message-Id: <slrn81ruc9.njb.bet@localhost.localdomain>
I recently had to suck a lot of odd bits out of a big pile of html; I ended up
going by way of a little treewalker. I.e. after shoving the HTML through
HTML::TreeBuilder, I then hit it with a converter function whose body looked
like:
my(@pfx) = (); # stack
my(@results) = ();
my $thagomizer;
$thagomizer = sub {
my($t) = @_;
push @pfx, join(':', grep{defined and /\S/} $t->tag(), map{$t->attr($_)}
qw(name value checked));
if ($t->is_empty()) {
push @results, join('/', @pfx, '') if $pfx[-1] =~ /:/;
} else {
for (@{$t->content()}) {
if (ref) {
$thagomizer->($_);
} else {
s/\s+$//;s/^\s+//;s/\s+/ /g;
push @results, join('/', @pfx, $_) if length;
}
}
}
pop @pfx; # Told you it was a stack!
};
$thagomizer->($_[0]);
return @results;
I'm sure there are other ways to write that treewalker, that's just what came
to mind first. Says something about the shape of my mind, perhaps:-).
Anyway, the return here is an array of strings, one for each leaf of the
original tree. The strings look sorta like the results of doing a
find . -type f -print
on a filesystem directory tree, sorta kinda. Anyway, I found it easier to pull
the data out of that array of strings than to pull it out of the original
tree.
-Bennett
------------------------------
Date: Mon, 01 Nov 1999 21:12:54 GMT
From: sleepernyc@my-deja.com
Subject: Re: Survey form, return multiple checkboxes
Message-Id: <7vkvoc$kpp$1@nnrp1.deja.com>
In article <MPG.1287505a53a5099798a16d@nntp.hpl.hp.com>,
Larry Rosler <lr@hpl.hp.com> wrote:
Thanks but, I'm not a programmer, would it be too difficult to explain
exactly where to put this param() ?
Does it go in my HTML form or in the cgi.bin code and if so
approximately where would it go?
THANKS!
Sleepless
I would like to have people check off five
> > hobbies out of ten, and return all answers to my form.log. Any
idea how
> > to do this? the radio fields work well because you can only pick
one.
> > <input type="CHECKBOX" name="hobby"
value="hiking">Hiking/Biking/Outdoors
> > <input type="CHECKBOX" name="hobby" value="sports">Sports
> > <input type="CHECKBOX" name="hobby" value="concerts">Live
Music/Concerts
> > <input type="CHECKBOX" name="hobby" value="theater">Theater
>
> The CGI module makes his very easy to handle. Use the param()
function
> in list context.
>
> for (param 'hobby') { use the values in $_ }
>
> --
> (Just Another Larry) Rosler
> Hewlett-Packard Laboratories
> http://www.hpl.hp.com/personal/Larry_Rosler/
> lr@hpl.hp.com
>
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Mon, 1 Nov 1999 14:35:23 -0800
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: Survey form, return multiple checkboxes
Message-Id: <MPG.1287b582165ef69c98a178@nntp.hpl.hp.com>
In article <7vkvoc$kpp$1@nnrp1.deja.com> on Mon, 01 Nov 1999 21:12:54
GMT, sleepernyc@my-deja.com <sleepernyc@my-deja.com> says...
> In article <MPG.1287505a53a5099798a16d@nntp.hpl.hp.com>,
> Larry Rosler <lr@hpl.hp.com> wrote:
> Thanks but, I'm not a programmer, would it be too difficult to explain
> exactly where to put this param() ?
Yes, it would be too difficult, because it wouldn't help you past the
next necessary modification. If you want to write or to modify a
program, then you must become a programmer or hire a programmer.
The following was posted earlier today. Read the whole thread ('Book
Suggestions').
...
If you only know a little HTML and are starting to do some
CGI, then you probably need to start with this web tutorial:
http://www.netcat.co.uk/rob/perl/win32perltut.html
Do not go to books like "Perl for Dummies" unless you want
a book which will try to convince you programming is hard
and scary. Get a book which doesn't treat you like a dummy.
David
--
David Cassell, OAO cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Mon, 01 Nov 1999 17:37:44 -0500
From: Aaron Walker <amwalker@gate.net>
Subject: system commands
Message-Id: <381E1638.33891BD@gate.net>
Since I do not have access to a UNIX shell, sometimes it is difficult to
debug my perl CGI scripts. I am attempting to write a CGI script that
gives the output of perl. Unfortunately, it is not working as planned.
Here is the source of perldiag.pl so far:
-start-
#!/usr/bin/perl -w
require("cgi-lib.pl");
&ReadParse;
@output = `perl $in{'file'}`;
print "Content-type: text/html\n\n";
print "Output of \"perl $in{'file'}\":\n<br><br>\n";
print "@output";
-end-
I produced a test script for perldiag.pl to test:
-start-
#!/usr/bin/perl -w
$var = 5 + 3
print "this is no semi-colon at the end of this"
-end-
Now, of course the above script does not work properly...
but if I execute the perldiag.pl script:
/cgi-bin/perldiag.pl?file=test.pl
Nothing is outputted. I also tested this script out with a working
script. Instead of outputting the actual html code and variables like
perl does at a command prompt, it shows the actual script as if I was
viewing that script in netscape. Now I know that when I execute system
commands inside `'s (hyphens), that it is executed right then and there,
but how would I go about getting the real output? I tried redirecting
the output of perl to a text file, but it still does the same thing...
Any ideas anyone?
Thanks in advance,
Aaron
------------------------------
Date: Mon, 01 Nov 1999 10:18:31 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: the "??" operator (was: Re: perl double-split)
Message-Id: <381d6644.2672650@news.skynet.be>
Ilya Zakharevich wrote:
> my $values = <> ?? die "'Name' line without matched 'values' line.\n";
>
>is the proper solution.
Does this "??" syntax work already? Since what version? I've been
waiting a long time for it to appear.
It doesn't work under 5.00502. Will it ever?
print 'a' ?? 'b';
-->
Search pattern not terminated at test.pl line 2
--
Bart.
------------------------------
Date: Mon, 01 Nov 1999 22:12:18 GMT
From: Dan Sugalski <dan@tuatha.sidhe.org>
Subject: Re: the "??" operator
Message-Id: <6foT3.624$c06.8505@news.rdc1.ct.home.com>
Bart Lateur <bart.lateur@skynet.be> wrote:
> Ilya Zakharevich wrote:
>> my $values = <> ?? die "'Name' line without matched 'values' line.\n";
>>
>>is the proper solution.
> Does this "??" syntax work already? Since what version? I've been
> waiting a long time for it to appear.
> It doesn't work under 5.00502. Will it ever?
Probably not. Certainly not in 5.6, and likely not after that.
Dan
------------------------------
Date: Mon, 01 Nov 1999 12:23:37 -0800
From: Kole Dunn <kole@arialnet.net>
Subject: UPS Perl code
Message-Id: <381DF6C6.1E144D39@arialnet.net>
Hi all,
I got this UPS Perl code (an API) from the UPS site to integrate into
our website, and just need a little guidence. I have posted below the
code supplied from UPS, which sends the data from the online form and
receives the rates back. I am supposed to be able to retrieve the UPS
rate in a string (delivered from something in this code), and have tried
to capture it, but no luck. I'm rather new to Perl and have written a
few useful scripts, but my knowledge ends here.
Can anyone provide a clue?
From UPS:
Code Snippet for sockets:
$AF_INET = 2;
$SOCK_STREAM = 2;
$sockaddr = "S n a4 x8";
$port = 80;
$them = "www.ups.com";
$function = "GET"; #Type of HTTP
$workFile = "/using/services/rave/qcostcgi.cgi";
$versionInfo = "HTTP/1.0\n\n";
$workString = "?";
$workString .= "accept_UPS_license_agreement=yes";
$workString .= "&";
$workString .= "10_action=$upsAction";
$workString .= "&";
$workString .= "13_product=$upsProduct";
$workString .= "&";
$workString .= "15_origPostal=$OriginPostalCode";
$workString .= "&";
$workString .= "19_destPostal=$DestZipCode";
$workString .= "&";
$workString .= "23_weight=$PackageWeight";
$request = "$function $workFile$workString $versionInfo";
#
# Initialize communications to the server
#
if (!&InitCommunications()) # This is a function to establish a socket
connection
{
# send request to server
#
print S "$request\n";
#
# retrieve answer sent back from the server
#
$resultlist = '';
while (<S>)
{
$resultlist .=$_;
}
close(S);
}
#
# Initialize Inter-process communications
#
sub InitCommunications
{
$errmsg = "";
#
# get info for socket open
#
($name, $aliases,$proto) = getprotobyname('tcp');
($name, $aliases,$port) = getservbyport($port,'tcp') unless $port
=~/^\d+$/;
($tname, $aliases,$type, $len, $thisaddr) =
gethostbyname($hostname);
($name, $aliases,$type, $len,$thataddr) = gethostbyname($them);
#
# pack information into structure for socket open
#
$this = pack($sockaddr, $AF_INET, 0, $thisaddr);
$that = pack($sockaddr, $AF_INET, $port, $thataddr);
#
# Create the socket filehandle
#
eval
{
alarm($connect_timeout);
if (socket(S, $AF_INET, $SOCK_STREAM, $proto) < 0)
{
$raveServer = 0;
return 0;
}
#
# disable buffering, flush after each write/print
#
select(S);
$| = 1;
select(STDOUT);
if (bind(S, $this) < 0)
{
$raveServer = 0;
return 0;
}
if (!connect(S, $that))
{
$raveServer = 0;
return 0;
}
alarm(0);
};
return $raveServer;
}
Receiving Rating Information
Rating information is returned in newline terminated strings, with each
piece of information separated by a percent sign, as follows:
* 3%$product%$orig_postal%$orig_country%$dest_postal%$dest_country%$zone
%$weight%$productchrg%$accs_surcharge%$totalchrg%$time%$\n
--
_________________________________
ArialNet, Inc.
Internet eCommerce and Order Fulfillment
1167 Annie Court, Minden NV 89423
Phone: (775) 267-0220 Fax: (775) 267-4979
------------------------------
Date: Mon, 01 Nov 1999 21:12:35 GMT
From: James Tolley <jtolley@bellatlantic.net>
Subject: Re: UPS Perl code
Message-Id: <381E01BA.866DABAE@bellatlantic.net>
Kole Dunn wrote:
> Hi all,
> I got this UPS Perl code (an API) from the UPS site to integrate into
> our website, and just need a little guidence. I have posted below the
> code supplied from UPS, which sends the data from the online form and
> receives the rates back. I am supposed to be able to retrieve the UPS
> rate in a string (delivered from something in this code), and have tried
> to capture it, but no luck. I'm rather new to Perl and have written a
> few useful scripts, but my knowledge ends here.
>
> Can anyone provide a clue?
Have you tried the Business::UPS module from www.cpan.org?
------------------------------
Date: 1 Nov 1999 20:25:03 GMT
From: "William" <bivey@teamdev.com>
Subject: Re: Weird uninitailized value
Message-Id: <01bf24a7$67a26ea0$3527e1ce@bill.jump.net>
John <johnny@my-deja.com> wrote in article
<J2mT3.35$eh.529@news.corecomm.net>...
[...]
> Use of uninitialized value at combine.prl line 71, <IN4> chunk 20 (or
> whatever the last line of the file is)
>
[...]
> while (<IN4>) {
> chomp;
> $dis{$c} = $_;
> $c = $c + 1;
> }
I trust that $c is set to something useful before you enter
this loop, right? -Wm
------------------------------
Date: Mon, 1 Nov 1999 12:33:47 -0800
From: "John" <johnny@my-deja.com>
Subject: Re: Weird uninitailized value
Message-Id: <wKmT3.45$eh.1827@news.corecomm.net>
$c is set to 1 before entering the loop ...
it is in the loop where it writes the output is where it has
William <bivey@teamdev.com> wrote in message
news:01bf24a7$67a26ea0$3527e1ce@bill.jump.net...
>
>
> John <johnny@my-deja.com> wrote in article
> <J2mT3.35$eh.529@news.corecomm.net>...
> [...]
> > Use of uninitialized value at combine.prl line 71, <IN4> chunk 20 (or
> > whatever the last line of the file is)
> >
> [...]
> > while (<IN4>) {
> > chomp;
> > $dis{$c} = $_;
> > $c = $c + 1;
> > }
>
> I trust that $c is set to something useful before you enter
> this loop, right? -Wm
------------------------------
Date: Mon, 01 Nov 1999 21:19:36 GMT
From: kragen@dnaco.net (Kragen Sitaker)
Subject: Re: Weird uninitailized value
Message-Id: <ItnT3.17879$23.956930@typ11.nn.bcandid.com>
In article <J2mT3.35$eh.529@news.corecomm.net>,
John <johnny@my-deja.com> wrote:
>Use of uninitialized value at combine.prl line 71, <IN4> chunk 20 (or
>whatever the last line of the file is)
Which line, exactly, is line 71? Is it possibly after the loop ends?
--
<kragen@pobox.com> Kragen Sitaker <http://www.pobox.com/~kragen/>
Mon Nov 01 1999
7 days until the Internet stock bubble bursts on Monday, 1999-11-08.
<URL:http://www.pobox.com/~kragen/bubble.html>
------------------------------
Date: Mon, 01 Nov 1999 21:04:29 GMT
From: bet@network.rahul.net (Bennett Todd)
Subject: Re: What makes the web go?
Message-Id: <slrn81s02s.njb.bet@localhost.localdomain>
1999-10-27-14:34:48 Randal L. Schwartz:
>No, nobody doing the kind of volume that Yahoo or Amazon.com gets
>could *ever* use M$ products.
Well, that might depend; at least one well-known high-volume site (Ebay) uses
IIS. Of course it is most famous for buckling under the load, but hey:-).
-Bennett
------------------------------
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 1247
**************************************