Skip to content

Commit

Permalink
minilla ver-up
Browse files Browse the repository at this point in the history
  • Loading branch information
ytnobody committed Jul 3, 2014
1 parent 0ae663f commit 546e90e
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 36 deletions.
31 changes: 12 additions & 19 deletions Build.PL
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ use utf8;
use Module::Build;
use File::Basename;
use File::Spec;
use CPAN::Meta;
use CPAN::Meta::Prereqs;

my %args = (
license => 'perl',
Expand Down Expand Up @@ -53,20 +51,15 @@ my $builder = Module::Build->subclass(
)->new(%args);
$builder->create_build_script();

my $mbmeta = CPAN::Meta->load_file('MYMETA.json');
my $meta = CPAN::Meta->load_file('META.json');
my $prereqs_hash = CPAN::Meta::Prereqs->new(
$meta->prereqs
)->with_merged_prereqs(
CPAN::Meta::Prereqs->new($mbmeta->prereqs)
)->as_string_hash;
my $mymeta = CPAN::Meta->new(
{
%{$meta->as_struct},
prereqs => $prereqs_hash
}
);
print "Merging cpanfile prereqs to MYMETA.yml\n";
$mymeta->save('MYMETA.yml', { version => 1.4 });
print "Merging cpanfile prereqs to MYMETA.json\n";
$mymeta->save('MYMETA.json', { version => 2 });
use File::Copy;

print "cp META.json MYMETA.json\n";
copy("META.json","MYMETA.json") or die "Copy failed(META.json): $!";

if (-f 'META.yml') {
print "cp META.yml MYMETA.yml\n";
copy("META.yml","MYMETA.yml") or die "Copy failed(META.yml): $!";
} else {
print "There is no META.yml... You may install this module from the repository...\n";
}

4 changes: 1 addition & 3 deletions META.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"ytnobody <ytnobody@gmail.com>"
],
"dynamic_config" : 0,
"generated_by" : "Minilla/v1.0.0, CPAN::Meta::Converter version 2.132140",
"generated_by" : "Minilla/v2.1.1, CPAN::Meta::Converter version 2.141520",
"license" : [
"perl_5"
],
Expand All @@ -28,8 +28,6 @@
"prereqs" : {
"configure" : {
"requires" : {
"CPAN::Meta" : "0",
"CPAN::Meta::Prereqs" : "0",
"Module::Build" : "0.38"
}
},
Expand Down
21 changes: 7 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,39 +7,32 @@ Otogiri - A lightweight medicine for using database
use Otogiri;
my $db = Otogiri->new(connect_info => ['dbi:SQLite:...', '', '']);


$db->insert(book => {title => 'mybook1', author => 'me', ...});

my $book_id = $db->last_insert_id;
my $row = $db->single(book => {id => $book_id});

print 'Title: '. $row->{title}. "\n";


my @rows = $db->select(book => sql_ge(price => 500));


### or non-strict mode
my @rows = $db->select(book => {price => {'>=' => 500}});

for my $r (@rows) {
printf "Title: %s \nPrice: %s yen\n", $r->{title}, $r->{price};
}


# or using iterator
my $iter = $db->select(book => {price => {'>=' => 500}});
while (my $row = $iter->next) {
printf "Title: %s \nPrice: %s yen\n", $row->{title}, $row->{price};
}


$db->update(book => [author => 'oreore'], {author => 'me'});


$db->delete(book => {author => 'me'});


### using transaction
do {
my $txn = $db->txn_scope;
Expand All @@ -54,21 +47,21 @@ Otogiri is a thing that like as ORM. A slogan is "Schema-less, Fat-less".

# ATTRIBUTES

Please see ATTRIBUTES section of [DBIx::Otogiri](http://search.cpan.org/perldoc?DBIx::Otogiri) documentation.
Please see ATTRIBUTES section of [DBIx::Otogiri](https://metacpan.org/pod/DBIx::Otogiri) documentation.

# METHODS

## new

my $db = Otogiri->new( connect_info => [$dsn, $dbuser, $dbpass] );

Instantiate and connect to db. Then, it returns [DBIx::Otogiri](http://search.cpan.org/perldoc?DBIx::Otogiri) object.
Instantiate and connect to db. Then, it returns [DBIx::Otogiri](https://metacpan.org/pod/DBIx::Otogiri) object.

# EXPORT FUNCTIONS

Otogiri exports each SQL::QueryMaker::sql\_\* functions. (ex. sql\_ge(), sql\_like() and more...)

For more information, please see FUNCTIONS section of [SQL::QueryMaker](http://search.cpan.org/perldoc?SQL::QueryMaker)'s documentation.
For more information, please see FUNCTIONS section of [SQL::QueryMaker](https://metacpan.org/pod/SQL::QueryMaker)'s documentation.

# INFORMATION ABOUT INCOMPATIBILITY

Expand All @@ -91,10 +84,10 @@ ytnobody <ytnobody@gmail.com>

# SEE ALSO

[DBIx::Otogiri](http://search.cpan.org/perldoc?DBIx::Otogiri)
[DBIx::Otogiri](https://metacpan.org/pod/DBIx::Otogiri)

[DBIx::Sunny](http://search.cpan.org/perldoc?DBIx::Sunny)
[DBIx::Sunny](https://metacpan.org/pod/DBIx::Sunny)

[SQL::Maker](http://search.cpan.org/perldoc?SQL::Maker)
[SQL::Maker](https://metacpan.org/pod/SQL::Maker)

[SQL::QueryMaker](http://search.cpan.org/perldoc?SQL::QueryMaker)
[SQL::QueryMaker](https://metacpan.org/pod/SQL::QueryMaker)

0 comments on commit 546e90e

Please sign in to comment.