Re: [cgiapp] redirecting to another location

2003-06-17 Thread Steve Hay
Hi all,

Scott Hepler wrote:

FWIW, I had to change the "use CGI::Carp" to "use Carp" near the top of
CGI::Application to get useful debugging info when running from the command
line (saw this in the archive somewhere).
 

I couldn't help jumping on this comment as another opportunity to make 
this request again.

Twice before I've asked for "use CGI::Carp" to be changed to "use Carp" 
and I've never heard any disagreement.  Last week I even posted a patch 
that would give use'rs the *option* of making this change (the default 
situation being unchanged to maintain backwards compatibility).  But 
I've yet to hear a final verdict on it.

Are you out there, Jesse?

Steve

-
Web Archive:  http://www.mail-archive.com/[EMAIL PROTECTED]/
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: [cgiapp] redirecting to another location

2003-06-17 Thread Scott Hepler
Steve and Brian:

Thanks for the help -- this works beautifully, of course.

FWIW, I had to change the "use CGI::Carp" to "use Carp" near the top of
CGI::Application to get useful debugging info when running from the command
line (saw this in the archive somewhere).

Thanks again,
s.

On Tue, Jun 17, 2003 at 11:14:21AM -0400, Steve Comrie wrote:
> Scott,
> 
> Try this instead
> 
> sub cgiapp_prerun
> {
>$self->prerun_mode('redirect_to_perl') if( $req_not_met );
> }
> 
> sub redirect_to_perl
> {
> my $self= shift;
> $self->header_props (-uri => 'http://www.perl.com/');
> $self->header_type ('redirect');
> return 1;
> }
> 
> The prerun_mode() method is used to change the run-mode that will be called
> upon exiting cgiapp_prerun(). Unless you change the run mode specifically to
> something else, CGI::App will still try to execute the runmode it thinks
> it's supposed to run.
> 
> > Hi Folks:
> >
> > I know I'm being dense, but I can't wrap my head around this
> >
> > I have a situation where I need to redirect to another location (outside
> of
> > this cgiapp) if certain security requirements aren't met.  So, I do this
> in
> > cgiapp_prerun:
> >
> > if ($req_not_met) {
> > $self->header_props (-uri => 'http://www.perl.com/');
> > $self->header_type ('redirect');
> > return $self->emptiness;
> > }
> >
> > and sub emptiness is just:
> >
> > sub emptiness {
> > return 1;
> > }
> >
> > This prints the correct HTTP header:
> >
> > Status: 302 Moved
> > Location: http://www.perl.com/
> >
> > BUT, it also prints the output of my runmode which should be run if the
> > requirements _are_ met.
> >
> > I've experimented with postrun, teardown, etc., but can find no joy.
> >
> > If anyone has any helpful thoughts or gentle dope-slaps, I'd be glad for
> > them.
> >
> > TIA,
> > s.
> >
> > -- 
> > Scott Hepler
> > System Administration and Security
> > Web Development
> > (802) 457-3796
> >
> > -
> > Web Archive:  http://www.mail-archive.com/[EMAIL PROTECTED]/
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
> 
> 
> -
> Web Archive:  http://www.mail-archive.com/[EMAIL PROTECTED]/
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 

-- 
Scott Hepler
System Administration and Security
Web Development
(802) 457-3796

-
Web Archive:  http://www.mail-archive.com/[EMAIL PROTECTED]/
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [cgiapp] redirecting to another location

2003-06-17 Thread Brian . T . Wightman
You will also want to return "undef" or "" from redirect_to_perl, not "1",
or (I believe), you will get "1" as the contents of your document, rather
than an empty "moved" document.

my $two_cents;
Brian

Brian T. Wightman
[EMAIL PROTECTED]
414.524.4025


   
   
  [EMAIL PROTECTED]
   
  ware.ca  To:   [EMAIL PROTECTED] 

   cc: 
   
      06/17/2003 10:14     Subject:  Re: [cgiapp] redirecting to 
another location 
  AM   
   
   
   
   
   




Scott,

Try this instead

sub cgiapp_prerun
{
   $self->prerun_mode('redirect_to_perl') if( $req_not_met );
}

sub redirect_to_perl
{
my $self= shift;
$self->header_props (-uri => 'http://www.perl.com/');
$self->header_type ('redirect');
return 1;
}

The prerun_mode() method is used to change the run-mode that will be called
upon exiting cgiapp_prerun(). Unless you change the run mode specifically
to
something else, CGI::App will still try to execute the runmode it thinks
it's supposed to run.

> Hi Folks:
>
> I know I'm being dense, but I can't wrap my head around this
>
> I have a situation where I need to redirect to another location (outside
of
> this cgiapp) if certain security requirements aren't met.  So, I do this
in
> cgiapp_prerun:
>
> if ($req_not_met) {
> $self->header_props (-uri => 'http://www.perl.com/');
> $self->header_type ('redirect');
> return $self->emptiness;
> }
>
> and sub emptiness is just:
>
> sub emptiness {
> return 1;
> }
>
> This prints the correct HTTP header:
>
> Status: 302 Moved
> Location: http://www.perl.com/
>
> BUT, it also prints the output of my runmode which should be run if the
> requirements _are_ met.
>
> I've experimented with postrun, teardown, etc., but can find no joy.
>
> If anyone has any helpful thoughts or gentle dope-slaps, I'd be glad for
> them.
>
> TIA,
> s.
>
> --
> Scott Hepler
> System Administration and Security
> Web Development
> (802) 457-3796
>
> -
> Web Archive:  http://www.mail-archive.com/[EMAIL PROTECTED]/
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


-
Web Archive:  http://www.mail-archive.com/[EMAIL PROTECTED]/
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]






-
Web Archive:  http://www.mail-archive.com/[EMAIL PROTECTED]/
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [cgiapp] redirecting to another location

2003-06-17 Thread Steve Comrie
Scott,

Try this instead

sub cgiapp_prerun
{
   $self->prerun_mode('redirect_to_perl') if( $req_not_met );
}

sub redirect_to_perl
{
my $self= shift;
$self->header_props (-uri => 'http://www.perl.com/');
$self->header_type ('redirect');
return 1;
}

The prerun_mode() method is used to change the run-mode that will be called
upon exiting cgiapp_prerun(). Unless you change the run mode specifically to
something else, CGI::App will still try to execute the runmode it thinks
it's supposed to run.

> Hi Folks:
>
> I know I'm being dense, but I can't wrap my head around this
>
> I have a situation where I need to redirect to another location (outside
of
> this cgiapp) if certain security requirements aren't met.  So, I do this
in
> cgiapp_prerun:
>
> if ($req_not_met) {
> $self->header_props (-uri => 'http://www.perl.com/');
> $self->header_type ('redirect');
> return $self->emptiness;
> }
>
> and sub emptiness is just:
>
> sub emptiness {
> return 1;
> }
>
> This prints the correct HTTP header:
>
> Status: 302 Moved
> Location: http://www.perl.com/
>
> BUT, it also prints the output of my runmode which should be run if the
> requirements _are_ met.
>
> I've experimented with postrun, teardown, etc., but can find no joy.
>
> If anyone has any helpful thoughts or gentle dope-slaps, I'd be glad for
> them.
>
> TIA,
> s.
>
> -- 
> Scott Hepler
> System Administration and Security
> Web Development
> (802) 457-3796
>
> -
> Web Archive:  http://www.mail-archive.com/[EMAIL PROTECTED]/
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


-
Web Archive:  http://www.mail-archive.com/[EMAIL PROTECTED]/
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



[cgiapp] redirecting to another location

2003-06-17 Thread Scott Hepler
Hi Folks:

I know I'm being dense, but I can't wrap my head around this

I have a situation where I need to redirect to another location (outside of
this cgiapp) if certain security requirements aren't met.  So, I do this in
cgiapp_prerun:

if ($req_not_met) {
$self->header_props (-uri => 'http://www.perl.com/');
$self->header_type ('redirect');
return $self->emptiness;
}

and sub emptiness is just:

sub emptiness {
return 1;
}

This prints the correct HTTP header:

Status: 302 Moved
Location: http://www.perl.com/
 
BUT, it also prints the output of my runmode which should be run if the
requirements _are_ met.

I've experimented with postrun, teardown, etc., but can find no joy.

If anyone has any helpful thoughts or gentle dope-slaps, I'd be glad for
them.

TIA,
s.

-- 
Scott Hepler
System Administration and Security
Web Development
(802) 457-3796

-
Web Archive:  http://www.mail-archive.com/[EMAIL PROTECTED]/
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]