| 1 | package WWW::Garden::Design::Util::Filer; | ||
| 2 | |||
| 3 | 10 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | 10 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | |||
| 6 | 10 | ▶ | use Moo; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 7 | |||
| 8 | 10 | ▶ | use Text::CSV::Encoded; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 9 | |||
| 10 | 10 | ▶ | use Types::Standard qw/Object/; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 11 | |||
| 12 | has csv => | ||
| 13 | ( | ||
| 14 | 10 | ▶ | default => sub{return Text::CSV::Encoded -> new({allow_whitespace => 1, encoding_in => 'utf-8'})}, |
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||
| 15 | 10 | is => 'rw', | |
| 16 | isa => Object, # 'Text::CSV::Encoded'. | ||
| 17 | required => 0, | ||
| 18 | ); | ||
| 19 | |||
| 20 | 10 | our $VERSION = '0.97'; | |
| 21 | |||
| 22 | # ----------------------------------------------- | ||
| 23 | |||
| 24 | sub read_csv_file | ||
| 25 | 23 | ▶ | { |
|
Subroutine
read_csv_file: called CC=1 SCAR=0.0
Pod
documented
| |||
| 26 | 23 | my($self, $file_name) = @_; | |
| 27 | 23 | my($io) = IO::File -> new($file_name, 'r'); | |
| 28 | |||
| 29 | 23 | $self -> csv -> column_names($self -> csv -> getline($io) ); | |
| 30 | |||
| 31 | 23 | return $self -> csv -> getline_hr_all($io); | |
| 32 | |||
| 33 | } # End of read_csv_file. | ||
| 34 | |||
| 35 | # -------------------------------------------------- | ||
| 36 | |||
| 37 | 10 | 1; | |
| 38 | |||
| 39 | =head1 NAME | ||
| 40 | |||
| 41 | WWW::Garden::Design::Util::Filer - Some file helpers | ||
| 42 | |||
| 43 | =head1 Synopsis | ||
| 44 | |||
| 45 | See L<WWW::Garden::Design/Synopsis>. | ||
| 46 | |||
| 47 | =head1 Description | ||
| 48 | |||
| 49 | L<WWW::Garden::Design> implements an interface to the 'flowers' database. | ||
| 50 | |||
| 51 | =head1 Distributions | ||
| 52 | |||
| 53 | See L<WWW::Garden::Design/Distributions>. | ||
| 54 | |||
| 55 | =head1 Installation | ||
| 56 | |||
| 57 | See L<WWW::Garden::Design/Installation>. | ||
| 58 | |||
| 59 | =head1 Methods | ||
| 60 | |||
| 61 | =head2 read_csv_file() | ||
| 62 | |||
| 63 | Returns a an arrayref of hashref of records. | ||
| 64 | |||
| 65 | =head1 Machine-Readable Change Log | ||
| 66 | |||
| 67 | The file Changes was converted into Changelog.ini by L<Module::Metadata::Changes>. | ||
| 68 | |||
| 69 | =head1 Version Numbers | ||
| 70 | |||
| 71 | Version numbers < 1.00 represent development versions. From 1.00 up, they are production versions. | ||
| 72 | |||
| 73 | =head1 Repository | ||
| 74 | |||
| 75 | L<https://github.com/ronsavage/WWW-Garden-Design> | ||
| 76 | |||
| 77 | =head1 Support | ||
| 78 | |||
| 79 | Email the author, or log a bug on RT: | ||
| 80 | |||
| 81 | L<https://rt.cpan.org/Public/Dist/Display.html?Name=WWW::Garden::Design>. | ||
| 82 | |||
| 83 | =head1 Author | ||
| 84 | |||
| 85 | L<WWW::Garden::Design> was written by Ron Savage I<E<lt>ron@savage.net.auE<gt>> in 2014. | ||
| 86 | |||
| 87 | My homepage: L<https://savage.net.au/>. | ||
| 88 | |||
| 89 | =head1 Copyright | ||
| 90 | |||
| 91 | Australian copyright (c) 2018, Ron Savage. | ||
| 92 | |||
| 93 | All Programs of mine are 'OSI Certified Open Source Software'; | ||
| 94 | you can redistribute them and/or modify them under the terms of | ||
| 95 | The Perl License, a copy of which is available at: | ||
| 96 | http://dev.perl.org/licenses/ | ||
| 97 | |||
| 98 | =cut | ||