[16472] in Perl-Users-Digest
Perl-Users Digest, Issue: 3884 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Aug 2 11:05:33 2000
Date: Wed, 2 Aug 2000 08:05:16 -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: <965228716-v9-i3884@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Wed, 2 Aug 2000 Volume: 9 Number: 3884
Today's topics:
Re: A DOS box question <guenther.degenfelder@datev.de>
Re: Broadcast-IP-address or netmask (Mike Bristow)
Re: Bulk Emailing (Mark W. Schumann)
Re: Configure Win32::ODBC Connection to a SQL Server? <linux@worsdall.demon.co.uk>
Re: Copy a hash and const? (Keith Calvert Ivey)
Re: Copy a hash and const? <dietmar.staab@t-online.de>
Re: Copy a hash and const? (Jens)
Re: day_of_week() and age() without using Date::Calc ? <guenther.degenfelder@datev.de>
Re: How to install openssl-0.9.3a (NP)
Re: How to Post a message to a newsgroup using Perl ? <gellyfish@gellyfish.com>
Re: I have an idea but will it work ? <bart.lateur@skynet.be>
Re: I have an idea but will it work ? <mjcarman@home.com>
Re: Net::FTP Module <panderse@us.ibm.com>
Net::FTP->ls('*.rcp'); <brendon@shipreg.com>
Newbie: Looking for sample http code <jdiadamo@cisco.com>
perl glob problem <alan@taz1.com>
Perl in Windows 2000 <bmacdonaldNObmSPAM@netstone.com.invalid>
Re: Perl Module in C - Question. (Greg Bacon)
Re: posting in newsgroup using perl script? <bart.lateur@skynet.be>
Re: Price look up procedure in Perl (part 2) <tony_curtis32@yahoo.com>
Re: Price look up procedure in Perl (part 2) <globalcon2isnot@myhouse.com>
Re: question about a Regular Expression <bart.lateur@skynet.be>
Re: QUICK Help. h2xs Extending Perl Question (Mark W. Schumann)
Redirect in DOS box (Stefan Wimmer)
Re: Redirect in DOS box <guenther.degenfelder@datev.de>
Regexp problem - Stripping HTML mbutt@my-deja.com
Re: Reserved word <bart.lateur@skynet.be>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 2 Aug 2000 15:50:21 +0200
From: "Guenther Degenfelder" <guenther.degenfelder@datev.de>
Subject: Re: A DOS box question
Message-Id: <398826b6$1@news.datev.de>
"James" <jamesmckay@MailAndNews.com> schrieb im Newsbeitrag
news:398A3C0E@MailAndNews.com...
> Hi All,
> Quick question: Is there a way to force a Perl script to run in a
DOS
> box? The script I've written flashes it's error messages on screen too
fast
> to read, then closes it's DOS box. I want to have the DOS box remain on
> screen after the script completes.
> Thanks in advance
> James
>
Try this:
Scriptname.pl & pause
Guenther
------------------------------
Date: Wed, 02 Aug 2000 14:10:14 GMT
From: mike@urgle.com (Mike Bristow)
Subject: Re: Broadcast-IP-address or netmask
Message-Id: <slrn8ogau6.rj.mike@hershey.urgle.com>
On Tue, 1 Aug 2000 18:16:19 +0200, Ralf Kible <kible@web.de> wrote:
>I'm looking for a possibility to find the broadcast-address or netmask of an
>network-interface, because I try to send a broadcast-message via UDP.
This is almost certainly going to be OS specific. On a unix-a-like
OS, you may be able to do somthing like this (but it'll need tweaking
on different flavours of unix)
You'll need to be careful about things like aliased interfaces, though
further discussion should probably be elsewhere (comp.unix.programmer,
perhaps) as the differences between unix varieties is not perl.
mike@lindt:~$ cat foo.pl
#!/usr/bin/perl -w
use strict;
my $interface = 'xl0';
print "The broadcast address is '" . getbroadcast($interface) . "'\n";
sub getbroadcast {
my $if = shift;
die "No interface in getbroadcast()!" unless defined $if;
my $ifconfig = `/sbin/ifconfig $if`;
my ($broadcast) = $ifconfig =~ /broadcast ((?:\d+\.){3}\d+)\s*$/m;
die "Can't parse '$ifconfig'" unless defined $broadcast;
return $broadcast;
}
mike@lindt:~$ ./foo.pl
[censored].175
mike@lindt:~$
--
Mike Bristow, seebitwopie
------------------------------
Date: 2 Aug 2000 10:29:00 -0400
From: catfood@apk.net (Mark W. Schumann)
Subject: Re: Bulk Emailing
Message-Id: <8m9b7c$ns3@junior.apk.net>
In article <3986d2eb@news.telinco.net>, John <john@nomailplease> wrote:
>Hi, I've written a script for a weekly mailshot to my subscribers (see
>below). As it works now the message is written again for every recipient. Is
>there a way of avoiding this without including every recipients address in
>the message header eg as in $smtp->to(@users);
> $smtp->to($$ref[0]);
This instructs your mailer to send to the indicated recipient. Hint:
there's no particular reason why you have to do this only once per
message.
> $smtp->data();
> $smtp->datasend('From: boxrec@uklinux.net'."\n");
> $smtp->datasend("To: ".$$ref[0]."\n");
This instructs your mailer to put this line into the header. It's
not the same thing as indicating an actual recipient. Allow me to
suggest something like:
$smtp->datasend ("To: Boxing Fans List <boxrec-request@uklinux.net>\n");
But of course this isn't really a Perl question anymore.
------------------------------
Date: Wed, 2 Aug 2000 14:47:11 +0100
From: Mark Worsdall <linux@worsdall.demon.co.uk>
Subject: Re: Configure Win32::ODBC Connection to a SQL Server?
Message-Id: <rqCDcIAfZCi5EwLk@worsdall.demon.co.uk>
In article <8m3pgk$j1d$1@relay1.orga.com>, Carola Begemann
<cbegemann@orga.com> writes
>Hallo,
>I am trying to configure a new Connection to a database on a sql 7 server
>using the Win32::ODBC module.
>Can someone help me with the correct Attrbutes for the driver "SQL Server"?
>I can nor imagine how to correct the string
> Win32::ODBC::ConfigDSN(ODBC_ADD_SYS_DSN,"SQL Server",
> ( "DSN=$dsn","Description= $condb automatisch generiert",
> "Server=$server","Database=$condb", "UID=$user", "PWD=$passwd"))
>
>I get the error : No such file or directory (whatever that stands for).
>And if i try the GetDSN() command on an existing SQL server connection all I
>get back is a string showing the path to the driver DLL.
>I did manage to configure a new ODBC Connection to an Access
>database following the given example.
>
> Carola
>
>
Naive i/p by me:
Have you created a connection in the windows control panel to the
database? If not, does that help?
(ODBC Data Sources)
--
He came from Econet - Oh no, I've run out of underpants :(
Home:- jaydee@wizdom.org.uk http://www.wizdom.org.uk
Shadow:- webmaster@shadow.org.uk http://www.shadow.org.uk
Work:- netman@hinwick.demon.co.uk http://www.hinwick.demon.co.uk
Web site Monitoring:- http://www.shadow.org.uk/SiteSight/
------------------------------
Date: Wed, 02 Aug 2000 12:44:56 GMT
From: kcivey@cpcug.org (Keith Calvert Ivey)
Subject: Re: Copy a hash and const?
Message-Id: <3991171b.39724323@news.newsguy.com>
"Ellegiers, J. M. (Jens)" <jellegie@ford.com> wrote:
>Dietmar Staab wrote:
>> sub key_remove {
>> # Can I make $family so it stays constant?
>> local %family = shift; <---------------- use local
>
>This does *not* work at all as you assign just the first key of
>%main::family to %key_remove::family. You have to pass a hash using
>
>my %family = @_;
That's true, but your explanation isn't quite right. There's no
key_remove package in Dietmar's code. There's just a localized
%main::family.
--
Keith C. Ivey <kcivey@cpcug.org>
Washington, DC
------------------------------
Date: Wed, 02 Aug 2000 15:44:10 -0500
From: "Dietmar Staab" <dietmar.staab@t-online.de>
Subject: Re: Copy a hash and const?
Message-Id: <8m98i5$gj5$18$1@news.t-online.com>
In article <39880394.9D7E375D@ford.com>, "Ellegiers, J. M. (Jens)"
<jellegie@ford.com> wrote:
Hi Jens, thank you for the detailed description and fixing my errors. I
should've used perl -w and reread the documentation about the differences
of local and my (and hashes as arguments to functions). local confused me
but it's used to save temporarily a value and does not create a local
variable.
Hm, it's my fault - I should not speed-read the code and try it before
posting.
Greetings, Dietmar
------------------------------
Date: Wed, 02 Aug 2000 16:07:28 +0200
From: "Ellegiers, J. M. (Jens)" <jellegie@ford.com>
Subject: Re: Copy a hash and const?
Message-Id: <39882B20.DB5EDC53@ford.com>
Keith Calvert Ivey wrote:
>
> "Ellegiers, J. M. (Jens)" <jellegie@ford.com> wrote:
> >Dietmar Staab wrote:
>
> >> sub key_remove {
> >> # Can I make $family so it stays constant?
> >> local %family = shift; <---------------- use local
> >
> >This does *not* work at all as you assign just the first key of
> >%main::family to %key_remove::family. You have to pass a hash using
> >
> >my %family = @_;
>
> That's true, but your explanation isn't quite right. There's no
> key_remove package in Dietmar's code. There's just a localized
> %main::family.
>
That's right. I've been thinking too much package-wise the last day's, I
guess! :-)
just wanted to clarify that this %family is part of the key_remove
subroutine. Should have rememembered that!
> --
> Keith C. Ivey <kcivey@cpcug.org>
> Washington, DC
--
Viele Gruesse, regards, saludos
Jens Ellegiers
---------------------------------------------------------------
FORD-Werke AG, Spessartstrasse, 50725 Koeln
Jens Ellegiers Email: jellegie@ford.com /"\
Engineer (I-Engine CAE) Phone: +49-221-90-31467 \ /
Mail Sym: D-ME/PN-S Fax : +49-221-90-33025 X
ASCII Ribbon campaign against HTML E-mail & Usenet News >------> / \
------------------------------
Date: Wed, 2 Aug 2000 15:55:41 +0200
From: "Guenther Degenfelder" <guenther.degenfelder@datev.de>
Subject: Re: day_of_week() and age() without using Date::Calc ?
Message-Id: <398827f4$1@news.datev.de>
"Keith Calvert Ivey" <kcivey@cpcug.org> schrieb im Newsbeitrag
news:398c0877.35976047@news.newsguy.com...
> Bart Lateur <bart.lateur@skynet.be> wrote:
>
> > $time = timegm(0, 0, 0, 2, 8-1, 2000);
>
> That works, but it's not documented, as far as I know.
> I'd prefer to show it as
>
> $time = timegm(0, 0, 0, 2, 8-1, 2000-1900);
>
> to remind people of how gmtime works.
>
> --
> Keith C. Ivey <kcivey@cpcug.org>
> Washington, DC
But I don't need timegm() or gmtime()!
;-)
------------------------------
Date: Wed, 02 Aug 2000 13:07:35 GMT
From: nvp@spamnothanks.speakeasy.org (NP)
Subject: Re: How to install openssl-0.9.3a
Message-Id: <r2Vh5.186971$t91.1644545@news4.giganews.com>
On Tue, 01 Aug 2000 19:45:49 -0700, Jeffrey <seesej@uswest.net> wrote:
:
: I am trying to install openssl-0.9.3a and then Net::SSLeay. I am attempting
: the install on Redhat 6.0.
I think that openssl-0.9.5a is the current version of OpenSSL. You
might want to try that instead.
: "I could not find your OpenSSL in `/usr/local/ssl'
: Please provide OpenSSL-0.9.3a installation directory"
Where did Red Hat install your OpenSSL rpm? I'll venture a guess that
it was in /usr/openssl or /usr/local/openssl (for your header files
and perhaps libs).
: Is this a problem with my install of openssl, or something with Net::SSLeay?
Looks like something is wrong/weird with your OpenSSL installation. I
used /usr/local/openssl and it worked fine for me under both FreeBSD
and Solaris.
You might also try comp.lang.perl.modules.
--
Nate II
------------------------------
Date: Wed, 02 Aug 2000 14:50:21 GMT
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: How to Post a message to a newsgroup using Perl ?
Message-Id: <NyWh5.890$82.47896@news.dircon.co.uk>
On Wed, 02 Aug 2000 12:41:50 GMT, Rui Anastácio Wrote:
>
> Hi !
>
> Can anyone tell-me how to post a message a a newsgroup using Per ?
> Thanks
>
I posted an example (albeit with a typo) of this yesterday.
/J\
------------------------------
Date: Wed, 02 Aug 2000 13:36:35 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: I have an idea but will it work ?
Message-Id: <pt8goskdv0hvkf9ti146u7p70rt5gc43p6@4ax.com>
Phil Latio wrote:
>Could I create a 5 field flat file database something like below with a line
>per record and then have a perl script that would search the database on the
>first 4 fields from the values entered by the customer (look up feature?)
>and drop in the price automatically.
>
>COLOUR,WEIGHT,SIDED,QUANTITY,PRICE
>white, 80gsm, s/sided, 1000, £40.00
>white, 80gsm, s/sided, 2500, £75.00
What happens if the customer demands a price for 2000 pages? I'd think
it should retrieve the next higher number.
--
Bart.
------------------------------
Date: Wed, 02 Aug 2000 09:28:06 -0500
From: Michael Carman <mjcarman@home.com>
Subject: Re: I have an idea but will it work ?
Message-Id: <39882FF6.6442691E@home.com>
Phil Latio wrote:
>
> I am interested to know how long you have been programming with
> Perl as you seem to have come up with that little script very
> quickly.
*shrug* A few years. This was something of a "no-brainer" for me,
though, because I have a program where I do essentially the same thing.
> I have a number of ideas for websites but have very little
> programming experience so I am considering learning Perl.
> Do you have any suggestions to online documention for beginners ?
Perl is a good language for that. If your serious about learning you
should go to you local bookstore and invest a little $$ in "Learning
Perl." As for online info, you should be able to find everything you
need starting at www.perl.com.
-mjc
------------------------------
Date: Wed, 02 Aug 2000 08:01:51 -0500
From: "Paul R. Andersen" <panderse@us.ibm.com>
Subject: Re: Net::FTP Module
Message-Id: <39881BBF.E33DA89E@us.ibm.com>
Troy Rasiah wrote:
>
> Also another thing with this module. It seems to work file when you upload
> one file at a time. But if i try and upload more than one file using the
> same filehandle (don't know if thats the correct termonology) the only file
> which gets uploaded is the first one. However...if i close the filehandle
> and reopen it in a loop it works fine..but alas thats very inefficient, and
> it clogs up the log files..anyone have a solution?
>
> here is a snippet of code which i'm using atm
>
> #!/usr/bin/perl
>
> use Net::FTP;
> use Net::Cmd;
>
> foreach (@filelisting) {
> # IF I TAKE THE CREATION OF $FTP out of the loop it doesn't copy the
> rest of the files
> my $ftp = Net::FTP->new("$server");
> my $logsuccess=$ftp->login("$username","$password");
> $ftp->cwd($movepath);
> $ftp->binary();
> $ftp->put("$tempdir/$_");
> $ftp->quit;
> `rm -f $tempdir/$_`;
> }
Troy;
I'm not quite sure what you mean by 'Creation of $ftp'. If that is the
ONLY line you are removing, clearly your code will not work since you
quit ($ftp->quit) at the bottom of the loop. Try something closer to:
my $ftp = Net::FTP->new("$server");
my $logsuccess=$ftp->login("$username","$password");
$ftp->cwd($movepath);
$ftp->binary();
foreach (@filelisting)
{ $ftp->put("$tempdir/$_"); }
$ftp->quit;
`rm -f $tempdir/$_`;
--
Paul Andersen
+++++++++++++
The difference between theory and practice is that in theory there is no
difference between theory and practice; but in practice there is.
------------------------------
Date: Wed, 2 Aug 2000 16:40:22 +0200
From: "Brendon Caligari" <brendon@shipreg.com>
Subject: Net::FTP->ls('*.rcp');
Message-Id: <8m98ff$o8q$1@news.news-service.com>
offending code:
----------------
print("Scanning for receipt files\n");
@jnlfiles = $ftp->ls('*.rcp');
unless ($ftp->ok()) {
print("Error: Unable to list directory\n");
last(RCPGET);
}
----------------
I have a system that deposits rcp files in the ftp root directory for a
particular user.
I'musing winNT4.0, ActivePerl build 616, libnet 1.06 (info retrieved via
ppm query).
I wrote a script that at regular intervals, signs on to this ftp, lists all
rcp files and retrieves any found.
At times (not very often) the system just hangs at the above code.....
....I am completely clueless as to what the error might be or how to
'recover' from this 'deadlock?'
has anybody got a clue?
brendon
++++
------------------------------
Date: Wed, 2 Aug 2000 10:52:56 -0400
From: "Joe DiAdamo" <jdiadamo@cisco.com>
Subject: Newbie: Looking for sample http code
Message-Id: <965228046.367602@sj-nntpcache-3>
Can someone point me to (or send me) sample code to send an http request and
receive the response?
Thanks ... joe
jdiadamo@cisco.com
------------------------------
Date: Wed, 2 Aug 2000 15:58:56 +0100
From: "alan" <alan@taz1.com>
Subject: perl glob problem
Message-Id: <8m9cnd$dgl$1@tcnnt0.totalserve.net>
Hi,
I am trying to glob all text files in a specified directory.
The glob function works fine in the root directory of the cgi script.
I want to glob all text files in a remote directory.
The following script works fine but it only globs files in the root
directory. It still writes the .dat file in the specified directory.
##### $dirnow = (directory input from form)
#####
opendir This, "$dirnow";
$Text = join ("$/", glob ('*.txt'));
closedir This;
open (OUTF, "+>$dirnow/data.dat");
print OUTF $Text;
close (OUTF);
$|=1;
################################
What I need is to force the glob to work on the directory I specify using
$dirnow
Anybody know what I am doing wrong ?
Please mail me at alan@nospamtaz1.com
or reply here at the group.
Thanks
Alan
------------------------------
Date: Wed, 02 Aug 2000 07:35:54 -0700
From: Brian <bmacdonaldNObmSPAM@netstone.com.invalid>
Subject: Perl in Windows 2000
Message-Id: <075a8b6f.6fa6bde3@usw-ex0103-086.remarq.com>
Hello, I have used Perl with unix. But in my current job they
run all windows. And i am not sure how to run Perl scripts. Do i
have to change my coding at all for windows. And What about a
perl intrperter? Cheers... Brian
-----------------------------------------------------------
Got questions? Get answers over the phone at Keen.com.
Up to 100 minutes free!
http://www.keen.com
------------------------------
Date: Wed, 02 Aug 2000 14:45:35 GMT
From: gbacon@HiWAAY.net (Greg Bacon)
Subject: Re: Perl Module in C - Question.
Message-Id: <sogd0fpudbm58@corp.supernews.com>
In article <398806E9.DE89EEB6@attglobal.net>,
<fortinj@attglobal.net> wrote:
: Greg Bacon wrote:
:
: > In article <nneeoschbm15pski7lpdcrpdqlo1dcm4uu@4ax.com>,
: > John Fortin <fortinj@attglobal.net> wrote:
: >
: > : hmmm, Activestate perl for windows doesn't seem to have manpages.
: >
: > Look again.
:
: OK, I looked again. Still no man pages. Plenty of HTML documentation,
: but alas, no man pages.
Gee, that's funny. I see plenty:
Directory of E:\Perl\lib\Pod
[.] [..] Functions.pm
Html.pm perl.pod perl5004delta.pod
perlapio.pod perlbook.pod perlbot.pod
perlcall.pod perldata.pod perldebug.pod
perldelta.pod perldiag.pod perldsc.pod
perlembed.pod perlfaq.pod perlfaq1.pod
perlfaq2.pod perlfaq3.pod perlfaq4.pod
perlfaq5.pod perlfaq6.pod perlfaq7.pod
perlfaq8.pod perlfaq9.pod perlform.pod
perlfunc.pod perlguts.pod perlhist.pod
perlipc.pod perllocale.pod perllol.pod
perlmod.pod perlmodinstall.pod perlmodlib.pod
perlobj.pod perlop.pod perlopentut.pod
perlpod.pod perlport.pod perlre.pod
perlref.pod perlreftut.pod perlrun.pod
perlsec.pod perlstyle.pod perlsub.pod
perlsyn.pod perlthrtut.pod perltie.pod
perltoc.pod perltoot.pod perltrap.pod
perlvar.pod perlwin32.pod perlxs.pod
perlxstut.pod Text.pm Win32.pod
60 File(s) 2,170,060 bytes
: No man command either. now that I think of it.
: :)
You don't need man(1) to have manpages.
: BTW, from my point of view, this conversation is somewhat
: tongue-in-cheek, as I use both the windows and unix versions of perl,
: and their respective documentation.
Oh, I see; you're just being a snit. I'm glad we cleared that up.
Greg
--
The viewing of web pages must not put the reader at risk of epileptic
seizures.
-- Tom Christiansen
------------------------------
Date: Wed, 02 Aug 2000 14:15:46 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: posting in newsgroup using perl script?
Message-Id: <c6bgoskma7oab7lofd7146te1lob2q70ga@4ax.com>
Jonathan Stowe wrote:
>Dont stupidly cut and paste stuff from usenet posts. The file I copied
>into my post ran perfectly fine.
You're sure? 'Cos your post, as it appeared on my news reader (not MS!),
shows that you used backticks around EOMESS.
--
Bart.
------------------------------
Date: 02 Aug 2000 08:07:13 -0500
From: Tony Curtis <tony_curtis32@yahoo.com>
Subject: Re: Price look up procedure in Perl (part 2)
Message-Id: <87ittj4xry.fsf@limey.hpcc.uh.edu>
>> On Wed, 2 Aug 2000 13:54:26 +0100,
>> "Phil Latio" <globalcon2isnot@myhouse.com> said:
> Next I created an order form on an HTML page with
> matching radio fields to those above ie: number, weight,
> sides, colour. I included <form name="testform"
> method="post"
> action="http://www.mywebsite.com/cgi-bin/printingprices.pl">
> At the bottom I put a submit button which I assumed
> would perform the "post" action of the choices entered
> on the form and this would be sent to the
> printingprices.pl script. I next assumed that when the
> data arrives, a search is performed of the __ DATA __
> and the result is then output to the next screen.
> All I get is the ever cheerful 500 server error message.
You're not outputting the correct headers for HTTP so that
the server and browser understand what you are doing. You
never see the headers from a browser, but they are there.
You need to include FORM handling and code to handle the
header generation. Fortunately you can just do:
use CGI ':standard';
which deals with GET, and POST transparently.
"perldoc CGI" for more about the module.
The first output from the program needs to be:
print header;
to prefix the text/html stream (perldoc describes what
header() does of course).
Also doing
use CGI::Carp 'fatalsToBrowser';
and using "die" to register errors means you can see the
appropriate error messages in the browser.
> # This data would come from your form my $number = 1000;
> my $weight = '80gsm'; my $sides = 's/sided'; my $color =
> 'white';
Fields in the form are decoded in the program as
my $field = param('field_name');
> Do I leave this in the code or change it in some way ?
> Also is the __ DATA __ supposed to be another file and
> shouldn't I put a comma between each field ?
You can separate the fields on whatever makes most sense
for you data. The use of DATA was presumably just to make
the example code self-contained. In the real world you'd
probably have this data in a file somewhere and your
program would have to open and read it (don't forget error
handling: see if the open actually worked).
If you want to be able to modify the stored data, then we
get into locking problems.
hth
t
--
"With $10,000, we'd be millionaires!"
Homer Simpson
------------------------------
Date: Wed, 2 Aug 2000 15:01:08 +0100
From: "Phil Latio" <globalcon2isnot@myhouse.com>
Subject: Re: Price look up procedure in Perl (part 2)
Message-Id: <8m99m3$q2g$1@plutonium.btinternet.com>
Tony Curtis <tony_curtis32@yahoo.com> wrote in message news:87ittj4xry.fsf@limey.hpcc.uh.edu...
> >> On Wed, 2 Aug 2000 13:54:26 +0100,
> >> "Phil Latio" <globalcon2isnot@myhouse.com> said:
>
> > Next I created an order form on an HTML page with
> > matching radio fields to those above ie: number, weight,
> > sides, colour. I included <form name="testform"
> > method="post"
> > action="http://www.mywebsite.com/cgi-bin/printingprices.pl">
>
> > At the bottom I put a submit button which I assumed
> > would perform the "post" action of the choices entered
> > on the form and this would be sent to the
> > printingprices.pl script. I next assumed that when the
> > data arrives, a search is performed of the __ DATA __
> > and the result is then output to the next screen.
>
> > All I get is the ever cheerful 500 server error message.
>
> You're not outputting the correct headers for HTTP so that
> the server and browser understand what you are doing. You
> never see the headers from a browser, but they are there.
>
> You need to include FORM handling and code to handle the
> header generation. Fortunately you can just do:
>
> use CGI ':standard';
>
> which deals with GET, and POST transparently.
>
> "perldoc CGI" for more about the module.
>
> The first output from the program needs to be:
>
> print header;
>
> to prefix the text/html stream (perldoc describes what
> header() does of course).
>
> Also doing
>
> use CGI::Carp 'fatalsToBrowser';
>
> and using "die" to register errors means you can see the
> appropriate error messages in the browser.
>
> > # This data would come from your form my $number = 1000;
> > my $weight = '80gsm'; my $sides = 's/sided'; my $color =
> > 'white';
>
> Fields in the form are decoded in the program as
>
> my $field = param('field_name');
>
> > Do I leave this in the code or change it in some way ?
> > Also is the __ DATA __ supposed to be another file and
> > shouldn't I put a comma between each field ?
>
> You can separate the fields on whatever makes most sense
> for you data. The use of DATA was presumably just to make
> the example code self-contained. In the real world you'd
> probably have this data in a file somewhere and your
> program would have to open and read it (don't forget error
> handling: see if the open actually worked).
>
> If you want to be able to modify the stored data, then we
> get into locking problems.
>
> hth
> t
> --
> "With $10,000, we'd be millionaires!"
> Homer Simpson
Many thanks for the reply.
However, I am now more confused than before. Was the code incorrect that was originally posted ?
Where do I put
use CGI ':standard';
I presume I put it in the perl script or do you mean put it in the head part of the HTML page ?
I am also still confused over
my $field = param('field_name');
Basically could you or someone give me the correct syntax so I can get this script running in it's
most elementarry form first. Once I have it working, I can then add other functionality like "die"
and if I get the coding wrong, at least I will know what part to look at and change.
Many thanks in anticipation.
Phil
------------------------------
Date: Wed, 02 Aug 2000 13:34:26 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: question about a Regular Expression
Message-Id: <hm8goskdj7olu37k864rel3dvcng3te34j@4ax.com>
Philip Taylor wrote:
>I have constructed the following regular expression to validate scores:-
>
>/^\s*[0-9]{1,2}\s*\-\s*[0-9]{1,2}\s*$/
>
>it's purpose is to validate scores eg "13-2", but I also want to allow for
>spaces being entered within the score eg " 12 - 2".
You're sure you won't ever get scores over 99?
If you're sure you've got scores, there's no need to check them in as
much detail.
($us, $them ) = split /-/;
Otherwise...
/^\s*\d+\s*-\s*\d+\s*$/
or, per Steven Kloder:
tr/\t \n//d;
/^\d+-\d+$/
--
Bart.
------------------------------
Date: 2 Aug 2000 10:30:32 -0400
From: catfood@apk.net (Mark W. Schumann)
Subject: Re: QUICK Help. h2xs Extending Perl Question
Message-Id: <8m9ba8$ofl@junior.apk.net>
In article <8lqelk$b2d$1@nnrp1.deja.com>, <kangchenjunga@my-deja.com> wrote:
>The Makefile.PL that was generated is below.
>I did not know what to do as far modification goes. A book have said
>that you you must
>modify the LIB lines abd the OBJECT lines (But there are no OBJECT
>lines). I don't know what
>to put for the LIB lines.
>
>use ExtUtils::MakeMaker;
># See lib/ExtUtils/MakeMaker.pm for details of how to influence
># the contents of the Makefile that is written.
>WriteMakefile(
> 'NAME' => 'Encrypt',
> 'VERSION_FROM' => 'Encrypt.pm', # finds $VERSION
> 'LIBS' => [''], # e.g., '-lm'
> 'DEFINE' => '', # e.g., '- DHAVE_SOMETHING'
> 'INC' => '', # e.g., '- I/usr/include/other'
>);
Try something like
'LIBS' => ['-lcrypt'], # e.g., '-lm'
if your system has libcrypt.a in the expected place.
------------------------------
Date: 2 Aug 2000 13:45:07 GMT
From: swimmer@www.gx.nl (Stefan Wimmer)
Subject: Redirect in DOS box
Message-Id: <slrn8og9f3.l5p.swimmer@r2d2.gx.nl>
HI,
I have to 'reconstruct' the fairly simple unix command
tail -f <file> | grep <pattern>
under Windows NT/DOS.
In the beginning I thought 'No problem - why reinventing the wheel if I
can use the great Perl Power Tools from the Unix Reconstruction
Project?'. Unfortunately it isn't so easy as I hoped :(
Using 'tail.pl -f <file>' supplies a perfect output in my DOS box, with
'tcgrep.pl <pattern>' the same, but combining the both commands within a
pipe construction show above supplies absolutely NO result on STDOUT !!!
As far as I understand it should work, because tail.pl prints the
results to STDOUT, and it should possible to catch this STDOUT as STDIN
for tcgrep.pl, shouldn't it?
Please give me some hint where my logic fails ...
Best regards
Stefan
------------------------------
Date: Wed, 2 Aug 2000 16:45:39 +0200
From: "Guenther Degenfelder" <guenther.degenfelder@datev.de>
Subject: Re: Redirect in DOS box
Message-Id: <398833ae$1@news.datev.de>
"Stefan Wimmer" <swimmer@www.gx.nl> schrieb im Newsbeitrag
news:slrn8og9f3.l5p.swimmer@r2d2.gx.nl...
> I have to 'reconstruct' the fairly simple unix command
> tail -f <file> | grep <pattern>
> under Windows NT/DOS.
...
> pipe construction show above supplies absolutely NO result on STDOUT !!!
>
> As far as I understand it should work, because tail.pl prints the
> results to STDOUT, and it should possible to catch this STDOUT as STDIN
> for tcgrep.pl, shouldn't it?
Yes. I know. :-]
I have struggled a lot writing skripts that REALLY run on UNIX and WinXY...
The problem is, that the '.pl'-files are 'connected' with the
Perl-Interpreter by your file-explorer. If you type 'Scriptname.pl' Perl is
startet with the Script and 'forks' away. The STDOUT of the Skript can't be
reached...
To avoid this 'effect' run your Skript with 'perl -S Scriptname
>output.txt'.
Or use the perl2bat converter. But be warned: perl2bat can take only 'some'
arguments (%0 ... %9). This should be fixed by the the expression %*, but i
didn't check that.
Another way to avoid this problem is, using a UNIX-like shell (ask me if you
can't find one).
Regards
Guenther
------------------------------
Date: Wed, 02 Aug 2000 14:33:03 GMT
From: mbutt@my-deja.com
Subject: Regexp problem - Stripping HTML
Message-Id: <8m9bf0$r06$1@nnrp1.deja.com>
I am trying to construct a regular expression to strip certain HTML tags
out of a string.
the string $x contains an entire HTML document. I wan to remove the PHP
tags from it.
e.g.
<?php echo "hello"?><br><h3>blah blah blah</h3><?php echo "good bye"?>
using the regexp s/\<\?.*\?\>// will remove everything. Because it
matches the first '<?' and the last '?>' without noticing if there are
any other starting and closing tags in between. How do I get it to
remove only the php tags and leave behine any HTML in between.
thank you,
Martin.
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Wed, 02 Aug 2000 13:13:12 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Reserved word
Message-Id: <pb7gos0ls4ktu5lb3nedrvqt1mdik04hmb@4ax.com>
chuckw wrote:
>>> bless ($self, scrubber);
>>
>>This is line 6.
>>
>>>Unquoted string "scrubber" may clash with future reserved word
>>>at scrubber.pm line 6.
>
>Well, you got me there. I am completely confused about your
>point.
The line giving the warning is:
bless ($self, scrubber);
Replace scrubber with 'scrubber', and all will be well.
bless $self, 'scrubber';
It may look confusing, but if perl is talking about package names etc.
it is talking about strings. Like:
"scrubber"->new;
This will look for a method (sub) called 'new', in the package called
'scrubber'. It won't give a warning (if the sub exists), and it even
works under "strict".
Waddayamean, "symbolic references"? ;-)
--
Bart.
------------------------------
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 3884
**************************************