Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical

Re^7: Perl/Tk code structure

by BrowserUk (Pope)
on Jan 11, 2012 at 10:58 UTC ( #947328=note: print w/replies, xml ) Need Help??

in reply to Re^6: Perl/Tk code structure
in thread Perl/Tk code structure

I was just reluctant to ask you to do it because it's too much like spoonfeeding.

The whole point of this place is to help people learn, so never be reluctant to ask questions. You'll occasionally garner a few downvotes from those who've forgotten that they also 'didn't know' at some point in the past. But as XP is worth less than the energy it takes to click a vote button, don't sweat it.

And most of us here are happy to answer questions.

If you think you can enlighten my about how to do this in a couple of comments added to the above code and add the code for generating a widget based on specific strings printed to the original script's STDOUT, that'd be great.

I don't add comments up front because: a) it is a lot of extra effort to do well, which all too often is wasted when the OP chooses someone else's solution; b) I don't know what level the questioner is at -- what bits they might need explaining and what not -- and trying to explain everything is impossible. I'd need to replicate the 100,000+ lines of the Perl documentation, and risk patronising you along the way with detailed explanations of stuff you already understand.

So, enough meta discussion. Which bits of the code I posted need further explanation? You said you had some experience of TK, so I don't want to waste time explaining stuff you understand.

How about we abandon this subthread, and you post a few questions as a direct reply to the code I posted and we go from there.

(ps. Have you actually tried just adding the 3 lines to your existing script and putting the module in the local directory, just to see how that works?)

With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

The start of some sanity?

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://947328]
[jdporter]: one prog I have has a UI which allows to input a bit mask
[jdporter]: currently it expects the bitmask to be in the form of a hex number, e.g. 0x0101
[jdporter]: but I'd like to let the user specify it as individual bits, i.e. 0b0000000100000001
[jdporter]: there is no bit/binary equivalent of hex, right?
[jdporter]: I guess that the most direct way of doing it is with some magical incantation involving unpack or whatever
[jdporter]: let me google that for me ;-)
[jdporter]: hex points explicitly to oct, which does the job. :-D
[jdporter]: omg, I f love Perl!
[choroba]: say unpack 'H*', pack 'B*', $mask =~ /0b([01]+)/;

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (8)
As of 2018-02-20 16:30 GMT
Find Nodes?
    Voting Booth?
    When it is dark outside I am happiest to see ...

    Results (272 votes). Check out past polls.