Prima::noX11(3)
π NAME π
Hiii bestie!! π«Ά Okay so this is the <pink>Prima::noX11(3)</pink> page from the User Contributed Perl Documentation, and the name is literally giving the whole plot: Prima::noX11 - Use Prima without X11. Slay. π
πΈ SYNOPSIS πΈ
So here's the whole βuse this before Primaβ situation, and yes, the order matters, iykyk β¨:
use Prima::noX11;
use Prima;
my $error = Prima::XOpenDisplay();
if ( defined $error) {
print "not connected to display: $error\n";
} else {
print "connected to display\n";
}
π¦ DESCRIPTION π¦
Okay so by default, Prima will connect to X11 server on unix. That's the default behavior, periodt. But if you're using Prima functionality in modules or programs where this default behavior is undesired, please follow the guidelines below. π
π No connection π
In the beginning of a script or a module that is never intended to connect to X11 display, add this:
use Prima::noX11;
use Prima;
It will be possible to connect to X11 server later on manually. So you're not locked out forever, bestie. π
π Manual connect to X11 π
If connection to X11 is optional, use this code after use Prima::noX11 was invoked:
my $error = Prima::XOpenDisplay();
if ( defined $error) {
print "not connected to display: $error\n";
} else {
print "connected to display\n";
}
π§ Checking if GUI functionality is accesiible. π§
Without X11 connection, no GUI functionality such as screen grabbing will be accessible. That's important, okay? In addition to that functionality, windowing functions will only become accessible after Prima::Application creates a single instance $::application.
Therefore, if $::application is defined, then all GUI functions can be safely used. If, on the contrary, it is not defined, initiate it as this:
unless ( $::application) {
my $error = Prima::XOpenDisplay();
die $error if defined $error;
require Prima::Application;
import Prima::Application;
}
π AUTHOR π
This iconic page was written by Dmitry Karasik, <dmitry@karasik.eu.org>. π«Ά
Okay that's the whole page, mwah π β this came from perl v5.42.0, dated 2024-08-20, and it's Prima::noX11(3). Periodt. πβ¨
π¦ where this page comes from
- opensuse-leap 16.0: perl-Prima 1.74000-bp160.1.13 Β· AGPL-3.0-only AND BSD-2-Clause
- opensuse-leap 16.0: perl-Prima 1.74000-bp160.1.13 Β· AGPL-3.0-only AND BSD-2-Clause
- opensuse-leap 16.0: perl-Prima 1.74000-bp160.1.13 Β· AGPL-3.0-only AND BSD-2-Clause
- opensuse-leap 16.0: perl-Prima 1.74000-bp160.1.13 Β· AGPL-3.0-only AND BSD-2-Clause
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms