1 package YAML::Mo; $VERSION = '0.88';
2 # use Mo qw[builder default import];
3 # The following line of code was produced from the previous line by
4 # Mo::Inline version 0.31
5 no warnings;my$M=__PACKAGE__.'::';*{$M.Object::new}=sub{bless{@_[1..$#_]},$_[0]};*{$M.import}=sub{import warnings;$^H|=1538;my($P,%e,%o)=caller.'::';shift;eval"no Mo::$_",&{$M.$_.::e}($P,\%e,\%o,\@_)for@_;return if$e{M};%e=(extends,sub{eval"no $_[0]()";@{$P.ISA}=$_[0]},has,sub{my$n=shift;my$m=sub{$#_?$_[0]{$n}=$_[1]:$_[0]{$n}};$m=$o{$_}->($m,$n,@_)for sort keys%o;*{$P.$n}=$m},%e,);*{$P.$_}=$e{$_}for keys%e;@{$P.ISA}=$M.Object};*{$M.'builder::e'}=sub{my($P,$e,$o)=@_;$o->{builder}=sub{my($m,$n,%a)=@_;my$b=$a{builder}or return$m;sub{$#_?$m->(@_):!exists$_[0]{$n}?$_[0]{$n}=$_[0]->$b:$m->(@_)}}};*{$M.'default::e'}=sub{my($P,$e,$o)=@_;$o->{default}=sub{my($m,$n,%a)=@_;$a{default}or return$m;sub{$#_?$m->(@_):!exists$_[0]{$n}?$_[0]{$n}=$a{default}->(@_):$m->(@_)}}};my$i=\&import;*{$M.import}=sub{(@_==2 and not $_[1])?pop@_:@_==1?push@_,grep!/import/,@f:();goto&$i};@f=qw[builder default import];use strict;use warnings;
7 our $DumperModule = 'Data::Dumper';
9 my ($_new_error, $_info, $_scalar_info);
12 *{$M.'Object::die'} = sub {
14 my $error = $self->$_new_error(@_);
15 $error->type('Error');
16 Carp::croak($error->format_message);
19 *{$M.'Object::warn'} = sub {
22 my $error = $self->$_new_error(@_);
23 $error->type('Warning');
24 Carp::cluck($error->format_message);
27 # This code needs to be refactored to be simpler and more precise, and no,
28 # Scalar::Util doesn't DWIM.
32 *{$M.'Object::node_info'} = sub {
34 my $stringify = $_[1] || 0;
35 my ($class, $type, $id) =
41 my @info = &$_info(overload::StrVal($_[0]));
42 if (ref($_[0]) eq 'Regexp') {
43 @info[0, 1] = (undef, 'REGEXP');
47 : &$_scalar_info($_[0]);
48 ($class, $type, $id) = &$_scalar_info("$_[0]")
50 return wantarray ? ($class, $type, $id) : $id;
53 #-------------------------------------------------------------------------------
55 return (($_[0]) =~ qr{^(?:(.*)\=)?([^=]*)\(([^\(]*)\)$}o);
61 \$_[0] =~ /\((\w+)\)$/o or CORE::die();
64 return (undef, undef, $id);
72 my $code = shift || 'unknown error';
73 my $error = YAML::Error->new(code => $code);
74 $error->line($self->line) if $self->can('line');
75 $error->document($self->document) if $self->can('document');
76 $error->arguments([@_]);