Repository navigation
Optional stricter normalization of raw ISBN input #28
briandfoy
announced in
Announcements
Replies: 1 comment 1 reply
|
I’m not a user of your module, but have you considered decoupling the parsing logic from the ISBN representation itself? You could extract it into |
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
A person brought up an issue in private about how non-ISBN data could inadvertently be recognized as an ISBN because
new(), through_common_format(), removes all characters that don't belong in an ISBN (ASCII digits and X). Something like123456789ABC...XYZ, after the internal conversion, can turn into123456789X.I'm going to add some code to handle this. The old behavior will be the same, so if you don't make changes to how you use the module, you shouldn't see anything change. There's a 3.015_01 preview release in the repo, and it should show up on CPAN soon, but will not install with
cpansince it's a developer release and is not indexed. I suggest that you test the release in isolation before you decide to uprade. It's usually a good idea to do that with anything.First, if you do nothing, you will get the same behavior that exists for 3.014 and prior. There are some internal reorganizations, but the behavior should be the
same.
Next,
newwill take an optional hashref second argument to set options. Not using that gives you the previous behavior unless you were passing multiple arguments tonew()andnew()was ignoring them. Now, most likely, if the second argument is not a hashref, you could see warnings about that. That hashref will have a keystrictthat allows you to use the stricter conversion:The stricter conversion removes only what might be there as a result of text or database extraction: surrounding vertical whitespace, all horizontal whitespace, and a selected set of things that look like dashes. So, if there are letters other than
X, they'll still be there, causing the parser to fail. You have to take action to get this behavior, though.Along with this, it was natural to allow you to specify your own way to modify the input string (although you could always do this before passing an argument):
You were probably already doing this:
All reactions