File: Buy.pm

package info (click to toggle)
libur-perl 0.470%2Bds-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 7,192 kB
  • sloc: perl: 61,814; javascript: 255; xml: 108; sh: 13; makefile: 9
file content (34 lines) | stat: -rw-r--r-- 673 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package Vending::Command::Buy;
use strict;
use warnings;

use Vending;

class Vending::Command::Buy {
    is => 'Vending::Command::Outputter',
    doc => 'Attempt to get a sellable item',
    has => [
        bare_args => {
            is_optional => 1,
            is_many => 1,
            shell_args_position => 1
        }
    ]
};

sub help_detail {
    q(Buy an item from one of the vending machine's slots.  
Command line argument is one of the slot/button names);
}

sub _get_items_to_output {
    my $self = shift;

    my $slot_names = [$self->bare_args];
    my $machine = $self->machine;
    my @bought = $machine->buy(@$slot_names);
    return @bought;
}

1;