logo       

Re: Best way to keep a value for entire session: msg#00097

Subject: Re: Best way to keep a value for entire session
On 9/14/05 11:50 PM, "Ski Kacoroski" <kacoroski@xxxxxxxxxxx> wrote:

> Hi,
> 
> I am creating a password changing page and I have to use expect to
> access Mac OSX open directory where the passwords reside.  Is there a
> nice way where I could make the connection in the cgiapp_init script and
> then have it available for the entire app (kind of like the dbh plugin).
> Right now I create and break the connection each time I need it in the
> application.
> 
> Thanks in advance.


Could you do something like this in your app (or in your cgiapp subclass if
you want it to be reused):

sub od_connection {
    my $self = shift;

    #connection already exists from before....
    return ($self->{_od_connection}) if (exists($self->{_od_connection}));

    #need to make connection, because it
    #doesn't already exist
    my $connection = ......

    $self->{_od_connection} = $connection;
    return $connection;
}

I haven't tested this and I don't know how you are making your connection to
the Open Directory server (fill in the '....' above), but I hope you get the
idea.  The first time this is called, either in cgiapp_init or, better, only
when needed (for some requests, you won't need the connection, so why make
it at all for those requests), the connection is made and stored.  The
second and all subsequent times, you get the same connection object.  Don't
forget to do error checking when making the connection.

HTH,
Sean


---------------------------------------------------------------------
Web Archive:  http://www.mail-archive.com/cgiapp@xxxxxxxxxxxxxxxxx/
              http://marc.theaimsgroup.com/?l=cgiapp&r=1&w=2
To unsubscribe, e-mail: cgiapp-unsubscribe@xxxxxxxxxxxxxxxxx
For additional commands, e-mail: cgiapp-help@xxxxxxxxxxxxxxxxx




<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Recently Viewed:
linux.arklinux....    user-groups.lin...    kde.usability/2...    ietf.ipp/2002-0...    mail.spam.spamc...    os.netbsd.devel...    audio.cd-record...    text.unicode.de...    php.documentati...    games.fps.halfl...    window-managers...    suse.oracle.gen...    bug-tracking.gn...    video.dvdrip.us...    xfree86.cvs/200...    java.netbeans.m...    network.argus/2...    culture.sf.kill...    debian.ports.al...    freebsd.questio...    qplus.devel/200...    handhelds.palm....   
Home | blog view | USPTO Patent Archive | advertise | OSDir is an inevitable website. super tiny logo

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe