| Builder documentation | Contained in the Builder distribution. |
Builder::Utils - Internal Builder Utils
Version 0.03
TBD
None.
Yank out requested elements (prescribed by anon sub) from an array... returning whats been yanked.
Barry Walsh <draegtun at cpan.org>
Please report any bugs or feature requests to bug-builder at rt.cpan.org, or through
the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Builder. I will be notified, and then you'll
automatically be notified of progress on your bug as I make changes.
You can find documentation for this module with the perldoc command.
perldoc Builder::Utils
You can also look for information at: Builder
See Builder
Copyright 2008-2010 Barry Walsh (Draegtun Systems Ltd | http://www.draegtun.com), all rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
| Builder documentation | Contained in the Builder distribution. |
package Builder::Utils; use strict; use warnings; use Carp; our $VERSION = '0.03'; # common utilities put here and not exported into Builder::* because it would pollute namespace (ie. tags!) sub yank (&\@) { my ( $code, $array ) = @_; my $index = 0; my @return; while ( $index <= $#{ $array } ) { local $_ = $array->[ $index ]; if ( $code->() ) { push @return, splice @$array, $index, 1; } else { $index++ } } return @return; } 1; __END__