Drop some debugging leftovers
[p5sagit/Gather-Once.git] / lib / Gather / Once.pm
CommitLineData
14342f72 1use strict;
2use warnings;
3
4package Gather::Once;
5
6use Devel::CallParser;
7
8use XSLoader;
9XSLoader::load(__PACKAGE__);
10
11use Carp 'croak';
12use Sub::Install 'install_sub';
13
14sub import {
15 my ($class, %args) = @_;
16 my $caller = caller;
17
14342f72 18 my $gather = sub { croak "$args{block} called as a function" };
19 my $take = sub { croak "$args{take} called as a function" };
20
21 install_sub({
22 code => $gather,
23 into => $caller,
24 as => $args{block},
25 });
26
27 install_sub({
28 code => $take,
29 into => $caller,
30 as => $args{take},
31 });
32
33 setup_gather_hook($gather, !!$args{topicalise});
34 setup_take_hook($take, [$args{topicalise}, $args{predicate}]);
35}
36
371;