[28018] in Perl-Users-Digest
Perl-Users Digest, Issue: 9382 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Jun 26 09:05:57 2006
Date: Mon, 26 Jun 2006 06:05:06 -0700 (PDT)
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, 26 Jun 2006 Volume: 10 Number: 9382
Today's topics:
Re: Can not "signal_conect" using GTK2::GladeXML in win <luxiangyu@msn.com>
cgi/perl on Tomcat web server narra.madan@gmail.com
Re: cgi/perl on Tomcat web server <simon.chao@gmail.com>
Re: cgi/perl on Tomcat web server narra.madan@gmail.com
Re: cgi/perl on Tomcat web server narra.madan@gmail.com
Re: DESTROY isn't called <bol@adv.magwien.gv.at>
excel ole readonly open liefje@gmail.com
Need to trace the output of Mime::Lite module (HELP) <kenhensleys@yahoo.com>
Perl Entwickler gesucht kl@exergy.de
Re: Regexp problem <rvtol+news@isolution.nl>
Re: Regular Expression Generator <josef.moellers@fujitsu-siemens.com>
Re: Regular Expression Generator <primzahl@gmail.com>
Re: Regular Expression Generator <xicheng@gmail.com>
Re: Regular Expression Generator <jurgenex@hotmail.com>
Test loop <kaz219@gawab.com>
Re: Test loop <noreply@gunnar.cc>
Re: Test loop <josef.moellers@fujitsu-siemens.com>
Re: Test loop <peace.is.our.profession@gmx.de>
Re: Test loop <kaz219@gawab.com>
Re: Test loop <peace.is.our.profession@gmx.de>
Re: Test loop <kaz219@gawab.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 26 Jun 2006 02:52:46 -0700
From: "phus" <luxiangyu@msn.com>
Subject: Re: Can not "signal_conect" using GTK2::GladeXML in win32.
Message-Id: <1151315566.374469.6070@r2g2000cwb.googlegroups.com>
got it.
my glade-win32 version is too high(2.8.10rc1). I tried reinstall
gladewin32(gtk-win32-devel-2.6.10-rc1.exe). so it's ok.
kpolston@gmail.com wrote:
> Hi
> I too have this problem - did you ever find a fix?
> Kevin
> phus wrote:
> > Hi all:
> > I write a perl script using gtk2-perl, i designed the GUI with
> > Glade, so i add "using GTK2::GladeXML" in my script code.
> > everything goes well in Linux(perl-5.8.6), but i want the script can
> > also run in win32. so i install activeperl-5.8.7 in win2000, install
> > gtk-win32-2.8.18-rc1.exe, and install GTK2, GTK2::GladeXML modules
> > with ppm(a cpan clone in win32).
> > but when run the script, perl give me the error "Can't locate object
> > method "signal_connect" via package "Gtk2::Window" at
> > C:/Perl/site/lib/Gtk2/GladeXML.pm line 40."
> > i have no idea to deal with it.
> > Thanks.
------------------------------
Date: 26 Jun 2006 03:34:37 -0700
From: narra.madan@gmail.com
Subject: cgi/perl on Tomcat web server
Message-Id: <1151318077.623777.171260@b68g2000cwa.googlegroups.com>
hi all,
can anyone briefly describe how to work cgi/perl on tomcat server...
i searched the web but could'nt get any sort of information..if
possible please send me a working example
thanks in advance
madan chowdary
------------------------------
Date: 26 Jun 2006 05:23:38 -0700
From: "it_says_BALLS_on_your_forehead" <simon.chao@gmail.com>
Subject: Re: cgi/perl on Tomcat web server
Message-Id: <1151324618.721675.201550@y41g2000cwy.googlegroups.com>
narra.ma...@gmail.com wrote:
> hi all,
> can anyone briefly describe how to work cgi/perl on tomcat server...
> i searched the web but could'nt get any sort of information..if
> possible please send me a working example
i could just be displaying my ignorance, but i thought Tomcat was a
servlet container. i think for a web server you want apache.
------------------------------
Date: 26 Jun 2006 05:36:40 -0700
From: narra.madan@gmail.com
Subject: Re: cgi/perl on Tomcat web server
Message-Id: <1151325400.459625.133670@b68g2000cwa.googlegroups.com>
tomcat is a webserver which has a servlet container in it but not
purely a servlet container..
it can handle http request and response when a servlet is used and even
cgi/perl...
so i just want to know how to configure cgi/perl in tomcat...
thanks for ur reply anyway..
------------------------------
Date: 26 Jun 2006 06:00:11 -0700
From: narra.madan@gmail.com
Subject: Re: cgi/perl on Tomcat web server
Message-Id: <1151326811.893490.198740@c74g2000cwc.googlegroups.com>
if u still doubt...check out web.xml file under conf directory in
tomcat...
u can see a commented block specifing abt cgi/perl..and cgi-bin
directory...
thats the reason i started this thread...
------------------------------
Date: Mon, 26 Jun 2006 13:10:14 +0200
From: "Ferry Bolhar" <bol@adv.magwien.gv.at>
Subject: Re: DESTROY isn't called
Message-Id: <1151320214.490551@proxy.dienste.wien.at>
Mumia W.:
> sub later (&) {
> bless [ shift ], 'Later';
> }
>
> sub Later::DESTROY {
> $_[0]->[0]->();
> }
Many thanks! Great! Now it works as expected.
But why?
> It seems that perl doesn't like to call destructors on objects which are
> based upon code refs.
Is this a known restriction or a bug?
Greetings, Ferry
--
Ing. Ferry Bolhar
Municipality of Vienna, Department 14
A-1010 Vienna / AUSTRIA
E-mail: bol@adv.magwien.gv.at
------------------------------
Date: 26 Jun 2006 02:31:54 -0700
From: liefje@gmail.com
Subject: excel ole readonly open
Message-Id: <1151314314.824271.139000@i40g2000cwc.googlegroups.com>
i would like to open an xls file in read only mode so i dont have to
say 'no' to the dialog box saying 'do you want to save the changes?'
everytime the script opens the file and closes it. i have tried using
this:
my $Book = $Excel->Workbooks->Open({
FileName => 'i:\tmp\ole\test.xls',
ReadOnly => 1 });
and this:
my $Book = $Excel->Workbooks->Open('i:\tmp\ole\test.xls', 0, 1);
i have also tried setting readonly for the file attributes!
nothing seems to work, its always asking me if i want to save changes
that didnt even happen in the first place.
------------------------------
Date: 26 Jun 2006 03:30:28 -0700
From: "kenhensleys@yahoo.com" <kenhensleys@yahoo.com>
Subject: Need to trace the output of Mime::Lite module (HELP)
Message-Id: <1151317828.028322.162480@m73g2000cwd.googlegroups.com>
I have this simple Mime::Lite script quoted below.
It works alright.
But I would like to trace the result of the output.
Something like
set -x in ksh
or anything else similar.
Or some logging?
What should I do and where should I put it?
.....................
#!/usr/bin/perl
use MIME::Lite;
use Net::SMTP;
my $from_address = john@yahoo.com';
my $to_address = 'smith@yahoo.com';
my $mail_host = 'mailhost.domain.com';
### Adjust subject and body message
my $subject = 'A message with 2 parts ...';
my $message_body = "Here's the attachment file(s) you wanted";
### Create the multipart container
$msg = MIME::Lite->new (
From => $from_address,
To => $to_address,
Subject => $subject,
Type =>'multipart/mixed'
) or die "Error creating multipart container: $!\n";
### Add the text message part
$msg->attach (
Type => 'TEXT',
Data => $message_body
) or die "Error adding the text message part: $!\n";
### Add the ZIP file
$msg->attach (
Type => 'application/zip',
Path => $my_file_zip,
Filename => $your_file_zip,
Disposition => 'attachment'
) or die "Error adding $file_zip: $!\n";
### Send the Message
MIME::Lite->send('smtp', $mail_host, Timeout=>60);
$msg->send;
------------------------------
Date: 26 Jun 2006 05:24:38 -0700
From: kl@exergy.de
Subject: Perl Entwickler gesucht
Message-Id: <1151324678.796286.114880@m73g2000cwd.googlegroups.com>
Wir suchen einen nebenberuflichen, freien PERL/CGI Programmierer f=FCr
die Weiterentwicklung unseres Content Management Systems ContRay
(www.contray.de).
Langfristige Zusammenarbeit gew=FCnscht!
Kontakt: info .at. contray .dot. de
------------------------------
Date: Mon, 26 Jun 2006 14:34:57 +0200
From: "Dr.Ruud" <rvtol+news@isolution.nl>
Subject: Re: Regexp problem
Message-Id: <e7orca.1ek.1@news.isolution.nl>
Mark Healey schreef:
> Like most open source perldoc sucks. By the time you know enough to
> pick the right terms to look for you don't need it.
I know I don't need you.
--
Affijn, Ruud
"Gewoon is een tijger."
------------------------------
Date: Mon, 26 Jun 2006 09:25:08 +0200
From: Josef Moellers <josef.moellers@fujitsu-siemens.com>
Subject: Re: Regular Expression Generator
Message-Id: <e7o28j$9ma$1@nntp.fujitsu-siemens.com>
jeremyje@gmail.com wrote:
> Is there a library or a way to generate an appropriate regular
> expression for any given input string?
> (remove quotes for examples)
> For example: "1234567890abcdef is in hex9"
> Regex Generator returns: [0-9|A-F]{16} [a-z]{2} [a-z]{2} [0-9|a-z]{3}
>=20
> Or anything that does some sort of similar processing?
Hardly.
First of all, your example is incorrect: "[0-9|A-F]{16}" will not match=20
"1...abcdef".
Second, The following RE will also match:
"1234567890abcdef is in hex9" as will
"[0-9a-z]{16} [0-9a-z]{2} [0-9a-z]{2} [0-9a-z]{3}" as will
".{16} .{2] .{2} .{4}" as will
".*\s.*\s.*\s.*" as will
"\S+\s+\S+\s+\S+\s+\S+"
IOW There is no single "appropriate regular expression" but infinitly=20
many (or some number close to infinity) that it's unpractical.
--=20
Josef M=F6llers (Pinguinpfleger bei FSC)
If failure had no penalty success would not be a prize
-- T. Pratchett
------------------------------
Date: 26 Jun 2006 00:34:32 -0700
From: "Reto" <primzahl@gmail.com>
Subject: Re: Regular Expression Generator
Message-Id: <1151307272.142016.314130@u72g2000cwu.googlegroups.com>
I have noticed there is a software available:
http://www.regexbuddy.com/perl.html
I did not try yet.
I would suggest to collect your recipes and make a list of common used
regex's ;-)
BR,
Reto
--
jeremyje@gmail.com wrote:
> Is there a library or a way to generate an appropriate regular
> expression for any given input string?
> (remove quotes for examples)
> For example: "1234567890abcdef is in hex9"
> Regex Generator returns: [0-9|A-F]{16} [a-z]{2} [a-z]{2} [0-9|a-z]{3}
>
> Or anything that does some sort of similar processing?
------------------------------
Date: 26 Jun 2006 00:50:14 -0700
From: "Xicheng Jia" <xicheng@gmail.com>
Subject: Re: Regular Expression Generator
Message-Id: <1151308214.785392.311180@c74g2000cwc.googlegroups.com>
Reto wrote:
> I have noticed there is a software available:
> http://www.regexbuddy.com/perl.html
> I did not try yet.
> I would suggest to collect your recipes and make a list of common used
> regex's ;-)
check this:
http://regexlib.com/
and the "External links" section in the following link:
http://www.answers.com/regular+expression?gwp=11&ver=2.0.0.453&method=3
and any questions, goto:
http://regexadvice.com/forums/default.aspx
Good luck,
Xicheng
------------------------------
Date: Mon, 26 Jun 2006 12:56:32 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: Regular Expression Generator
Message-Id: <4QQng.26791$Xn.23675@trnddc05>
jeremyje@gmail.com wrote:
> Is there a library or a way to generate an appropriate regular
> expression for any given input string?
> (remove quotes for examples)
> For example: "1234567890abcdef is in hex9"
> Regex Generator returns: [0-9|A-F]{16} [a-z]{2} [a-z]{2} [0-9|a-z]{3}
>
> Or anything that does some sort of similar processing?
Well, yes, sure: actually the desired RE is a constant: .*
For a more advanced RE you can even quantify it with the length of the
string.
Seriously: it is impossible to derive a generic RE pattern from a single
text sample.
And you provided the point in case: why are you scanning for [a-f] in the
first part (I assume the upper case is a mistake, otherwise the RE wouldn't
match anyway) but for a-z in the second part? Shouldn't that be [is] or
maybe /is/? Without knowing the generic pattern it is impossible to know
what RE you me be looking for.
Jue
------------------------------
Date: 26 Jun 2006 01:45:39 -0700
From: "KaZ" <kaz219@gawab.com>
Subject: Test loop
Message-Id: <1151311539.040097.274090@m73g2000cwd.googlegroups.com>
Hi,
I'm trying to do the following:
for each value of an array, make a test.
If the loop comes to the end without that the test became true a single
time, do action A. Otherwise, just go on, without doing action A.
Can somebody help me here? Thanks a lot!
------------------------------
Date: Mon, 26 Jun 2006 11:14:35 +0200
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: Test loop
Message-Id: <4g9mvmF1l0v5uU1@individual.net>
KaZ wrote:
> I'm trying to do the following:
> for each value of an array, make a test.
> If the loop comes to the end without that the test became true a single
> time, do action A. Otherwise, just go on, without doing action A.
Use the grep() function in scalar context.
perldoc -f grep
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
------------------------------
Date: Mon, 26 Jun 2006 11:28:58 +0200
From: Josef Moellers <josef.moellers@fujitsu-siemens.com>
Subject: Re: Test loop
Message-Id: <e7o9i1$3fk$1@nntp.fujitsu-siemens.com>
KaZ wrote:
> Hi,
>=20
> I'm trying to do the following:
> for each value of an array, make a test.
> If the loop comes to the end without that the test became true a single=
> time, do action A. Otherwise, just go on, without doing action A.
>=20
> Can somebody help me here? Thanks a lot!
What have you tried so far? Where has it failed to work as expected?
Have you looked at the "map" operator?
Josef
--=20
Josef M=F6llers (Pinguinpfleger bei FSC)
If failure had no penalty success would not be a prize
-- T. Pratchett
------------------------------
Date: Mon, 26 Jun 2006 11:34:33 +0200
From: Mirco Wahab <peace.is.our.profession@gmx.de>
Subject: Re: Test loop
Message-Id: <e7o9ua$9cj$1@mlucom4.urz.uni-halle.de>
Thus spoke KaZ (on 2006-06-26 10:45):
> I'm trying to do the following:
> for each value of an array, make a test.
> If the loop comes to the end without that the test became true a single
> time, do action A. Otherwise, just go on, without doing action A.
>
> Can somebody help me here? Thanks a lot!
As Gunnar already said, use the 'grep' operator.
To be more specific: use something like
...
if( not grep { condition_of $_ } @array ) {
print "do something";
}
else {
print "go ahead";
}
...
grep pulls all elements from @array,
transfers them one-at-a-time into it's
block, accessible as $_ - and, depending
on the outcome of your 'condition',
and constructs another list corresponding
to the 'true' values only.
If there are no 'true' values, grep
returns an empty list, which gives
in the scalar context of the 'if'
a (length) value of 0/zero/false.
Regards
Mirco
------------------------------
Date: 26 Jun 2006 02:55:58 -0700
From: "KaZ" <kaz219@gawab.com>
Subject: Re: Test loop
Message-Id: <1151315758.664314.111590@y41g2000cwy.googlegroups.com>
Mirco Wahab wrote:
>
> As Gunnar already said, use the 'grep' operator.
>
> To be more specific: use something like
>
> ...
> if( not grep { condition_of $_ } @array ) {
> print "do something";
> }
> else {
> print "go ahead";
> }
> ...
>
> grep pulls all elements from @array,
> transfers them one-at-a-time into it's
> block, accessible as $_ - and, depending
> on the outcome of your 'condition',
> and constructs another list corresponding
> to the 'true' values only.
>
> If there are no 'true' values, grep
> returns an empty list, which gives
> in the scalar context of the 'if'
> a (length) value of 0/zero/false.
>
> Regards
>
> Mirco
Thanks a lot!
To be more precise, I want to write a line in a file only if it hasn't
already been written in it. So I have to scan the lines of the file
with a foreach loop, and if the line wasn't found, I wrote it in.
I made it with loop-controlers until here, but it isn't very good
programming in my opinion.
So, actually, I have another question: is it possible to open the file
only once at the beginning of the script (I'm writing a script), search
it for a line, append lines, without having to close and reopen it?
Because opening and closing files a lot of times make the script quite
slow, as far as I can tell, and I want to process very big files with
it, so speed matters.
Greetings,
kaz
------------------------------
Date: Mon, 26 Jun 2006 12:10:46 +0200
From: Mirco Wahab <peace.is.our.profession@gmx.de>
Subject: Re: Test loop
Message-Id: <e7oc26$9u8$1@mlucom4.urz.uni-halle.de>
Thus spoke KaZ (on 2006-06-26 11:55):
> To be more precise, I want to write a line in a file only if it hasn't
> already been written in it. So I have to scan the lines of the file
> with a foreach loop, and if the line wasn't found, I wrote it in.
>
> I made it with loop-controlers until here, but it isn't very good
> programming in my opinion.
>
> So, actually, I have another question: is it possible to open the file
> only once at the beginning of the script (I'm writing a script), search
> it for a line, append lines, without having to close and reopen it?
> Because opening and closing files a lot of times make the script quite
> slow, as far as I can tell, and I want to process very big files with
> it, so speed matters.
Open the File:
open(my $fh , '<', $filename) or die "without hesitation $!";
Read the file into an array and close it
my @fa = <$fh>;
close $fh;
Do all comparisons on the array, never on the file
for( all_things_to_do ) {
work_on_array_only( @array );
}
If done, write the array back to the file,
(you may save a backup before if necessary)
replace it:
open($fh , '>', $filename) or die "WTF $!";
print $fh @array;
close $fh;
Above statements draw the outline only.
Now you have to make sense of it ;-)
Regards
Mirco
------------------------------
Date: 26 Jun 2006 05:40:41 -0700
From: "KaZ" <kaz219@gawab.com>
Subject: Re: Test loop
Message-Id: <1151325641.127902.174410@u72g2000cwu.googlegroups.com>
Many thanks for your help!
I still have a strange problem: I use the grep to search the array like
this:
if (not grep { "blah:$var" } @foo) {...}
But I can put whatever I want instead of "blah:$var", like "kfdhkf",
really anything, the grep is going to match. Except when the array is
empty.
I made a print grep .... and it always returns the first element of the
array, whatever I ask the grep to search for.
I missed something, but I can't find out what. If you habe any idea
about this...
------------------------------
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 9382
***************************************