[Webtek-devel] Session methods
Status: Alpha
Brought to you by:
prozessor13
From: Adrian S. <adr...@gm...> - 2008-09-04 15:48:30
|
I thought it would be nice to be able to define my own methods on the Session class. In other frameworks, it's possible to subclass the Session class, add extra attributes (not necessary in the case of WebTek) and add extra methods. I thought it might be nice if this happened automatically. So I added code in the Session class to check for the existance of an AppName::Session. If it's there, it's used, otherwise the standard WebTek::Session is used. However, i didn't get on very well. Firstly the AppName::Session is not automatically loaded (AppName::Classname is not loaded; AppName::Package::Classname is, which I didn't expect), and then I had a problem where the compiler went into an infinite loop when I tried to automatically load the class from somewhere else (I've no idea why) and so I gave up on automatic loading and put "use AppName::Session" in the Handler.pm. The module is loaded, but now I get the error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1' in delete from session where I.e. it tries to execute the statement "delete from session where" with no where condition, as far as I can see. Well, I shall continue trying tomorrow. Currently I have spent about 2 hours on this feature. It is just to display a different text if a certain condition is true, if certain attributes are set on the session at the same time, i.e. all I need is one utility method actually! Maybe I can give up on this approach if it is not possible, and e.g. put the utility method somewhere else e.g. global function somewhere. Do you have any advice on this matter? Thanks, Adrian |