Permalink
Browse files

imported from version 0.05, see Changes file.

  • Loading branch information...
1 parent c3f0102 commit fd3e0eb2de93259be68181605c2796a630b55468 @barbie committed Apr 6, 2009
Showing with 50 additions and 48 deletions.
  1. +5 −0 Changes
  2. +0 −6 MANIFEST
  3. +2 −2 META.yml
  4. +8 −0 README
  5. +11 −1 lib/Data/Phrasebook/Loader/Ini.pm
  6. +24 −39 t/01load.t
View
@@ -1,5 +1,10 @@
# Changes log for Data::Phrasebook::Loader::Ini
+0.05 25/03/2005
+ - Added DSLIP information
+ - Rewrote test scripts
+ - Devel::Cover - 98.2%
+
0.04 03/03/2005
- POD updates.
View
@@ -9,13 +9,7 @@ MANIFEST
MANIFEST.SKIP
META.yml
README
-t/00basic.t
t/01load.t
t/01phrases.ini
-t/02phrases.ini
-t/02shorts.t
-t/03phrases.ini
-t/03sql.t
t/90podtest.t
t/91podcover.t
-t/BookDB.pm
View
@@ -1,7 +1,7 @@
# http://module-build.sourceforge.net/META-spec.html
#XXXXXXX This is a prototype!!! It will change in the future!!! XXXXX#
name: Data-Phrasebook-Loader-Ini
-version: 0.04
+version: 0.05
version_from: lib/Data/Phrasebook/Loader/Ini.pm
installdirs: site
requires:
@@ -10,4 +10,4 @@ requires:
Test::More: 0.47
distribution_type: module
-generated_by: ExtUtils::MakeMaker version 6.23
+generated_by: ExtUtils::MakeMaker version 6.25
View
8 README
@@ -55,6 +55,14 @@ if you are able to pinpoint problems or even supply a patch.
Fixes are dependant upon their severity and my availablity. Should a fix not
be forthcoming, please feel free to (politely) remind me.
+DSLIP
+
+ b - Beta testing
+ d - Developer
+ p - Perl-only
+ O - Object oriented
+ p - Standard-Perl: user may choose between GPL and Artistic
+
AUTHOR
Barbie, <barbie@cpan.org>
@@ -5,7 +5,7 @@ use Carp qw( croak );
use base qw( Data::Phrasebook::Loader::Base Data::Phrasebook::Debug );
use Config::IniFiles;
-our $VERSION = '0.04';
+our $VERSION = '0.05';
=head1 NAME
@@ -106,6 +106,8 @@ sub get {
my $data = $class->{cfg}->val( $class->{dict}, $key );
$data = $class->{cfg}->val( $class->{default}, $key ) unless($data);
+ return unless($data);
+
$data =~ s!^\s+!!s;
$data =~ s!\s+$!!s;
$data =~ s!\s+! !sg;
@@ -132,6 +134,14 @@ able to pinpoint problems or even supply a patch.
Fixes are dependant upon their severity and my availablity. Should a fix not
be forthcoming, please feel free to (politely) remind me.
+=head1 DSLIP
+
+ b - Beta testing
+ d - Developer
+ p - Perl-only
+ O - Object oriented
+ p - Standard-Perl: user may choose between GPL and Artistic
+
=head1 AUTHOR
Barbie, <barbie@cpan.org>
View
@@ -3,54 +3,39 @@ use strict;
use lib 't';
use vars qw( $class );
-use Test::More tests => 8;
+use Test::More tests => 10;
# ------------------------------------------------------------------------
-BEGIN {
- $class = 'Data::Phrasebook';
- use_ok $class;
-}
+$class = 'Data::Phrasebook::Loader::Ini';
+use_ok($class);
my $file = 't/01phrases.ini';
my $dict = 'BASE';
# ------------------------------------------------------------------------
{
- my $obj = $class->new( loader => 'Ini' );
- isa_ok( $obj => $class.'::Plain', "Bare new" );
- $obj->file( $file );
- is( $obj->file() => $file , "Set/get file works");
- $obj->dict( $dict );
- is( $obj->dict() => $dict , "Set/get dict works");
-}
-
-{
- my $obj = $class->new( file => $file, loader => 'Ini' );
- isa_ok( $obj => $class.'::Plain', "New with file" );
- is( $obj->file() => $file , "Get file works");
-
- {
- my $str = $obj->fetch( 'foo', {
- my => "Iain's",
- place => 'locale',
- });
-
- is ($str, "Welcome to Iain's world. It is a nice locale.",
- "Fetch matches" );
- }
-
- {
- $obj->delimiters( qr{ :(\w+) }x );
-
- my $str = $obj->fetch( 'bar', {
- my => "Bob's",
- place => 'whatever',
- });
-
- is ($str, "Welcome to Bob's world. It is a nice whatever.",
- "Fetch matches" );
- }
+ my $obj = $class->new();
+ isa_ok( $obj => $class, "Bare new" );
+
+ eval { $obj->load(); };
+ ok($@);
+ eval { $obj->load( 'blah' ); };
+ ok($@);
+
+ eval { $obj->load( $file ); };
+ ok(!$@);
+ eval { $obj->load( $file, 'BLAH' ); };
+ ok(!$@);
+ eval { $obj->load( $file, $dict ); };
+ ok(!$@);
+
+ my $phrase = $obj->get();
+ is($phrase,undef);
+ $phrase = $obj->get('blah');
+ is($phrase,undef);
+ $phrase = $obj->get('foo');
+ like( $phrase, qr/Welcome to/);
}

0 comments on commit fd3e0eb

Please sign in to comment.