Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: Contribute a hack to the new "Perl Hacks" book

by zentara (Archbishop)
on Dec 17, 2005 at 12:57 UTC ( [id://517477]=note: print w/replies, xml ) Need Help??


in reply to Contribute a hack to the new "Perl Hacks" book

Well this is a shortcut I use all the time, to setup a Perl script. I use midnight commander for almost all my work, and it has a "template menu" which you can invoke in the editor to add template code. This one lets you "touch filename" ( I have touch bash-aliased to just 't' :-) ), then hit F4 to edit the empty new file, then F11 to get a selection of templates. Then hit 'p' to insert the basic perl template.

In /usr/share/mc/cedit.menu

+ y unknown & t r p #!/usr/bin/perl echo "#!/usr/bin/perl use warnings; use strict; " >%b
I also have extended it to make a basic gtk2 app with the 'h' key
+ y unknown & t r h #!/usr/bin/perl echo "#!/usr/bin/perl use warnings; use strict; use Glib qw/TRUE FALSE/; use Gtk2 '-init'; my \$window = Gtk2::Window->new('toplevel'); \$window->set_title('Z'); \$window ->signal_connect( 'destroy' => \\&delete_event +); \$window->set_border_width(10); \$window->set_size_request(300,200); my \$vbox = Gtk2::VBox->new( FALSE, 6 ); \$window->add(\$vbox); \$vbox->set_border_width(2); my \$hbox= Gtk2::HBox->new( FALSE, 6 ); \$vbox->pack_end(\$hbox,FALSE,FALSE,0); \$hbox->set_border_width(2); my \$frame0 = Gtk2::Frame->new('Controls'); \$vbox->pack_end( \$frame0, FALSE, FALSE, 0 ); \$frame0->set_border_width(3); \$vbox->pack_end (Gtk2::HSeparator->new, FALSE, FALSE, 0 +); my \$hbox0 = Gtk2::HBox->new( FALSE, 6 ); \$frame0->add(\$hbox0); \$hbox0->set_border_width(3); my \$button = Gtk2::Button->new_from_stock('gtk-quit'); \$hbox0->pack_end( \$button, FALSE, FALSE, 0 ); \$button->signal_connect( clicked => \\&delete_event ); \$window->show_all(); Gtk2->main; ##################################### sub delete_event { Gtk2->main_quit; return FALSE; } " >%b

I'm not really a human, but I play one on earth. flash japh

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://517477]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (4)
As of 2024-04-25 10:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found