From 81a380987d4f92fe85c3eab4ec94618163494632 Mon Sep 17 00:00:00 2001 From: dakkar Date: Thu, 10 Nov 2016 14:51:29 +0000 Subject: docs & critic fixes --- lib/Data/QRCode.pm | 47 ++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 44 insertions(+), 3 deletions(-) (limited to 'lib/Data/QRCode.pm') diff --git a/lib/Data/QRCode.pm b/lib/Data/QRCode.pm index 649e1f9..37cab64 100644 --- a/lib/Data/QRCode.pm +++ b/lib/Data/QRCode.pm @@ -8,6 +8,28 @@ use namespace::clean; # ABSTRACT: qrcodes in C # VERSION +=head1 SYNOPSIS + + use Data::QRCode; + + my $qr = Data::QRCode->new('some string'); + + my $text_matrix = $qr->map( + sub { $_[0]->{color} ? '*' : ' ' } + ); + + print "$_\n" for map { join '',@{$_} } @{$text_matrix}; + +=head1 DESCRIPTION + +This class exposes a simple interface to the L<< +C|http://fukuchi.org/works/qrencode/index.html.en >> +library. + +=attr C + +=cut + has error_correction_level => ( is => 'ro', isa => QRCodeEC, @@ -15,6 +37,10 @@ has error_correction_level => ( default => Data::QRCode::Input::ECLEVEL_M, ); +=attr C + +=cut + has mode => ( is => 'ro', isa => QRCodeMode, @@ -22,12 +48,23 @@ has mode => ( default => Data::QRCode::Input::MODE_8, ); +=attr C + +=cut + has version => ( is => 'rwp', isa => Int, default => 0, ); +=attr C + +=for Pod::Coverage +BUILDARGS + +=cut + has input_data => ( is => 'ro', required => 1, @@ -49,7 +86,7 @@ has _result => ( handles => [ qw(width data_at) ], ); -sub _build__result { +sub _build__result { ## no critic(ProhibitUnusedPrivateSubroutines) my ($self) = @_; my $input = Data::QRCode::Input->new(); @@ -63,7 +100,11 @@ sub _build__result { return $ret; } -sub map { +=method C + +=cut + +sub map { ## no critic(ProhibitBuiltinHomonyms) my ($self,$code) = @_; my $r = $self->_result; @@ -74,7 +115,7 @@ sub map { # use the internal function to avoid re-checking the x/y # bounds my $raw_data = $r->_data_at($x,$y); - my $hash_data = Data::QRCode::Result::_data_hash($raw_data); + my $hash_data = Data::QRCode::Result::_data_hash($raw_data); ## no critic(ProtectPrivateSubs) push @{$result[-1]}, $code->($hash_data,$raw_data); } -- cgit v1.2.3