Manish Grewal > Text-7Segment-v0.0.1_0 > _

Download:
Text-7Segment-v0.0.1_0.tar.gz

Annotate this POD

Source   Latest Release: Text-7Segment-v0.0.1_1

NAME ^

                                       _
Text::7Segment - Display characters in  | segment style.
                                        |

VERSION ^

This documentation refers to Text::7Segment version 0.0.1_0. This is alpha version, interface is likely to change slightly.

SYNOPSIS ^

        use Text::7Segment;

        my $seg7 = Text::7Segment->new();
        $seg7->disp_str(':0123456789 abcdef ABCDEJ');

        # all hex digits available in both upper and lower case
        $seg7->fancy_segments(1); 
        $seg7->disp_str(':0123456789 abcdef ABCDEF');

        # start display at 5th row from top and 
        # 10th character from left 
        my $seg7 = Text::7Segment->new( x_init => 10, y_init => 5);

        # 7-segment led clock
        my $seg7 = Text::7Segment->new( );
        while (1) {
                chomp(my $time = qx/date '+%T'/);

                $seg7->x_curr(0);
                $seg7->y_curr(0);

                $seg7->disp_str($time);

                sleep 1;
        }

DESCRIPTION ^

This module will display strings in 7 segment style. This is the common display style used in lcd calculators, digital watches etc.

The module takes only the hex digits([0-9A-Fa-f]), colon (:) and space characters (at present).

The intended application of this module is to emulate a seven segment clock or calculator display just for fun.

If you are still in the dark or need more info please refer to http://en.wikipedia.org/wiki/Seven-segment_display for lots of details on this display technology.

METHODS ^

A Text::7Segment object is an instance of a 7-segment display. The following methods can be called on the object:

DIAGNOSTICS ^

If the string contains a character outside of the character class [a..fA..F0..9: ], it will not be displayed and a warning will be given. It will be a good idea to redirect the error output to somewhere other than the terminal if this is likely.

        Warning: Code not defined for $chr

CONFIGURATION AND ENVIRONMENT ^

Any output to the terminal can wreak havoc with the curses display. If the string to be displayed can have an unsupported character, it would be better to redirect STDOUT to a file or another place away from STDOUT. E.g.,

        perl seg7-disp.pl 2>/dev/null
        perl seg7-disp.pl 2>error.out

DEPENDENCIES ^

This module depends on the Curses module for displaying the output. It could be done without curses in a text terminal but then the input will have to be line bufferred. i.e the module should get the whole line of string at a time because it couldn't go back to top row after moving to the 2nd or 3rd.

BUGS AND LIMITATIONS ^

It seems to get stuck at end of screen. Need to handle y_curr when it reaches max value.

Sometimes the terminal needs to be reset after a script using the module terminates. The terminal is still usable but the prompt gets shifted to the right. Just typing reset at the prompt and hitting enter seems to fix the issue for me.

Please report problems to manigrew (Manish.Grewal@gmail.com). Patches are welcome.

ROADMAP ^

Following is a quick List of future enhancements off the top of my head based on what i have seen around the web for similar functionality.

- support different size of character - not just 3x3, e.g like bsd banner command - allow lookup func override if not already available and also good to have an example of how it should be subclassed. - use standard conventional letters for segments (a..g) in var names/comments - use colors

Immediate todo:

- mention defaults - say char class once and ref from there

AUTHOR ^

manigrew (Manish.Grewal@gmail.com)

LICENCE AND COPYRIGHT ^

Copyright (c) 2013 manigre (Manish.Grewal@gmail.com). All rights reserved.

This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlartistic. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

syntax highlighting: