Hi all,

It turns out that I didn't read the "init_code" instructions well 
enough.  When I removed the sub {} (which aren't required) the script 
threw an unknown function "redirect" error.  I just added "use CGI 
qw/:standard/; " and now it works.

Thanks for the help.

keith

Keith Anthony Boroevich wrote:
> Thanks Sheldon,
>
> Yes I've tried "init_code".  The redirect (returned or printed) for 
> that section is making it to the browser as I don't think the 
> init_code option was intended to do this.  I have the following in my 
> init_code section.
> ---- BEGIN CODE ----
> init_code = sub {
>    use lib '/home/asalbase/dev/perl-lib';
>    use ASBcommon;
>    my $session = ASBcommon::start_session();
>    my $referer = '/';
>    if (! defined $session->param('access')) {
>      $session->param('warn',"Error: Must be logged in to access.");
>      return redirect({uri=>$referer});
>    } elsif ($session->param('access') < 1) {
>      $session->param('warn',"Error: Insufficient Access Level.");
>      return redirect({uri=>$referer});
>    }
>    return;
>  }
> ---- END CODE ----
>
> keith
>
>
> Sheldon McKay wrote:
>> Hi Keith,
>>
>> Have you tried the init_code option?
>>
>> Sheldon
>>
>> On Feb 13, 2008 12:10 PM, Keith Anthony Boroevich 
>> <[EMAIL PROTECTED]> wrote:
>>  
>>> Hi all,
>>>
>>> I was wondering if there are any sections of the configuration file 
>>> that
>>> will interpret/execute a perl subroutine before any html code is
>>> printed?  I want to have gbrowse behind session based authentication,
>>> and thus redirect to the log-in page if the user is not authenticated.
>>> Therefore if there is a section that I could add a sub{} to check this
>>> before the "Content-type" is printed (so that the redirect will work),
>>> that would be great.  If not I suppose I will just edit the actual
>>> gbrowse file.
>>>
>>> Also, if there isn't such a section, would there be any interest in
>>> adding one?  It seems like a trivial feature that might be useful in
>>> many cases.
>>>
>>> Keith
>>>
>>> ------------------------------------------------------------------------- 
>>>
>>> This SF.net email is sponsored by: Microsoft
>>> Defy all challenges. Microsoft(R) Visual Studio 2008.
>>> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
>>> _______________________________________________
>>> Gmod-gbrowse mailing list
>>> [email protected]
>>> https://lists.sourceforge.net/lists/listinfo/gmod-gbrowse
>>>
>>>     
>>
>>
>>
>>   
>

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Gmod-gbrowse mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gmod-gbrowse

Reply via email to