Hi,

I am frustrated trying to cleanly finish a request at the right time,
just after sending a redirect to the browser. I'm calling 'exit' not
from the Embperl templates themselves, but from a module I'm including
providing several utility functions. For completeness sake, here is
this particular function:

sub redirect {
    # Redirect the request to a new page inside the system (preceded by
    # $epreq->{conf}{base_url}) - and stop processing before doing any
    # further harm
    my ($self, $to);
    $self = shift;
    $to = $self->{epreq}->{conf}->base_url . '/' . shift;

    $to =~ s!/+!/!g;

    $self->{headers}{Location} = $to;
    exit(301);
}

Now, this works. However, it fills my logs with useless messages. If I
use it this particular way, I get:

[Wed Dec 06 17:38:37 2006] [error] [25086]ERR:  24:  Error in Perl code: 
ModPerl::Util::exit: (120000) exit was called at 
/home/gwolf/cvs/iiec_minisist/SmbGate/trunk/lib//SmbGate/Embperl/WebClient.pm 
line 48

If instead of calling just exit I call Apache::exit (I'm running under
mod_perl): 

[Wed Dec 06 17:44:31 2006] [error] [25086]ERR:  24:  Error in Perl code: 
Undefined subroutine &Apache::exit called at 
/home/gwolf/cvs/iiec_minisist/SmbGate/trunk/lib//SmbGate/Embperl/WebClient.pm 
line 48.

Ok, I'm under mod_perl2, so I tried Apache2::exit:

[Wed Dec 06 17:46:48 2006] [error] [25086]ERR:  24:  Error in Perl code: 
Undefined subroutine &Apache2::exit called at 
/home/gwolf/cvs/iiec_minisist/SmbGate/trunk/lib//SmbGate/Embperl/WebClient.pm 
line 48.\n

Umh... In some documentation, I read about ModPerl::Util::exit - Still:

[Wed Dec 06 17:52:27 2006] [error] [25086]ERR:  24:  Error in Perl code: 
ModPerl::Util::exit: (120000) exit was called at 
/home/gwolf/cvs/iiec_minisist/SmbGate/trunk/lib//SmbGate/Embperl/WebClient.pm 
line 48

Tried also with Embperl::exit:

[Wed Dec 06 19:47:32 2006] [error] [25086]ERR:  24:  Error in Perl code: 
component at 
/home/gwolf/cvs/iiec_minisist/SmbGate/trunk/lib//SmbGate/Embperl/WebClient.pm 
line 48.\n

So... What should I do? Where is my logic failing?

Greetings,

-- 
Gunnar Wolf - [EMAIL PROTECTED] - (+52-55)5623-0154 / 1451-2244
PGP key 1024D/8BB527AF 2001-10-23
Fingerprint: 0C79 D2D1 2C4E 9CE4 5973  F800 D80E F35A 8BB5 27AF

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to