plerd icon indicating copy to clipboard operation
plerd copied to clipboard

sub _build_posts does not sort a file list with both .md and .markdown correctly

Open taskboy3000 opened this issue 4 years ago • 1 comments

This may be irrelevant, considering the list is later sorted by desired publication date, but in the posts builder, this line appears:

            sort { $a->basename cmp $b->basename }

In context, $a and $b are Path::Class::File objects and one might expect basename to return the filename without an extension here. However, it does not. The extension is still present.

Using the venerable File::Basename::basename routine allows the caller to provide a list extensions to be stripped out of the returned file name. However, Path::Class::File::basename does not appear to take extensions as arguments to strip off, which is surprising.

Ultimately, the list of posts is sorted by the desired publication date, which Plerd::Post calculates.

Frankly, I would suggest removing the file sort as it appears do work that is ultimately thrown away.

Marking this as an enhancement because it does not really cause problems in the project. This is sort of "it would be nice to fix for pendantry" issue.

taskboy3000 avatar Jun 20 '20 15:06 taskboy3000

Re-labeling as a bug, since if it's doing work that gets tossed, it might be unnecessarily slowing down publication.

jmacdotorg avatar Jul 09 '20 20:07 jmacdotorg