NAME

Manip::END - Mess around with END blocks

SYNOPSIS

  use Manip::END qw( clear_end_array set_end_array );

  clear_end_array();

	set_end_array(sub {...}, sub {...});

DESCRIPTION

Perl keeps an array of subroutines that should be run just before your program exits (see perlmod manpage for more details). This module allows you to manipulte this array.

HOW TO USE IT

EXPORTED FUNCTIONS

clear_end_array()

This will clear the array of END blocks.

set_end_array(@blocks)

@blocks is an array of subroutine references. This will set the array of END blocks.

CLASS METHODS

ref()

This will return a blessed reference to the array of END blocks which you can manipulate yourself. You can also invoke several methods on this array reference.

NOTE!!!!The array contains an undef for each END blcok that has been encountered, it's not really an undef though, it some sort of raw coderef that's not wrapped in a scalar ref. This leads to fun error messages like

Bizarre copy of CODE in sassign

when you try to assign one of these values to another variable. This makes manipulating the array a littel delicate if you want to preserve these values.

That said, you can erase them without any problem and you can add your own coderefs without any problem too.

OBJECT METHODS

$obj->unshift(@blocks)

@blocks is an array of references to code blocks. This will add the blocks to the start of the array. By adding to the start of the array, they will be the first code blocks executed by Perl when it is exiting

$obj->push(@blocks)

@blocks is an array of references to code blocks. This will add the blocks to the end of the array. By adding to the end of the array, they will be the last code blocks executed by Perl when it is exiting

$obj->clear()

This clears the array.

AUTHOR

Written by Fergal Daly <fergal@esatclear.ie>. Suggested by Mark Jason Dominus at his talk in Dublin.

LICENSE

Copyright 2003 by Fergal Daly <fergal@esatclear.ie>.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

See http://www.perl.com/perl/misc/Artistic.html