Name

Info

Synopsis

$cons->Info

Returns an array of information about the console, which contains:

  • Number of columns (X size) of the console buffer

  • Number of rows (Y size) of the console buffer

  • Current column (X position) of the cursor

  • Current row (Y position) of the cursor

  • Current attribute used for Write

  • Left column (X of the starting point) of the current console window

  • Top row (Y of the starting point) of the current console window

  • Right column (X of the final point) of the current console window

  • Bottom row (Y of the final point) of the current console window

  • Maximum number of columns for the console window, given the current buffer size, font, and screen size

  • Maximum number of rows for the console window, given the current buffer size, font, and screen size

This example prints the cursor’s current position:

@info = $CONSOLE->Info(  );
print "Cursor at $info[3], $info[4].0";

Get Perl in a Nutshell, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.