[25875] in Perl-Users-Digest
Perl-Users Digest, Issue: 8105 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon May 23 09:05:30 2005
Date: Mon, 23 May 2005 06:05:07 -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, 23 May 2005 Volume: 10 Number: 8105
Today's topics:
Re: Error Handler in Embedded Perl (Anno Siegel)
Re: How to step over a line in the debugger? <Peter@PSDT.com>
might be OT sendmail script running very slow <usenet@NOSPAM.obantec.net>
Re: might be OT sendmail script running very slow <noreply@gunnar.cc>
Re: might be OT sendmail script running very slow <mark.clementsREMOVETHIS@wanadoo.fr>
Re: might be OT sendmail script running very slow <noreply@gunnar.cc>
Re: might be OT sendmail script running very slow <usenet@NOSPAM.obantec.net>
Question about Modules and Variable Scope <dhannotte@nyc.rr.com>
Re: Question about Modules and Variable Scope (Anno Siegel)
Re: Regex help: delete text only if not within quotatio <djames@thehub.com.au>
Re: Regex help: delete text only if not within quotatio (Anno Siegel)
Test <test@freenet.de>
Re: Test (Anno Siegel)
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 23 May 2005 11:08:35 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Error Handler in Embedded Perl
Message-Id: <d6sdjj$nio$1@mamenchi.zrz.TU-Berlin.DE>
Guenther Sohler <guenther.sohler@newlogic.com> wrote in comp.lang.perl.misc:
> Hallo,
>
> I have a embedded perl in my c program.
> Whenever perl creates an error(eg function not found)
> it quits my whole program. i dont want this.
> I want a callbackfunction to be called instead.
> How can I register such a callback function ?
> Where can I find documentation on that ?
perldoc perlcall, look for the G_EVAL flag.
Anno
------------------------------
Date: Mon, 23 May 2005 12:36:21 GMT
From: Peter Scott <Peter@PSDT.com>
Subject: Re: How to step over a line in the debugger?
Message-Id: <pan.2005.05.23.12.36.11.145081@PSDT.com>
On Mon, 23 May 2005 03:17:10 -0700, Sysadmin wrote:
> Hi everyone,
>
> I just found myself needing to use the debugger to sort out a problem in one of
> my administrative scripts, and I realized I needed a feature that seems obvious
> enough for a debugger, but I can't find it mentioned in perldebug or the Camel.
> Is it possible to step over an arbitrary line of code, without executing it?
No. The debugger is not directing the execution of your program, it is
observing it. All you can do is vary the places it stops to report what's
happening.
> Let's say I have a script with simple example code like this:
> print "Line 1.\n";
> print "Line 2.\n";
> print "Line 3.\n";
>
> What must I do to execute line 1 and 3, but not line 2, inside the debugger?
If line 2 contained a conditional, e.g.
print "Line 2.\n" if $foo;
you could set $foo to false in the debugger before reaching the line.
That's about it.
--
Peter Scott
http://www.perlmedic.com/
http://www.perldebugged.com/
------------------------------
Date: Mon, 23 May 2005 12:13:35 +0100
From: "Mark D Smith" <usenet@NOSPAM.obantec.net>
Subject: might be OT sendmail script running very slow
Message-Id: <4291ba2d$0$2588$da0feed9@news.zen.co.uk>
Hi
this might be a sendmail issue but the snippet below is from a script that
is used in part of an automated program than ran fine on RH8 but on FC3
takes around 13 seconds from Start of sendmail line to end of sendmail line.
my $mailprog = '/usr/sbin/sendmail';
print "start of sendmail<br>\n";
open (MAIL, "|$mailprog -t -f system-check\@domain.xyz");
print MAIL "To: Support <support\@domain.xyz>\n";
print MAIL "Cc: Support1 <support1\@domain1.xyz>\n";
print MAIL "From: Test Script<server1\@domain.xyz>\n";
print MAIL "Subject: mail test\n\n";
close(MAIL);
print "end of sendmail<br>\n";
Mark
------------------------------
Date: Mon, 23 May 2005 13:27:39 +0200
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: might be OT sendmail script running very slow
Message-Id: <3fdt43F7a4v7U1@individual.net>
Mark D Smith wrote:
> this might be a sendmail issue
So it seems.
> but the snippet below is from a script that
> is used in part of an automated program than ran fine on RH8 but on FC3
> takes around 13 seconds from Start of sendmail line to end of sendmail line.
>
> my $mailprog = '/usr/sbin/sendmail';
>
> print "start of sendmail<br>\n";
>
> open (MAIL, "|$mailprog -t -f system-check\@domain.xyz");
> print MAIL "To: Support <support\@domain.xyz>\n";
> print MAIL "Cc: Support1 <support1\@domain1.xyz>\n";
> print MAIL "From: Test Script<server1\@domain.xyz>\n";
> print MAIL "Subject: mail test\n\n";
>
> close(MAIL);
> print "end of sendmail<br>\n";
Try using one of the Perl modules instead. This code replaces the above
using Mail::Sender:
use Mail::Sender;
ref (new Mail::Sender -> MailMsg( {
smtp => 'localhost',
from => 'Test Script <server1@domain.xyz>',
fake_from => 'system-check@domain.xyz',
to => 'Support <support@domain.xyz>',
cc => 'Support1 <support1@domain1.xyz>',
subject => 'mail test',
msg => '',
} )) or die "Cannot send mail. $Mail::Sender::Error\n";
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
------------------------------
Date: 23 May 2005 11:31:07 GMT
From: "Mark Clements" <mark.clementsREMOVETHIS@wanadoo.fr>
Subject: Re: might be OT sendmail script running very slow
Message-Id: <4291befb$0$1242$8fcfb975@news.wanadoo.fr>
Mark D Smith wrote:
> Hi
>
> this might be a sendmail issue but the snippet below is from a script
> that is used in part of an automated program than ran fine on RH8 but
> on FC3 takes around 13 seconds from Start of sendmail line to end of
> sendmail line.
>
> my $mailprog = '/usr/sbin/sendmail';
>
> print "start of sendmail<br>\n";
>
> open (MAIL, "|$mailprog -t -f system-check\@domain.xyz");
> print MAIL "To: Support <support\@domain.xyz>\n";
> print MAIL "Cc: Support1 <support1\@domain1.xyz>\n";
> print MAIL "From: Test Script<server1\@domain.xyz>\n";
> print MAIL "Subject: mail test\n\n";
>
> close(MAIL);
> print "end of sendmail<br>\n";
>
DNS is working correctly on the FC3 system? Can its hostname (or
whatever sendmail thinks it's called) be resolved by DNS?
What happens if you run sendmail directly?
This is off-topic for this newsgroup (as you have guessed), so I
suggest that you either post the question in a sendmail group, or you
can mail me directly, but note my crude address-munging.
Mark
------------------------------
Date: Mon, 23 May 2005 13:31:50 +0200
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: might be OT sendmail script running very slow
Message-Id: <3fdtc6F7a7bsU1@individual.net>
Gunnar Hjalmarsson wrote:
>
> from => 'Test Script <server1@domain.xyz>',
> fake_from => 'system-check@domain.xyz',
Sorry, that would be the other way around:
from => 'system-check@domain.xyz',
fake_from => 'Test Script <server1@domain.xyz>',
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
------------------------------
Date: Mon, 23 May 2005 13:23:50 +0100
From: "Mark D Smith" <usenet@NOSPAM.obantec.net>
Subject: Re: might be OT sendmail script running very slow
Message-Id: <4291caa4$0$24082$db0fefd9@news.zen.co.uk>
"Gunnar Hjalmarsson" <noreply@gunnar.cc> wrote in message
news:3fdtc6F7a7bsU1@individual.net...
> Gunnar Hjalmarsson wrote:
> >
> > from => 'Test Script <server1@domain.xyz>',
> > fake_from => 'system-check@domain.xyz',
>
> Sorry, that would be the other way around:
>
> from => 'system-check@domain.xyz',
> fake_from => 'Test Script <server1@domain.xyz>',
>
> --
> Gunnar Hjalmarsson
> Email: http://www.gunnar.cc/cgi-bin/contact.pl
Hi
takes just as long! , I'll contact Mark Clements via email and see if he can
help as per his posting.
Mark
------------------------------
Date: Mon, 23 May 2005 12:37:10 GMT
From: "Dean Hannotte" <dhannotte@nyc.rr.com>
Subject: Question about Modules and Variable Scope
Message-Id: <W7kke.673$XB2.244286@twister.nyc.rr.com>
Keywords: module scope
I'm writing a content management system and I've put some generally useful
routines into a common library that I invoke by starting my scripts with
'use cms;'. I then use a configuration file to initialize certain global
variables by coding 'require config.pl'. The problem is, I can't figure out
how I can get the library routines to see the globals that I've set in
'config.pl'. When I refer to these values from any of the library routines,
their values are undefined. I guess segregating code into a Perl module puts
it into a completely separate namespace.
If I code 'require config.pl' from inside 'cms.pm', then the library sees
the values, but the script doesn't! So I guess there's an internal mechanism
to prevent the loading of the same 'require' more than once in the same run?
How can I get the library, 'cms.pm', to see the same values that my scripts
see when they 'require config.pl' without having to pass these values as
subroutine parameters? Thanks!
Dean Hannotte
http://www.hannotte.net
------------------------------
Date: 23 May 2005 13:00:17 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Question about Modules and Variable Scope
Message-Id: <d6sk51$nio$6@mamenchi.zrz.TU-Berlin.DE>
Keywords: module scope
Dean Hannotte <dhannotte@nyc.rr.com> wrote in comp.lang.perl.misc:
> I'm writing a content management system and I've put some generally useful
> routines into a common library that I invoke by starting my scripts with
> 'use cms;'. I then use a configuration file to initialize certain global
> variables by coding 'require config.pl'. The problem is, I can't figure out
> how I can get the library routines to see the globals that I've set in
> 'config.pl'. When I refer to these values from any of the library routines,
> their values are undefined. I guess segregating code into a Perl module puts
> it into a completely separate namespace.
>
> If I code 'require config.pl' from inside 'cms.pm', then the library sees
> the values, but the script doesn't! So I guess there's an internal mechanism
> to prevent the loading of the same 'require' more than once in the same run?
>
> How can I get the library, 'cms.pm', to see the same values that my scripts
> see when they 'require config.pl' without having to pass these values as
> subroutine parameters? Thanks!
Make config.pl export the variables and import them as needed. The
variables have to be package variables for that.
perldoc Exporter.
Anno
------------------------------
Date: Mon, 23 May 2005 10:55:42 GMT
From: Damian James <djames@thehub.com.au>
Subject: Re: Regex help: delete text only if not within quotation marks
Message-Id: <slrnd93dhm.bnb.djames@puli.local>
On Mon, 23 May 2005 18:40:17 +1000, Scott Bass said:
> s#\*\s*(.+?)\s*\; (?!(["'])(.+?)\1)##;
> ...
> I want to delete text delimited by * ;, but only if * ; does not occur
> within quotation marks.
> ...
> I thought I was on the right track with negative lookahead assertion???
Perhaps others will explain what is going wrong with your regex, but
I'd suggest you look at
perldoc -q delimited
before proceeding further. Treating quotes properly is non-trivial, is
difficult or impossible with a regex alone, and is well supported by a
range of modules. Foremost of these is Text::Balanced.
Aside: Is that in the standard distro yet? I seem to have it and don't
remember installing it, but that doesn't mean much ;).
--damian
------------------------------
Date: 23 May 2005 11:12:35 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Regex help: delete text only if not within quotation marks
Message-Id: <d6sdr3$nio$2@mamenchi.zrz.TU-Berlin.DE>
Damian James <djames@thehub.com.au> wrote in comp.lang.perl.misc:
> On Mon, 23 May 2005 18:40:17 +1000, Scott Bass said:
> > s#\*\s*(.+?)\s*\; (?!(["'])(.+?)\1)##;
> > ...
> > I want to delete text delimited by * ;, but only if * ; does not occur
> > within quotation marks.
> > ...
> > I thought I was on the right track with negative lookahead assertion???
>
> Perhaps others will explain what is going wrong with your regex, but
> I'd suggest you look at
>
> perldoc -q delimited
>
> before proceeding further. Treating quotes properly is non-trivial, is
> difficult or impossible with a regex alone, and is well supported by a
> range of modules. Foremost of these is Text::Balanced.
>
> Aside: Is that in the standard distro yet? I seem to have it and don't
> remember installing it, but that doesn't mean much ;).
perldoc perlmodlib | grep Balanced
Text::Balanced
so, yes, it's a standard module.
Anno
------------------------------
Date: Mon, 23 May 2005 13:17:44 +0200
From: "test" <test@freenet.de>
Subject: Test
Message-Id: <d6sdgf$vhf$62@pomoranche.gu.net>
It's only a test.
Please klick on link to test:
http://www.surf-tipps.info/fclick/fclick.php?13
Thanks
------------------------------
Date: 23 May 2005 11:26:26 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Test
Message-Id: <d6sel2$nio$3@mamenchi.zrz.TU-Berlin.DE>
test <test@freenet.de> wrote in comp.lang.perl.misc:
> It's only a test.
> Please klick on link to test:
> http://www.surf-tipps.info/fclick/fclick.php?13
Stop that. Use a test group.
Anno
------------------------------
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 8105
***************************************