Running a PERL script from AX25D
I am trying to run a PERL script as the "server" for some AX25 connections. My PERL script works fine when I invoke it from the command line.
In ax25d.conf I specifiy a bash script to be run as the session command. Inside the bash script there is an 'echo' command, which I see when i connect. Other commands in that script also work. But then it runs the PERL script and everything just stalls.
Here is the bash script:
#!/bin/bash
echo 'wait...'
HOME=/home/bbs
echo 'HOME set'
cd /home/bbs
pwd
perl t.pl
and here is the PERL script:
#!/usr/bin/perl
print "Hi\n";
print "Enter a number\n";
$buf = <STDIN>;
$n = $buf * 2;
print "Twice that is $n\n";
print "bye!\n";
Any suggestions?
KB1EHD
Quoted 7 lines · pd
I am trying to run a PERL script as the "server" for some AX25 connections. My PERL script works fine when I invoke it from the command line.
In ax25d.conf I specifiy a bash script to be run as the session command. Inside the bash script there is an 'echo' command, which I see when i connect. Other commands in that script also work. But then it runs the PERL script and everything just stalls.
Sounds like a buffering problem to me. What's that command in perl again? $| or something.
- Craig
Signature · 3 lines
Craig Small VK2XLZ GnuPG:1C1B D893 1418 2AF4 45EE 95CB C76C E5AC 12CA DFA5 Eye-Net Consulting http://www.enc.com.au/ <[email protected]> MIEEE <[email protected]> Debian developer <[email protected]>
Quoted 9 lines · Craig Small
Quoted 7 lines · pd
I am trying to run a PERL script as the "server" for some AX25 connections. My PERL script works fine when I invoke it from the command line.
In ax25d.conf I specifiy a bash script to be run as the session command. Inside the bash script there is an 'echo' command, which I see when i connect. Other commands in that script also work. But then it runs the PERL script and everything just stalls.
Quoted 4 lines
Sounds like a buffering problem to me. What's that command in perl again? $| or something.
- Craig
I feel so stupid. Posting to Majordomo address, Ugh!
Anyway here is what I meant to send to the list, and not to the subscription bot:
Sounds right. I have it as:
$| = 1;
(or any non-zero value)
This should unbuffer your script's output. Without this, your output to STDOUT is buffered and only sent when a certain block size is reached, or when the script exits with a less than full buffer.
Kelly Black
KB0GBJ
Except that on AX25 you *want* it to buffer up the output so the packets are larger. Otherwise the protocol becomes inefficient.
I guess I should try an explicit flush just before asking for input. Currently I am running it under axspawn, which works, but I am not sure if it is buffering up output either. And it means I have to have a Linux account for each user (though they all are in the same directory).
Part of the problem may be that under ax25d STDIN and STDOUT are packet files, not byte stream files. axspawn deals with this.