Initial commit of OpenSPARC T2 design and verification files.
[OpenSPARC-T2-DV] / tools / perl-5.8.0 / lib / site_perl / 5.8.0 / sun4-solaris / Tk / send.pod
CommitLineData
86530b38
AT
1# Copyright (c) 1990-1994 The Regents of the University of California.
2# Copyright (c) 1994-1996 Sun Microsystems, Inc.
3# See the file "license.terms" for information on usage and redistribution
4# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
5#
6#
7
8=head1 NAME
9
10send - Execute a command in a different application
11
12=for category Tk Generic Methods
13
14=head1 SYNOPSIS
15
16S< >I<$result> = I<$widget>-E<gt>B<send>(?I<options>,?I<app>=E<gt>I<cmd>?I<arg arg ...>?)
17
18=head1 DESCRIPTION
19
20This method arranges for I<cmd> (and I<arg>s) to be 'sent' to the
21application named by I<app>. It returns the result or
22an error (hence above should probably be 'wrapped' in B<eval{}> and $@ tested).
23I<App> may be the name of any application whose main window is
24on the display containing the sender's main window; it need not
25be within the same process.
26If no I<arg> arguments are present, then the string to be sent
27is contained entirely within the I<cmd> argument. If one or
28more I<arg>s are present, they are concatenated separated by white space to
29form the string to be sent.
30
31If the initial arguments of the call begin with ``-''
32they are treated as options. The following options are
33currently defined:
34
35=over 4
36
37=item B<-async>
38
39Requests asynchronous invocation. In this case the B<send>
40command will complete immediately without waiting for I<cmd>
41to complete in the target application; no result will be available
42and errors in the sent command will be ignored.
43If the target application is in the same process as the sending
44application then the B<-async> option is ignored.
45
46=item B<-->
47
48Serves no purpose except to terminate the list of options. This
49option is needed only if I<app> could contain a leading ``-''
50character.
51
52=back
53
54=head1 APPLICATION NAMES
55
56The name of an application is set initially from the name of the
57program or script that created the application.
58You can query and change the name of an application with the
59B<appname> method.
60
61=head1 WHAT IS A SEND
62
63The B<send> mechanism was designed to allow Tcl/Tk applications
64to send Tcl Scripts to each other. This does not map very well onto perl/Tk.
65Perl/Tk "sends" a string to I<app>, what happens as a result of this
66depends on the receiving application. If the other application is a Tcl/Tk4.*
67application it will be treated as a Tcl Script. If the "other" application is
68perl/Tk application (including sends to self) then the string is
69passed as an argument to a method call of the following form:
70
71I<$mainwindow>-E<gt>B<Receive(>I<string>);
72
73There is a default (AutoLoaded) B<Tk::Receive> which returns an error to the
74sending application. A particular application may define its own
75B<Receive> method in any class in B<MainWindow>'s inheritance tree
76to do whatever it sees fit. For example it could B<eval> the string,
77possibly in a B<Safe> "compartment".
78
79If a Tcl/Tk application "sends" anything to a perl/Tk application
80then the perl/Tk application would have to attempt to interpret the
81incoming string as a Tcl Script. Simple cases are should not be too hard to
82emulate (split on white space and treat first element as "command" and other
83elements as arguments).
84
85=head1 SECURITY
86
87The B<send> command is potentially a serious security loophole,
88since any application that can connect to your X server can send
89scripts to your applications. Hence the default behaviour outlined above.
90(With the availability of B<Safe> it may make sense to relax default behaviour
91a little.)
92
93Unmonitored B<eval>'ing of these incoming "scripts" can cause perl to
94read and write files and invoke subprocesses under your name.
95Host-based access control such as that provided by B<xhost>
96is particularly insecure, since it allows anyone with an account
97on particular hosts to connect to your server, and if disabled it
98allows anyone anywhere to connect to your server.
99In order to provide at least a small amount of
100security, core Tk checks the access control being used by the server
101and rejects incoming sends unless (a) B<xhost>-style access control
102is enabled (i.e. only certain hosts can establish connections) and (b) the
103list of enabled hosts is empty.
104This means that applications cannot connect to your server unless
105they use some other form of authorization
106such as that provide by B<xauth>.
107
108=head1 SEE ALSO
109
110Perl's B<eval>
111perl's B<Safe> Module
112system's administrator/corporate security guidelines etc.
113
114=head1 KEYWORDS
115
116application, name, remote execution, security, send
117
118=cut
119