Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change

Comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
#!/usr/bin/perl -w use strict; use Tk; =head1 NAME =head1 VERSION 0.1 (alpha) =head1 SYNOPSIS CryptEdit provides a quick text edit environment which saves directly to an encrypted file, which removes the incredibly insecure step of saving the text to a file on disk and then encrypting from there. =head1 AUTHOR Michael Libby =head1 USAGE C<> The program is set to use GnuPG using a keyring in a default location (or with an options file readable from the default location. (I have also included a sample that will use a keyring located on a floppy disk on a Windows machine). You may need to alter the $PRIV_CMD to operate with your install of PGP or GnuPG. Enter a valid pathname/filename. Enter a recipient name. Type your text (or even use cut and paste to insert text from elsewhere), click the "Encrypt to File" button. Viola! =cut #user settings #$PRIV_CMD must have a trailing space! my $PRIV_CMD = "gpg "; #my $PRIV_CMD = "pgp "; #my $PRIV_CMD = "gpg --homedir A: "; #construct the application window my $mw = Tk::MainWindow->new(); #create action buttons my $button_bar = $mw->Frame()->pack( -expand => 1, -fill => 'x'); my $button_encrypt = $button_bar->Button( -text => 'Encrypt to File', -command => \&encrypt_to_file ); my $button_exit = $button_bar->Button( -text => 'Exit', -command => \&exit_app ); $button_encrypt->pack( -side => 'left' ); $button_exit->pack( -side => 'left' ); #create entry fields my $name_frame = $mw->Frame()-> pack( -expand => 1, -fill => 'x' ); my $name_label = $name_frame->Label( text => 'Filename:')-> pack( -side => 'left' ); my $name_entry = $name_frame->Entry()-> pack( -side => 'right', -fill => 'x', -expand => 1 ); my $recip_frame = $mw->Frame()-> pack( -expand => 1, -fill => 'x' ); my $recip_label = $recip_frame->Label( text => 'Recipient:')-> pack( -side => 'left' ); my $recip_entry = $recip_frame->Entry()-> pack( -side => 'right', -fill => 'x', -expand => 1 ); #create main text area my $text_box = $mw->Scrolled( 'Text', '-scrollbars' => 'e', )-> pack(); MainLoop; sub encrypt_to_file { #get privacy call command my $priv_call = $PRIV_CMD; $priv_call .= "-r " . $recip_entry->get() . " "; $priv_call .= "-o " . $name_entry->get() . " "; $priv_call .= "--encrypt "; #get text my $text = $text_box->get('1.0', 'end'); #open pipe to privacy command open( PRIVACY, "| $priv_call"); print PRIVACY $text; close PRIVACY; } sub exit_app { #add check if text changed since last saved or signed? exit; } =head1 COPYRIGHT This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Also available in full at =cut

In reply to by ichimunki

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, 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, 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.
  • Log In?

    What's my password?
    Create A New User
    [Corion]: erix: Yeah, I just found that it has no documentation at all on how to circumvent/ eliminate "1+n SELECTs" by building a local hash... I guess I have to make ->has_many do the hash lookup instead of doing the SQL query. But as the problem ...
    [Corion]: ... has only manifested itself so far through the puzzled questions of other bystanders, I won't go deeper at this time. But the DBIx::Class documentation could well do with a document on how to make "it" (that is, ORMs in general) faster ;)
    [Corion]: I find that DBIx::Class, like most ORMs makes things easy until they become performance critical and then makes it horribly hard to change things because the design is highly inflexible if you don't already know about the problems of 1+n :-/
    [choroba]: that's why I don't like similar libraries. They pretend you don't have to learn SQL, but in the end, you have to learn how SQL plus to overcome their own limitations
    [Corion]: "Just write the proper SQL beforehand" is of course the appropriate solution, but if you did that, you wouldn't/couldn't use DBIx::Class either. At least not in an obvious (to me) way.
    choroba scratches a "how"
    [Corion]: choroba: Exactly... But maybe that's just because I'm old and grumpy ;)
    [Corion]: But maybe that could also be a nice talk, how to restructure your DBIx::Class-based app to remove 1+n-style query patterns
    [Corion]: In theory, that should be easy because you should have the "where" clause from part 1 of the patterns and then do the corresponding single select using that where clause to select all rows in one go for the n other parts.
    [Corion]: But in practice I don't see any obvious places documented in DBIx::Class where one would do that and then just feed hash lookups instead of DB lookups for ->has_many results

    How do I use this? | Other CB clients
    Other Users?
    Others pondering the Monastery: (7)
    As of 2017-09-25 11:11 GMT
    Find Nodes?
      Voting Booth?
      During the recent solar eclipse, I:

      Results (279 votes). Check out past polls.