[16864] in Perl-Users-Digest
Perl-Users Digest, Issue: 4276 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Sep 10 14:05:29 2000
Date: Sun, 10 Sep 2000 11:05:12 -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: <968609112-v9-i4276@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Sun, 10 Sep 2000 Volume: 9 Number: 4276
Today's topics:
BUG? <loreley@familiehaase.de>
CGI.pm & transaction management <kj0@mailcity.com>
Re: CGI.pm & transaction management (David Efflandt)
cgi.pm and scrolling lists <g.soper@soundhouse.co.uk>
Re: cgi.pm and scrolling lists (brian d foy)
Re: cgi.pm and scrolling lists <g.soper@soundhouse.co.uk>
Re: cgi.pm and scrolling lists <flavell@mail.cern.ch>
Re: cgi.pm and scrolling lists (brian d foy)
Re: cgi.pm and scrolling lists <g.soper@soundhouse.co.uk>
Entering data from an HTML into a hash of hashes <g.soper@soundhouse.co.uk>
Re: Entering data from an HTML into a hash of hashes <g.soper@soundhouse.co.uk>
Help with building from perl to C <BennyS@GuruNet.com>
Re: Help! uploaded .wav files' corrupted. (David Efflandt)
how to extract data from html table document ? (Tom)
Re: how to restart apache <no@never.no>
Re: how to restart apache <no@never.no>
Re: Howto debug a perl cgi script (David Efflandt)
Re: HTML::Template <fliptop@peacecomputers.com>
Re: HTML::Template (brian d foy)
Re: Is there a file rename function? (Gwyn Judd)
Job Offers: Web Designers & Programmers <jobs2001@gmx.net>
Re: Matching anything but a certain string (Charles DeRykus)
Msql-Mysql-modules-1.2215 install error <robert_pearse@hotmail.com>
Re: New Perl Tutorial - www.perltutor.com (Gwyn Judd)
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Sun, 10 Sep 2000 04:44:45 +0200
From: "Gerrit Haase" <loreley@familiehaase.de>
Subject: BUG?
Message-Id: <39baf59e$1@loreley.antigone>
Is this a bug?
C:\>perldoc perl
Unrecognized escape \p passed through at c:\perl57\bin/perldoc.bat line 26.
NAME
perl - Practical Extraction and Report Language
[snip]
C:\>perl -v
This is perl, v5.7.0 built for MSWin32-x86-multi-thread
Copyright 1987-2000, Larry Wall
[snap]
--
Gerrit Haase
------------------------------
Date: 10 Sep 2000 11:23:59 -0400
From: kj0 <kj0@mailcity.com>
Subject: CGI.pm & transaction management
Message-Id: <8pg92f$kkl$1@panix3.panix.com>
The state-less model of cookie-free CGI-based interaction makes it a
bit difficult to prevent accidental duplicate transactions. For
example, if a user submits a request to perform a financial
transaction or to write new data to a database, and sees that his/her
browser hangs, s/he has no good way of knowning whether the
transaction went through or should be re-submitted. Or, seeing the
browser hang, the user may get impatient and hit the Reload button,
unaware of the possibility of sending a duplicate submission of the
original transaction. One can come up with more scenarios in which
the user, while seemingly only navigating the site, may inadvertently
cause duplicate transactions to take place.
Since this problem is so common, I imagine that already there are
several standard solutions to it, maybe including some that can be
implemented as part of CGI.pm-based scripts.
Where can I read about these solutions?
Thank you,
KJ
------------------------------
Date: Sun, 10 Sep 2000 16:18:42 +0000 (UTC)
From: efflandt@xnet.com (David Efflandt)
Subject: Re: CGI.pm & transaction management
Message-Id: <slrn8rnd2o.g4e.efflandt@efflandt.xnet.com>
On 10 Sep 2000 11:23:59 -0400, kj0 <kj0@mailcity.com> wrote:
>
>The state-less model of cookie-free CGI-based interaction makes it a
>bit difficult to prevent accidental duplicate transactions. For
>example, if a user submits a request to perform a financial
>transaction or to write new data to a database, and sees that his/her
>browser hangs, s/he has no good way of knowning whether the
>transaction went through or should be re-submitted. Or, seeing the
>browser hang, the user may get impatient and hit the Reload button,
>unaware of the possibility of sending a duplicate submission of the
>original transaction. One can come up with more scenarios in which
>the user, while seemingly only navigating the site, may inadvertently
>cause duplicate transactions to take place.
>
>Since this problem is so common, I imagine that already there are
>several standard solutions to it, maybe including some that can be
>implemented as part of CGI.pm-based scripts.
You might get better answers from a more appropiate .cgi newsgroup, since
the issue is not Perl specific.
Common sense would dictate checking if such a transaction from that person
was recently completed (if it matters or requires payment), and asking
them to confirm the total (including previous transactions) before
accepting it.
--
David Efflandt efflandt@xnet.com http://www.de-srv.com/
http://www.autox.chicago.il.us/ http://www.berniesfloral.net/
http://hammer.prohosting.com/~cgi-wiz/ http://cgi-help.virtualave.net/
------------------------------
Date: Sun, 10 Sep 2000 15:27:56 +0100
From: Geoff Soper <g.soper@soundhouse.co.uk>
Subject: cgi.pm and scrolling lists
Message-Id: <49fbe1bc5ag.soper@soundhouse.co.uk>
Is it possible to have values already selected in a scrolling list in a
form as generated by scrolling_list in cgi.pm ?
I'm trying to find hlep upon this but am so far failing so if anybody has
a quick explanation I'd be most grateful!
Thanks as ever
--
Geoff Soper
g.soper@soundhouse.co.uk
Take a look at the Soundhouse page http://www.soundhouse.co.uk/
------------------------------
Date: Sun, 10 Sep 2000 10:56:03 -0400
From: brian@smithrenaud.com (brian d foy)
Subject: Re: cgi.pm and scrolling lists
Message-Id: <brian-ya02408000R1009001056030001@news.panix.com>
In article <49fbe1bc5ag.soper@soundhouse.co.uk>, Geoff Soper <g.soper@soundhouse.co.uk> posted:
> Is it possible to have values already selected in a scrolling list in a
> form as generated by scrolling_list in cgi.pm ?
see the example in the CGI.pm documentation. you use the -default
parameter.
--
brian d foy
CGI Meta FAQ <URL:http://www.smithrenaud.com/public/CGI_MetaFAQ.html>
Perl Mongers <URL:http://www.perl.org/>
------------------------------
Date: Sun, 10 Sep 2000 16:03:57 +0100
From: Geoff Soper <g.soper@soundhouse.co.uk>
Subject: Re: cgi.pm and scrolling lists
Message-Id: <39BBA2DD.64D00815@soundhouse.co.uk>
Thanks, I'm still trying to find the documentation, is the -default
parameter used like -values ?
thanks again
brian d foy wrote:
>
> In article <49fbe1bc5ag.soper@soundhouse.co.uk>, Geoff Soper <g.soper@soundhouse.co.uk> posted:
>
> > Is it possible to have values already selected in a scrolling list in a
> > form as generated by scrolling_list in cgi.pm ?
>
> see the example in the CGI.pm documentation. you use the -default
> parameter.
------------------------------
Date: Sun, 10 Sep 2000 17:04:45 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: cgi.pm and scrolling lists
Message-Id: <Pine.GHP.4.21.0009101651360.17608-100000@hpplus03.cern.ch>
On Sun, 10 Sep 2000, Geoff Soper wrote:
> Is it possible to have values already selected in a scrolling list in a
> form as generated by scrolling_list in cgi.pm ?
That's CGI.pm (case _is_ significant here).
http://stein.cshl.org/WWW/software/CGI/#scrolling_list
> I'm trying to find hlep upon this but am so far failing so if anybody has
> a quick explanation I'd be most grateful!
What have you tried so far? Have you even found that HTML-based
documentation for CGI.pm (not to be confused with some HTML-ised
version of the POD, which isn't very good.)
I thought this bit:
The optional third argument (-default)can be either a reference to a
list containing the values to be selected by default, or can be a
single value to select. If this argument is missing or undefined,
then nothing is selected when the list first appears.
was reasonably self-explanatory.
However, I think I'd have to warn you from experience that using
scrolling lists with MULTIPLE has poor user-acceptance. Many users
have no idea how to make more than one selection, even when the list
doesn't scroll: and wanting them scroll the list will only make
matters worse.
I'd suggest considering a group of checkboxes instead, if you really
want multiple selections to be convenient to the user.
If you insist on using SELECT with MULTIPLE, then it's slightly better
if you can set the SIZE equal to the number of entries, so that no
actual scrolling is needed.
good luck
------------------------------
Date: Sun, 10 Sep 2000 11:38:23 -0400
From: brian@smithrenaud.com (brian d foy)
Subject: Re: cgi.pm and scrolling lists
Message-Id: <brian-ya02408000R1009001138230001@news.panix.com>
In article <39BBA2DD.64D00815@soundhouse.co.uk>, Geoff Soper <g.soper@soundhouse.co.uk> posted:
> Thanks, I'm still trying to find the documentation,
then you haven't used the CGI Meta FAQ.
--
brian d foy
CGI Meta FAQ <URL:http://www.smithrenaud.com/public/CGI_MetaFAQ.html>
Perl Mongers <URL:http://www.perl.org/>
------------------------------
Date: Sun, 10 Sep 2000 16:34:03 +0100
From: Geoff Soper <g.soper@soundhouse.co.uk>
Subject: Re: cgi.pm and scrolling lists
Message-Id: <49fbe7c9d1g.soper@soundhouse.co.uk>
In article <Pine.GHP.4.21.0009101651360.17608-100000@hpplus03.cern.ch>,
Alan J. Flavell <flavell@mail.cern.ch> wrote:
> On Sun, 10 Sep 2000, Geoff Soper wrote:
> > I'm trying to find hlep upon this but am so far failing so if anybody
> > has a quick explanation I'd be most grateful!
> What have you tried so far? Have you even found that HTML-based
> documentation for CGI.pm (not to be confused with some HTML-ised
> version of the POD, which isn't very good.)
I hadn't found that, just what I was looking for, thanks!
> However, I think I'd have to warn you from experience that using
> scrolling lists with MULTIPLE has poor user-acceptance. Many users
> have no idea how to make more than one selection, even when the list
> doesn't scroll: and wanting them scroll the list will only make
> matters worse.
I had thought of that, I'll use checkboxes on the page the normal user
experiences (where there is only on set of data being entered) and the
scrollable list for the admin page where a potentially large number of
data sets will be on the same page and where checkboxes would use too much
space.
--
Geoff Soper
g.soper@soundhouse.co.uk
Take a look at the Soundhouse page http://www.soundhouse.co.uk/
------------------------------
Date: Sun, 10 Sep 2000 17:13:19 +0100
From: Geoff Soper <g.soper@soundhouse.co.uk>
Subject: Entering data from an HTML into a hash of hashes
Message-Id: <49fbeb6267g.soper@soundhouse.co.uk>
Following posts here already from me I have managed to read data from a
file into a hash of hashes and then used that to populate a form on a web
page. After the user makes changes to this web page I need to replace the
original data in the hash of hashes with the data submitted from the HTML
form.
Is there an simple way to do this?
The script is at http://www.soundhouse.co.uk/cgi-bin/2.cgi and can be
examined at http://www.soundhouse.co.uk/geoff/ along with the database
file.
Many thanks
--
Geoff Soper
g.soper@soundhouse.co.uk
Take a look at the Soundhouse page http://www.soundhouse.co.uk/
------------------------------
Date: Sun, 10 Sep 2000 18:08:48 +0100
From: Geoff Soper <g.soper@soundhouse.co.uk>
Subject: Re: Entering data from an HTML into a hash of hashes
Message-Id: <49fbf076c1g.soper@soundhouse.co.uk>
In article <49fbeb6267g.soper@soundhouse.co.uk>,
Geoff Soper <g.soper@soundhouse.co.uk> wrote:
> Following posts here already from me I have managed to read data from a
> file into a hash of hashes and then used that to populate a form on a web
> page. After the user makes changes to this web page I need to replace the
> original data in the hash of hashes with the data submitted from the HTML
> form.
> Is there an simple way to do this?
I'm thinking if I name all the fields in the format data-user-field e.g.
data-john.doe-email I could go through all the fields returned by the
param() function, ignoring any that don't begin with data and inserting
the others into the hash of hashes %allusers using the data and field data
i.e. $allusers{"john.doe"}{"email"} = param(data-john.doe-email)
Does this sound sensible?
Thinking about it I'll use a better choice of delimiter as a name could
reasonably contain a hyphen.
--
Geoff Soper
g.soper@soundhouse.co.uk
Take a look at the Soundhouse page http://www.soundhouse.co.uk/
------------------------------
Date: Sun, 10 Sep 2000 21:04:23 +0300
From: "Benny Siegelov" <BennyS@GuruNet.com>
Subject: Help with building from perl to C
Message-Id: <39bbcc0b@news.barak.net.il>
I have a huge number of scripts and modules.
I'm building C code using 'perl -MO=CC filename'
But what can I do with modules and how afterwords
I can compile modules and scripts that use these modules together ?
------------------------------
Date: Sun, 10 Sep 2000 16:37:23 +0000 (UTC)
From: efflandt@xnet.com (David Efflandt)
Subject: Re: Help! uploaded .wav files' corrupted.
Message-Id: <slrn8rne5q.g4e.efflandt@efflandt.xnet.com>
On Sun, 10 Sep 2000 15:52:42 +1200, Ken <kenn_mar@hotmail.com> wrote:
>
>A script I have using web upload (CGI.pm) corrupts the uploaded .wav
>files. But text and graphics are Ok. What's the problem? Anyone with
>similar experience? Any successful in doing that?
perldoc -f binmode
I have never done upload on a Windows platform, but apparently you need to
binmode(STDIN) and your filehandle you are saving to. Or you may not
using the proper method for binary files explained in: perldoc CGI
CGI.pm has an uploadInfo method to check the Content-Type of an uploaded
file so you can write your script to automatically handle it properly.
Everything should be handled as binary unless the Content-Type contains
/text/.
--
David Efflandt efflandt@xnet.com http://www.de-srv.com/
http://www.autox.chicago.il.us/ http://www.berniesfloral.net/
http://hammer.prohosting.com/~cgi-wiz/ http://cgi-help.virtualave.net/
------------------------------
Date: Sun, 10 Sep 2000 14:49:16 GMT
From: tk28@gmx.net (Tom)
Subject: how to extract data from html table document ?
Message-Id: <39bb9f58.1096553@news01.buzzardnews.com>
**** Post for FREE via your newsreader at post.usenet.com ****
Hi there,
is there an facility to extract data from an html ( table ) document
using perl on win32 ?
I need to extract some data to importing it into msql database.
thanks in advance for your urgently help .
Tom
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
*** Usenet.com - The #1 Usenet Newsgroup Service on The Planet! ***
http://www.usenet.com
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
------------------------------
Date: Sun, 10 Sep 2000 02:45:43 -0600
From: "Jerri Blavittł" <no@never.no>
Subject: Re: how to restart apache
Message-Id: <bUHu5.1888$n97.641125@news.uswest.net>
Kirk R. Wythers <kwythers@forestry.umn.edu> wrote in message
news:39B7B962.E97876EC@forestry.umn.edu...
> Where does red hat put apachectl in a standard install? I know it's
> installed but I can't seem to find and apache/sbin dir.
>
find / -iname apachectl
/usr/sbin/
or better find the httpd which is usually in /etc/httpd
Then use the Apache approved
kill -USR1 <httpd PID> to "reload" an already running apache.
Using the /etc/rc.d/init.d call will unfortunately reset all the /status data to zero.
------------------------------
Date: Sun, 10 Sep 2000 02:48:04 -0600
From: "Jerri Blavittł" <no@never.no>
Subject: Re: how to restart apache
Message-Id: <oWHu5.1889$n97.642174@news.uswest.net>
<thedrag@--X--houston.rr.com> wrote in message
news:39b82648.4642137@news-server.houston.rr.com...
> Just make a small script named
> # !/bin/sh
> #restart-apache.sh
> /etc/rc.d/init.d/httpd restart
> # end restart-apache.sh
>
> ICK, I hope you aren't going to seriously use the apache rpm from the
> RH distro.
> PLEASE DO NOT USE LINUXCONF to edit the apache config.
> 1) The RH distro has an incomplete httpd.conf. some moron deleted the
> majority of the documented config entries.
I noticed that too. But where to find simply a complete httpd.conf template ...?
------------------------------
Date: Sun, 10 Sep 2000 16:49:25 +0000 (UTC)
From: efflandt@xnet.com (David Efflandt)
Subject: Re: Howto debug a perl cgi script
Message-Id: <slrn8rnesb.g4e.efflandt@efflandt.xnet.com>
On Sat, 09 Sep 2000, yossariancomputing@my-deja.com
<yossariancomputing@my-deja.com> wrote:
>Yup helped...I've been at it far too long....couldn't see some basic
>errors....indeed, permissions were incorrect on diorectories I need to
>write to/read from, but I've corrected them now...alas to no avail %(
>
>Problem is I don't run my live server, someone does that for me...so I
>can't check/amend httpd.conf if ExecCGI's not on (could that cause
>this?)..and I can get no response from support (full marks
>virtualis)....
>
>Is there a way I could perhaps get to see those errors you mention
>though?
You could insert the following near the beginning of your script so errors
will hopefully go to the browser. This assumes that you test any open()
statements and have a die error including the reason $! if they fail.
If that gets you nothing on a Unix system you could try making a wrapper
to get all errors (2>&1 redirects stderr to stdout):
#!/bin/sh
echo "Content-type: text/plain
echo
./other.cgi 2>&1
If that fails, make sure that you are ftp uploading scripts as ASCII text,
and NOT binary mode.
>I'll pick this up tomorrow...the script that's not working is at least
>flagged as such (see www.yossarian-music.com/content/content.html)...so
>it'll have to wait as I'm off to my pit to get some rest ;)
>
>Thnx for your help,
>
>Steve H
--
David Efflandt efflandt@xnet.com http://www.de-srv.com/
http://www.autox.chicago.il.us/ http://www.berniesfloral.net/
http://hammer.prohosting.com/~cgi-wiz/ http://cgi-help.virtualave.net/
------------------------------
Date: Sun, 10 Sep 2000 11:04:46 -0400
From: fliptop <fliptop@peacecomputers.com>
To: Paul Robinson <robinson_p@btconnect.com>
Subject: Re: HTML::Template
Message-Id: <39BBA30E.6E3E004E@peacecomputers.com>
Paul Robinson wrote:
>
> Using TMPL VAR I am able to pass values directly to template and that works
> ok. What I need to be able to do is pass an array of items for use in
>
> <select>
> <option> ....
> <option> ....
> </select>
>
> this I am doing with no problem but how do I set the SELECTED value. I know
> that the <option> tag allows the use of 'SELECTED' but if I'm passing in an
> array of elements into a TMPL LOOP how do I state which one is currently
> selected. I also have the same problem with a multiple select list.
hi paul, see if this helps. here's a little subroutine i wrote that
takes a particular date (yyyy-mm-dd format) and generates 3 <select>
groups with the date selected.
=====
sub option_date {
my $date = shift;
my @dates = split(/-/, $date);
my @numbers = (
[ '01', 'January' ], [ '02', 'February' ],
[ '03', 'March' ], [ '04', 'April' ],
[ '05', 'May' ], [ '06', 'June' ],
[ '07', 'July' ], [ '08', 'August' ],
[ '09', 'September' ], [ '10', 'October' ],
[ '11', 'November' ], [ '12', 'December' ],
);
my @months =
map {
{ NUM => @$_[0], TEXT => @$_[1],
MATCH => ($dates[1] eq @$_[0]) ? 1 : 0
}
} @numbers;
@numbers = qw{01 02 03 04 05 06 07 08 09 10
11 12 13 14 15 16 17 18 19 20
21 22 23 24 25 26 27 28 29 30 31};
my @days =
map {
{ NUM => $_, MATCH => ($dates[2] eq $_) ? 1 : 0 }
} @numbers;
@numbers = qw{2000 2001 2002 2003 2004 2005
2006 2007 2008 2009 2010};
my @years =
map {
{ NUM => $_, MATCH => ($dates[0] eq $_) ? 1 : 0 }
} @numbers;
return(\@years, \@months, \@days);
}
=====
the corresponding html template file looks like this:
=====
<select name="month">
<tmpl_loop name="MONTHS">
<option value="<tmpl_var name="NUM">"<tmpl_if name="MATCH">
selected</tmpl_if>><tmpl_var name="TEXT"></option>
</tmpl_loop>
</select>
<select name="day">
<tmpl_loop name="DAYS">
<option value="<tmpl_var name="NUM">"<tmpl_if name="MATCH">
selected</tmpl_if>><tmpl_var name="NUM"></option>
</tmpl_loop>
</select>
<select name="year">
<tmpl_loop name="YEARS">
<option value="<tmpl_var name="NUM">"<tmpl_if name="MATCH">
selected</tmpl_if>><tmpl_var name="NUM"></option>
</tmpl_loop>
</select>
=====
hope this helped!
------------------------------
Date: Sun, 10 Sep 2000 12:23:22 -0400
From: brian@smithrenaud.com (brian d foy)
Subject: Re: HTML::Template
Message-Id: <brian-ya02408000R1009001223220001@news.panix.com>
In article <39BBA30E.6E3E004E@peacecomputers.com>, fliptop@peacecomputers.com posted:
> hi paul, see if this helps. here's a little subroutine i wrote that
> takes a particular date (yyyy-mm-dd format) and generates 3 <select>
> groups with the date selected.
> sub option_date {
> my $date = shift;
> my @dates = split(/-/, $date);
> my @numbers = (
> [ '01', 'January' ], [ '02', 'February' ],
> [ '03', 'March' ], [ '04', 'April' ],
> [ '05', 'May' ], [ '06', 'June' ],
> [ '07', 'July' ], [ '08', 'August' ],
> [ '09', 'September' ], [ '10', 'October' ],
> [ '11', 'November' ], [ '12', 'December' ],
> );
> my @months =
> map {
> { NUM => @$_[0], TEXT => @$_[1],
> MATCH => ($dates[1] eq @$_[0]) ? 1 : 0
you are using an array slice to access a single element. just
access the single element
$$_[0]
> }
> } @numbers;
my $count = 0;
my @months = map { ... }
map { [ sprintf("%02d", ++$count), $_ ] }
qw(January ... December);
> @numbers = qw{01 02 03 04 05 06 07 08 09 10
> 11 12 13 14 15 16 17 18 19 20
> 21 22 23 24 25 26 27 28 29 30 31};
the range operater can save typing.
@days = map sprintf("%02d", $_), 0 .. 31;
> my @days =
> map {
> { NUM => $_, MATCH => ($dates[2] eq $_) ? 1 : 0 }
> } @numbers;
but you don't need @numbers at all.
my @days = map { ... }
map sprintf("%02d", $_), 0 .. 31;
> @numbers = qw{2000 2001 2002 2003 2004 2005
> 2006 2007 2008 2009 2010};
@years = 2000 .. 2010;
> my @years =
> map {
> { NUM => $_, MATCH => ($dates[0] eq $_) ? 1 : 0 }
> } @numbers;
but, you don't need the extra variable.
my @years = map { } 2000 .. 2010;
even if you stored the year range somewhere else so you didn't
have to edit the source once a year:
my @years = map { } @years;
> return(\@years, \@months, \@days);
> }
> =====
even if you made all of those improvements, you still have the
same basic code repeated three times. you transform one list
into another. this can be abstracted as well.
> the corresponding html template file looks like this:
>
> =====
> <select name="month">
> <tmpl_loop name="MONTHS">
> <option value="<tmpl_var name="NUM">"<tmpl_if name="MATCH">
> selected</tmpl_if>><tmpl_var name="TEXT"></option>
> </tmpl_loop>
> </select>
i'm glad i don't have to edit that file. what a mess compared to
simply inserting a value. templates are supposed to make life
easier, not harder. you had to jump through all sorts of hoops
in the subroutine to get the data ready to insert into the
template, and then you have to strain your eyes to be able to
pick apart the sea of < and > in the template.
CGI.pm can make life very easy:
#!/usr/bin/perl
use strict;
use vars qw( @YEARS @MONTHS );
use CGI qw(popup_menu);
BEGIN { @YEARS = 2000 .. 2010;
@MONTHS = qw(January February March April May June July
August September October November December);
}
sub option_date
{
my $date = shift;
return unless $date =~ m/(\d\d\d\d) - (\d\d) - (\d\d)/x;
my( $year, $month, $day ) = ( $1, $2, $3 );
my $year_select = popup_menu( -name => 'year',
-values => \@YEARS,
-default => $year,
);
my $month_select = popup_menu( -name => 'month',
-values => \@MONTHS,
-default => $MONTHS[ $month ],
);
my $day_select = popup_menu( -name => 'day',
-values => [ 1 .. 31 ],
-default => int $day,
);
return( \$year_select, \$month_select, \$day_select );
}
print map { $$_ } option_date( '2000-08-04' );
--
brian d foy
CGI Meta FAQ <URL:http://www.smithrenaud.com/public/CGI_MetaFAQ.html>
Perl Mongers <URL:http://www.perl.org/>
------------------------------
Date: Sun, 10 Sep 2000 11:39:43 GMT
From: tjla@guvfybir.qlaqaf.bet (Gwyn Judd)
Subject: Re: Is there a file rename function?
Message-Id: <slrn8rmsup.2fi.tjla@thislove.dyndns.org>
I was shocked! How could Ken <kenn_mar@hotmail.com>
say such a terrible thing:
>Hi all,
>The subject title says it all. Any doc on how file rename can be done? I
^^^^^^
>know I did come across it somewhere but just couldn't recall.
And today's winner for the prize for a self answering question is Ken!
What's he won Bob?
--
Gwyn Judd (print `echo 'tjla@guvfybir.qlaqaf.bet' | rot13`)
Revolution is the opiate of the intellectuals.
------------------------------
Date: Sun, 10 Sep 2000 20:33:30 +0300
From: "jobs2001" <jobs2001@gmx.net>
Subject: Job Offers: Web Designers & Programmers
Message-Id: <08C4AC570B9FD211B1DB00A0C9D339354FD014@hqnts40div01.academy.kiev.ua>
Job Offers: Web Designers & Programmers
Vacancies
a world wide operating software company, with
branches in Eastern, North, South Europe, invites
applications for the following positions in
Web Designers
The ideal candidates should have experiences with
some of the latest web technologies and design applications,
like Frontpage, Golive, DreamWeaver, Photoshop, Flash,
DHTML, CSS, XML, Java Script, Java, ASP, CGI, Perl, PHP3 etc.
Programmers
The ideal candidates should have experiences in some
of the following fields: Win32, C/C++, ASP, Java,
Java Script, XML, DHTML, MS SQL, Access/VB,
web database/servers, MFC, Visual C/InterDev,
Win NT/2000, MacOS, Linux and CGI.
Positions are available on part time, full time (also remotely)
and contract basis.
Applications
Interested applicants should forward a CV,
a detailed description of their skills, experiences
and of the past projects they have worked on and
their duties in these projects via
e-mail to: jobs2001@gmx.net
Important information we also need:
- if appropriate, URL reference to you sample
web pages/site
- your current location
- your current occupation
------------------------------
Date: Sun, 10 Sep 2000 10:12:47 GMT
From: ced@bcstec.ca.boeing.com (Charles DeRykus)
Subject: Re: Matching anything but a certain string
Message-Id: <G0o1pB.Itu@news.boeing.com>
In article <slrn8rm6im.b1k.abigail@alexandra.foad.org>,
Abigail <abigail@foad.org> wrote:
>Randal L. Schwartz (merlyn@stonehenge.com) wrote on MMDLXVI September
>MCMXCIII in <URL:news:m1hf7p2w3h.fsf@halfdome.holdit.com>:
>`'
>`' $word =~ m{
>`' horse # start with a horse
>`' (?: # and between them
>`' [^pig]+ # permit a run of any uninteresting chars
>`' | # or
>`' (?!pig). # any single character as long as we're not stari
>`' # at our forbidden string
>`' )* # and that's ok 0 or more times
>`' cow # and end up at cow
>`' }six; # and that's the end
>`'
>`' Others will probably have better optimizations, but this will do in a
>`' pinch.
>
>
>Well, `i' and `g' are very uninteresting characters as well. The only
>character to trigger an exception is `p'. Hence, we can optimize to:
>
> m/horse(?:[^p]+|p(?!ig))*cow/;
>
>And we can optimize the alternation away:
>
> m/horse[^p]*(?:p+(?!ig)[^p]*)*cow/;
>
Or, if you wanted to promote "g" to an interesting character :)
m/horse[^g]*(?:(?<!pi)g[^g]*)*cow/;
--
Charles DeRykus
------------------------------
Date: Sun, 10 Sep 2000 17:26:03 GMT
From: "Robert Eric Pearse" <robert_pearse@hotmail.com>
Subject: Msql-Mysql-modules-1.2215 install error
Message-Id: <LuPu5.35901$C5.719180@typhoon.austin.rr.com>
hi,
i'm having some ld errors when i run 'make install'. the output is below.
i believe this is the offending line:
LD_RUN_PATH="/usr/lib:/usr/lib/gcc-lib/i386-linux/2.95.2" /usr/bin/gcc -o
../blib/arch/auto/DBD/mysql/mysql.so -shared -L/usr/local/lib dbdimp.o
mysql.o -L/usr/lib -L/usr/lib -lmysqlclient -lm -lz -L/usr/lib/gcc-lib/i3
86-linux/2.95.2 -lgcc
/usr/bin/ld: cannot find -lz
my apologies if this is a silly question. i'll be you dollars for doughnuts
that this is a misconfiguration on my part. but, i would certainly
appreciate any help.
cheeers,
pearse
debian:~/.cpan/build/Msql-Mysql-modules-1.2215# make
mkdir blib
mkdir blib/lib
mkdir blib/arch
mkdir blib/arch/auto
mkdir blib/arch/auto/Msql-Mysql-modules
mkdir blib/lib/auto
mkdir blib/lib/auto/Msql-Mysql-modules
mkdir blib/man1
make[1]: Entering directory
`/root/.cpan/build/Msql-Mysql-modules-1.2215/mysql'
mkdir ../blib/lib/DBD
mkdir ../blib/arch/auto/DBD
mkdir ../blib/arch/auto/DBD/mysql
mkdir ../blib/lib/auto/DBD
mkdir ../blib/lib/auto/DBD/mysql
mkdir ../blib/man3
cp lib/DBD/mysql.pm ../blib/lib/DBD/mysql.pm
cp lib/Bundle/DBD/mysql.pm ../blib/lib/Bundle/DBD/mysql.pm
cp lib/Mysql/Statement.pm ../blib/lib/Mysql/Statement.pm
cp lib/Mysql.pm ../blib/lib/Mysql.pm
/usr/bin/gcc -c -I/usr/local/lib/perl5/site_perl/5.6.0/i686-linux-thread-mul
ti/auto/DBI -I/usr/include/mysql -I../dbd -I/usr/local/lib/perl5/site_perl/5
.6.0/i686-linux-thread-multi/auto/DBI -I/usr/local/lib/perl5/5.6.0/i686-linu
x-thread-multi -D_REENTRANT -fno-strict-aliasing -I/usr/local/include -D_LAR
GEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -O2 -DVERSION=\"2.0415\" -DXS_VERSI
ON=\"2.0415\" -fpic -I/usr/local/lib/perl5/5.6.0/i686-linux-thread-multi/COR
E -DDBD_MYSQL dbdimp.c
/usr/local/bin/perl -p -e "s/~DRIVER~/mysql/g" <
/usr/local/lib/perl5/site_perl/5.6.0/i686-linux-thread-multi/auto/DBI/Driver
.xst > mysql.xsi
/usr/local/bin/perl -I/usr/local/lib/perl5/5.6.0/i686-linux-thread-multi -I/
usr/local/lib/perl5/5.6.0
usr/local/lib/perl5/5.6.0/ExtUtils/xsubpp -typemap
/usr/local/lib/perl5/5.6.0/ExtUtils/typemap mysql.xs > mysql.xsc && mv
mysql.xsc mysql.c
/usr/bin/gcc -c -I/usr/local/lib/perl5/site_perl/5.6.0/i686-linux-thread-mul
ti/auto/DBI -I/usr/include/mysql -I../dbd -I/usr/local/lib/perl5/site_perl/5
.6.0/i686-linux-thread-multi/auto/DBI -I/usr/local/lib/perl5/5.6.0/i686-linu
x-thread-multi -D_REENTRANT -fno-strict-aliasing -I/usr/local/include -D_LAR
GEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -O2 -DVERSION=\"2.0415\" -DXS_VERSI
ON=\"2.0415\" -fpic -I/usr/local/lib/perl5/5.6.0/i686-linux-thread-multi/COR
E -DDBD_MYSQL mysql.c
Running Mkbootstrap for DBD::mysql ()
chmod 644 mysql.bs
LD_RUN_PATH="/usr/lib:/usr/lib/gcc-lib/i386-linux/2.95.2" /usr/bin/gcc -o
../blib/arch/auto/DBD/mysql/mysql.so -shared -L/usr/local/lib dbdimp.o
mysql.o -L/usr/lib -L/usr/lib -lmysqlclient -lm -lz -L/usr/lib/gcc-lib/i3
86-linux/2.95.2 -lgcc
/usr/bin/ld: cannot find -lz
collect2: ld returned 1 exit status
make[1]: *** [../blib/arch/auto/DBD/mysql/mysql.so] Error 1
make[1]: Leaving directory
`/root/.cpan/build/Msql-Mysql-modules-1.2215/mysql'
make: *** [subdirs] Error 2
------------------------------
Date: Sun, 10 Sep 2000 08:25:04 GMT
From: tjla@guvfybir.qlaqaf.bet (Gwyn Judd)
Subject: Re: New Perl Tutorial - www.perltutor.com
Message-Id: <slrn8rmhhq.2fi.tjla@thislove.dyndns.org>
I was shocked! How could Keith Calvert Ivey <kcivey@cpcug.org>
say such a terrible thing:
>tjla@guvfybir.qlaqaf.bet (Gwyn Judd) wrote:
>
>>hmmm...interpolating \\ in a single quoted string is pointless (and
>>annoying, meaning you need to double your backslashes if you actually
>>did want to print two of them.
>
>How do you propose to represent a backslash at the end of a
>single-quoted string then? Or include a backslash followed
>by a single quote in the string?
Good point :)
--
Gwyn Judd (print `echo 'tjla@guvfybir.qlaqaf.bet' | rot13`)
In Greene, New York, it is illegal to eat peanuts and walk backwards on
the sidewalks when a concert is on.
------------------------------
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 4276
**************************************