The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Term::TtyWrite - remote control a terminal

SYNOPSIS

As root.

  use Term::TtyWrite;

  my $tty = Term::TtyWrite->new("/dev/ttyp1");

  $tty->write("echo hi\n");

DESCRIPTION

Remote control a terminal via the TIOCSTI ioctl. This typically requires that the code be run as root, or on Linux that the appropriate capability has been granted.

This module will throw an exception if anything goes awry; use eval or Try::Tiny to catch these, if necessary.

METHODS

new device-path

Constructor; returns an object that the write method may be used on. The new method requires that a path to a device be supplied. These will vary by operating system, and can be listed for a given terminal with the tty(1) command.

write string

Writes the given string to the terminal device specified in the constructor new.

BUGS

Reporting Bugs

Please report any bugs or feature requests to bug-term-ttywrite at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Term-TtyWrite.

Patches might best be applied towards:

https://github.com/thrig/Term-TtyWrite

Known Issues

Untested portability given the use of particular ioctl()s that perlport warns about. The security concerns of running as root.

AUTHOR

thrig - Jeremy Mates (cpan:JMATES) <jmates at cpan.org>

COPYRIGHT AND LICENSE

Copyright (C) 2016 by Jeremy Mates

This program is free software; you can redistribute it and/or modify it under the terms of the the Artistic License (2.0). You may obtain a copy of the full license at:

http://www.perlfoundation.org/artistic_license_2_0