Amb
view release on metacpan or search on metacpan
use vars qw(@ISA @EXPORT @EXPORT_OK $VERSION);
@ISA = qw(Exporter DynaLoader);
$VERSION = '0.02';
@EXPORT = qw(amb);
@EXPORT_OK = qw(angelic demonic);
bootstrap Amb $VERSION;
use B::Generate 1.13;
use Carp qw(confess croak);
use PadWalker;
BEGIN { *CORE::GLOBAL::die = \&dier } ;
my (%patched, %cv, @stack, $charged, $debug);
$debug = $ENV{AMB_DEBUG}||0;
sub dier
{
CORE::die(@_) if $^S; # eval
}
return $id;
}
sub find_ctx
{
# get the COP that is right before the call of amb()
my $what = shift;
my $up = PadWalker::_upcontext(1);
fail $what unless $up;
my $op = Amb::caller_op($up);
fail $what unless $op and ref($op) eq 'B::COP';
# ensure that the call is inside if(...) statement
my $x = $op-> sibling;
fail $what unless $x and ref($x) eq 'B::UNOP';
$x = $x-> first;
fail $what unless $x and ref($x) eq 'B::LOGOP' and $x-> name =~ /^(cond_expr|and)$/;
# get the cv frame that has called
my $upper = PadWalker::_upcontext(2);
my $cx;
if ( $upper) {
$cx = Amb::context_cv($upper);
fail $what unless $cx and ref($cx) eq 'CODE';
}
return $op, $cx, $up;
}
sub amb
# http://module-build.sourceforge.net/META-spec.html
#XXXXXXX This is a prototype!!! It will change in the future!!! XXXXX#
name: Amb
version: 0.02
version_from: Amb.pm
installdirs: site
requires:
B::Generate: 1.13
PadWalker: 0
distribution_type: module
generated_by: ExtUtils::MakeMaker version 6.30_01
Makefile.PL view on Meta::CPAN
# $Id: Makefile.PL,v 1.4 2008/09/03 12:56:14 dk Exp $
use ExtUtils::MakeMaker;
require 5.008_000;
WriteMakefile(
'NAME' => 'Amb',
'VERSION_FROM' => 'Amb.pm',
'PREREQ_PM' => {PadWalker => 0, 'B::Generate' => '1.13'},
);
( run in 0.825 second using v1.01-cache-2.11-cpan-05444aca049 )