[Edinburgh-pm] CPAN upload

Aaron Crane perl at aaroncrane.co.uk
Wed Dec 21 09:29:57 PST 2011


Miles Gould <miles at assyrian.org.uk> wrote:
> On Wed, Dec 21, 2011 at 11:08 AM, Aaron Crane <perl at aaroncrane.co.uk> wrote:
>> I suggest also looking at Makefile.PL.  The current version claims
>> that the author is one A. U. Thor <a.u.thor at a.galaxy.far.away>, which
>> seems moderately unlikely.
>
> Good spot! Should I change that to be my name or the original
> author's? He's still listed as a co-maintainer, but apparently hasn't
> touched Perl for some years.

Good question.  I've stuck with the original author's name when I've
been in that situation, but I don't know whether that's expected
practice.  Nor, for that matter, whether it makes any difference if
the original author no longer does any Perl.

> [string-on-error]
>> - remove the limitations that cause those to be error conditions,
>> where reasonable
>
> "Not added because it's a dup" feels like something that shouldn't be
> an error at all,

That sounds reasonable to me, on the face of it.  One question,
though: might callers *ever* want to know about the detail of which
inserts are (or would be) ignored?  If so, perhaps a `contains` method
would be a useful addition; die-on-duplicate-insert behaviour can then
be implemented by callers.

> but "not added because capacity() has been exceeded
> and we're already full of higher-priority stuff" feels like correct
> behaviour that you might want to know about as a caller. So I think
> the Right Thing is to […] return 0 on "insert failed because you're
> over capacity".

My naive reaction (without having thought much about how
List::Priority might be used) is to disagree: I'd want an exception if
`$container->insert($thing)` didn't leave $container with a $thing,
regardless of the sort of container.  Perhaps extend the API with a
`maybe_insert` method, which inserts only if there's enough spare
capacity?  Though I'm aware this would be another API change, so you
might decide to favour API stability even if you agree with me.

What are the use cases for the capacity-limit feature?

> I have no idea how hard it will be to remove the restriction on duplicates :-)

Now that I've actually looked at the code in more than the most
superficial way, I think I can tell you that it's trivial — it's the
chunk of code starting here:

https://github.com/pozorvlak/List-Priority/blob/ade2a6b1d8c620d4bc9bc69de0859b43a7d1db06/Priority.pm#L41

-- 
Aaron Crane ** http://aaroncrane.co.uk/


More information about the Edinburgh-pm mailing list