Re: prestore hook

[email protected] (Joshua N Pritikin) Sun, 15 May 2005 10:12:17 +0530
Newsgroups perl.kwiki
Message-ID <[email protected]>
On Sat, 2005-05-14 at 17:48 -0700, Brian Ingerson wrote:
> I took out the call_hooks because it was a woefully underpowered abstraction.
> I replaced with an amazing abstraction called Spoon::Hooks that allows you to
> add pre/post hook methods to any method in Kwiki.

Indeed, that sounds like a good idea.  :-)

> PS drop by #kwiki on irc.freenode.net if you need more help.

I tried but I guess I'm in the wrong time zone (India).

> > What I want to do is change store_content to write to a temporary
> > filename and then atomically rename it into place.  This also has the
> > advantage of putting the new & old file on disk for a moment.  I'd like
> > to run hooks during this moment so I can generate a diff and email it.

To get this to work, I still need to split
Spoon::ContentObject::store_content into two methods.

1. Instead of storing to $self->file_path, I'd store to
'.'.$self->file_path.'.new'.$$.

2. Another method, store_content_commit, would rename the new file to
the appropriate filename.

Shall I email a patch?

-- 
If you are an American then support http://fairtax.org
 (Permanently replace 50,000+ pages of tax law with about 200 pages.)
signature.asc (application/pgp-signature, 189 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)

iD8DBQBChtMpqcqnlKSmC70RAgxmAKCsfuNKBmtCfXEi3GHL45U1OuXC2ACeN3az
Qha7hUepE0LxPBvAvZK7yiw=
=S7BO
-----END PGP SIGNATURE-----