Manish Grewal > Text-7Segment-v0.0.1_1 > Text::7Segment



Annotate this POD

Module Version: 0.0.1_1   Source  


Text::7Segment - Display characters in seven-segment style in a text terminal.

*IMPORTANT:* The previous version - 0.0.1 - displayed the text using the Curses module. From this version, the module displays text in a plain terminal without Curses. Curses functionality is being shifted to Curses::7Segment which is coming soon. Please use the previous version if you need the ability to display more characters in a previous line.


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


        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->disp_str(':0123456789 abcdef ABCDEF');


This module will display hexadecimal strings and a few other characters in 7 segment style in a terminal. This is the common display style used in lcd calculators, digital watches etc.

The 7-segment display is usually constrained by hardware, as in, the hardware has seven short segments laid out like the figure eight and subsets of the 7 segments can be turned on or off at a time to display various characters, for example, by applying appropriate voltages to hardware pins or by writing bits into a memory location.

This implementation is intended to be run in a terminal which of course supports a much richer character set and the constraints are purely logical. It is just an emulation of the 7 segment style display just for fun.

An advantage of this display style is that a character is readable from a distance due to the large size. An application could use it as a simple large font for displaying numeric data in a terminal window - e.g hw probe state (cpu-temperature, fan speed etc).



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



None: this is a pure perl implementation that uses only the core modules.


No known bug. Please report problems to manigrew ( Patches are welcome.

The string to be displayed has to be specified a line at a time. This is because a character spans 3 lines and it is not possible to go back to a previous line in a terminal to show more characters. If you have a requirement to display more characters in a line later, see the module Curses::7Segment on CPAN.


Following is a quick and dirty list of future enhancements:

- 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



manigrew (


Copyright (c) 2013 manigre ( 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.

syntax highlighting: