Perl 6 module: Get the current width of the terminal
Other
Switch branches/tags
Nothing to show
Latest commit 7646c22 May 31, 2017 @zoffixznet committed on GitHub Update .travis.yml
Permalink
Failed to load latest commit information.
examples First full commit May 27, 2016
lib/Terminal Add unit module May 27, 2016
logotype First full commit May 27, 2016
t Fix tests May 27, 2016
.gitignore First full commit May 27, 2016
.travis.yml Update .travis.yml May 31, 2017
LICENSE First full commit May 27, 2016
META6.json Use SPDX identifier in license field of META6.json Apr 27, 2017
README.md Add fancy chars May 27, 2016

README.md

Build Status

NAME

Terminal::Width - Get the current width of the terminal

SYNOPSIS

    use Terminal::Width;

    # Default to 80 characters if we fail to get actual width:
    my $width = terminal-width;

    # Default to 100 characters if we fail to get actual width:
    $width = terminal-width :default<100>;

    # return a Failure if we fail to get actual width:
    $width = terminal-width :default<0>;

DESCRIPTION

This module tries to figure out the current width of the terminal the program is running in. The module is known to work on Windows 10 command prompt and Debian flavours of Linux. Untested on other systems, but should also work on OSX.

EXPORTED SUBROUTINES

terminal-width

    terminal-width (Int :$default = 80 --> Int|Failure)

Returns and Int representing the character width of the terminal. Takes one optional named argument :default that specifies the width to use if we fail to determine the actual width (defaults to 80). If :default is set to 0 the subroutine will return a Failure if it can't determine the width.

⚠ SECURITY NOTE

On Windows, this module attempts to run program mode and on all other systems it attempts to run tput. A clever attacker can manipulate what the actual executed program is, resulting in it being executed with the privileges of your script's user.

REPOSITORY

Fork this module on GitHub: https://github.com/zoffixznet/perl6-Terminal-Width

BUGS

To report bugs or request features, please use https://github.com/zoffixznet/perl6-Terminal-Width/issues

AUTHOR

Zoffix Znet (http://zoffix.com/)

LICENSE

You can use and distribute this module under the terms of the The Artistic License 2.0. See the LICENSE file included in this distribution for complete details.