You are viewing a plain text version of this content. The canonical link for it is here.
Posted to embperl@perl.apache.org by alan milligan <al...@hotmail.com> on 2001/08/31 18:44:33 UTC

Modelling

JSP has a tag where as long as you haven't written to OUT, you can forward 
all output from the current file to another, abandoning all consequent 
instructions in this file.  I have been trying to achieve similar using 
Embperl, to little success (probably because my Apache knowledge is rather 
limited ...).  The following stub indicates what I want to do: if the 
authorise function fails, hand the request to /public/secviolation.html and 
don't present any of the rest of the page.

<html>
  <head>
    <link rel="stylesheet" href="/balclutha.css">
  </head>
    [!
    use DBIx::Recordset;
sub authorise(%) {
  my ($argref) = @_;
  $$argref{errorpage} ||= '/public/secviolation.html';
  if (!exists $udat{user} ||
      exists $$argref{group} &&  !$udat{user}->hasgroup($$argref{group})) {

    my $r = Apache->request;
    $r->internal_redirect_handler($$argref{errorpage});
  }
}
    !]
    <body>

      [* authorise( { group => 'aadmin' } ); *]
      <h4>Operations Control</h4>
      <h4>Clients</h4>
      <table>
      ......

However, this does the contents of the redirect and continues to present the 
page.  In fact, it splits the contents of the page over two HTTP requests.  
Does anyone know how this should be done properly?

Cheers, Alan

_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp


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


Re: Modelling

Posted by Gerald Richter <ri...@ecos.de>.
----- Original Message -----
From: "alan milligan" <al...@hotmail.com>
To: <em...@perl.apache.org>
Sent: Friday, August 31, 2001 4:44 PM
Subject: Modelling <jsp:forward>


> limited ...).  The following stub indicates what I want to do: if the
> authorise function fails, hand the request to /public/secviolation.html
and
> don't present any of the rest of the page.
>

do a

[- if (!authorise)
    {
    $http_headers_out{Location} = '/public/secviolation.html' ;
    exit ;
    }
-]

here comes some more html

Gerald


-------------------------------------------------------------
Gerald Richter    ecos electronic communication services gmbh
Internetconnect * Webserver/-design/-datenbanken * Consulting

Post:       Tulpenstrasse 5         D-55276 Dienheim b. Mainz
E-Mail:     richter@ecos.de         Voice:    +49 6133 925131
WWW:        http://www.ecos.de      Fax:      +49 6133 925152
-------------------------------------------------------------




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