in reply to Re: simple IPC needed
in thread simple IPC needed

Yes this is exactly what I need. Thanks! I haven't been able to get it working though, as I've never done anything in Tk before.

The second program runs fine, but when running the first program, it says "Failed to AUTOLOAD 'MainWindow::send" (under windows) or "send to non-secure perl/Tk application rejected" (under linux).

I found this in the perl/tk FAQ:

the script that receives from a Tk::send must run with taint
checking turned on (i.e. with the -T switch thrown) and 
it must untaint all commands received from the other process. 
Apparently this error has to do with me not untainting my data? I tried running the scripts with -T, but its still not working. I'm a newbie to this tainting concept.

Any idea of how to get around this problem?

Replies are listed 'Best First'.
Re^3: simple IPC needed
by lidden (Curate) on Feb 19, 2005 at 12:54 UTC
    Here are two progs that works under linux, I have no way to test under windows. You should read "perldoc perlsec" for info about security and tainted data. You untaint data with regexps, remember to be careful.
    #!/usr/bin/perl -w use strict; use Tk; my $mw = MainWindow->new(); my $file_name = 'Some file'; $mw->send('Foo' => $file_name); #!/usr/bin/perl -Tw use strict; use Tk; my $main_window = MainWindow->new(-title => 'My other prog'); $main_window->appname('Foo'); MainLoop; sub Tk::Receive{ shift; my $string = shift; if (my ($file) = $string =~ /^([^-]+)$/){ print "Got: $file\n"; exit 0; } else { print "Wrong arg Received\n"; exit 1; } }