| 1 | package HTML::Barcode::2D; | ||
| 2 | use Any::Moose; | ||
| 3 | extends 'HTML::Barcode'; | ||
| 4 | |||
| 5 | has '+show_text' => (default => 0); | ||
| 6 | |||
| 7 | has '+bar_width' => (default => '3px'); | ||
| 8 | has '+bar_height' => (default => '3px'); | ||
| 9 | has module_size => ( | ||
| 10 | is => 'rw', | ||
| 11 | default => '3px', | ||
| 12 | trigger => \&_module_size_set, | ||
| 13 | ); | ||
| 14 | sub _module_size_set { | ||
| 15 | my ($self, $size) = @_; | ||
| 16 | $self->bar_width($size); | ||
| 17 | $self->bar_height($size); | ||
| 18 | } | ||
| 19 | |||
| 20 | |||
| 21 | =head1 NAME | ||
| 22 | |||
| 23 | HTML::Barcode::2D - A base class for HTML representations of 2D barcodes | ||
| 24 | |||
| 25 | =head1 DESCRIPTION | ||
| 26 | |||
| 27 | This is a base class for creating HTML representations of one-dimensional barcodes. Do not use it directly. | ||
| 28 | |||
| 29 | If you are looking to generate a barcode, please see one of the following | ||
| 30 | modules instead: | ||
| 31 | |||
| 32 | =head2 Known Types | ||
| 33 | |||
| 34 | Here are some of the types of barcodes you can scan with the modules in | ||
| 35 | this distribution. Others may exist, so try searching CPAN. | ||
| 36 | |||
| 37 | =over 4 | ||
| 38 | |||
| 39 | =item L<HTML::Barcode::QRCode> - Two dimensional QR codes. | ||
| 40 | |||
| 41 | =item L<HTML::Barcode::Code93> - Code 93 barcodes. | ||
| 42 | |||
| 43 | =item L<HTML::Barcode::Code128> - Code 128 barcodes. | ||
| 44 | |||
| 45 | =back | ||
| 46 | |||
| 47 | =head2 Subclassing | ||
| 48 | |||
| 49 | =head3 barcode_data | ||
| 50 | |||
| 51 | You need to either override this, or override the C<render_barcode> method | ||
| 52 | so it does not use this. | ||
| 53 | |||
| 54 | This should return a 2-dimensional arrayref of true and false values | ||
| 55 | (for "on" and "off"). | ||
| 56 | |||
| 57 | It is not recommended to publish this method in your API. | ||
| 58 | |||
| 59 | =head1 ATTRIBUTES | ||
| 60 | |||
| 61 | In addition to those provided by L<HTML::Barcode>, a 2D barcode has these: | ||
| 62 | |||
| 63 | =head2 module_size | ||
| 64 | |||
| 65 | This is a CSS value for width and height of a square block within the barcode. | ||
| 66 | |||
| 67 | It is simply a convenience method that sets | ||
| 68 | both the L<bar_height|HTML::Barcode/bar_height> and L<bar_width|HTML::Barcode/bar_width> attributes. | ||
| 69 | |||
| 70 | =head1 AUTHOR | ||
| 71 | |||
| 72 | Mark A. Stratman, C<< <stratman@gmail.com> >> | ||
| 73 | |||
| 74 | =head1 SOURCE REPOSITORY | ||
| 75 | |||
| 76 | L<http://github.com/mstratman/HTML-Barcode> | ||
| 77 | |||
| 78 | =head1 SEE ALSO | ||
| 79 | |||
| 80 | L<HTML::Barcode> | ||
| 81 | |||
| 82 | =head1 LICENSE AND COPYRIGHT | ||
| 83 | |||
| 84 | Copyright 2011 Mark A. Stratman. | ||
| 85 | |||
| 86 | This program is free software; you can redistribute it and/or modify it | ||
| 87 | under the terms of either: the GNU General Public License as published | ||
| 88 | by the Free Software Foundation; or the Artistic License. | ||
| 89 | |||
| 90 | See http://dev.perl.org/licenses/ for more information. | ||
| 91 | |||
| 92 | |||
| 93 | =cut | ||
| 94 | |||
| 95 | no Any::Moose; | ||
| 96 | 1; # End of HTML::Barcode |