| 1 | #============================================================================= | ||
| 2 | # | ||
| 3 | # Module: Term::CLI::ReadLine | ||
| 4 | # | ||
| 5 | # Description: Class for Term::CLI and Term::ReadLine glue | ||
| 6 | # | ||
| 7 | # Author: Steven Bakker (SBAKKER), <sbakker@cpan.org> | ||
| 8 | # Created: 23/01/18 | ||
| 9 | # | ||
| 10 | # Copyright (c) 2018 Steven Bakker | ||
| 11 | # | ||
| 12 | # This module is free software; you can redistribute it and/or modify | ||
| 13 | # it under the same terms as Perl itself. See "perldoc perlartistic." | ||
| 14 | # | ||
| 15 | # This software is distributed in the hope that it will be useful, | ||
| 16 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 17 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
| 18 | # | ||
| 19 | #============================================================================= | ||
| 20 | |||
| 21 | 15 | ▶ | use 5.014_001; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 22 | |||
| 23 | package Term::CLI::ReadLine 0.051003 { | ||
| 24 | |||
| 25 | 15 | ▶ | use Modern::Perl 1.20140107; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 26 | |||
| 27 | 15 | ▶ | use parent 0.228 qw( Term::ReadLine ); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 28 | |||
| 29 | 15 | ▶ | use Term::ReadLine::Gnu; |
|
Subroutine
BEGIN: called CC=1 SCAR=2.6
| |||
| 30 | |||
| 31 | use namespace::clean 0.25; | ||
| 32 | |||
| 33 | my $Term = undef; | ||
| 34 | |||
| 35 | sub new { | ||
| 36 | my $class = shift; | ||
| 37 | $Term = Term::ReadLine->new(@_); | ||
| 38 | return bless $Term, $class; | ||
| 39 | } | ||
| 40 | |||
| 41 | sub term { return $Term } | ||
| 42 | |||
| 43 | sub term_width { | ||
| 44 | my $self = shift; | ||
| 45 | my ($rows, $cols) = $self->term->get_screen_size(); | ||
| 46 | return $cols; | ||
| 47 | } | ||
| 48 | |||
| 49 | sub term_height { | ||
| 50 | my $self = shift; | ||
| 51 | my ($rows, $cols) = $self->term->get_screen_size(); | ||
| 52 | return $rows; | ||
| 53 | } | ||
| 54 | |||
| 55 | } | ||
| 56 | |||
| 57 | 1; | ||
| 58 | |||
| 59 | __END__ | ||