DaemonForums  

Go Back   DaemonForums > Miscellaneous > Programming

Programming C, bash, Python, Perl, PHP, Java, you name it.

Reply
 
Thread Tools Display Modes
  #1   (View Single Post)  
Old 9th August 2008
bsdnewbie999 bsdnewbie999 is offline
Package Pilot
 
Join Date: May 2008
Posts: 145
Default compiling and running perl/tk

How do I compile and run a perl/tk program using terminal?
Reply With Quote
  #2   (View Single Post)  
Old 9th August 2008
Carpetsmoker's Avatar
Carpetsmoker Carpetsmoker is offline
Real Name: Martin
Tcpdump Spy
 
Join Date: Apr 2008
Location: Netherlands
Posts: 2,243
Default

% perl myscript.pl

It's as simple as that
__________________
UNIX was not designed to stop you from doing stupid things, because that would also stop you from doing clever things.
Reply With Quote
  #3   (View Single Post)  
Old 9th August 2008
ai-danno's Avatar
ai-danno ai-danno is offline
Spam Deminer
 
Join Date: May 2008
Location: Boca Raton, Florida
Posts: 284
Default

Are you interested in learning to program in perl and tk? Or are you interested in compiling and running programs/scripts that others have written?

If you are interested in the programming side, I would suggest the "Learning Perl" book by O'Reilly Publishing, affectionately known as the "The Llama". It's out of print but available online. And it's completely worth it.
__________________
Network Firefighter
Reply With Quote
  #4   (View Single Post)  
Old 9th August 2008
ocicat ocicat is offline
Administrator
 
Join Date: Apr 2008
Posts: 3,318
Default

Quote:
Originally Posted by ai-danno View Post
It's out of print but available online.
The fifth edition of Learning Perl was published in June 2008:

http://oreilly.com/catalog/9780596520106/

If copies cannot be found in bookstores, it can be ordered online. As ai-danno, I agree that this is a very good introduction to Perl, but it does not cover Perl/Tk.
Reply With Quote
  #5   (View Single Post)  
Old 10th August 2008
drl's Avatar
drl drl is offline
Port Guard
 
Join Date: May 2008
Posts: 19
Default

Hi.

Assuming you have entered the following with an editor of your choice:
Code:
#!/usr/bin/perl

# @(#) p1       Demonstrate perl/tk.
# Learning Perl/Tk, O'Reilly, Walsh, 1999, page 11.

use Tk;

my $mw = MainWindow->new;
$mw->title("Hello, world.");
$mw->Button( -text => "Done", -command => sub {exit} )->pack;
MainLoop;
You then may do:
Code:
chmod +x p1
./p1
and a small window will be created on your console, assuming all other prerequisites are handled: X is up, perl is at /usr/bin/perl, etc. This allows you to use this file just like a standard command. I prefer this method. I rarely code in perl/tk, but I have standardized comments for processing with command what -- that's what the @(#) comment is about -- you don't need that to run perl codes. The chmod need only be done once. After that, edit to your heart's content, and re-run with ./p1

See also the reference below ... cheers, drl

Quote:
Title: Learning Perl/Tk
Author: Nancy Walsh
Edition: 1st
Date: 1999
Publisher: O'Reilly
ISBN: 1565923146
Pages: 376
Categories: programming, perl, tk
Comments: 3 stars (33 reviews, Amazon, 2008.08)
Comments: More recent: Mastering Perl/Tk, 2002

Last edited by drl; 10th August 2008 at 10:25 AM.
Reply With Quote
Reply

Tags
perl, perl/tk

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Compiling pingus error. bsdnewbie999 OpenBSD General 7 16th May 2009 08:43 AM
Compiling Epkowa Oko OpenBSD Packages and Ports 3 30th December 2008 10:01 PM
c++ compiling hello world Gates Programming 3 26th July 2008 12:48 PM
Compiling Nagios 3.02 roundkat Solaris 1 2nd June 2008 09:09 PM
Compiling OpenBSD code WeakSauceIII OpenBSD General 4 19th May 2008 12:59 AM


All times are GMT. The time now is 11:17 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Content copyright © 2007-2010, the authors
Daemon image copyright ©1988, Marshall Kirk McKusick