1Prima::noX11(3)       User Contributed Perl Documentation      Prima::noX11(3)
2
3
4

NAME

6       Prima::noX11 - Use Prima without X11
7

SYNOPSIS

9          use Prima::noX11;
10          use Prima;
11
12          my $error = Prima::XOpenDisplay();
13          if ( defined $error) {
14               print "not connected to display: $error\n";
15          } else {
16               print "connected to display\n";
17          }
18

DESCRIPTION

20       Prima will by default connect to X11 server on unix. To use Prima
21       functionality in modules or programs where this default behavior is
22       undesired, please follow the guidelines below.
23
24   No connection
25       In the beginning of a script or a module that is never intended to
26       connect to X11 display, add this:
27
28         use Prima::noX11;
29         use Prima;
30
31       It will be possible to connect to X11 server later on manually.
32
33   Manual connect to X11
34       If connection to X11 is optional, use this code after "use
35       Prima::noX11" was invoked:
36
37          my $error = Prima::XOpenDisplay();
38          if ( defined $error) {
39               print "not connected to display: $error\n";
40          } else {
41               print "connected to display\n";
42          }
43
44   Checking if GUI functionality is accesiible.
45       Without X11 connection, no GUI functionality such as screen grabbing
46       will be accessible. In addition to that functionality, windowing
47       functions will only become accessible after Prima::Application creates
48       a single instance $::application.
49
50       Therefore, if $::application is defined, then all GUI functions can be
51       safely used. If, on the contrary, it is not defined, initiate it as
52       this:
53
54               unless ( $::application) {
55                       my $error = Prima::XOpenDisplay();
56                       die $error if defined $error;
57                       require Prima::Application;
58                       import Prima::Application;
59               }
60

AUTHOR

62       Dmitry Karasik, <dmitry@karasik.eu.org>.
63
64
65
66perl v5.36.0                      2023-03-20                   Prima::noX11(3)
Impressum