posted by
pmsumner at 01:32am on 30/04/2002
perlCGI-phil99 version 1.01 now allows custom friend group posting. Gawd that was a nightmare. Problem after problem after problem. My solution to the final problem is cludgy - but it works. Anyhow, enough geekery for now. Explain later.
It's SODDING COLD! It's supposed to be summer yet I am sat with one hand either between my legs or under my armpits to try and get them warm enough to type without making LOADS of mistakes. It's supposed to be summer for Bob's sake.
Think of how a CGI script that's run on a webserver works. When you hit submit, it takes in some information from your browser, spits a page out based on that information, and then promptly forgets about it forever. There is no "easy" way to store information between pages. This was a problem with my handling of friend groups - I was downloading them from LJ at login, and then when the script ended, all data is effectively thrown away - meaning that when it came to run next time someone clicked submit, they were unavailable.
The solution... well, cludgy as all hell. It downloads the friends groups every time it spits out a page. This is really the only way to ensure that the friends groups displayed are up to date (you could make a new group on the LJ website while having my web page open) but I don't feel too happy about working it that way - it's yet more traffic to the LJ servers. There were other solutions possible - caching FGs on disk, or using hidden fields on the output pages. I'm not sure yet whether the hidden field solution might hold the real key to success.
My next trick to solve this will be to have the friend groups stored as cookies with a short expiration time - say, 10 minutes from being set. That way there shouldn't be a huge server overhead and it keeps data relatively fresh.
I need a drink :)
It's SODDING COLD! It's supposed to be summer yet I am sat with one hand either between my legs or under my armpits to try and get them warm enough to type without making LOADS of mistakes. It's supposed to be summer for Bob's sake.
Think of how a CGI script that's run on a webserver works. When you hit submit, it takes in some information from your browser, spits a page out based on that information, and then promptly forgets about it forever. There is no "easy" way to store information between pages. This was a problem with my handling of friend groups - I was downloading them from LJ at login, and then when the script ended, all data is effectively thrown away - meaning that when it came to run next time someone clicked submit, they were unavailable.
The solution... well, cludgy as all hell. It downloads the friends groups every time it spits out a page. This is really the only way to ensure that the friends groups displayed are up to date (you could make a new group on the LJ website while having my web page open) but I don't feel too happy about working it that way - it's yet more traffic to the LJ servers. There were other solutions possible - caching FGs on disk, or using hidden fields on the output pages. I'm not sure yet whether the hidden field solution might hold the real key to success.
My next trick to solve this will be to have the friend groups stored as cookies with a short expiration time - say, 10 minutes from being set. That way there shouldn't be a huge server overhead and it keeps data relatively fresh.
I need a drink :)
(no subject)
(no subject)
*staggers out the door, swaying slightly and hiccuping*
(no subject)
i am using it in my 3rd year project. (which i have a week to finish. shiiiiit)
(no subject)
Thanks for the heads up, looks useful - must investigate further. Don't have it installed by default with Activeperl though, feh.