The problem:

I want to report phishing spam. To do this, I want to do various analyses of the spam, so that I can (for example) tell the bank which headers are my ISP's internal stuff and where the real injection point is. My plan is to get various outputs from things like whois, mark the rows I want in my final LART, and then output them to a single screen so that I can do a single cut & paste rather than the dozen or so I need at present.

The issue:

I can get whois output into Perl and output it with checkboxes. However, it's more than a screen long, and I can find no sensible way of scrolling.

The code:
use strict; use warnings; use diagnostics; use Tk; use Tk::Pane; use IO::Socket; my $nVOffset = 20; my $nHOffset = 18; my $wMain = MainWindow->new; $wMain->geometry('1020x700'); $wMain->toplevel->resizable(0,0); my $frame = $wMain->Scrolled('Frame', -scrollbars => 'e', -height => 680, -width => 1000) ->place(-x => 0, -y => 20); #== sub landing { use vars qw/$server $sock $port @data $whois/; $server = "whois.completewhois.com"; $port = "43"; my $target = "81.202.7.241"; $sock = IO::Socket::INET->new(PeerAddr=>$server,PeerPort=>$port,Prot +o=>'tcp'); print $sock $target,"\r\n"; @data = <$sock>; undef($sock); my $i = 1; my @chkReport; my @lblReport; for (@data) { $chkReport[$i] = $frame->Checkbutton() ->place(-x => 0, -y => $nHOffset * ($i + 1)); #== $lblReport[$i] = $frame->Label(-text => $_) ->place(-x => $nVOffset, -y => $nHOffset * ($i + 1)); #== $i++; } } my $bLanding = $wMain->Button(-text => 'Parse', -command => sub{landing}) ->place(-x => 500, -y => 0); #== MainLoop;
Nonsense I know about:

The "#==" that appears at the end of some lines is because of a peculiarity in OpenIDE, which doesn't always seem to know when to stop showing things in purple. This solves that problem.

Part of the code uses Hungarian notation and part doesn't. This is because I have picked up some of the code from Yet another whois client (only in perl) and elsewhere, and want to get it working before I add mistakes by renaming variables.

I have hard coded inputs (a) to reduce the length of the code, and (b) to reduce the chance of bugs. This won't happen in the final version.

I have tried:

Canvas instead of frame. The docs I have read indicate that frame isn't scrollable, but I also get the impression that Pane is the way around this.

Update everywhere I can imagine it making a difference.

Outputting each line as the "text" attribute of the checkbox.

Feel free to go all perlmonks on me or attempt a Socratic dialogue. I'm trying to learn. Also, if & when I get it working (no promises on time), is this the sort of thing other monks would like me to post?

TIA & regards,

John Davies

In reply to Scrolling data in Tk by davies

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.