[jifty-devel] Strange result with column named "log"!

Wolfgang Kinkeldei wolfgang at kinkeldei.de
Mon Sep 4 05:13:55 EDT 2006

Am 03.09.2006 um 01:27 schrieb Frederic BLANC:

>  Hello,
>  I found what I think to be namespace conflict between the  
> Jifty::Object
> log method and columns of the same name:
>  I was building a quick app to be the frontend of an existing database
> with one of its columns named "log", a legitimate name (IMO) for a  
> column
> designed to keep... log messages.
>  But after I started the server and connected to the Administration
> interface to check that I can access all the data, what was my  
> surprise
> to find the ref of a Log::Log4perl object instead of the expected
> log message!
>  After digging into Jifty's code, I found that this behaviour came  
> from
> the existence of the log method of the Object class, mother of
> (almost every Jifty classes including) the Jifty::Record class.

The same result will happen with any column name that is equal to a  
method of Jifty::Record or its superclasses Jifty::DBI::Record or  
Jifty::Object. This is due to the fact, that Jifty::DBI::Record  
constructs accessors for the column names by building subs to access  
the column's value.

Inside the admin mode, the actions access the values by calling

IDEA: by using overloading (use overload ('%{}' => sub {...}) on the  
Jifty::DBI::Record object could behave different when used in hash  
context and using a tied hash on the Record.
Then, any column's value could get retrieved (or set) by accessing:

However, then a couple of things would need a review and some  
modifications :-(

>  If I well understood the usage of the log method, it is supposed  
> to be
> a class method of the Jifty class, so maybe the method definition  
> should
> be moved to the Jifty.pm module?
>  Best regards,
>  Frederic BLANC
> PS: by the way, the Jifty module has a logger method that seems
>     to be used nowhere.

...but it could be used by frontend programmers.


Wolfgang Kinkeldei


' /\_/\ ' .print[split??,"".(($/=q|Cms)+-03467:;<=|)=~tr!C-z -B! -z!)x
'( o.o )' .$/]->[hex]foreach split qr<>,qq+1ecd039ad65b025b8063475b+||
' > ^ < ' .q<!-- Wolfgang Kinkeldei - mailto:wolfgang at kinkeldei.de -->

More information about the jifty-devel mailing list