HTML::O...::Screen(3)
β¨ NAME β¨
So like, this is HTML::Object::DOM::Screen β the HTML Object DOM Screen Class, bestie. That's the whole vibe. It's the class that gives you the screen object, and we're gonna get into it π
πΈ SYNOPSIS πΈ
Okay so here's how you actually summon one of these bad boys into existence:
use HTML::Object::DOM::Screen;
my $screen = HTML::Object::DOM::Screen->new ||
die( HTML::Object::DOM::Screen->error, "\n" );
Very demure, very mindful. Either you get a $screen or you die screaming the error message with a newline. No in-between, no cap π
π VERSION π
v0.2.0
That's the version, bestie. Iconic. Write it down π
π¦ DESCRIPTION π¦
Okay so the "Screen" interface β and yes it's in quotes like that, that's how they wrote it β represents the screen. And not just a screen, the only one, under perl, on which the current window object exists. Highkey main character energy: there's literally one screen and your window lives on it π
You get your hands on it using "screen" in HTML::Object::DOM::Window. That's the door, that's the way in, iykyk πͺβ¨
π INHERITANCE π
The family tree, fr fr. This is the whole lineage, exactly as it goes:
+-----------------------+ +---------------------------+ +---------------------------+
| HTML::Object::Element | --> | HTML::Object::EventTarget | --> | HTML::Object::DOM::Screen |
+-----------------------+ +---------------------------+ +---------------------------+
So HTML::Object::Element flows into HTML::Object::EventTarget, which flows into HTML::Object::DOM::Screen. Three generations of absolute royalty, and our girl is at the end of the chain eating everything that came before her ππ
π PROPERTIES π
Okay so this class straight-up inherits properties from its parent HTML::Object::EventTarget, bestie. Let's get into it π
availHeight
Heads up: normally this returns undef under perl, but you can set whatever number value you want. It's giving "paint your own reality" β¨
Under JavaScript, this specifies the height of the screen, in pixels, minus permanent or semipermanent user interface features displayed by the operating system, such as the Taskbar on Windows. So basically the real estate you actually get.
Example:
use HTML::Object::DOM qw( screen window );
my $availHeight = window->screen->availHeight;
my $paletteWindow = window->open( "panels.html", "Panels", "left=0, top=0, width=200" );
Another example:
window->outerHeight = window->screen->availHeight;
See also Mozilla documentation: https://developer.mozilla.org/en-US/docs/Web/API/Screen/availHeight
availLeft
Normally this returns undef under perl, but you can set whatever number value you want, no cap π
Under JavaScript, this returns the first available pixel available from the left side of the screen.
Example:
use HTML::Object::DOM qw( screen window );
my $availLeft = window->screen->availLeft;
my $setX = window->screen->width - window->screen->availLeft;
my $setY = window->screen->height - window->screen->availTop;
# The following does absolutely nothing in perl, obviously
window->moveTo( $setX, $setY );
See also Mozilla documentation: https://developer.mozilla.org/en-US/docs/Web/API/Screen/availLeft
availTop
Normally this returns undef under perl, but you can set whatever number value you want π«Ά
Under JavaScript, this specifies the y-coordinate of the first pixel that is not allocated to permanent or semipermanent user interface features.
Example:
my $availTop = window->screen->availTop;
my $setX = window->screen->width - window->screen->availLeft;
my $setY = window->screen->height - window->screen->availTop;
# The following does absolutely nothing in perl, obviously
window->moveTo( $setX, $setY );
See also Mozilla documentation: https://developer.mozilla.org/en-US/docs/Web/API/Screen/availTop
availWidth
Normally this returns undef under perl, but you can set whatever number value you want β
Under JavaScript, this returns the amount of horizontal space in pixels available to the window.
Example:
my $width = window->screen->availWidth
my $screenAvailWidth = window->screen->availWidth;
say( $screenAvailWidth );
See also Mozilla documentation: https://developer.mozilla.org/en-US/docs/Web/API/Screen/availWidth
colorDepth
Normally this returns undef under perl, but you can set whatever number value you want π
Under JavaScript, this returns the color depth of the screen. Literally how many colors your vibe can serve.
Example:
use HTML::Object::DOM qw( screen window );
# Check the color depth of the screen
if( window->screen->colorDepth < 8 )
{
# Use low-color version of page
}
else
{
# Use regular, colorful page
}
See also Mozilla documentation: https://developer.mozilla.org/en-US/docs/Web/API/Screen/colorDepth
height
Normally this returns undef under perl, but you can set whatever number value you want π
Under JavaScript, this returns the height of the screen in pixels.
Example:
my $height = window->screen->height
use HTML::Object::DOM qw( screen window );
if( window->screen->availHeight !== window->screen->height )
{
# Something is occupying some screen real estate!
}
See also Mozilla documentation: https://developer.mozilla.org/en-US/docs/Web/API/Screen/height
left
Normally this returns undef under perl, but you can set whatever number value you want π¦
Under JavaScript, this returns the distance in pixels from the left side of the main screen to the left side of the current screen.
Example:
use HTML::Object::DOM qw( screen window );
my $left = window->screen->left;
See also Mozilla documentation: https://developer.mozilla.org/en-US/docs/Web/API/Screen/left
lockOrientation
Under perl environment this returns undef by default, but you can set whatever value you want. Main character energy: you decide your own orientation π
β¨
Under JavaScript, this locks the screen into a specified orientation into which to lock the screen. This is either a string or an array of strings. Passing several strings lets the screen rotate only in the selected orientations.
Possible values that are not enforced under this perl interface are:
portrait-primaryβ It represents the orientation of the screen when it is in its primary portrait mode. A screen is considered in its primary portrait mode if the device is held in its normal position and that position is in portrait, or if the normal position of the device is in landscape and the device held turned by 90Β° clockwise. The normal position is device dependant.portrait-secondaryβ It represents the orientation of the screen when it is in its secondary portrait mode. A screen is considered in its secondary portrait mode if the device is held 180Β° from its normal position and that position is in portrait, or if the normal position of the device is in landscape and the device held is turned by 90Β° counterclockwise. The normal position is device dependant.landscape-primaryβ It represents the orientation of the screen when it is in its primary landscape mode. A screen is considered in its primary landscape mode if the device is held in its normal position and that position is in landscape, or if the normal position of the device is in portrait and the device held is turned by 90Β° clockwise. The normal position is device dependant.landscape-secondaryβ It represents the orientation of the screen when it is in its secondary landscape mode. A screen is considered in its secondary landscape mode if the device held is 180Β° from its normal position and that position is in landscape, or if the normal position of the device is in portrait and the device held is turned by 90Β° counterclockwise. The normal position is device dependant.portraitβ It represents bothportrait-primaryandportrait-secondary.landscapeβ It represents bothlandscape-primaryandlandscape-secondary.defaultβ It represents eitherportrait-primaryandlandscape-primarydepends on natural orientation of devices. For example, if the panel resolution is1280*800,defaultwill make it landscape, if the resolution is800*1280,defaultwill make it to portrait.
See also Mozilla documentation: https://developer.mozilla.org/en-US/docs/Web/API/Screen/lockOrientation
mozBrightness
Normally this returns undef under perl, but you can set whatever number value you want π₯
Under JavaScript, this Controls the brightness of a device's screen. A double between 0 and 1.0 is expected.
Example:
use HTML::Object::DOM qw( screen window );
my $screenBrightness = window->screen->mozBrightness;
See also Mozilla documentation: https://developer.mozilla.org/en-US/docs/Web/API/Screen/mozBrightness
mozEnabled
Normally this is read-only, but under perl you can set whatever boolean value you want π
Under JavaScript, when this is set to false, it will turn off the device's screen.
Example:
use HTML::Object::DOM qw( screen window );
my $screenEnabled = window->screen->mozEnabled
See also Mozilla documentation: https://developer.mozilla.org/en-US/docs/Web/API/Screen/mozEnabled
orientation
Normally this returns undef under perl, but you can set whatever string value you want. This returns a scalar object πΈ
Under JavaScript, this returns the ScreenOrientation instance associated with this screen.
Example:
use HTML::Object::DOM qw( screen window );
my $orientation = screen->$orientation;
my $orientation = screen->orientation;
if( $orientation == "landscape-primary" )
{
say( "That looks good." );
}
elsif( $orientation == "landscape-secondary" )
{
say( "Mmmh... the screen is upside down!" );
}
elsif( $orientation == "portrait-secondary" || $orientation == "portrait-primary" )
{
say( "Mmmh... you should rotate your device to landscape" );
}
elsif( $orientation == undefined )
{
say( "The orientation API is not supported in this browser :(" );
}
See also Mozilla documentation: https://developer.mozilla.org/en-US/docs/Web/API/Screen/orientation
pixelDepth
Normally this returns undef under perl, but you can set whatever number value you want π
Under JavaScript, this gets the bit depth of the screen.
Example:
use HTML::Object::DOM qw( screen window );
my $depth = window->screen->pixelDepth
# if there is not adequate bit depth
# choose a simpler color
if( window->screen->pixelDepth > 8 )
{
$doc->style->color = "#FAEBD7";
}
else
{
$doc->style->color = "#FFFFFF";
}
See also Mozilla documentation: https://developer.mozilla.org/en-US/docs/Web/API/Screen/pixelDepth
top
Normally this returns undef under perl, but you can set whatever number value you want π
Under JavaScript, this returns the distance in pixels from the top side of the current screen.
Example:
use HTML::Object::DOM qw( screen window );
my $top = window->screen->top;
See also Mozilla documentation: https://developer.mozilla.org/en-US/docs/Web/API/Screen/top
width
Normally this returns undef under perl, but you can set whatever number value you want β¨
Under JavaScript, this returns the width of the screen.
Example:
use HTML::Object::DOM qw( screen window );
my $lWidth = window->screen->width
# Crude way to check that the screen is at least 1024x768
if( window->screen->width >= 1024 && window->screen->height >= 768 )
{
# Resolution is 1024x768 or above
}
See also Mozilla documentation: https://developer.mozilla.org/en-US/docs/Web/API/Screen/width
π METHODS π
And the methods? Also inherited from its parent HTML::Object::EventTarget, obviously π
unlockOrientation
This always returns undef under perl. Yeah, always. It's giving "no thoughts, head empty" π
Normally, under JavaScript, this unlocks the screen orientation (only works in fullscreen or for installed apps)
See also Mozilla documentation: https://developer.mozilla.org/en-US/docs/Web/API/Screen/unlockOrientation
πΈ AUTHOR πΈ
Jacques Deguest <jack@deguest.jp> β the icon who made this happen π
π¦ SEE ALSO π¦
Mozilla documentation: https://developer.mozilla.org/en-US/docs/Web/API/Window
π COPYRIGHT & LICENSE π
Okay bestie, final section, the grown-up part β but we're gonna make it cute anyway because that's just how we roll π
The copyright on this whole thing belongs to DEGUEST Pte. Ltd., and it's from 2021:
Copyright(c) 2021 DEGUEST Pte. Ltd.
And yes, all the rights are reserved. Every single one of them, no cap:
All rights reserved
Now here's the fun part β this is free software, like genuinely free, and the terms it runs on are the exact same terms as Perl itself:
This program is free software; you can redistribute it and/or modify it
under the same terms as Perl itself.
So like, redistribute it, modify it, do your thing β just under Perl's own terms. That's the whole vibe check, periodt π«Ά
and that's a wrap on the whole page, bestie!! β¨ππ¦
You just read the docs for HTML::O...::Screen(3), as shipped with perl v5.42.2, and this little snapshot was dated 2026-02-15 πΈ
go forth and slay your terminal, ily, bye ππ
π¦ where this page comes from
- alpine 3.24: perl-html-object-doc 0.6.0-r1 Β· GPL-1.0-or-later OR Artistic-1.0-Perl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms