in reply to Re^2: Saving a Perl session to a file
in thread Saving a Perl session to a file
This was just a quick hack thrown together to show what might be done with Win32::Console.
After I got to the point at which I captured $rect, I dd-ed it (Data::Dump) and found that a string that appeared as, e.g., 'perl...' in the console was dumped as "p\0\a\0e\0\a\0r\0\a\0l\0\a\0..." I used the
$rect =~ s{ \0\a\0 } ''xmsg;
substitution to convert the string back to 'perl...'. Why the extra "\0\a\0" groups were present with each character I don't know; I assume some character set/encoding effect. I didn't investigate further, but just zapped them. I would suggest you do a raw dump of whatever you first get back from the
my $rect = $con_current->ReadRect($left, $top, $right, $bottom);
call and adjust as necessary for your system; I don't know what the appropriate s/// will be for you.
What you get back from the ReadRect() call is apparently a single long line without newlines. You then may have to break this string up into lines (possibly triming trailing whitespace) in order to have something useful, but again, I didn't bother with this step. I did find a bunch of blanks may be present at the end of the string, which I got rid of with the
$rect =~ s{ [ ]+ \z } ''xms;
substitution. Purely for cosmetic purposes, a further substitution of
$rect =~ s{ .{$width} \z } ''xms;
removes the last line with the
c:\@Work\Perl\monks\gpmathis>capsess
invocation before printing the $rect string.
... i get the whole text in vertical sense ie only in the first column of the console.
By this I assume you mean that 'perl...' appears as
in your console window. I have no idea why this is, but can only suggest that you dump the raw $rect string returned by the ReadRect() call and go on from there, hacking away until you get something that looks ok. Good luck.p e r l . . .
Give a man a fish: <%-{-{-{-<
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Saving a Perl session to a file - Win32::Console usabability
by Discipulus (Canon) on Apr 15, 2017 at 11:52 UTC | |
by AnomalousMonk (Archbishop) on Apr 15, 2017 at 18:54 UTC |