[25879] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 8109 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue May 24 11:05:25 2005

Date: Tue, 24 May 2005 08: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           Tue, 24 May 2005     Volume: 10 Number: 8109

Today's topics:
    Re: "Incremental" Embedded Perl (Anno Siegel)
    Re: Error Handler in Embedded Perl (Anno Siegel)
    Re: Error Handler in Embedded Perl <do-not-use@invalid.net>
    Re: Error Handler in Embedded Perl (Anno Siegel)
    Re: FormMail Problem (Anno Siegel)
    Re: Question about Modules and Variable Scope <1usa@llenroc.ude.invalid>
    Re: Question about Modules and Variable Scope (Anno Siegel)
    Re: Question about Modules and Variable Scope (Anno Siegel)
        sendmail windows trouble <alexj@freesurf.ch>
    Re: sendmail windows trouble <tadmc@augustmail.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: 24 May 2005 11:24:30 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: "Incremental" Embedded Perl
Message-Id: <d6v2te$cr4$5@mamenchi.zrz.TU-Berlin.DE>

Guenther Sohler  <guenther.sohler@newlogic.com> wrote in comp.lang.perl.misc:
> I have an Application using embedded Perl
> 
> it works in following steps
> 
> 1) I allocate and create perl
> 2) I parse my perl script with the perl interpreter (perl_parse)
> 3) I definde my own functions using newXS
> 4) I run the perl script
> 5)  Eventually some perl functions are called from within my c code
>   which properly do their job - all find
> 
> 6) My program has the ability to run custom perl scripts. In this case
>    continue at 2
>   perl_parse is called again to read in the new perl script
> 
> 7) Unfortunately all the other context already read is deleted. Varibles,
> functions ... that means the fucntions called at 5 will fail
> 
> 
> Is it possible to incrementally load perl scripts using perl_parse
> eg if I load script1 which defines a=5, I parse and execute it, so a
> becomes 5 ; then to parse script2 which prints out a, and then run script2
> to see that a is set to 5.
> How would it work ? what do I have to do ?

Study the pertinent documentation.  I'm pretty sure I read something
about your problem when I looked up the answer to your last question.
I'm not going back to find it again.

In another reply, Sherm Pendley has listed the documents that concern
embedding Perl.  Yes, it's a lot to read.  Read them anyway, instead
of asking the group to do it for you.

Anno


------------------------------

Date: 24 May 2005 10:56:07 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Error Handler in Embedded Perl
Message-Id: <d6v187$cr4$2@mamenchi.zrz.TU-Berlin.DE>

Guenther Sohler  <guenther.sohler@newlogic.com> wrote in comp.lang.perl.misc:
> On Mon, 23 May 2005 11:08:35 +0000, Anno Siegel wrote:
> Hallo Anno,
> 
> It works wery fine,
> thank you for your help!

What does?  Quote some context when you reply.  That *you* see the
posting you are replying to as you write doesn't mean your readers
see it when they read it.  Show some consideration.

Anno


------------------------------

Date: 24 May 2005 13:26:17 +0200
From: Arndt Jonasson <do-not-use@invalid.net>
Subject: Re: Error Handler in Embedded Perl
Message-Id: <yzdy8a43lwm.fsf@invalid.net>


anno4000@lublin.zrz.tu-berlin.de (Anno Siegel) writes:
> Guenther Sohler  <guenther.sohler@newlogic.com> wrote in comp.lang.perl.misc:
> > On Mon, 23 May 2005 11:08:35 +0000, Anno Siegel wrote:
> > Hallo Anno,
> > 
> > It works wery fine,
> > thank you for your help!
> 
> What does?  Quote some context when you reply.  That *you* see the
> posting you are replying to as you write doesn't mean your readers
> see it when they read it.  Show some consideration.

I think that many people post a quick question here, get an answer,
give thanks, and then don't read anything further. This seems especially
probable to me if they apparently haven't read the posting guidelines.


------------------------------

Date: 24 May 2005 11:37:12 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Error Handler in Embedded Perl
Message-Id: <d6v3l8$cr4$6@mamenchi.zrz.TU-Berlin.DE>

Arndt Jonasson  <do-not-use@invalid.net> wrote in comp.lang.perl.misc:
> 
> anno4000@lublin.zrz.tu-berlin.de (Anno Siegel) writes:
> > Guenther Sohler  <guenther.sohler@newlogic.com> wrote in comp.lang.perl.misc:
> > > On Mon, 23 May 2005 11:08:35 +0000, Anno Siegel wrote:
> > > Hallo Anno,
> > > 
> > > It works wery fine,
> > > thank you for your help!
> > 
> > What does?  Quote some context when you reply.  That *you* see the
> > posting you are replying to as you write doesn't mean your readers
> > see it when they read it.  Show some consideration.
> 
> I think that many people post a quick question here, get an answer,
> give thanks, and then don't read anything further. This seems especially
> probable to me if they apparently haven't read the posting guidelines.

I realize that, though in this case the OP *has* posted again.  I'm
writing these replies more for the general benefit than for the
individual I'm replying to.  Not that I have any illusions about
googlistas and their propensity to lurk before they post, but not
replying would look like endorsement.

It's a nuisance.

Anno


------------------------------

Date: 24 May 2005 12:56:46 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: FormMail Problem
Message-Id: <d6v8ae$i6k$1@mamenchi.zrz.TU-Berlin.DE>

Gunnar Hjalmarsson  <noreply@gunnar.cc> wrote in comp.lang.perl.misc:
> Christopher Nehren wrote:
> >> Olen R. Pearson wrote:
> >>> I am using FormMail.CGI v. 1.92 (04/21/02) to process s form on a
> >>> Website.
> > 
> > *stop* using FormMail now. It's
> > horribly, horrendously insecure and thoroughly broken.
> 
> Even if I'm not sure, I have a feeling that you are referring to 
> previous versions. If also v. 1.92 deserves that verdict, it would be 
> nice if you (or somebody else) could explain *how* it's broken.

I don't know about security but it's still substandard Perl code.
I see  no strict, no warnings, use of global package variables all over
the place and a general lack of familiarity with Perl's possiblilities.
Some use of qr() would help the code as would POSIX::strftime instead
of the homebrew date conversion.

One concrete example (there are more):

    $Config{'required'} =~ s/(\s+|\n)?,(\s+|\n)?/,/g;
    $Config{'required'} =~ s/(\s+)?\n+(\s+)?//g;
    $Config{'env_report'} =~ s/(\s+|\n)?,(\s+|\n)?/,/g;
    $Config{'env_report'} =~ s/(\s+)?\n+(\s+)?//g;
    $Config{'print_config'} =~ s/(\s+|\n)?,(\s+|\n)?/,/g;
    $Config{'print_config'} =~ s/(\s+)?\n+(\s+)?//g;

That should be something like (untested):

    for ( @config{ qw( required env_report print_config} ) {
        s/(\s+|\n)?,(\s+|\n)?/,/g;
        s/(\s+)?\n+(\s+)?//g;
    }

As mentioned I didn't look for holes (other people are presumably
doing that), but the coding standard doesn't instil much confidence.
The vulnerabilities that have been exposed in the past may have been
fixed, but a secure program must be written with security in mind
from the start.  Clearly this code hasn't seen a ground-up rewrite
since its beginnings under Perl 4.  I wouldn't trust it.

Anno


------------------------------

Date: Tue, 24 May 2005 10:45:52 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: Question about Modules and Variable Scope
Message-Id: <Xns9660449E0BF09asu1cornelledu@127.0.0.1>

"Dean Hannotte" <dhannotte@nyc.rr.com> wrote in
news:MMAke.709$XB2.376051@twister.nyc.rr.com: 

[ please do not top-post ]

> "Anno Siegel" <anno4000@lublin.zrz.tu-berlin.de> wrote in message
> news:d6sk51$nio$6@mamenchi.zrz.TU-Berlin.DE...

>> Make config.pl export the variables and import them as needed.  The
>> variables have to be package variables for that.
>>
>> perldoc Exporter.
>
> Are you implying that I should turn 'config.pl' itself into a module
> (i.e. 'config.pm') and then issue 'use config;' both in my scripts and
> from inside 'cms.pm'?

I doubt Anno is recommending that you use the name 'config.pm'.

Sinan
-- 
A. Sinan Unur <1usa@llenroc.ude.invalid>
(reverse each component and remove .invalid for email address)

comp.lang.perl.misc guidelines on the WWW:
http://mail.augustmail.com/~tadmc/clpmisc/clpmisc_guidelines.html


------------------------------

Date: 24 May 2005 10:59:08 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Question about Modules and Variable Scope
Message-Id: <d6v1ds$cr4$3@mamenchi.zrz.TU-Berlin.DE>

Dean Hannotte <dhannotte@nyc.rr.com> wrote in comp.lang.perl.misc:

> "Anno Siegel" <anno4000@lublin.zrz.tu-berlin.de> wrote in message
> news:d6sk51$nio$6@mamenchi.zrz.TU-Berlin.DE...
> > Dean Hannotte <dhannotte@nyc.rr.com> wrote in comp.lang.perl.misc:

[top-posting rearranged.  please don't do that]


[...]

> > > 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.

> Are you implying that I should turn 'config.pl' itself into a module (i.e.
> 'config.pm') and then issue 'use config;' both in my scripts and from inside
> 'cms.pm'?

Yes, though module names should begin upper-cased.  Lower-case names
are reserved for pragmas.

> In that case, might it not be easier to merge 'config.pm' and 'cms.pm' into
> one file? Thanks!

The purpose of a configuration file (whether technically a module or
not) is to keep some declarations and definitions apart from the
rest of he software.  Incorporating it in the main module means
you won't have a configuration file but a configuration section
in the module.

Your call.

Anno



------------------------------

Date: 24 May 2005 11:00:51 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Question about Modules and Variable Scope
Message-Id: <d6v1h3$cr4$4@mamenchi.zrz.TU-Berlin.DE>

A. Sinan Unur <1usa@llenroc.ude.invalid> wrote in comp.lang.perl.misc:
> "Dean Hannotte" <dhannotte@nyc.rr.com> wrote in
> news:MMAke.709$XB2.376051@twister.nyc.rr.com: 
> 
> [ please do not top-post ]
> 
> > "Anno Siegel" <anno4000@lublin.zrz.tu-berlin.de> wrote in message
> > news:d6sk51$nio$6@mamenchi.zrz.TU-Berlin.DE...
> 
> >> Make config.pl export the variables and import them as needed.  The
> >> variables have to be package variables for that.
> >>
> >> perldoc Exporter.
> >
> > Are you implying that I should turn 'config.pl' itself into a module
> > (i.e. 'config.pm') and then issue 'use config;' both in my scripts and
> > from inside 'cms.pm'?
> 
> I doubt Anno is recommending that you use the name 'config.pm'.

I almost did, overlooking the non-conformal spelling.  Thanks for
the pointer.

Anno


------------------------------

Date: Tue, 24 May 2005 14:08:32 +0200
From: Alexandre Jaquet <alexj@freesurf.ch>
Subject: sendmail windows trouble
Message-Id: <42931940$0$1148$5402220f@news.sunrise.ch>

Hi,

I'm been using indigo sendmail windows portage in windows xp and I'm 
having some trouble when I using it.

with this code (in cgi env using apache2)

sub sendNewRegistrationMail {
     my $email = shift || '';
     my $username = shift || '';
     my $password = shift || '';
     my $user_name = shift || '';
     my $first_name = shift || '';

     my $sendmail = "sendmail";
     my $tempfile = "temp.msg";

     open(MAIL,">$tempfile");
     print MAIL "To: $user_name $first_name <$email>\n";
     print MAIL "From: Webmaster <test\@host.com>\n";
     print MAIL "Subject: This is the subject\n\n";

     print MAIL "This is the body of the message\n";
     print MAIL "This is line 2\n";
     close (MAIL);

     system("$sendmail -t -messagefile=$tempfile");

}

I got [Tue May 24 14:03:36 2005] [error] [client 127.0.0.1] 'sendmail' 
is not reconize as a internal program, referer: 
http://127.0.0.1/cgi-bin/recordz.cgi?lang=fr&page=register


I've added my sendmail path in the PATH var but still doesn't work.

Any idea ?

Thanks in advance

Alexandre Jaquet


------------------------------

Date: Tue, 24 May 2005 09:08:59 -0500
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: sendmail windows trouble
Message-Id: <slrnd96dbr.i4e.tadmc@magna.augustmail.com>

Alexandre Jaquet <alexj@freesurf.ch> wrote:


>      my $tempfile = "temp.msg";


CGI programs run in a multitasking environment, the file could get
corrupted if two users hit this program at the same time...


>      open(MAIL,">$tempfile");


You should always, yes *always*, check the return value from open():

    open(MAIL,">$tempfile") or die "could not open '$tempfile'  $!";


> I got 


You did?


> [Tue May 24 14:03:36 2005] [error] [client 127.0.0.1] 'sendmail' 
> is not reconize as a internal program, referer: 
         ^^^^^^^^
> http://127.0.0.1/cgi-bin/recordz.cgi?lang=fr&page=register


Please do not re-type error messages, use copy/paste instead.


> I've added my sendmail path in the PATH var but still doesn't work.
> 
> Any idea ?


Use an absolute path to sendmail rather than relying on the PATH mechanism.


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


------------------------------

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 8109
***************************************


home help back first fref pref prev next nref lref last post