[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index][Thread Index][Top&Search][Original]

Dual-life and autodie (Pumpking input appreciated)



G'day p5p,

autodie (a lexical flavour of Fatal) works.  It works in 5.10, it works in 
5.8, it may even work in 5.6 with a few tweaks.  I've got some work to do 
around the edges, but I'm now giving serious thought about moving towards a 
*real* release (as opposed to a developer release[1]).

autodie is essentially a massive patch on top of Fatal.  This means it can 
interact with Fatal in a sane fashion.  This is good.

However Fatal is a core module, and core modules can be hard to change, 
especially if they're being applied to an existing version of Perl.  This is 
bad.

So, I need advice.  I have two choices, and I need to know which one to take:

1) I've been assuming that the new autodie/Fatal is a candidate for 
inclusion into the core, mainly because nobody has objected to the idea.  If 
this is the case, I can keep my existing architecture, and try to figure out 
what to do when autodie gets installed form the CPAN[2].  This is relatively 
easy, and results in a system which works nicely.

2) The other alternative is to turn autodie from being a massive patch into 
being a massive hack.  When autodie is loaded, it can find Fatal and 
dynamically replace its guts with new code.  I don't like this alternative, 
because there's a whole lot of race conditions (like someone using Fatal 
before autodie), and I don't have good solutions for these.  It's painful, 
but it completely avoids overwriting Fatal.pm.

Because I've been mindful of the inclusion of autodie in core, I've kept the 
dependencies slim.  The only true dependency is Scope::Guard, which I can 
inline in a few lines.  autodie also uses IPC::System::Simple (which has no 
dependencies) to help implement the autodying form of system().  autodie 
still works fine by itself, but it's a compile-time error to 'use autodie 
qw(system)' without it.

I guess I can keep my current architecture without autodie entering the 
core, although I'll still need to seek some sort of official blessings to 
overwrite Fatal.pm (otherwise it ends up being an "unauthorised release" on 
the CPAN).

Many thanks,

	Paul

[1] You can grab the developer releases from the CPAN. 
http://search.cpan.org/perldoc?autodie or track the development at 
http://github.com/pfenwick/autodie

[2] I assume that dual-life modules are a solved problem, and that I can 
use/borrow/steal code that arranges for modules installed from the CPAN to 
replace the core code.

[3] A third alternative is for me to ignore Fatal altogether, but then any 
interaction between Fatal and autodie is almost guaranteed to cause pain and 
misery.

-- 
Paul Fenwick <pjf@perltraining.com.au> | http://perltraining.com.au/
Director of Training                   | Ph:  +61 3 9354 6001
Perl Training Australia                | Fax: +61 3 9354 2681


Follow-Ups from:
Paul Fenwick <pjf@perltraining.com.au>

[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index][Thread Index][Top&Search][Original]