Mailing List Archive

POSIX::tcgetattr()
hmm...

i just tried to use this and failed. i got far enough to work out that
i needed to do:

$term = new POSIX::Termios;
tcgetattr($new, 0);

but, there isn't a auto/POSIX/tcgetattr.al file -- POSIX.pm doesn't seem
to define what to do for tc[sg]etattr.. it's been too long since i did
any extension stuff to know what the problem is without looking in to the
docs ;-), so, i thought i'd ask here first..

any one know what to do here ? at a guess POSIX.pm needs

sub tcgetattr {
getattr(@_);
}

sub tcsetattr {
setattr(@_);
}

or so.

thanks.

.mrg.
Re: POSIX::tcgetattr() [ In reply to ]
Excerpts from the mail message of matthew green:
)
) i just tried to use this and failed. i got far enough to work out that
) i needed to do:
)
) $term = new POSIX::Termios;
) tcgetattr($new, 0);
^^^ I'll assume you meant "term" instead of "new" here

) but, there isn't a auto/POSIX/tcgetattr.al file -- POSIX.pm doesn't seem
) to define what to do for tc[sg]etattr.. it's been too long since i did
) any extension stuff to know what the problem is without looking in to the
) docs ;-), so, i thought i'd ask here first..
)
) any one know what to do here ? at a guess POSIX.pm needs
)
) sub tcgetattr {
) getattr(@_);
) }

The only way I could get this to work was to change POSIX.xs:

getattr -> tcgetattr
setattr -> tcsetattr

and use

use POSIX;
$term= new POSIX::Termios;
then
$term->tcgetattr(0);
or
POSIX::Termios::tcgetattr($term,0);

Even if I use
use POSIX 'tcgetattr';
writing
tcgetattr($term,0);
tries to autoload auto/POSIX/tcgetattr.al and even if I create
that I get an error when it tries to call getattr() or tcgetattr()
even if I explicitly prepend POSIX:: or POSIX::Termios::.

So I could never get it to autoload but I couldn't see any use for
having a stub in POSIX.pm just so the stub could be autoloaded.
Perhaps it should have been auto/POSIX/Termios/tcgetattr.al (yes,
I know I should have changed POSIX.pm and reinstalled but I wouldn't
have even had time to get it working if I'd waited that long per
iteration).

So I suspect that the export method doesn't handle the routines in
POSIX::SigSet and POSIX::Termios correctly. Perhaps the fix is
as simple as changing $EXPORT_TAGS{termios_h}[-3] from "tcgetattr"
to "Termios::tcgetattr" but I really need to get back to work now.

Hope that helps.
--
Tye McQueen tye@metronet.com || tye@doober.usu.edu
Nothing is obvious unless you are overlooking something
http://www.metronet.com/~tye/ (scripts, links, nothing fancy)
Re: POSIX::tcgetattr() [ In reply to ]
Excerpts from the mail message of tye:
) So I suspect that the export method doesn't handle the routines in
) POSIX::SigSet and POSIX::Termios correctly. Perhaps the fix is
) as simple as changing $EXPORT_TAGS{termios_h}[-3] from "tcgetattr"
) to "Termios::tcgetattr" but I really need to get back to work now.

I had a moment while kermiting a file so I did what I said above
and tcgetattr() now gets exported correctly. It probably doesn't
make sense to have

termios_h => [qw( Termios::B0 Termios::B110 Termios::B1200
[...]
Termios::tcsendbreak Termios::tcsetattr )],

but perhaps

termios_h => [qw( B0 B110 B1200 [...] tcsendbreak tcsetattr )],
[...]
foreach( @{$EXPORT_TAGS{termios_h}} ) {
$_= "Termios::$_";
}
--
Tye McQueen tye@metronet.com || tye@doober.usu.edu
Nothing is obvious unless you are overlooking something
http://www.metronet.com/~tye/ (scripts, links, nothing fancy)
Re: POSIX::tcgetattr() [ In reply to ]
On Wed, 6 Sep 1995, Tye McQueen wrote:

> Excerpts from the mail message of tye:
> ) So I suspect that the export method doesn't handle the routines in
> ) POSIX::SigSet and POSIX::Termios correctly. Perhaps the fix is
> ) as simple as changing $EXPORT_TAGS{termios_h}[-3] from "tcgetattr"
> ) to "Termios::tcgetattr" but I really need to get back to work now.
>
> I had a moment while kermiting a file so I did what I said above
> and tcgetattr() now gets exported correctly. It probably doesn't
> make sense to have
>
> termios_h => [qw( Termios::B0 Termios::B110 Termios::B1200
> [...]
> Termios::tcsendbreak Termios::tcsetattr )],
>
> but perhaps
>
> termios_h => [qw( B0 B110 B1200 [...] tcsendbreak tcsetattr )],
> [...]
> foreach( @{$EXPORT_TAGS{termios_h}} ) {
> $_= "Termios::$_";
> }

I have no wish to toot my own horn, but (toot-toot-tootle!) Term::ReadKey
can retrieve the terminal speeds and even goes to the trouble to convert
them to decimal. Given a choice, I'd rather have people use TRK and put
all the portability concerns into it then have everybody reinventing the
terminal code and having it break on different platorms.

Of course, this has no absolutely no bearing on whether the the POSIX
module is exporting symbols properly, so now back to your regularly
scheduled mailing-list.

> --
> Tye McQueen tye@metronet.com || tye@doober.usu.edu
> Nothing is obvious unless you are overlooking something
> http://www.metronet.com/~tye/ (scripts, links, nothing fancy)
>

--
Kenneth Albanowski (kjahds@kjahds.com, CIS: 70705,126)