So, which part actually makes the script "stay open"?
Do you launch it with a "&" to put it in the background?

And why are there examples of daemons on the Web which look nothing at all like the webreference tutorial example? I mean, one page says "you need lines A and B" while another page says you need "C and D" and does not use A and B at all?

See why I'm confused. :-)

thanks,
-Walter

At 09:18p -0600 05/22/2006, Doug McNutt didst inscribe upon an electronic papyrus:

At 21:16 -0400 5/22/06, Joseph Hourcle wrote:
 >On May 20, 2006, at 4:16 AM, Walter Ian Kaye wrote:
>>Speaking of Perl, is anyone here familiar with writing Unix daemons in Perl?
 >>I need to write a "helper app" for my CGIs. Socket to me, baby!

I'm still trying to persuade a BBEdit worksheet to talk to a shell on a Linux box,

This is a start at a daemon for Linux which just reflects things sent to a socket. There are some examples on the perl.org web site.

#!/usr/bin/perl
# Backup directory:     Dione/Backups/BBEditBackup/
# Backup history:
# Saved as /Volumes/Echo/Projects/BBEditScripts/BBremote.pl with backup to Dione/Backups/BBEditBackup/ on Tue Dec 20 14:06:32 MST 2005
# This will be run in background from a user account on the Linux box
use strict;
use IO::Socket;
# use Net::hostent;   # for OO version of gethostbyaddr
my ($host, $port, $kidpid, $server, $client, $line, $prompt);
$port = 7255;
$prompt = "theDoctor sez ";  # Yeah the Linux box is named Gallifrey

$server = IO::Socket::INET->new
        (
        Proto   => 'tcp',
        LocalPort       => $port,
        Listen  => SOMAXCONN,
        Reuse   => 1
        );
if (! $server)
        {
        die "Can't set up server: $!\n";
        }
print "Sever established on port $port\n";
while ($client = $server->accept())
        {
        $client->autoflush(1);
        print $client "You're talking to $0\n";
        while ( <$client>)
                {
                chomp;
                $line = $_;
                last if ($line eq "exit");
                print $client "$prompt$line\n";
                }
        close $client;
        }
__END__

--

--> From the U S of A, the only socialist country that refuses to admit it. <--

--
------------------------------------------------------------------
Have a feature request? Not sure the software's working correctly?
If so, please send mail to <[EMAIL PROTECTED]>, not to the list.
List FAQ: <http://www.barebones.com/support/lists/bbedit_talk.shtml>
List archives: <http://www.listsearch.com/BBEditTalk.lasso>
To unsubscribe, send mail to:  <[EMAIL PROTECTED]>


--
------------------------------------------------------------------
Have a feature request? Not sure the software's working correctly?
If so, please send mail to <[EMAIL PROTECTED]>, not to the list.
List FAQ: <http://www.barebones.com/support/lists/bbedit_talk.shtml>
List archives: <http://www.listsearch.com/BBEditTalk.lasso>
To unsubscribe, send mail to:  <[EMAIL PROTECTED]>

Reply via email to