You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucy.apache.org by ma...@apache.org on 2011/12/10 02:30:31 UTC
[lucy-commits] svn commit: r1212707 - in /incubator/lucy/trunk/clownfish/lib: Clownfish.pm
Clownfish/Util.pm
Author: marvin
Date: Sat Dec 10 01:30:30 2011
New Revision: 1212707
URL: http://svn.apache.org/viewvc?rev=1212707&view=rev
Log:
Move Clownfish::Util content into Clownfish.pm.
Modified:
incubator/lucy/trunk/clownfish/lib/Clownfish.pm
incubator/lucy/trunk/clownfish/lib/Clownfish/Util.pm
Modified: incubator/lucy/trunk/clownfish/lib/Clownfish.pm
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/clownfish/lib/Clownfish.pm?rev=1212707&r1=1212706&r2=1212707&view=diff
==============================================================================
--- incubator/lucy/trunk/clownfish/lib/Clownfish.pm (original)
+++ incubator/lucy/trunk/clownfish/lib/Clownfish.pm Sat Dec 10 01:30:30 2011
@@ -23,6 +23,57 @@ use XSLoader;
BEGIN { XSLoader::load( 'Clownfish', '0.01' ) }
{
+ package Clownfish::Util;
+ use base qw( Exporter );
+ use Scalar::Util qw( blessed );
+ use Carp;
+ use Fcntl;
+
+ BEGIN {
+ our @EXPORT_OK = qw(
+ slurp_text
+ current
+ strip_c_comments
+ verify_args
+ a_isa_b
+ write_if_changed
+ trim_whitespace
+ is_dir
+ make_dir
+ make_path
+ );
+ }
+
+ sub verify_args {
+ my $defaults = shift; # leave the rest of @_ intact
+
+ # Verify that args came in pairs.
+ if ( @_ % 2 ) {
+ my ( $package, $filename, $line ) = caller(1);
+ $@ = "Parameter error: odd number of args at $filename line $line\n";
+ return 0;
+ }
+
+ # Verify keys, ignore values.
+ while (@_) {
+ my ( $var, undef ) = ( shift, shift );
+ next if exists $defaults->{$var};
+ my ( $package, $filename, $line ) = caller(1);
+ $@ = "Invalid parameter: '$var' at $filename line $line\n";
+ return 0;
+ }
+
+ return 1;
+ }
+
+ sub a_isa_b {
+ my ( $thing, $class ) = @_;
+ return 0 unless blessed($thing);
+ return $thing->isa($class);
+ }
+}
+
+{
package Clownfish::Base;
}
@@ -650,6 +701,7 @@ BEGIN { XSLoader::load( 'Clownfish', '0.
{
package Clownfish::Binding::Perl::Subroutine;
+ BEGIN { push our @ISA, 'Clownfish::Base' }
use Carp;
use Clownfish::Util qw( verify_args );
Modified: incubator/lucy/trunk/clownfish/lib/Clownfish/Util.pm
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/clownfish/lib/Clownfish/Util.pm?rev=1212707&r1=1212706&r2=1212707&view=diff
==============================================================================
--- incubator/lucy/trunk/clownfish/lib/Clownfish/Util.pm (original)
+++ incubator/lucy/trunk/clownfish/lib/Clownfish/Util.pm Sat Dec 10 01:30:30 2011
@@ -13,56 +13,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-use strict;
-use warnings;
-
package Clownfish::Util;
use Clownfish;
-use base qw( Exporter );
-use Scalar::Util qw( blessed );
-use Carp;
-use Fcntl;
-
-our @EXPORT_OK = qw(
- slurp_text
- current
- strip_c_comments
- verify_args
- a_isa_b
- write_if_changed
- trim_whitespace
- is_dir
- make_dir
- make_path
-);
-
-sub verify_args {
- my $defaults = shift; # leave the rest of @_ intact
-
- # Verify that args came in pairs.
- if ( @_ % 2 ) {
- my ( $package, $filename, $line ) = caller(1);
- $@ = "Parameter error: odd number of args at $filename line $line\n";
- return 0;
- }
-
- # Verify keys, ignore values.
- while (@_) {
- my ( $var, undef ) = ( shift, shift );
- next if exists $defaults->{$var};
- my ( $package, $filename, $line ) = caller(1);
- $@ = "Invalid parameter: '$var' at $filename line $line\n";
- return 0;
- }
-
- return 1;
-}
-
-sub a_isa_b {
- my ( $thing, $class ) = @_;
- return 0 unless blessed($thing);
- return $thing->isa($class);
-}
1;