Thanks pg thats just what I needed to see. I think I got those problems sorted
but I'm after uncovering new problems. I'm trying to

  • Set the encryption key using get_key() whether its envoked by new_cipher() or just the Set Encryption Key button in the main window. And store this key so new_cipher() doesn't ask for a new key, the only way to change it would be to click on the Set Encryption Key button in the main window.

This doesn't seem to want to work new_cipher() doesn't envoke get_key() at all. And when new_cipher is run it returns an error of invalid key.(From the DES module) although the key has been created correctly(as far as I can see.) The $key is created at the start of the script and is accessible to all functions.(i.e. its public) in each of the functions I use $newkey  #(a new private var) for creating and setting the key.

See the functions new_cipher() and get_key() below.

sub new_cipher { my $newkey = get_key() if ($key eq ""); my $cipher = Crypt::CBC->new( {'key' => "$newkey", 'cipher' => 'DES', 'iv' => '$KJh#(}q', 'regenerate_key' => 0, # default tr +ue 'padding' => 'space', 'prepend_iv' => 0 }); return $cipher; } sub get_key { my $getkeybox = $mw->DialogBox(-title=>"Set Encryption Key", -buttons=>["Ok", "Cancel"] ); $getkeybox->add('Label', -anchor => 'w', -justify => 'left', -text => qq(Please enter your Encryption Key))->pa +ck(qw/-side top -anchor w/); my $keybox = $getkeybox->add('Entry', -takefocus => '1', -textvariable => "$key", )->pack(qw/-side top -fill both -expand 1 + -anchor w/); my $button = $getkeybox->Show(); my $newkey = pack("H16", $keybox->get) unless $button eq "Cancel"; $key = $newkey; return $newkey; }


The error I get is:
Tk::Error: Can't locate object method "TIEHANDLE" via package "" at cbc.pl line
162.

I get this error by clicking straight on the Encryption button which calls new_cipher() before get_key()!!
I'm pretty puzzled. And would apprieciate any help you could give.


All the Best, Eoin...

If everything seems to be going well, you obviously don't know what the hell is going on.


In reply to Re: Re: popup values in Tk by eoin
in thread popup values in Tk by eoin

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.