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

p e r l . . .
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.


Give a man a fish:  <%-{-{-{-<


In reply to Re^3: Saving a Perl session to a file by AnomalousMonk
in thread Saving a Perl session to a file by gpmathis

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.