zostay / Acme-Urinal

Assign resources using the same algorithm used by men choosing which urinal to use
0 stars 0 forks source link

SYNOPSIS is not 100% correct #1

Open oalders opened 6 years ago

oalders commented 6 years ago

Hi Sterling!

my $urinals = Acme::Urinal->new(8);

say $urinal->pick_one; # prints 1

First problem is that the variable being printed should be plural rather than singular. Second issue is that pick_one() returns a 3 element array, so following the example the output looks more like:

115
335
555
774
222
442
662
001

I would have sent a pull request, but it's not clear to me what the best way is to change the SYNOPSIS.

Also, would be helpful if the repo were in the metadata. :)

I can send you a quick PR if you have an opinion on how to best update the example. Maybe something like

  use feature qw( say );
  use Acme::Urinal;

  my $urinals = Acme::Urinal->new(8);
  for ( 0 .. 8 ) {
      my ( $index, $resource, $comfort_level ) = $urinals->pick_one;
      say $index;
  }

prints:

    1
    3
    5
    7
    2
    4
    6
    0

    Use of uninitialized value $index in say at bar.pl line 11.
zostay commented 6 years ago

Oh, yeah, sure, whatever... I created this on a dare during a meeting I think and haven't looked at it since. ;)