Builder::Utils - Internal Builder Utils


Builder documentation Contained in the Builder distribution.

Index


Code Index:

NAME

Top

Builder::Utils - Internal Builder Utils

VERSION

Top

Version 0.03

SYNOPSIS

Top

TBD

EXPORT

Top

None.

FUNCTIONS

Top

yank

Yank out requested elements (prescribed by anon sub) from an array... returning whats been yanked.

AUTHOR

Top

Barry Walsh <draegtun at cpan.org>

BUGS

Top

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.

SUPPORT

Top

You can find documentation for this module with the perldoc command.

    perldoc Builder::Utils




You can also look for information at: Builder

* RT: CPAN's request tracker

http://rt.cpan.org/NoAuth/Bugs.html?Dist=Builder

* AnnoCPAN: Annotated CPAN documentation

http://annocpan.org/dist/Builder

* CPAN Ratings

http://cpanratings.perl.org/d/Builder

* Search CPAN

http://search.cpan.org/dist/Builder/

ACKNOWLEDGEMENTS

Top

See Builder

COPYRIGHT & LICENSE

Top


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__