Skip Menu |

This queue is for tickets about the Term-Screen CPAN distribution.

Report information
The Basics
Id: 9433
Status: resolved
Priority: 0/
Queue: Term-Screen

People
Owner: Nobody in particular
Requestors: kevins [...] bmrb.co.uk
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 1.02
Fixed in: (no value)



Subject: stty fails on Solaris
Term-Screen-1.02 produces messages to screen when calling new Term::Screen or ->resize on Solaris 9 sparc... eg. (new Term::Screen) unknown mode: speed unknown mode: size ($scr->resize()) unknown mode: size I've tracked this down to output from the stty command, it appears 'stty speed' and 'stty size' are unsupported on Solaris (I have tried on Solaris 6 and Solaris 9). Heres some example output... Show quoted text
>stty size
unknown mode: size Show quoted text
>stty speed
unknown mode: speed Show quoted text
>stty
speed 38400 baud; -parity rows = 24; columns = 80; ypixels = 0; xpixels = 0; swtch = <undef>; brkint -inpck -istrip icrnl -ixany imaxbel onlcr tab3 echo echoe echok echoctl echoke iexten The attached patch to Screen.pm has solved this on my system. Thanks Kevin
--- Screen.pm.orig Wed Jan 5 11:15:21 2005 +++ Screen.pm Wed Jan 5 11:42:02 2005 @@ -76,8 +76,13 @@ my ($ospeed); # adjust OSPEED below to your system. - eval { $ospeed = `stty speed`; }; # Unixish way to get OSpeed - works - $ospeed = 9600 if ($@); # on Linux, Gnuish, Suns ... + if ( $^O ne "solaris") { + eval { $ospeed = `stty speed`; }; # Unixish way to get OSpeed - works + } else { # on Linux, Gnuish ... + # work around Solaris stty + eval { foreach(`stty`) { if (/^speed (\d+)/) {$ospeed=$1;last} } } + } + $ospeed = 9600 if (!$ospeed || $@); my $term = Tgetent Term::Cap { 'TERM' => '', 'OSPEED' => $ospeed }; my $this = {}; # create object @@ -189,12 +194,22 @@ # find screen size -- trying different methods if ($#_ != 2 || $r <= 0 || $c <= 0) { - $r = 0; $c = 0; - eval { $size = `stty size`; }; # not portable but most accurate - if ( $size =~ /^\s*(\d+)\s+(\d+)\s*/ ) - { - ($r, $c) = ($1, $2); - } + $r = 0; $c = 0; + + if ( $^O ne "solaris") { + eval { $size = `stty size`; }; # not portable but most accurate + if ( $size =~ /^\s*(\d+)\s+(\d+)\s*/ ) + { + ($r, $c) = ($1, $2); + } + } else { + # work around Solaris stty + eval { + foreach(`stty`) { + if (/^rows = (\d+); columns = (\d+)/) {$r=$1; $c=$2 ;last} + } + } + } } if ($r == 0 || $c == 0) # try getting rows and cols some other way {
[guest - Wed Jan 5 06:53:19 2005]: Show quoted text
> Term-Screen-1.02 produces messages to screen when calling new > Term::Screen or ->resize on Solaris 9 sparc... > > eg. > > (new Term::Screen) > unknown mode: speed > unknown mode: size > > ($scr->resize()) > unknown mode: size > > I've tracked this down to output from the stty command, it appears > 'stty speed' and 'stty size' are unsupported on Solaris (I have tried > on Solaris 6 and Solaris 9). Heres some example output... >
> >stty size
> unknown mode: size
> >stty speed
> unknown mode: speed
> >stty
> speed 38400 baud; -parity > rows = 24; columns = 80; ypixels = 0; xpixels = 0; > swtch = <undef>; > brkint -inpck -istrip icrnl -ixany imaxbel onlcr tab3 > echo echoe echok echoctl echoke iexten > > > The attached patch to Screen.pm has solved this on my system.
Thanks, I have applied the patch and it seems to work okay. One of the items on the TODO is to replace the calls to 'stty' with POSIX tty API calls where available, but I have made an interim release for now.