[25340] in Perl-Users-Digest
Perl-Users Digest, Issue: 7585 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Dec 28 14:15:55 2004
Date: Tue, 28 Dec 2004 11:15:22 -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 Tue, 28 Dec 2004 Volume: 10 Number: 7585
Today's topics:
Leak in Win32::ChangeNotify? <ThomasKratz@REMOVEwebCAPS.de>
Re: Line continuation in Perl <bik.mido@tiscalinet.it>
Re: Multiple submit actions. <sam.wun@authtec.com>
Re: Multiple submit actions. <tadmc@augustmail.com>
Re: Multiple submit actions. <sam.wun@authtec.com>
Re: Multiple submit actions. <eighner@io.com>
Re: Perl CGI script using Win::ODBC module - failed log <byoukstetter@hotmail.com>
Re: Perl CGI script using Win::ODBC module - failed log <byoukstetter@hotmail.com>
perldoc perltie <perl@my-header.org>
Re: problems with Perl RegEx match <mitch_christow@biogen.com>
Using Apache::Session for storing form data as opposed ioneabu@yahoo.com
YAPC::Europe::2004 - NICE IDE downloadable at last <ThomasKratz@REMOVEwebCAPS.de>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 28 Dec 2004 15:42:47 +0100
From: Thomas Kratz <ThomasKratz@REMOVEwebCAPS.de>
Subject: Leak in Win32::ChangeNotify?
Message-Id: <41d170e7$0$776$bb690d87@news.main-rheiner.de>
The code below is a simple example of using Win32::ChangeNotify. AFAIK
this is how it should be used according to the docs.
If you run this you will see a steady increase in the used nonpage pool
memory of the perl process in the Win32 performance monitor (Category
'Process', counter 'Pool Nonpaged Bytes'). Changing the file will result
in the notification message printed to screen as well as in more memory
leaking. After the second change it will go berserk and if you don't
terminate the process quickly it will eat up all the systems nonpaged pool
memory and thus cause serious trouble elsewhere in the system.
Moving the object creation into the while loop and deleting the line with
'$notify->reset()' works around the problem.
Can somebody confirm this? If yes I will file a bug report on rt.cpan.org.
Tested with perl 5.8.4 (custom build) and libwin 0.19.1
(Win32::ChangeNotify 1.02) under WinXP and Win2003 Server.
Thomas
=== code start ===
use strict;
use warnings;
$| = 1;
use File::Spec::Functions qw/catfile/;
use Win32::ChangeNotify;
my $dir = 'd:/tmp/perl/chng';
my $notify_fn = catfile($dir, 'bla.txt');
my $last = 0;
my $notify = Win32::ChangeNotify->new($dir, 0, 'LAST_WRITE');
die 'cannot create notify object'
unless ref($notify) eq 'Win32::ChangeNotify';
while ( 1 ) {
my $rc = $notify->wait(100);
$notify->reset();
last if $rc == -1;
my @stat = stat($notify_fn);
if ( $rc == 1 and $stat[9] > $last ) {
print "$notify_fn has changed\n";
$last = $stat[9];
}
}
=== code end ===
--
$/=$,,$_=<DATA>,s,(.*),$1,see;__END__
s,^(.*\043),,mg,@_=map{[split'']}split;{#>J~.>_an~>>e~......>r~
$_=$_[$%][$"];y,<~>^,-++-,?{$/=--$|?'"':#..u.t.^.o.P.r.>ha~.e..
'%',s,(.),\$$/$1=1,,$;=$_}:/\w/?{y,_, ,,#..>s^~ht<._..._..c....
print}:y,.,,||last,,,,,,$_=$;;eval,redo}#.....>.e.r^.>l^..>k^.-
------------------------------
Date: Tue, 28 Dec 2004 17:17:26 +0100
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: Line continuation in Perl
Message-Id: <qt03t0hbghr08mcnf46q64a3al21ahmqlv@4ax.com>
On 24 Dec 2004 08:04:24 GMT, Abigail <abigail@abigail.nl> wrote:
>"Somebody" is correct, in Perl1 to Perl5, you can put whitespace between
>tokens. Including newlines. (Perl6 will be different, putting whitespace
>between certain tokens will change the meaning of your program. Or be
>a syntax error. Fun, fun, fun!)
Indeed will be slightly less free-form than we're used to (in some
senses). I know that you're particularly upset by this choice, in fact
I seem to remeber you even wrote something like "Perl6 will pass
Python on the wrong side"; OTOH I think we all have something about
Perl6 that we just can't feel at ease with, but aren't your concerns
just a little bit exaggerated? I mean: yes, you won't be allowed e.g.
to leave whitespace after a sigil or brackets, but you will still be
allowed to do this provided you explicitly put the dereferencer there,
which incidentally happens to be a simple dot.
Just curious,
Michele
--
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
.'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,
------------------------------
Date: Tue, 28 Dec 2004 23:16:36 +0800
From: sam <sam.wun@authtec.com>
Subject: Re: Multiple submit actions.
Message-Id: <cqruuc$21t7$1@news.hgc.com.hk>
Sorry for asking an out of topic question.
I have abandoned the use of CGI in solving this problem.
Thanks
Sam.
sam wrote:
> Hi,
>
> I tried to create a form which embedded with another form, thus I expect
> the second submit button will call the second cgi script, the main
> submit button will call the main cgi script seperately.
>
> eg.
> print "<Form action=main.cgi>\n";
> print "<table>\n";
> print "<td><form action=second.cgi>\";
> print "<input type=submit value=\"Outlets\">\n";
> print "</form></td>\n";
> print "</table>\n";
> print "<td><form action=queryl.pl><input type=submit
> value=\"MainQuery\"></form>\n";
>
> in the above coding, pressed the MainQuery submit button actually called
> to main.cgi script instead of query1.pl.
>
> How can I change this?
>
> Thanks
> Sam
------------------------------
Date: Tue, 28 Dec 2004 09:31:03 -0600
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: Multiple submit actions.
Message-Id: <slrnct2v1n.sf4.tadmc@magna.augustmail.com>
sam <sam.wun@authtec.com> wrote:
> I have abandoned the use of CGI in solving this problem.
Why?
Seems to me to be a perfectly good way of solving this problem.
What alternative "solution" have you discovered?
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Tue, 28 Dec 2004 23:36:39 +0800
From: sam <sam.wun@authtec.com>
Subject: Re: Multiple submit actions.
Message-Id: <cqs03v$22j4$1@news.hgc.com.hk>
Tad McClellan wrote:
> sam <sam.wun@authtec.com> wrote:
>
>
>>I have abandoned the use of CGI in solving this problem.
>
>
>
> Why?
>
> Seems to me to be a perfectly good way of solving this problem.
>
> What alternative "solution" have you discovered?
>
>
I know it is, but my client does not require this solution. I would
rather focus my effort in other area.
Thanks
Sam
------------------------------
Date: Tue, 28 Dec 2004 09:44:28 -0600
From: Lars Eighner <eighner@io.com>
Subject: Re: Multiple submit actions.
Message-Id: <slrnct2vlh.20bi.eighner@goodwill.io.com>
In our last episode, <cqruuc$21t7$1@news.hgc.com.hk>, the lovely
and talented sam broadcast on comp.lang.perl.misc:
> Sorry for asking an out of topic question.
> I have abandoned the use of CGI in solving this problem.
But your problem wasn't CGI. It was that you do not write valid
html. You will have problems with anything you put on the web
until and unless you know how to compose valid html.
--
Lars Eighner eighner@io.com http://www.io.com/~eighner/
Health is merely the slowest possible rate at which one can die.
------------------------------
Date: 28 Dec 2004 08:20:27 -0800
From: "brandony" <byoukstetter@hotmail.com>
Subject: Re: Perl CGI script using Win::ODBC module - failed login on
Message-Id: <1104250827.220398.123480@z14g2000cwz.googlegroups.com>
Matt Garrish wrote:
> If I understand you correctly, it sounds like you haven't specified
the
> username and password for the DSN properly in the ODBC manager (i.e.,
there
> is no default user and password for that DSN). Go to Settings --
Control
> Panel -- Admin Tools -- ODBC Settings (or something similar depending
on
> your version of Windows) and trying testing the connection. If you
can't
> connect, then go over the settings and see what you've missed. Also,
make
> sure that you've set it up as a System DSN and not a User DSN.
>
> It definitely doesn't sound like a Perl problem, though. I would
personally
> recommend you switch to the DBI and DBD::ODBC modules, however, as
support
> for Win32::ODBC is suspect.
>
> Matt
Matt,
I don't think its a problem with the ODBC connection. It is a System
DSN and I always get the green light when testing the connnection at
the end of setup. Any other ideas? I will look at the DBD::ODBC
modules. BTW, I agree that this doesnt seem like a perl problem, but
rather a setup issue with respect to the web site context (user rights
is was my first inclination). I just thought someone here may have had
similar issues.
------------------------------
Date: 28 Dec 2004 09:05:52 -0800
From: "brandony" <byoukstetter@hotmail.com>
Subject: Re: Perl CGI script using Win::ODBC module - failed login on
Message-Id: <1104250796.965780.120670@z14g2000cwz.googlegroups.com>
Matt Garrish wrote:
> If I understand you correctly, it sounds like you haven't specified
the
> username and password for the DSN properly in the ODBC manager (i.e.,
there
> is no default user and password for that DSN). Go to Settings --
Control
> Panel -- Admin Tools -- ODBC Settings (or something similar depending
on
> your version of Windows) and trying testing the connection. If you
can't
> connect, then go over the settings and see what you've missed. Also,
make
> sure that you've set it up as a System DSN and not a User DSN.
>
> It definitely doesn't sound like a Perl problem, though. I would
personally
> recommend you switch to the DBI and DBD::ODBC modules, however, as
support
> for Win32::ODBC is suspect.
>
> Matt
Matt,
I don't think its a problem with the ODBC connection. It is a System
DSN and I always get the green light when testing the connnection at
the end of setup. Any other ideas? I will look at the DBD::ODBC
modules. BTW, I agree that this doesnt seem like a perl problem, but
rather a setup issue with respect to the web site context (user rights
is was my first inclination). I just thought someone here may have had
similar issues.
------------------------------
Date: Tue, 28 Dec 2004 19:52:33 +0100
From: Matija Papec <perl@my-header.org>
Subject: perldoc perltie
Message-Id: <52a3t0h3fe2t4i0oeha933lbprd8jfhs2b@4ax.com>
Is there another way to reset internal hash iterator? This looks like great
overhead since when I'm calling "keys %tied_hash", I'm also performing
second "keys" call in tie class (or is there some cunning optimization when
"keys" isn't in list context?).
> FIRSTKEY this
> This method will be triggered when the user is going to iterate
> through the hash, such as via a keys() or each() call.
>
> sub FIRSTKEY {
> carp &whowasi if $DEBUG;
> my $self = shift;
> my $a = keys %{$self->{LIST}}; # reset each() iterator
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> each %{$self->{LIST}}
> }
--
Matija
------------------------------
Date: 28 Dec 2004 07:42:01 -0800
From: "mitch" <mitch_christow@biogen.com>
Subject: Re: problems with Perl RegEx match
Message-Id: <1104248521.746602.313050@f14g2000cwb.googlegroups.com>
Hi everyone,
Thanks first of all for all the great comments and suggestions. So
Abigail, you were right, I foolishly forgot to close a silly brace.
That should teach me to write code after only sleeping for two hours
(boy do I feel sheepish).
In terms of indenting, my code is beautifully indented, however while
posting it, the tabs and spaces had been removed. Next time I'll add
some HTML code to the posting, just so that it gets formatted properly.
In any event, I appreciate all the comments and thanks again for the
prompt response. It took me literaly 10 seconds to find the missing
brace. I guess sometimes you have been staring too long at the code to
see the problem. I was convinced that the problem was in the RegEx.
Well, live and learn.... thanks again folks.
Regards,
Mitch
------------------------------
Date: 28 Dec 2004 10:00:43 -0800
From: ioneabu@yahoo.com
Subject: Using Apache::Session for storing form data as opposed to database columns
Message-Id: <1104256843.768684.278620@f14g2000cwb.googlegroups.com>
I realize that searching for data this way is not as efficient, but it
makes it easy if a form changes, there is no need to change a database
structure. I was wondering if others do it this way, saving all of
their web form data to a hash and putting it in Apache::Session to call
out later with the session id number. It's like leaving your clothes
at the dry cleaners and taking a ticket home to retrieve the clothes at
a later time.
Here is a sub I wrote to handle the work:
sub session_handler
{
my ($dbh,$hash_ref,$sess_id_ref,$action) = @_;
my %session;
tie %session, 'Apache::Session::MySQL', $$sess_id_ref,
{Handle=>$dbh, LockHandle=>$dbh};
$$sess_id_ref = $session{'_session_id'};
if ($action =~ /write/i)
{$session{$_} = ${$hash_ref}{$_} for keys %{$hash_ref}}
elsif ($action =~ /read/i)
{${$hash_ref}{$_} = $session{$_} for keys %session}
elsif ($action =~ /delete/i) {tied(%session)->delete}
}
the hash referenced by $hash_ref is either filled with data or is to be
filled with data depending on the value of $action. Same with
$sess_id_ref.
It is tested and appears to work fine. I started with a big mess of
code and tried to clean it up by using statement modifiers.
Any advice on code would be appreciated and on the soundness of the
overall method of using Apache::Session for storing fairly large
amounts of important data from html forms.
Thanks,
wana
------------------------------
Date: Tue, 28 Dec 2004 16:58:23 +0100
From: Thomas Kratz <ThomasKratz@REMOVEwebCAPS.de>
Subject: YAPC::Europe::2004 - NICE IDE downloadable at last
Message-Id: <41d1829f$0$776$bb690d87@news.main-rheiner.de>
For those of you, that attended (others are welcome too, of course) the
lightning talk of Bernd Ulmann about his hypothetical, educational NICE
processor and want to play around with the IDE we built, the latest
version can now be downloaded from:
http://www.vaxman.de/projects/nice/nice.html
You'll get the description of the processor's features there as well.
Can someone please put a copy of this post on the p5p mailing list, since
I am not a subscriber and the attendees of YAPC will more likely read
there? I would have put it on the wiki, but it is spammed to oblivion.
Have fun,
Thomas
--
$/=$,,$_=<DATA>,s,(.*),$1,see;__END__
s,^(.*\043),,mg,@_=map{[split'']}split;{#>J~.>_an~>>e~......>r~
$_=$_[$%][$"];y,<~>^,-++-,?{$/=--$|?'"':#..u.t.^.o.P.r.>ha~.e..
'%',s,(.),\$$/$1=1,,$;=$_}:/\w/?{y,_, ,,#..>s^~ht<._..._..c....
print}:y,.,,||last,,,,,,$_=$;;eval,redo}#.....>.e.r^.>l^..>k^.-
------------------------------
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.
NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice.
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 7585
***************************************