FAQ
Hi,

I'm using embperl 1.3.6 on RedHat linux 9 with Apache 1.3.31 with
mod_perl 1.29. I'm encountering some strange behaviour with the mailing
package. I have an embperl file calling a method in a package I'm
written. This method does some work (processes a credit-card payment)
and returns the results as a hash reference. Then the .epl does a
little more work and calls HTML::Embperl::Mail::Execute() to send a
notice to the customer.

The strangeness I'm seeing is that the HTML::Embperl::Execute() called
inside HTML::Embperl::Mail::Execute() successfully parses and rendered
the email template but returns a non-empty errors array with a string
identical to a warn debugging message issued in the credit card
processing package. If I comment out the warn statements in the
package, the mailer works. How is it that Embperl (in the C code?) has
access to the warn message and uses it to claim an error message?

Dan


---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org

Search Discussions

  • Gerald Richter at Jun 24, 2004 at 5:59 am

    The strangeness I'm seeing is that the HTML::Embperl::Execute() called
    inside HTML::Embperl::Mail::Execute() successfully parses and rendered
    the email template but returns a non-empty errors array with a string
    identical to a warn debugging message issued in the credit card
    processing package. If I comment out the warn statements in the
    package, the mailer works. How is it that Embperl (in the C code?)
    has access to the warn message and uses it to claim an error message?
    Embperl gather all errors and warining messages that occurs during the
    processing of an Embperl request in the error array. It does not make a
    difference if this errors or warings occurs inside the Emberl page it self
    or inside a modul it calls.

    The return code from Execute tells you if there is only a warning or an
    error (on error Execute returns a non zero value)

    Gerald

    ---------------------------------------------------------------------------
    Gerald Richter ecos electronic communication services gmbh
    IT-Securitylösungen * Webapplikationen mit Apache/Perl/mod_perl/Embperl

    Post: Tulpenstrasse 5 D-55276 Dienheim b. Mainz
    E-Mail: richter@ecos.de Voice: +49 6133 939-122
    WWW: http://www.ecos.de/ Fax: +49 6133 939-333
    ---------------------------------------------------------------------------
    ECOS BB-5000 Firewall- und IT-Security Appliance: www.bb-5000.info
    ---------------------------------------------------------------------------


    ---------------------------------------------------------------------
    To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
    For additional commands, e-mail: embperl-help@perl.apache.org
  • Maurice McCabe at Jul 2, 2004 at 11:49 pm
    I am installing on a shared Windows Server running IIS and want to be
    able to run embpcgi.pl as a regular CGI script (no file extension
    mapping is available, since not supported in this ISP's shared
    environment). By default, in CGI mode, IIS does not generate the correct
    value for PATH_TRANSLATED, so I created a fix that gets around the
    problem that I would like to share.

    Adding the following to your embpcgi.pl will allow you to run on IIS
    using a URL like:
    http://www.mycompany.com/cgi-bin/embpcgi.pl/myembperlapplication/index.h
    tm
    (This fix still behaves correctly when using file extension mapping
    allowing you to run in either mode)

    BEGIN {
    if ($^O eq "MSWin32" && $#ARGV == -1) {
    my $SCRIPT_FILENAME=$0;
    my ($path_info) = $ENV{PATH_INFO} =~ /^$ENV{SCRIPT_NAME}(.*)$/;
    my $SCRIPT_NAME = $ENV{SCRIPT_NAME};
    $SCRIPT_NAME =~ s/\//\\\\/g;
    my ($document_root) = $SCRIPT_FILENAME =~ /^(.*)$SCRIPT_NAME.*/;
    $ENV{PATH_TRANSLATED}=$document_root . $path_info;
    }
    }

    This fix is not restricted for use with Embperl or even with Perl (may
    involve more coding if rewritten in another language). It should work
    for any CGI application running on IIS that uses PATH_TRANSLATED.

    Hope this helps some folks out there that have been looking for this.

    BTW: With this fix, I can confirm that Embperl will run in a shared
    Windows environment running IIS and Perl. (Requires only FTP and setting
    of @INC to install. Must have precompiled non-modperl version of Embperl
    for windows available from Randy Kobes)

    Maurice


    ---------------------------------------------------------------------
    To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
    For additional commands, e-mail: embperl-help@perl.apache.org
  • Filin at Jul 5, 2004 at 8:19 am
    I have a trouble with using of output of embperl procedures. E.g. there is following declaration in some file:
    [$ sub somesub $]Some text[$ endsub $]

    If I want to catch output of somesub, I can:
    Execute({inputfile=>"file", import=>0});
    Execute({inputfile=>"file", sub=>'somesub', output=>\$str});

    But what if I need to use something like:
    $file=Execute({object=>"file"});
    $file->somesub();

    How can I catch output in this case?
    It is possible of course just to replace [$ sub somesub ... $] with [! sub somesub {...} !],
    but I would be VERY glad to hear that it isn't the only decision.

    Please help me.

    (I use Embperl 1.3.6)

    ---
    Owl


    ---------------------------------------------------------------------
    To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
    For additional commands, e-mail: embperl-help@perl.apache.org
  • Gerald Richter at Jul 6, 2004 at 4:16 am

    Filin wrote:
    I have a trouble with using of output of embperl procedures. E.g.
    there is following declaration in some file: [$ sub somesub $]Some
    text[$ endsub $]

    If I want to catch output of somesub, I can:
    Execute({inputfile=>"file", import=>0});
    Execute({inputfile=>"file", sub=>'somesub', output=>\$str});

    But what if I need to use something like:
    $file=Execute({object=>"file"});
    $file->somesub();

    How can I catch output in this case?
    It is possible of course just to replace [$ sub somesub ... $] with
    [! sub somesub {...} !],
    but I would be VERY glad to hear that it isn't the only decision.
    You cannot directly catch the output of a method, but you can create a
    wrapper:

    [!
    sub wrapper
    {
    $param[0]->$param[1]() ;
    }
    !]

    call it via

    Execute({inputfile=>"file", sub=>'wrapper', output=>\$str, param => [$file,
    'somesub']});

    Gerald



    ---------------------------------------------------------------------------
    Gerald Richter ecos electronic communication services gmbh
    IT-Securitylosungen * Webapplikationen mit Apache/Perl/mod_perl/Embperl

    Post: Tulpenstrasse 5 D-55276 Dienheim b. Mainz
    E-Mail: richter@ecos.de Voice: +49 6133 939-122
    WWW: http://www.ecos.de/ Fax: +49 6133 939-333
    ---------------------------------------------------------------------------
    ECOS BB-5000 Firewall- und IT-Security Appliance: www.bb-5000.info
    ---------------------------------------------------------------------------


    ---------------------------------------------------------------------
    To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
    For additional commands, e-mail: embperl-help@perl.apache.org
  • Filin at Jul 7, 2004 at 4:16 pm
    Thank you, Gerald. Your recipe is perfectly good for me, but I have new
    questions about catching output (Embperl 1.3.6).

    Let us assume that we have next three files:

    some.epl
    Some text (Content does not matter)

    title.epl
    [- die "Die in title.epl, " -]
    Test

    test.epl
    <H1>[- Execute('title.epl'); # should die there -]</H1>
    [-
    Execute({
    inputfile=>"some.html",
    output=>\$res,
    });

    #print OUT $res;
    -]
    <hr>
    I am alive. Why!?!


    I thought that execution of test.html should die in the title.epl.
    However, it doesn't.

    Well, it will die, but _only_ if we comment the "output=>\$res" in the test.epl.

    Moreover, the most strange for me: if we uncomment "#print OUT $res", we'll
    discover that there are lost error messages in the $res. Why it is so, if we
    didn't try to catch output of "Execute('title.epl')"?

    I dont understand what's happening. :(
    Could some kind person explain it for me?

    Thanks.
    ---
    Filin




    ---------------------------------------------------------------------
    To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
    For additional commands, e-mail: embperl-help@perl.apache.org
  • Gerald Richter at Jul 8, 2004 at 12:17 pm
    Hi,
    title.epl
    [- die "Die in title.epl, " -]
    Test
    In 1.3.6 "die" only ends the current block, not the file. If you want to end
    processing of the file, you have to use exit, but exit only ends the
    proessing of the current file, the caller will still continue. You have to
    catch it somehow there.

    Embperl 2 has a better die and exit handling (see README.v2)

    Gerald


    ---------------------------------------------------------------------------
    Gerald Richter ecos electronic communication services gmbh
    IT-Securitylosungen * Webapplikationen mit Apache/Perl/mod_perl/Embperl

    Post: Tulpenstrasse 5 D-55276 Dienheim b. Mainz
    E-Mail: richter@ecos.de Voice: +49 6133 939-122
    WWW: http://www.ecos.de/ Fax: +49 6133 939-333
    ---------------------------------------------------------------------------
    ECOS BB-5000 Firewall- und IT-Security Appliance: www.bb-5000.info
    ---------------------------------------------------------------------------


    ---------------------------------------------------------------------
    To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
    For additional commands, e-mail: embperl-help@perl.apache.org
  • Sherwin at Jul 8, 2004 at 12:56 pm

    On Thu, Jul 08, 2004 at 02:16:53PM +0200, Gerald Richter wrote:
    In 1.3.6 "die" only ends the current block, not the file. If you want to end
    processing of the file, you have to use exit, but exit only ends the
    proessing of the current file, the caller will still continue. You have to
    catch it somehow there.
    Gerald,

    By exit, do you mean CORE::exit? Can the poster use Apache::exit to
    achieve what he wants in 1.3.6?


    ---------------------------------------------------------------------
    To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
    For additional commands, e-mail: embperl-help@perl.apache.org
  • Gerald Richter at Jul 8, 2004 at 2:43 pm

    Sherwin wrote:
    On Thu, Jul 08, 2004 at 02:16:53PM +0200, Gerald Richter wrote:
    In 1.3.6 "die" only ends the current block, not the file. If you
    want to end processing of the file, you have to use exit, but exit
    only ends the proessing of the current file, the caller will still
    continue. You have to catch it somehow there.
    Gerald,

    By exit, do you mean CORE::exit? Can the poster use Apache::exit to
    achieve what he wants in 1.3.6?
    Embperl overloads exit, so when you do call just exit Embperl will handle it
    for you (the same will happen if you call Apache::exit).

    If you call CORE::exit the process (Apache child) will exit imediately. You
    normaly don't want this

    Gerald

    ---------------------------------------------------------------------------
    Gerald Richter ecos electronic communication services gmbh
    IT-Securitylösungen * Webapplikationen mit Apache/Perl/mod_perl/Embperl

    Post: Tulpenstrasse 5 D-55276 Dienheim b. Mainz
    E-Mail: richter@ecos.de Voice: +49 6133 939-122
    WWW: http://www.ecos.de/ Fax: +49 6133 939-333
    ---------------------------------------------------------------------------
    ECOS BB-5000 Firewall- und IT-Security Appliance: www.bb-5000.info
    ---------------------------------------------------------------------------


    ---------------------------------------------------------------------
    To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
    For additional commands, e-mail: embperl-help@perl.apache.org
  • Filin at Jul 9, 2004 at 9:47 am

    Gerald Richter wrote:
    In 1.3.6 "die" only ends the current block, not the file. If you want to end
    processing of the file, you have to use exit, but exit only ends the
    proessing of the current file, the caller will still continue. You have to
    catch it somehow there.
    Mm... No, I do not understand something, in spite of your explanation.

    Let me say diversly:

    When I Execute one file (title.epl, and there is "die" in it) and after (or
    before) that try to catch output of another (output of some.epl, into $res), I
    receive error messages from title.epl (!) in $res variable.

    But I didn't try to catch output of title.epl at all!
    Why are they (errors from title.epl) sitting in the variable, which should
    contain the output of some.epl?

    This is my testing .epl file:

    <H1>[- Execute('title.epl'); # should die there -]</H1>
    [-
    Execute({
    inputfile=>"some.epl",
    output=>\$res,
    });

    print OUT $res;
    -]
    <hr>

    If there are no errors in title.epl than there are no questions. All
    happens exactly as expected.

    ---
    Filin





    ---------------------------------------------------------------------
    To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
    For additional commands, e-mail: embperl-help@perl.apache.org
  • Gerald Richter at Jul 12, 2004 at 7:41 pm

    When I Execute one file (title.epl, and there is "die" in it) and
    after (or before) that try to catch output of another (output of
    some.epl, into $res), I receive error messages from title.epl (!) in
    $res variable.
    Aah I see...

    Embperl accumulates all error during one request. To not receive the error,
    just reset Embperl error flag like

    [-
    $r = shift ; # embperl request object
    -]
    <H1>[- Execute('title.epl'); # should die there -]</H1>
    [-
    $r -> Error (0) ; # reset error flag
    Execute({
    inputfile=>"some.epl",
    output=>\$res,
    });

    print OUT $res;
    -]

    Hope this helps

    Gerald

    P.S. This only work with Embperl 1.x

    ---------------------------------------------------------------------------
    Gerald Richter ecos electronic communication services gmbh
    IT-Securitylosungen * Webapplikationen mit Apache/Perl/mod_perl/Embperl

    Post: Tulpenstrasse 5 D-55276 Dienheim b. Mainz
    E-Mail: richter@ecos.de Voice: +49 6133 939-122
    WWW: http://www.ecos.de/ Fax: +49 6133 939-333
    ---------------------------------------------------------------------------
    ECOS BB-5000 Firewall- und IT-Security Appliance: www.bb-5000.info
    ---------------------------------------------------------------------------


    ---------------------------------------------------------------------
    To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
    For additional commands, e-mail: embperl-help@perl.apache.org
  • Filin at Jul 13, 2004 at 8:17 am

    Embperl accumulates all error during one request. To not receive the error,
    just reset Embperl error flag like
    Aah I see...
    Hope this helps
    This helps. Thank you Gerald.
    P.S. This only work with Embperl 1.x
    Sorry for silly question, but:
    Does it means that in Embperl 2.x this problem has not descision, or
    just we have not such problem in 2.x?

    Thank you, again.

    ---
    Filin




    ---------------------------------------------------------------------
    To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
    For additional commands, e-mail: embperl-help@perl.apache.org
  • Gerald Richter at Jul 13, 2004 at 9:03 am

    Sorry for silly question, but:
    Does it means that in Embperl 2.x this problem has not descision, or
    just we have not such problem in 2.x?
    It still work withing 2.x, but Embperl 2.x has some API changes, so you need
    to use $r -> error instead of $r -> Error

    In 2.x you also has a chance to access the list of error that occured so
    far, by accessing $r -> errors, which return an array ref (or you can pass a
    array ref to set/reset the list of errors)

    Gerald

    ---------------------------------------------------------------------------
    Gerald Richter ecos electronic communication services gmbh
    IT-Securitylosungen * Webapplikationen mit Apache/Perl/mod_perl/Embperl

    Post: Tulpenstrasse 5 D-55276 Dienheim b. Mainz
    E-Mail: richter@ecos.de Voice: +49 6133 939-122
    WWW: http://www.ecos.de/ Fax: +49 6133 939-333
    ---------------------------------------------------------------------------
    ECOS BB-5000 Firewall- und IT-Security Appliance: www.bb-5000.info
    ---------------------------------------------------------------------------


    ---------------------------------------------------------------------
    To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
    For additional commands, e-mail: embperl-help@perl.apache.org

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupembperl @
categoriesmodperl, perl
postedJun 22, '04 at 4:27p
activeJul 13, '04 at 9:03a
posts13
users5
websiteperl.apache.org

People

Translate

site design / logo © 2022 Grokbase