Apache-Wyrd
view release on metacpan or search on metacpan
###############################################################################
my %_error_handler = ();
my $_disabled_error_handler = sub {
return undef
};
my $_enabled_error_handler = sub {
my ($self, $value) = @_;
my @caller = caller();
$caller[0] =~ s/.+://;
$caller[2] =~ s/.+://;
my $id = "($caller[0]:$caller[2])";
$value = join(':', $id, $value);
$_dbl->log_event($value) if ($_dbl);
print STDERR "$value\n";
};
my $_fatal_error_handler = sub {
my ($self, $value) = @_;
die "_raise_exception called without object. Always call _raise_exception as a method, not a subroutine."
unless UNIVERSAL::isa($self, 'Apache::Wyrd');
my @caller = caller();
$caller[0] =~ s/.+://;
$caller[2] =~ s/.+://;
my $processing = undef;
$processing = $self->dbl->self_path if ($_dbl);
$processing ||= "{COULD NOT PROCESS PATH TO PERL OBJECT}";#assume self_path could be erroneously null
my $id = "($processing -- $caller[0]:$caller[2])";
$value = join(':', $id, $value , "\n". $self->{'_as_html'} . "\n");
if ($_dbl) {
my $htmlvalue = join(':', $id, $value , "<BR>\n". Apache::Util::escape_html($self->{'_as_html'}) . "<BR>\n");
$_dbl->log_event($htmlvalue);
if(defined($self->{$AUTOLOAD})){
#if the method is called with no argument it's a GET value request
return $self->{$AUTOLOAD} unless (scalar(@_) == 2);
#if the method is called with an argument, it's a SET value request
$self->{$AUTOLOAD} = $newval;
#set always returns the value it is set to (no reason, may be useful for catching
#errors down the road).
return $newval;
} elsif (ref($self) && &UNIVERSAL::can($self, '_raise_exception')) {
$self->_error("Dead because of \$self->" . $AUTOLOAD . " being called. You probably need to define this function/attribute or import it from somewhere else.");
return $self->_raise_exception("Undefined variable was accessed in AUTOLOAD: $AUTOLOAD at " . join(':', caller()));
}
}
die ("Dead because an undefined subroutine in a non-method call was executed: " . $AUTOLOAD . "() at " . join(':', caller()) . ". You probably need to correct/define this subroutine or import it from somewhere else. This error was reported by Wyrd...
}
=pod
Note: methods are described I<(format: (returned value/s) C<methodname>
(arguments))>, where the first argument, representing the object itself, is
assumed, since the method is called using the standard notation
C<$object-E<gt>method>.
=over
Wyrd/DBL.pm view on Meta::CPAN
=item (void) C<log_bug> (scalar)
insert a debugging message in the session log.
=cut
sub log_bug {
return unless (ref($_[0]) and ($_[0]->{'debug'}));
my ($self, $value) = @_;
my @caller = caller();
$caller[0] =~ s/.+://;
$caller[2] =~ s/.+://;
my $id = "($caller[0]:$caller[2])";
$value = join(':', $id, $value);
push @{$self->{'dbl_log'}}, $value;
warn $value;
}
=pod
Wyrd/Datum.pm view on Meta::CPAN
sub _default_value {
return;
}
sub _default_params {
return {'strict' => 0};
}
sub _raise_exception {
my ($value) = @_;
die ($value . " " . join(':', caller()));
}
sub _check_params {
#by default, check nothing
return $_[1];
}
sub _suggest {
return $_[1];
}
Wyrd/Input/Complex.pm view on Meta::CPAN
=head1 LICENSE
Copyright 2002-2007 Wyrdwright, Inc. and licensed under the GNU GPL.
See LICENSE under the documentation for C<Apache::Wyrd>.
=cut
sub _unimplemented {
my ($self, $params) = @_;
my @method = caller(1);
$self->_raise_exception("You need to override the $method[3] method. $params. This message applies to the Wyrd");
}
1;
Wyrd/Services/MySQLIndex.pm view on Meta::CPAN
map_list => \@maps,
tables => \@tables,
extended => ((scalar(@attributes) > 8) ? 8 : 0),
wordmin => $$init{'wordmin'}
};
bless $data, $class;
return $data;
}
sub obsolete {
my @caller = caller(1);
my @source = caller(2);
die "$source[3]() called obsolete method $caller[3]()";
}
sub dbh {
my ($self) = @_;
return $self->{'dbh'};
}
sub db {
my ($self) = @_;
( run in 0.441 second using v1.01-cache-2.11-cpan-b61123c0432 )