On 4 Apr 2007, at 17:21, John Siracusa wrote:
[snip]
> The only way to distinguish the two is by calling context.  That  
> said, there
> are (slightly) better ways to detect the context than using caller().
> Here's what I suggest:
>
>     # Override init in you common base class
>     # (See the Rose::Object docs for details)
>     sub init
>     {
>       my($self) = shift;
>       local $self->{'__allow_set'} = 1; # or whatever attr name you  
> pick
>       $self->SUPER::init(@_);
>     }
[snip]
> Granted, this is still a bit of a hack, but at least it only relies on
> public APIs, rather than internal implementation details.
[snip]

I've done something similar myself.

Since there are at least three folk who have wanted this sort of  
functionality - would it be worth adding something like  
is_initialising() to Rose::DB::Object::Util? Just to prevent  
gratuitous wheel reinvention :-)

Adrian

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Rose-db-object mailing list
Rose-db-object@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rose-db-object

Reply via email to