FAQ
Author: marvin
Date: Tue Nov 24 19:38:05 2009
New Revision: 883831

URL: http://svn.apache.org/viewvc?rev=883831&view=rev
Log:
Add a Perl constructor binding for Err.

Added:
lucene/lucy/trunk/perl/t/binding/034-err.t (with props)
Modified:
lucene/lucy/trunk/perl/lib/Lucy.pm
lucene/lucy/trunk/perl/lib/Lucy/Object/Err.pm

Modified: lucene/lucy/trunk/perl/lib/Lucy.pm
URL: http://svn.apache.org/viewvc/lucene/lucy/trunk/perl/lib/Lucy.pm?rev=883831&r1=883830&r2=883831&view=diff
==============================================================================
--- lucene/lucy/trunk/perl/lib/Lucy.pm (original)
+++ lucene/lucy/trunk/perl/lib/Lucy.pm Tue Nov 24 19:38:05 2009
@@ -44,6 +44,14 @@
'""' => \&do_to_string,
fallback => 1;

+ sub new {
+ my ( $either, $message ) = @_;
+ my ( undef, $file, $line ) = caller;
+ $message .= ", $file line $line\n";
+ return $either->_new(
+ mess => Lucy::Object::CharBuf->new($message) );
+ }
+
sub do_throw {
my $err = shift;
$err->cat_mess( longmess() );

Modified: lucene/lucy/trunk/perl/lib/Lucy/Object/Err.pm
URL: http://svn.apache.org/viewvc/lucene/lucy/trunk/perl/lib/Lucy/Object/Err.pm?rev=883831&r1=883830&r2=883831&view=diff
==============================================================================
--- lucene/lucy/trunk/perl/lib/Lucy/Object/Err.pm (original)
+++ lucene/lucy/trunk/perl/lib/Lucy/Object/Err.pm Tue Nov 24 19:38:05 2009
@@ -7,9 +7,10 @@
__BINDING__

Boilerplater::Binding::Perl::Class->register(
- parcel => "Lucy",
- class_name => "Lucy::Object::Err",
- bind_methods => [qw( Cat_Mess )],
+ parcel => "Lucy",
+ class_name => "Lucy::Object::Err",
+ bind_methods => [qw( Cat_Mess Get_Mess )],
+ bind_constructors => ["_new"],
);

__COPYRIGHT__

Added: lucene/lucy/trunk/perl/t/binding/034-err.t
URL: http://svn.apache.org/viewvc/lucene/lucy/trunk/perl/t/binding/034-err.t?rev=883831&view=auto
==============================================================================
--- lucene/lucy/trunk/perl/t/binding/034-err.t (added)
+++ lucene/lucy/trunk/perl/t/binding/034-err.t Tue Nov 24 19:38:05 2009
@@ -0,0 +1,10 @@
+use strict;
+use warnings;
+
+use Test::More tests => 1;
+use Lucy::Test;
+
+my $err = Lucy::Object::Err->new("Bad stuff happened");
+
+isa_ok( $err, 'Lucy::Object::Err', "new" );
+

Propchange: lucene/lucy/trunk/perl/t/binding/034-err.t
------------------------------------------------------------------------------
svn:eol-style = native

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouplucy-commits @
categorieslucene
postedNov 24, '09 at 7:38p
activeNov 24, '09 at 7:38p
posts1
users1
websitelucene.apache.org

1 user in discussion

Marvin: 1 post

People

Translate

site design / logo © 2018 Grokbase