On 17 Sep 98, at 15:57, Ivan Sergio Borgonovo wrote:

> On 16 Sep 98, at 22:47, [EMAIL PROTECTED] wrote:
> 
> >    Thanks to Ivan, I now have cookies!  That was the simplest
> >    explanation
> > of the bunch, and I do like simplicity.  One added line in the headers,
> > and an extra environmental variable to check.  Simplicity!
> 
> -- snip --
> 
> >    Peter, I appreciate your comments about subroutines, but calling a
> > subroutine for a one line function just isn't efficient.  An awful lot
> > of the functions I see in programs are one or two liners that are not
> > available in other languages.  Knowledge is more readily transportable
> > across platforms, and the more knowledge you accumulate, the more chance
> > some of it will distill into wisdom. But sometimes, I too use short
> > subroutines. It just depends. 

My general rule is that if I have to do the same thing twice then I 
go subroutine.

I find this very simple, fast.  I can use &get_cookies in any script 
to get the cookies.  I once did cookies manually but this is easier, 
quicker.

my $hr_cookie = &get_cookies;

my $password = $hr_cookie->{'password'};
my $user_id =  $hr_cookie->{'user_id'};
my $email = $hr_cookie->{'email'};

And to write a cookie(s):

my $cookie_user = $q->cookie(-name=>'user_id',-value=>"$user_id");
my $cookie_email = $q->cookie(-name=>'email',-value=>"$email");

print $q->header(-cookie=>[$cookie_user,$cookie_email]);

But knowing what is going on  is very important.  

I just write too many scripts to have to re-write or cut-and-past.  
ASAP I am going full OO.

Peter

____________________________________________________________________
--------------------------------------------------------------------
 Join The Web Consultants Association :  Register on our web site Now
Web Consultants Web Site : http://just4u.com/webconsultants
If you lose the instructions All subscription/unsubscribing can be done
directly from our website for all our lists.
---------------------------------------------------------------------

Reply via email to