[21983] in Perl-Users-Digest
Perl-Users Digest, Issue: 4205 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Dec 2 18:06:19 2002
Date: Mon, 2 Dec 2002 15:05:13 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Mon, 2 Dec 2002 Volume: 10 Number: 4205
Today's topics:
[ANNOUNCE] wxPerl 0.12 <mbarbon@delete_me.dsi.unive.it>
Re: advanced html form question <jurgenex@hotmail.com>
Re: advanced html form question <joleebaby@hotmail.com>
Re: advanced html form question (Malcolm Dew-Jones)
ANNOUNCE: Algorithm::Tree::NCA version 0.01 uploaded to <mats.kindahl@nowhere.net>
ANNOUNCE: CGI::Widget::Tabs v.1.05 <NO.koos.JUNK.pol.MAIL@raketnet.nl>
Application creation (Jan Fure)
Asterisk (was: disable Unicode in Perl 5.8 ?) <a.gohr@web.de>
cron and argv (woodywit)
Re: DBI-Performance Problem <cpryce@pryce.net>
help: advanced html form question <joleebaby@hotmail.com>
Re: help: advanced html form question <koos_pol@NO.nl.JUNK.compuware.MAIL.com>
Re: help: advanced html form question (Helgi Briem)
how to get it quoted? <du_bing@hotmail.com>
Re: mask bit detection (Tad McClellan)
Re: mysql <mgiga@logava.com>
Re: mysql <jeff@vpservices.com>
Re: Need Help with OLE ! <Mark@ecc-limited.com>
perl CGI calling external programs (Mason)
Re: perl CGI calling external programs (Tad McClellan)
Re: perl CGI calling external programs (Tad McClellan)
Perl DBI binaries <ncremployee@ncr.com>
Persistence::Object::Simple writing many files to /tmp (Brian Huntington)
regular expression beyond my ability (Rossz)
Re: regular expression beyond my ability <dave@dave.org.uk>
Re: regular expression beyond my ability <krahnj@acm.org>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Mon, 02 Dec 2002 21:03:35 GMT
From: Mattia Barbon <mbarbon@delete_me.dsi.unive.it>
Subject: [ANNOUNCE] wxPerl 0.12
Message-Id: <Xns92D8C8EF379FBmbarbondsiuniveit@192.168.9.1>
A new version of wxPerl, the Perl bindings to wxWindows is out!
wxWindows is a free and cross platform (Windows/Motif/GTK/Mac) C++ GUI
toolkit,
with native look and feel. (visit http://www.wxwindows.org/
for more informations).
You can download wxPerl sources from CPAN.
Binary packages for ActivePerl/Win32 6xx builds and Red Hat Linux are
available
along with documentation in HTML and MS HTML Help format from
http://wxperl.sourceforge.net/
The project home page is
http://wxperl.sourceforge.net/
There is also a mailing list dedicated to wxPerl users:
wxperl-users@lists.sourceforge.net
Changes since the last version:
- new DEPRECATIONS section in README.txt, please read it
- it is now possibile to get the native handle of a Wx::Window
- implemented wxWizard and related classes
- Document/View framework (thanks to Simon Flack)
- Mostly completed wxStyledTextCtrl interface
(thanks to Graciliano M. P. and Simon Flack)
- implemented wxFontEnumerator and wxFontMapper
- implemented wxLogChain and wxLogPassThrough (2.3)
- Wx::PlLog, Wx::PlLogPassThrough, for custom logging
A special thank to Giulio Marcon and Marco Gaion, who offered some
logistic
help with the release.
Regards
Mattia
------------------------------
Date: Mon, 02 Dec 2002 16:45:29 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: advanced html form question
Message-Id: <J6MG9.5281$361.1956@nwrddc04.gnilink.net>
Fred wrote:
> Question: I want the answers to the first question to be included in
> the next question. The first question will give a multiple choice
> answer in check box form like so (this is just a simplified example
> not actual survey):
>
> What is your favorite color?
> _Blue
> _Green
> _Red
> x-Yellow
> _Pink
print "What is your favourite colour?";
my $colour = <STDIN>;
> The answer the respondent gave to the first question was yellow, so
> the next question should read:
>
> Why is your favorite color yellow?
> _I like it
> _it makes me smile
> _my mother was that color
print "Why is your favourite colour $colour?";
my $colourreason = <STDIN>;
jue
------------------------------
Date: Mon, 2 Dec 2002 14:38:57 -0500
From: "Fred" <joleebaby@hotmail.com>
Subject: Re: advanced html form question
Message-Id: <3debb709$1@rutgers.edu>
"Jürgen Exner" <jurgenex@hotmail.com> wrote in message
news:J6MG9.5281$361.1956@nwrddc04.gnilink.net...
> Fred wrote:
> > Question: I want the answers to the first question to be included in
> > the next question. The first question will give a multiple choice
> > answer in check box form like so (this is just a simplified example
> > not actual survey):
> >
> > What is your favorite color?
> > _Blue
> > _Green
> > _Red
> > x-Yellow
> > _Pink
>
> print "What is your favourite colour?";
> my $colour = <STDIN>;
>
> > The answer the respondent gave to the first question was yellow, so
> > the next question should read:
> >
> > Why is your favorite color yellow?
> > _I like it
> > _it makes me smile
> > _my mother was that color
>
> print "Why is your favourite colour $colour?";
> my $colourreason = <STDIN>;
>
> jue
>
>
In the first question from my example, I am going to force the respondent to
answer exactly 3 checkboxes. What would i use in the result page to ask
three follow up questions based on the first three answers?
------------------------------
Date: 2 Dec 2002 12:45:08 -0800
From: yf110@vtn1.victoria.tc.ca (Malcolm Dew-Jones)
Subject: Re: advanced html form question
Message-Id: <3debc654@news.victoria.tc.ca>
Fred (joleebaby@hotmail.com) wrote:
: "Jürgen Exner" <jurgenex@hotmail.com> wrote in message
: news:J6MG9.5281$361.1956@nwrddc04.gnilink.net...
: > Fred wrote:
: > > Question: I want the answers to the first question to be included in
: > > the next question. The first question will give a multiple choice
: > > answer in check box form like so (this is just a simplified example
: > > not actual survey):
: > >
: > > What is your favorite color?
: > > _Blue
: > > _Green
: > > _Red
: > > x-Yellow
: > > _Pink
: >
: > print "What is your favourite colour?";
: > my $colour = <STDIN>;
: >
: > > The answer the respondent gave to the first question was yellow, so
: > > the next question should read:
: > >
: > > Why is your favorite color yellow?
: > > _I like it
: > > _it makes me smile
: > > _my mother was that color
: >
: > print "Why is your favourite colour $colour?";
: > my $colourreason = <STDIN>;
: >
: > jue
: >
: >
: In the first question from my example, I am going to force the respondent to
: answer exactly 3 checkboxes. What would i use in the result page to ask
: three follow up questions based on the first three answers?
I'm afraid that your question is too basic for anyone to give a good
answer. If you don't know how to proceed then the answer is to learn to
program, or something like that - sorry if this sounds sarcastic, it is
not meant to be so.
You mention html forms, so I must assume this program will run as a cgi
script.
I suggest you find some example cgi script to see how they work.
#!perl
use strict;
use CGI qw(:standard);
print header;
print "<html><header><title></title></header><body><pre>";
my $colour = param('COLOUR');
print "your answer was $colour";
if ($colour eq "Blue")
{ print "so what now?";
}
print "</pre></body></html>";
------------------------------
Date: Mon, 02 Dec 2002 12:44:49 GMT
From: Mats Kindahl <mats.kindahl@nowhere.net>
Subject: ANNOUNCE: Algorithm::Tree::NCA version 0.01 uploaded to CPAN
Message-Id: <3deb7cf7$1_8@news.teranews.com>
Announcing the release of Perl Module Algorithm::Tree::NCA Version 0.01
Algorithm::Tree::NCA - Constant-time retrieval of nearest common ancestor
This package provides constant-time retrieval of the Nearest Common
Ancestor (NCA) of nodes in a tree. The implementation is based on an
algorithm by Harel and Tarjan which can, after linear-time (and
linear-space) preprocessing, retrieve the nearest common ancestor of
two nodes in constant time.
This release also contains a comparison between this algorithm and the
naive straight-forward implementation of the same algorithm with
linear complexity but with a low constant factor.
Module Entry
6) Data Types and Data Type Utilities (see also Database Interfaces)
Name DSLIP Description Info
------------ ----- -------------------------------------------- ----
Algorithm::Tree::
::NCA RdpOp Constant-time retrieval of nearest common
ancestor
--
IAR Systems in Uppsala, Sweden.
Any opinions expressed are my own and not those of my company.
Spam prevention: Contact me at mNaOtSkPiAnM@acm.org, removing
the NO SPAM.
------------------------------
Date: Mon, 02 Dec 2002 22:04:49 +0100
From: Koos Pol <NO.koos.JUNK.pol.MAIL@raketnet.nl>
Subject: ANNOUNCE: CGI::Widget::Tabs v.1.05
Message-Id: <asghth$r84i7$1@ID-171888.news.dfncis.de>
Announcement for CGI::Widget::Tabs, version 1.05
The changes for this version are:
- Added wrapping and indentation functionality.
- Minor documentation changes.
- Relocated file Styles.pm. Read INSTALL for details.
Enclosed is the README for reference.
Best regards,
Koos Pol
CGI::Widget::Tabs
=================
DESCRIPTION
CGI::Widget::Tabs lets you simulate tab widgets in HTML. You
could benefit from a tab widget if you want to serve only one
page. Depending on the tab selected you fetch and display the
underlying data. There are two main reasons for taking this
approach:
1. For the end user not to be directed to YAL or YAP (yet another
link / yet another page), but keep it all together: The single
point of entry paradigm.
2. As a consequence the end user deals with a more consistent and
integrated GUI. This will give a better "situational awareness"
within the application.
3. For the Perl hacker to handle multiple related data sources
within the same script environment.
As an example the following tabs could be used on a web page for
someone's spotting hobby:
__________ __________ __________
/ Planes \ / Trains \ / Classics \
------------------------------------------------------
_________
/ Bikes \
------------------------
As you can see, the headings wrap at three and a small
indentation is added to the start of the next row. The nice thing
about CGI::Widget::Tabs is that the tabs know their internal
state. So you can ask a tab for instance which heading has been
clicked by the user. This way you get instant feedback.
DOCUMENTATION
The documentation is included in the module. You can read it's
manpage after installation with `perldoc CGI::Widget::Tabs'. If
you prefer you can read the documentation before installation
with `perldoc ./Tabs.pm'
DEPENDENCIES
- CGI, CGI::Minimal or another CGI "object broker"
with the param() method and with similar behaviour
- HTML::Entities
- URI
- A CSS style sheet for the tabs markup
INSTALLATION
This distribution has relocated a file. Read INSTALL for details
on how to install this distribution.
DOWNLOAD
You can download CGI::Widget::Tabs from CPAN at
http://cpan.perl.org. The latest version is always available from
the CGI::Widget::Tabs homepage at:
http://users.raketnet.nl/koos_pol/en/Tabs/index.html
COPYRIGHT AND LICENCE
Copyright (c) 2002 Koos Pol. All rights reserved.
This program is free software; you can redistribute it and/or
modify it under the same terms as Perl itself.
CHANGES
These changes are against the previous version. For a complete
history log, see the file 'CHANGES' in the distribution.
1.05 (2002-12-02)
-----------------
- Added wrapping and indentation functionality.
- Minor documentation changes.
- Relocated file Styles.pm. Read INSTALL for details.
--
KP
koos _ pol @ raketnet nl
------------------------------
Date: 2 Dec 2002 11:15:39 -0800
From: jan_may2002_fure@attbi.com (Jan Fure)
Subject: Application creation
Message-Id: <e47a84bf.0212021115.e532a1f@posting.google.com>
Hi;
I hope everybody are recovered from giving thanks!
I would like to know what the best option is for distributing a Perl
application to windows users. I like the idea of using the activestate
perl develop kit (PDK), as it seems like I then could distribute the
application without requiring installation of Perl and required
modules.
The problem is that the demo is either buggy or intentionally gutted,
as the Kommodo (Tools -> Build standalone perl application)
application builder option erroneously reports that PDK is not
installed.
I don't mind paying for the full license, but I would feel silly if
what I want to do is still not possible. I have posed some questions
to the activestate contact E-mail address, but I have been unable to
get much more information than "See our web page".
Are there ways outside active Perl to make a standalone application?
Does anybody know if PDK does what I expect (allow me to distribute an
executable file which does the same as a perl script using modules
beyond those built into activestate perl)?
Jan
------------------------------
Date: Mon, 02 Dec 2002 16:13:13 +0100
From: "Andreas Gohr" <a.gohr@web.de>
Subject: Asterisk (was: disable Unicode in Perl 5.8 ?)
Message-Id: <pan.2002.12.02.15.13.08.584902@web.de>
On Sun, 01 Dec 2002 23:02:37 +0000, Benjamin Goldberg wrote:
> I don't see your problem -- Obviously, you've got to have two code
> paths, but that's not especially difficult.
>
> BEGIN {
> my $have_encode = eval {
> require Encode;
> import Encode qw(encode);
> 1;
> } || 0;
> *HAVE_ENCODE = sub () { $have_encode };
> }
Thanks a lot. This works fine and is more elegant than checking for the
Perl version. Just a question on the syntax. What does the asterisk in
*HAVE_ENCODE stand for? I've never seen that before... How does it work?
Any FAQ sections I have to read?
Andi
------------------------------
Date: 2 Dec 2002 15:01:55 -0800
From: markwitczak@yahoo.com (woodywit)
Subject: cron and argv
Message-Id: <88c9f169.0212021501.272a0b7d@posting.google.com>
I'm having a problem with reading $ARGV[0] in a perl script that is
executed by cron. Any solutions?
Here is the script AppCamDriver.pl:
#!/usr/local/bin/perl -w
use strict;
my $martName = $ARGV[0];
print $martName,"\n";
The cron entry looks like this:
01 15 * * * csh -c \$CONIHOME/scripts/AppCamDriver.pl ALL
------------------------------
Date: Mon, 02 Dec 2002 13:19:59 -0600
From: cp <cpryce@pryce.net>
Subject: Re: DBI-Performance Problem
Message-Id: <BA110E7F.12A31%cpryce@pryce.net>
in article 3DE5F04B.F8EB0728@bln1.siemens.de12345, Henning Meyer at
Henning.Meyer@bln1.siemens.de12345 wrote on 11/28/02 4:30 AM:
[ f'ups reset ]
> How could it be, that there is an prepare/execute ratio of 2?
>
> I have execute much equal statements with bind-Values, and its very
> annoying that there are 400 prepares for 200 executes instead of one
> prepare.
>
> Any hints?
First hint is: Don't multi-post. Cross posting your question to more than
one news group usually insures that you get all the answers.
See the answer to this question in alt.perl, and:
" ...drivers are allowed to defer actually doing the prepared stage of the
cycle until execute() is called. That's because some databases don't provide
any other way of doing it. ..." [1]
In general, a prepare() should parse the statement and check for errors,
execute() should set a pointer, and fetch() should return the result set.
HTH,
cp
------------------------------
Date: Mon, 2 Dec 2002 09:42:23 -0500
From: "Fred" <joleebaby@hotmail.com>
Subject: help: advanced html form question
Message-Id: <3deb7186$1@rutgers.edu>
I am creating an online survey, the answers to which will be sent to a mySQL
dbase using php.
Question: I want the answers to the first question to be included in the
next question. The first question will give a multiple choice answer in
check box form like so (this is just a simplified example not actual
survey):
What is your favorite color?
_Blue
_Green
_Red
x-Yellow
_Pink
The answer the respondent gave to the first question was yellow, so the next
question should read:
Why is your favorite color yellow?
_I like it
_it makes me smile
_my mother was that color
So in essence, the first answer is inserted into the next question. Is this
possible?
------------------------------
Date: Mon, 02 Dec 2002 16:12:43 +0100
From: Koos Pol <koos_pol@NO.nl.JUNK.compuware.MAIL.com>
Subject: Re: help: advanced html form question
Message-Id: <newscache$7lzh6h$xed$1@news.emea.compuware.com>
Fred wrote (Monday 02 December 2002 15:42):
> I am creating an online survey, the answers to which will be sent to a
> mySQL dbase using php.
^^^
You seem to be lost. This is a Perl newsgroup.
--
KP
------------------------------
Date: Mon, 02 Dec 2002 15:58:41 GMT
From: helgi@decode.is (Helgi Briem)
Subject: Re: help: advanced html form question
Message-Id: <3deb8308.4107056484@news.cis.dfn.de>
On Mon, 2 Dec 2002 09:42:23 -0500, "Fred"
<joleebaby@hotmail.com> wrote:
>I am creating an online survey, the answers to which will be sent to a
>mySQL dbase using php.
Your question is off-topic in this newsgroup which is
for discussion of the Perl programming language.
--
Regards, Helgi Briem
helgi AT decode DOT is
A: Top posting
Q: What is the most irritating thing on Usenet?
- "Gordon" on apihna
------------------------------
Date: Mon, 02 Dec 2002 16:56:14 -0600
From: user <du_bing@hotmail.com>
Subject: how to get it quoted?
Message-Id: <3DEBE50E.FCC655E7@hotmail.com>
The following script snippet works. Basically, it just sends 'hello' to
a user's (identified by ID c24b18d4bb4afdf052330678af9a601d) sent-mail
folder.
==========
#/usr/local/bin/perl
open(MAIL,"|mailx -s 'for test' c24b18d4bb4afdf052330678af9a601d+
sent-mail\@neo.tamu.edu");
print MAIL "hello\n";
close(MAIL);
==========
However, we have many users whose folder names have space, e.g. 'sent
mail'. In this case, changing 'sent-mail' to 'sent mail' will break the
above script and result in '9389edec9f36467e34cfb759e0c4359c+sent...
User unknown'. Apparently, 'c24b18d4bb4afdf052330678af9a601d+sent
mail@neo.tamu.edu' is treated by mailx as two separate email addresses,
one is c24b18d4bb4afdf052330678af9a601d+sent and the other is
mail@neo.tamu.edu.
So the question is how should I get mail delivered to folders with space
in name?
open(MAIL,"|mailx -s 'for test' c24b18d4bb4afdf052330678af9a601d+sent
mail\@neo.tamu.edu") does not work.
Thanks for any help in advance,
Bing
------------------------------
Date: Mon, 2 Dec 2002 09:15:29 -0600
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: mask bit detection
Message-Id: <slrnaumu8h.3p5.tadmc@magna.augustmail.com>
Vorxion <vorxion@fairlite.com> wrote:
> Given 0751 and the like,
I assume that you mean:
my $num = 0751;
> what is the best method in perl for determining
> which "bits" are set on each byte?
> Suggetions?
my @bits = map { $num & 1<<$_ ? 'set' : 'cleared'} 0..15;
print "bit number $_ is $bits[$_]\n" for 0..15;
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Mon, 2 Dec 2002 13:55:09 -0500
From: "Avantage" <mgiga@logava.com>
Subject: Re: mysql
Message-Id: <l%NG9.783$rv5.355936@news20.bellglobal.com>
> ie. $mysql->query(q{
> INSERT INTO logs (field1, field2, field3, field4, field5, field6) VALUES
> ($fields[0],$fields[1],$fields[2],$fields[3],$fields[4],$fields[5])
> });
Why not simply use (notice the doubled "q" followed by "!") :
$mysql->query(qq!
INSERT INTO logs (field1, field2, field3, field4, field5, field6) VALUES
(@fields)
!);
have a nice one,
Michel
------------------------------
Date: Mon, 02 Dec 2002 11:21:37 -0800
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: mysql
Message-Id: <3DEBB2C1.6060203@vpservices.com>
Avantage wrote:
>>ie. $mysql->query(q{
>> INSERT INTO logs (field1, field2, field3, field4, field5, field6) VALUES
>>($fields[0],$fields[1],$fields[2],$fields[3],$fields[4],$fields[5])
>> });
>>
>
> Why not simply use (notice the doubled "q" followed by "!") :
>
> $mysql->query(qq!
> INSERT INTO logs (field1, field2, field3, field4, field5, field6) VALUES
> (@fields)
> !);
Why not try your bogus code before suggesting it to others?
--
Jeff
------------------------------
Date: Mon, 2 Dec 2002 15:40:14 -0000
From: "mark wildey" <Mark@ecc-limited.com>
Subject: Re: Need Help with OLE !
Message-Id: <uun19bp1mce98b@corp.supernews.com>
Jay
Thanks for the information, it is now working.
Regards
Mark
------------------------------
Date: 2 Dec 2002 11:06:17 -0800
From: mase7479@hotmail.com (Mason)
Subject: perl CGI calling external programs
Message-Id: <8a3d8abc.0212021106.118366fe@posting.google.com>
I am having the hardest time finding information on the web so maybe
someone could help. I have a perl CGI script accepting data from a
form, this part is easy. But then, depending on the data from the
form I need to either call a C++ program or perl program and pass a
string to either one as applicable. Then either my C++ or perl
program will output results in an HTML formatted table.OK
1. I'm not sure how to call the C++ and perl program.
2. I don't know how to exactly pass the data from the form to the
programs.
3. I don't know how to accept the data within the C++ and perl
programs.
I've found a lot of different references, but none have helped. If you
have any input it would be appreciated.
------------------------------
Date: Mon, 2 Dec 2002 14:44:27 -0600
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: perl CGI calling external programs
Message-Id: <slrnaunhhb.54c.tadmc@magna.augustmail.com>
Mason <mase7479@hotmail.com> wrote:
> But then, depending on the data from the
> form
Are you taint checking this form data?
perldoc perlsec
You'd better be...
> I need to either call a C++ program or perl program and pass a
> string to either one as applicable. Then either my C++ or perl
> program will output results in an HTML formatted table.OK
> 1. I'm not sure how to call the C++ and perl program.
With system() or backticks.
> 2. I don't know how to exactly pass the data from the form to the
> programs.
Pass it as a command line argument.
> 3. I don't know how to accept the data within the C++ and perl
> programs.
You can use backticks to run an external program and capture
the STDOUT from that program:
my $prog_output = `someprog somestring anotherstring`;
or
my $prog_output = qx/someprog somestring anotherstring/;
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Mon, 2 Dec 2002 14:45:34 -0600
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: perl CGI calling external programs
Message-Id: <slrnaunhje.54c.tadmc@magna.augustmail.com>
Mason <mase7479@hotmail.com> wrote:
> I need to either call a C++ program or perl program
> I've found a lot of different references, but none have helped. If you
> have any input it would be appreciated.
perldoc -q STDERR
How can I capture STDERR from an external command?
There are three basic ways of running external commands:
...
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Mon, 2 Dec 2002 11:50:28 -0500
From: "NCR Employee" <ncremployee@ncr.com>
Subject: Perl DBI binaries
Message-Id: <3deb8f55$1@rpc1284.daytonoh.ncr.com>
Hi all,
I am looking for the Perl DBI binary distribution for Sun Solaris (Sparc 8)
in form of package (so I can use the pkgadd to add to my system (/usr/local
is preferable). If you happen to know where it locates then please give me
a shout at kp100012@ncr.com
Many thanks in advance.
Khue.
P.S. I can get the source code from CPAN and build it on development
machine but on the Production box I don't have compiler (and don't want to
install one since this is our customer box). So all I hope is to find one
pre-built for Solaris 8 or I have to do by myself.
------------------------------
Date: 2 Dec 2002 11:12:52 -0800
From: bhuntington@agu.org (Brian Huntington)
Subject: Persistence::Object::Simple writing many files to /tmp
Message-Id: <23aa28ab.0212021112.43c785e5@posting.google.com>
Hello everyone,
I have recently developed a Perl/CGI online membership and
subscription form for my organization that utilizes CGI::Persistent,
and have encountered two problems that may or may not be related.
My first problem is that although I have declared a path for storage
session files, P::O::S continues to write a series of files (many with
the the exact same ten digits preceding '.') to our system /tmp
directory. There is no relationship in name between these files and
the single file containing session vars that is being written to the
path declared for session storage. The files written to /tmp are
either empty or contain the following, single line:
$VAR1 = bless( {}, 'Persistence::Object::Simple' );
My second issue is that the CGI::Persistent function delete_all() does
not remove any session files from the system disk.
In reviewing the documentation for P::O::S I have the feeling that the
methods commit() and load() may be of help in solving this problem.
But, honestly, I do not completely understand thier use or how to
implement them.
If someone could point me in the right direction, I would be most
grateful.
Here are the first several lines of code in the main part of the app
(file name renewal), that directs the session through the appropriate
modules. Note that $q is shared through each module, accomplished by
the means of Exporter.pm for which I will provide another example
further below:
use strict;
require '/[sendmail_path]/sendmail.pl';
use CGI::Persistent qw($q);
use CGI::Carp qw(fatalsToBrowser carpout);
use Carp ();
local $SIG{__WARN__} = \&Carp::cluck;
### these are my custom modules
use lib qw(.);
use VARI qw(%g);
use HTML qw($q $h);
use DEMO qw($q $h);
use CLAS qw($q $h);
use JOUR qw($q $h);
use PREP qw($q $h);
use vars qw($q %g $h $dg $c $j $pr);
### these are the new objects or refs
$q = new CGI::Persistent "./storage";
*g = \%VARI::g;
$h = new HTML;
$dg = new DEMO;
$c = new CLAS;
$j = new JOUR;
$pr = new PREP;
### a few globals
use vars qw(
$field
$buttons
$grad
$advisorName
$advisorEmail
$advisorPhone
$First
$Lastn
$Email
);
### state in app
my $outputPage = $q->param("outputPage");
my $submit = $q->param("submit");
### The following lines are not literaly in the app
### only an example of what is done
if ($outputPage eq 'a'){ do a; }
elsif ($outputPage eq 'b'){ do b; }
elsif ($outputPage eq 'c'){ do c; }
### The following lines are in the app
### The last step in any membership application
elsif($outputPage eq '2003 journals'){
### print the HTML headers including tables, forms etc.
$h->top('my title','my subtitle','my form action');
### print the various journals to which one may subscribe
$j->all_vchoice();
### print hidden HTML form fields and prepare other fields
### for our verification and payment page
$pr->verify_prep_jour;
### delete all - !not removing any session files from disk!
$q->delete_all();
### print the HTML footers, close forms etc. and 'exit;'
$h->bop('submit button values','my outputPage');
}
### end examples in the file renewal
### Here is an example of source code in one of the modules, DEMO.pm:
package DEMO;
use strict;
BEGIN {
use Exporter();
@DEMO::ISA = qw(Exporter);
@DEMO::EXPORT = qw();
@DEMO::EXPORT_OK = qw($h $q);
}
use vars qw($q $h);
use HTML qw($q $h);
use DBMG;
my $db = new DBMG;
use VARI;
use vars qw(
%months
%g
%degree
%section
%empFunction
%empClass
);
*months = \%VARI::months;
*g = \%VARI::g;
*degree = \%VARI::degree;
*section = \%VARI::section;
*empFunction = \%VARI::empFunction;
*empClass = \%VARI::empClass;
### followed by varios subs
### end of example
Any assistance would be greatly appreciated, as our staff is currently
required to delete thousands of files per hour from our system. Any
hints would help. If more information is needed, feel free to ask
questions.
Thank's for your time.
Sincerely,
Brian Huntington
bhuntington@agu.org
------------------------------
Date: Mon, 02 Dec 2002 17:49:17 GMT
From: nobody@nowhere.com (Rossz)
Subject: regular expression beyond my ability
Message-Id: <Xns92D863E893959tinlcnews@64.164.98.7>
I'm converting 75 static web pages into dynamic pages stored in MySQL. I'm
stripping everything up to and including <BODY> and well as from </BODY> to
the end. This part I have working:
my @Data = SuckInFile(file.list');
my $stuff;
foreach $filename (@Data) {
$filename =~ /\.\/(.*)\/(.*)[\.]/;
my $ThisChapter = $1;
my $ThisSection = $2;
#grab the whole file as a single variable
open (HTML, '<', $filename) || die ("failed to read $filename");
{ undef $/; $stuff=<HTML>; }
close (HTML);
# strip header and tailer
$stuff =~ /<body[^>]*>(.*)<\/body>/ism;
$stuff = $1;
# static to dynamic replacement goes here
#status only while I figure this crap out
print "Chapter = $ThisChapter, Section = $ThisSection\n";
}
Part of the conversion process is to convert the static links into the
corresponding dynamic links. I have these possibilities, any other links
should be left as is. Hopefully, the news readers won't try to convert
this mess into real links.
<a href='title.html'>
becomes
<a href='program.php?menu=$ThisChapter&body=title'>
<a href='../chapter/title.html'>
becomes
<a href='program.php?menu=chapter&body=title'>
<a href='#subtitle'>
becomes
<a href='program.php?menu=$ThisChapter&body=$ThisTitle§ion=subtitle'>
<a href='../chapter/title.html#subtitle'>
becomes
<a href='program.php?menu=chapter&body=title§ion=subtitle'>
Speed is not an important factor. Any help would be greatly appreciated
--
ebffm@inzbf-jragjbegu.bet
Qba'g cvff zr bss! V unir oebnqonaq naq n crey fpevcg, naq V'z abg nsenvq
gb hfr gurz!
------------------------------
Date: Mon, 02 Dec 2002 20:28:00 +0000
From: "Dave Cross" <dave@dave.org.uk>
Subject: Re: regular expression beyond my ability
Message-Id: <pan.2002.12.02.20.27.59.561000@dave.org.uk>
On Mon, 02 Dec 2002 17:49:17 +0000, Rossz wrote:
> Any help would be greatly appreciated
To parse HTML, you should use an HTML parser. I'm guessing that
HTML::TokeParser or HTML::LinkExtor would be most useful in this case.
Dave...
--
.sig missing...
------------------------------
Date: Mon, 02 Dec 2002 20:57:45 GMT
From: "John W. Krahn" <krahnj@acm.org>
Subject: Re: regular expression beyond my ability
Message-Id: <3DEBC915.EE71C24C@acm.org>
Rossz wrote:
>
> I'm converting 75 static web pages into dynamic pages stored in MySQL. I'm
> stripping everything up to and including <BODY> and well as from </BODY> to
> the end. This part I have working:
>
> my @Data = SuckInFile(file.list');
> my $stuff;
>
> foreach $filename (@Data) {
>
> $filename =~ /\.\/(.*)\/(.*)[\.]/;
> my $ThisChapter = $1;
> my $ThisSection = $2;
You shouldn't use the dollar-digit variables unless the regular
expression was successful.
my ( $ThisChapter, $ThisSection ) = $filename =~ m[\./(.*)/(.*)\.];
> #grab the whole file as a single variable
> open (HTML, '<', $filename) || die ("failed to read $filename");
You should include the $! variable in the error message.
open (HTML, '<', $filename) || die ("failed to read $filename:
$!");
> { undef $/; $stuff=<HTML>; }
You shouldn't undef global variables, it could adversely affect other
parts of your program.
my $stuff = do { local $/; <HTML> };
> close (HTML);
>
> # strip header and tailer
> $stuff =~ /<body[^>]*>(.*)<\/body>/ism;
> $stuff = $1;
Since you want to STRIP the header and tailer:
$stuff =~ s!^.*<body[^>]*>!!is;
$stuff =~ s!</body>.*\z!!is;
> # static to dynamic replacement goes here
>
> #status only while I figure this crap out
> print "Chapter = $ThisChapter, Section = $ThisSection\n";
> }
John
--
use Perl;
program
fulfillment
------------------------------
Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 6 Apr 01)
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.
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 V10 Issue 4205
***************************************