Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Various fixes and cleanups #4

Merged
merged 8 commits into from
Feb 13, 2017
Merged

Conversation

xsawyerx
Copy link
Contributor

[This falls under my Pull Request Challenge, extending my PR for Dancer2-Plugin-DBIC into this distribution.]

This includes similar fixes as those submitted to Dancer2-Plugin-DBIC. You can view this as "Step 2 out of 4".

The fixes and improvements, in summary, include:

  • Provide META.json file in the dist.
  • Provide provides entry in the metadata.
  • Code cleanups and simplification.
  • Explicitly use DBIx::Class::Schema::Loader and declare it appropriately, resolving #18 in Dancer2-Plugin-DBIC.
  • Replace die calls with croak.

The following plugin adds the META.json file. This is considered
the more modern META data format.
The following plugin will add the provides metadata to the
distribution, which is considered a best practice.
croak() is used in some places but not everywhere, so might as well
report from the caller everywhere.
In Dancer2-Plugin-DBIC, DBIx::Class::Schema::Loader is mentioned
as a requirement. It's a lazy optional one. It's also hard to spot
because it's being loaded as a string using Module::Load.

Instead, this makes it a bit clearer by using 'require' directly.

It would be better to make this an optional requirement instead of
a default one.
Currently DBIx::Class::Schema::Loader is loaded optionally, but
reported as a hard dependency. (See previous commit.)

This makes it recommended, but optional.
die "You must provide a schema_class option or install $dbic_loader."
if $@;
$dbic_loader->naming( $options->{schema_loader_naming} || 'v7' );
eval { require DBIx::Class::Schema::Loader; 1; }
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did you change this from eval { load $dbic_loader };?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The eval is a bit clearer and I always prefer using barewords for require where possible.

I changed it because I hoped it will be clearer for others to read. This was missed in a comment on Dancer2-Plugin-DBIC in which recognizing this was used was missed.

Feel free to skip this if you don't like it.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the old code is cleaner. Please change this part back. Also, please make sure all lines are <= 80 characters long.

@hvoers
Copy link
Contributor

hvoers commented Feb 11, 2017 via email

@xsawyerx
Copy link
Contributor Author

I know I changed the load to require, I have explained it here: 4f80a6f

I have made it reported optional appropriately here: 9e527d2

Anywho, feel free to skip this one, like I said. I personally think it's cleaner to use require directly when possible, but that's just my personal preference. :)

@hvoers
Copy link
Contributor

hvoers commented Feb 12, 2017

Aha. Okay.

@xsawyerx
Copy link
Contributor Author

I reverted that specific commit. I had made no other changes that pass 80 characters.

@ironcamel ironcamel merged commit bc90045 into ironcamel:master Feb 13, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants