App-Tarotplane

 view release on metacpan or  search on metacpan

lib/App/Tarotplane/Cards.pm  view on Meta::CPAN


	@{$self->{Cards}} = shuffle @{$self->{Cards}};

}

1;



=head1 NAME

App::Tarotplane::Cards - Read tarotplane card files

=head1 SYNOPSIS

  use App::Tarotplane::Cards;

  $deck = App::Tarotplane::Cards->new(@files);

  $deck->order_deck('Term');

  $deck->shuffle_deck();

  $card0 = $deck->card(0);

  $term1 = $deck->card_side(1, 'Term');

=head1 DESCRIPTION

App::Tarotplane::Cards is a module used by L<tarotplane> to read and organize
decks of card files from text files. For information on how to format card
files, consult the relevant documentation in the L<tarotplane> manual page.

=head1 Object Methods

=head2 App::Tarotplane::Cards->new(@files)

Reads cards from @files, and returns an App::Tarotplane::Cards object. To read
more about the card file format, consult the L<tarotplane> manual page.

=head2 $deck->get($get)

Get $get from $deck. The following can be gotten:

=over 4

=item Cards

Array ref of cards.

=item CardNum

Number of cards.

=back

Returns undef on failure.

=head2 $deck->card($n)

Return $n-th card from deck. The card will be a hash ref that looks like this

  {
    Term       => 'term string',
    Definition => 'definition string',
  }

Returns undef on failure.

=head2 $deck->card_side($n, $side)

Returns side $side of card $n. $side must be 'Term' or 'Definition'
(case-sensitive).

=head2 $deck->order_deck([$side])

Order cards alphabetically by $side, which must be 'Term' or 'Definition'
(case-sensitive). If $side is not specified, sorts by terms.

=head2 $deck->shuffle_deck()

Randomize order of cards.

=head1 AUTHOR

Written by Samuel Young E<lt>L<samyoung12788@gmail.com>E<gt>.

=head1 COPYRIGHT

Copyright 2024, Samuel Young

This library is free software; you may redistribute it and/or
modify it under the same terms as Perl itself.

=head1 SEE ALSO

L<tarotplane>

=cut



( run in 1.757 second using v1.01-cache-2.11-cpan-98e64b0badf )