FAQ 8.31 Can I use perl to run a telnet or ftp session?


This is an excerpt from the latest version perlfaq8.pod, which
comes with the standard Perl distribution. These postings aim to
reduce the number of repeated questions as well as allow the community
to review and update the answers. The latest version of the complete
perlfaq is at http://faq.perl.org .

--------------------------------------------------------------------

8.31: Can I use perl to run a telnet or ftp session

Try the Net::FTP, TCP::Client, and Net::Telnet modules (available from
CPAN). http://www.cpan.org/scripts/netstuff/telnet.emul.shar will also
help for emulating the telnet protocol, but Net::Telnet is quite
probably easier to use..

If all you want to do is pretend to be telnet but don't need the initial
telnet handshaking, then the standard dual-process approach will
suffice:

use IO::Socket; # new in 5.004
$handle = IO::Socket::INET->new('www.perl.com:80')
or die "can't connect to port 80 on www.perl.com: $!";
$handle->autoflush(1);
if (fork()) { # XXX: undef means failure
select($handle);
print while ; # everything from stdin to socket
} else {
print while ; # everything from socket to stdout
}
close $handle;
exit;



--------------------------------------------------------------------

The perlfaq-workers, a group of volunteers, maintain the perlfaq. They
are not necessarily experts in every domain where Perl might show up,
so please include as much information as possible and relevant in any
corrections. The perlfaq-workers also don't have access to every
operating system or platform, so please include relevant details for
corrections to examples that do not work on particular platforms.
Working code is greatly appreciated.

If you'd like to help maintain the perlfaq, see the details in
perlfaq.pod.
Posted On: Tuesday 16th of October 2012 06:37:43 AM Total Views:  99
View Complete with Replies

RELATED TOPICS OF Perl PROGRAMMING LANGUAGE




FAQ 8.18 How can I do an atexit() or setjmp()/longjmp()? (Exception handling)

This is an excerpt from the latest version perlfaq8.pod, which comes with the standard Perl distribution. These postings aim to reduce the number of repeated questions as well as allow the community to review and update the answers. The latest version of the complete perlfaq is at http://faq.perl.org . -------------------------------------------------------------------- 8.18: How can I do an atexit() or setjmp()/longjmp() (Exception handling) Release 5 of Perl added the END block, which can be used to simulate atexit(). Each package's END block is called when the program or thread ends (see perlmod manpage for more details). For example, you can use this to make sure your filter program managed to finish its output without filling up the disk: END { close(STDOUT) || die "stdout close failed: $!"; } The END block isn't called when untrapped signals kill the program, though, so if you use END blocks you should also use use sigtrap qw(die normal-signals); Perl's exception-handling mechanism is its eval() operator. You can use eval() as setjmp and die() as longjmp. For details of this, see the section on signals, especially the time-out handler for a blocking flock() in "Signals" in perlipc or the section on "Signals" in the Camel Book. If exception handling is all you're interested in, try the exceptions.pl library (part of the standard perl distribution). If you want the atexit() syntax (and an rmexit() as well), try the AtExit module available from CPAN. -------------------------------------------------------------------- The perlfaq-workers, a group of volunteers, maintain the perlfaq. They are not necessarily experts in every domain where Perl might show up, so please include as much information as possible and relevant in any corrections. The perlfaq-workers also don't have access to every operating system or platform, so please include relevant details for corrections to examples that do not work on particular platforms. Working code is greatly appreciated. If you'd like to help maintain the perlfaq, see the details in perlfaq.pod.
VIEWS ON THIS POST

141

Posted on:

Tuesday 16th October 2012
View Replies!

How can I change the icons in the Tk::ToolBar

I have a script using Tk::ToolBar and would like to use icons that are not in the built in icons. The images are ".png" or ".jpg" format. sample code: use Tk ; use Tk::ToolBar; my $mw = new MainWindow; my $tb = $mw->ToolBar( -movable => 1, -side => 'top', -indicatorcolor => 'blue'); $tb->ToolButton (-text => 'Button', -command => sub { print "hi\n" }); $tb->ToolLabel (-text => 'A Label'); my $tb2 = $mw->ToolBar; $tb2->ToolButton(-image => 'navback22', # 'back', -command => \&back); $tb2->ToolButton(-image => 'navforward22', -tip => 'forward', -command => \&forward); $tb2->separator; $tb2->ToolButton(-image => 'navhome22', -tip => 'home', -command => \&home); $tb2->ToolButton(-image => 'actreload22', -tip => 'reload', -command => \&reload); MainLoop;
VIEWS ON THIS POST

135

Posted on:

Tuesday 16th October 2012
View Replies!

How to insert raw image pixels into canvas?

I'd like to paint a section of an image onto a canvas. For that, I cut out the section using Image::Magick::GetPixels. However, this function returns a raw array of image pixels (RGBA, in my case). What function could I use to insert this into a canvas I cannot use the createImage method as that requires an image created with the imageCreate method (I use Photo). I also don't want to load the entire image and just move some window over it, as I'd like to construct the image on the canvas from sections of a number of other images. use warnings; use strict; use Image::Magick; use Tk; my $image = Image::Magick->new; my $x = $image->Read('Image.png'); warn "$x" if "$x"; my @sub = $image->GetPixels('width'=> 10, 'height' => 10, 'x' => 2000, 'y' => 2000, 'map' => 'RGBA', 'normalize' => 'false'); my $top = new MainWindow; my $canvas = $top->Canvas()->pack(); my $tile = $canvas->Photo(-data => @sub, -height => 10, -width => 10); $canvas->createImage(-image => $tile); MainLoop(); exit 0; -- Mails please to josef dot moellers and I'm on gmx dot de.
VIEWS ON THIS POST

136

Posted on:

Tuesday 16th October 2012
View Replies!

FAQ 4.14 How can I compare two dates and find the difference?

This is an excerpt from the latest version perlfaq4.pod, which comes with the standard Perl distribution. These postings aim to reduce the number of repeated questions as well as allow the community to review and update the answers. The latest version of the complete perlfaq is at http://faq.perl.org . -------------------------------------------------------------------- 4.14: How can I compare two dates and find the difference (contributed by brian d foy) You could just store all your dates as a number and then subtract. Life isn't always that simple though. If you want to work with formatted dates, the "Date::Manip", "Date::Calc", or "DateTime" modules can help you. -------------------------------------------------------------------- The perlfaq-workers, a group of volunteers, maintain the perlfaq. They are not necessarily experts in every domain where Perl might show up, so please include as much information as possible and relevant in any corrections. The perlfaq-workers also don't have access to every operating system or platform, so please include relevant details for corrections to examples that do not work on particular platforms. Working code is greatly appreciated. If you'd like to help maintain the perlfaq, see the details in perlfaq.pod.
VIEWS ON THIS POST

172

Posted on:

Tuesday 16th October 2012
View Replies!

Win32::IE::Mechanize can't upload

I have a form on a webpage I am trying to automate. there is a 'file' field that I can't get to accept data. I've mapped the path down to the Win32::IE::Input module, and tried to set the value from that, but still nothing. Has anyone been able to get this to work
VIEWS ON THIS POST

118

Posted on:

Tuesday 16th October 2012
View Replies!

FAQ 5.31 How can I tell whether there's a character waiting on a filehandle?

This is an excerpt from the latest version perlfaq5.pod, which comes with the standard Perl distribution. These postings aim to reduce the number of repeated questions as well as allow the community to review and update the answers. The latest version of the complete perlfaq is at http://faq.perl.org . -------------------------------------------------------------------- 5.31: How can I tell whether there's a character waiting on a filehandle The very first thing you should do is look into getting the Term::ReadKey extension from CPAN. As we mentioned earlier, it now even has limited support for non-portable (read: not open systems, closed, proprietary, not POSIX, not Unix, etc) systems. You should also check out the Frequently Asked Questions list in comp.unix.* for things like this: the answer is essentially the same. It's very system dependent. Here's one solution that works on BSD systems: sub key_ready { my($rin, $nfd); vec($rin, fileno(STDIN), 1) = 1; return $nfd = select($rin,undef,undef,0); } If you want to find out how many characters are waiting, there's also the FIONREAD ioctl call to be looked at. The *h2ph* tool that comes with Perl tries to convert C include files to Perl code, which can be "require"d. FIONREAD ends up defined as a function in the *sys/ioctl.ph* file: require 'sys/ioctl.ph'; $size = pack("L", 0); ioctl(FH, FIONREAD(), $size) or die "Couldn't call ioctl: $!\n"; $size = unpack("L", $size); If *h2ph* wasn't installed or doesn't work for you, you can *grep* the include files by hand: % grep FIONREAD /usr/include/*/* /usr/include/asm/ioctls.h:#define FIONREAD 0x541B Or write a small C program using the editor of champions: % cat > fionread.c #include main() { printf("%#08x\n", FIONREAD); } ^D % cc -o fionread fionread.c % ./fionread 0x4004667f And then hard code it, leaving porting as an exercise to your successor. $FIONREAD = 0x4004667f; # XXX: opsys dependent $size = pack("L", 0); ioctl(FH, $FIONREAD, $size) or die "Couldn't call ioctl: $!\n"; $size = unpack("L", $size); FIONREAD requires a filehandle connected to a stream, meaning that sockets, pipes, and tty devices work, but *not* files. -------------------------------------------------------------------- The perlfaq-workers, a group of volunteers, maintain the perlfaq. They are not necessarily experts in every domain where Perl might show up, so please include as much information as possible and relevant in any corrections. The perlfaq-workers also don't have access to every operating system or platform, so please include relevant details for corrections to examples that do not work on particular platforms. Working code is greatly appreciated. If you'd like to help maintain the perlfaq, see the details in perlfaq.pod.
VIEWS ON THIS POST

209

Posted on:

Tuesday 16th October 2012
View Replies!

FAQ 5.35 Why can't I use "C:\temp\foo" in DOS paths? Why doesn't `C:\temp\foo.exe` work?

This is an excerpt from the latest version perlfaq5.pod, which comes with the standard Perl distribution. These postings aim to reduce the number of repeated questions as well as allow the community to review and update the answers. The latest version of the complete perlfaq is at http://faq.perl.org . -------------------------------------------------------------------- 5.35: Why can't I use "C:\temp\foo" in DOS paths Why doesn't `C:\temp\foo.exe` work Whoops! You just put a tab and a formfeed into that filename! Remember that within double quoted strings ("like\this"), the backslash is an escape character. The full list of these is in "Quote and Quote-like Operators" in perlop. Unsurprisingly, you don't have a file called "ctab)emp(formfeed)oo" or "ctab)emp(formfeed)oo.exe" on your legacy DOS filesystem. Either single-quote your strings, or (preferably) use forward slashes. Since all DOS and Windows versions since something like MS-DOS 2.0 or so have treated "/" and "\" the same in a path, you might as well use the one that doesn't clash with Perl--or the POSIX shell, ANSI C and C++, awk, Tcl, Java, or Python, just to mention a few. POSIX paths are more portable, too. -------------------------------------------------------------------- The perlfaq-workers, a group of volunteers, maintain the perlfaq. They are not necessarily experts in every domain where Perl might show up, so please include as much information as possible and relevant in any corrections. The perlfaq-workers also don't have access to every operating system or platform, so please include relevant details for corrections to examples that do not work on particular platforms. Working code is greatly appreciated. If you'd like to help maintain the perlfaq, see the details in perlfaq.pod.
VIEWS ON THIS POST

159

Posted on:

Tuesday 16th October 2012
View Replies!

How to get topleft corner of screolled canvas

I'm creating a scrolled canvas with a photo in it. I'd like to know the absolute coordinates when I click into the photo. The values I get through "Ev('x')" and "Ev('y')" are relative to the top left corner of the window, so if I scroll right, and click into the top left corner, I still get very low values. How do I get the "real" coordinates -- Mails please to josef dot moellers and I'm on gmx dot de.
VIEWS ON THIS POST

219

Posted on:

Tuesday 16th October 2012
View Replies!

FAQ 5.19 How can I reliably rename a file?

This is an excerpt from the latest version perlfaq5.pod, which comes with the standard Perl distribution. These postings aim to reduce the number of repeated questions as well as allow the community to review and update the answers. The latest version of the complete perlfaq is at http://faq.perl.org . -------------------------------------------------------------------- 5.19: How can I reliably rename a file If your operating system supports a proper mv(1) utility or its functional equivalent, this works: rename($old, $new) or system("mv", $old, $new); It may be more portable to use the File::Copy module instead. You just copy to the new file to the new name (checking return values), then delete the old one. This isn't really the same semantically as a rename(), which preserves meta-information like permissions, timestamps, inode info, etc. Newer versions of File::Copy export a move() function. -------------------------------------------------------------------- The perlfaq-workers, a group of volunteers, maintain the perlfaq. They are not necessarily experts in every domain where Perl might show up, so please include as much information as possible and relevant in any corrections. The perlfaq-workers also don't have access to every operating system or platform, so please include relevant details for corrections to examples that do not work on particular platforms. Working code is greatly appreciated. If you'd like to help maintain the perlfaq, see the details in perlfaq.pod.
VIEWS ON THIS POST

267

Posted on:

Tuesday 16th October 2012
View Replies!

FAQ 4.42 How can I tell whether a certain element is contained in a list or array?

This is an excerpt from the latest version perlfaq4.pod, which comes with the standard Perl distribution. These postings aim to reduce the number of repeated questions as well as allow the community to review and update the answers. The latest version of the complete perlfaq is at http://faq.perl.org . -------------------------------------------------------------------- 4.42: How can I tell whether a certain element is contained in a list or array (portions of this answer contributed by Anno Siegel) Hearing the word "in" is an *in*dication that you probably should have used a hash, not a list or array, to store your data. Hashes are designed to answer this question quickly and efficiently. Arrays aren't. That being said, there are several ways to approach this. If you are going to make this query many times over arbitrary string values, the fastest way is probably to invert the original array and maintain a hash whose keys are the first array's values. @blues = qw/azure cerulean teal turquoise lapis-lazuli/; %is_blue = (); for (@blues) { $is_blue{$_} = 1 } Now you can check whether $is_blue{$some_color}. It might have been a good idea to keep the blues all in a hash in the first place. If the values are all small integers, you could use a simple indexed array. This kind of an array will take up less space: @primes = (2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31); @is_tiny_prime = (); for (@primes) { $is_tiny_prime[$_] = 1 } # or simply @istiny_prime[@primes] = (1) x @primes; Now you check whether $is_tiny_prime[$some_number]. If the values in question are integers instead of strings, you can save quite a lot of space by using bit strings instead: @articles = ( 1..10, 150..2000, 2017 ); undef $read; for (@articles) { vec($read,$_,1) = 1 } Now check whether "vec($read,$n,1)" is true for some $n. These methods guarantee fast individual tests but require a re-organization of the original list or array. They only pay off if you have to test multiple values against the same array. If you are testing only once, the standard module "List::Util" exports the function "first" for this purpose. It works by stopping once it finds the element. It's written in C for speed, and its Perl equivalent looks like this subroutine: sub first (&@) { my $code = shift; foreach (@_) { return $_ if &{$code}(); } undef; } If speed is of little concern, the common idiom uses grep in scalar context (which returns the number of items that passed its condition) to traverse the entire list. This does have the benefit of telling you how many matches it found, though. my $is_there = grep $_ eq $whatever, @array; If you want to actually extract the matching elements, simply use grep in list context. my @matches = grep $_ eq $whatever, @array; -------------------------------------------------------------------- The perlfaq-workers, a group of volunteers, maintain the perlfaq. They are not necessarily experts in every domain where Perl might show up, so please include as much information as possible and relevant in any corrections. The perlfaq-workers also don't have access to every operating system or platform, so please include relevant details for corrections to examples that do not work on particular platforms. Working code is greatly appreciated. If you'd like to help maintain the perlfaq, see the details in perlfaq.pod.
VIEWS ON THIS POST

358

Posted on:

Tuesday 16th October 2012
View Replies!

FAQ 3.26 Where can I learn about object-oriented Perl programming?

This is an excerpt from the latest version perlfaq3.pod, which comes with the standard Perl distribution. These postings aim to reduce the number of repeated questions as well as allow the community to review and update the answers. The latest version of the complete perlfaq is at http://faq.perl.org . -------------------------------------------------------------------- 3.26: Where can I learn about object-oriented Perl programming A good place to start is perltoot, and you can use perlobj, perlboot, perltoot, perltooc, and perlbot for reference. A good book on OO on Perl is the "Object-Oriented Perl" by Damian Conway from Manning Publications, or "Intermediate Perl" by Randal Schwartz, brian d foy, and Tom Phoenix from O'Reilly Media. -------------------------------------------------------------------- The perlfaq-workers, a group of volunteers, maintain the perlfaq. They are not necessarily experts in every domain where Perl might show up, so please include as much information as possible and relevant in any corrections. The perlfaq-workers also don't have access to every operating system or platform, so please include relevant details for corrections to examples that do not work on particular platforms. Working code is greatly appreciated. If you'd like to help maintain the perlfaq, see the details in perlfaq.pod.
VIEWS ON THIS POST

124

Posted on:

Tuesday 16th October 2012
View Replies!

FAQ 2.2 How can I get a binary version of perl?

This is an excerpt from the latest version perlfaq2.pod, which comes with the standard Perl distribution. These postings aim to reduce the number of repeated questions as well as allow the community to review and update the answers. The latest version of the complete perlfaq is at http://faq.perl.org . -------------------------------------------------------------------- 2.2: How can I get a binary version of perl For Windows, ActiveState provides a pre-built Perl for free: http://www.activestate.com/ Sunfreeware.com provides binaries for many utilities, including Perl, for Solaris on both Intel and SPARC hardware: http://www.sunfreeware.com/ If you don't have a C compiler because your vendor for whatever reasons did not include one with your system, the best thing to do is grab a binary version of gcc from the net and use that to compile perl with. CPAN only has binaries for systems that are terribly hard to get free compilers for, not for Unix systems. Some URLs that might help you are: http://www.cpan.org/ports/ http://www.perl.com/pub/language/info/software.html Someone looking for a perl for Win16 might look to Laszlo Molnar's djgpp port in http://www.cpan.org/ports/#msdos , which comes with clear installation instructions. -------------------------------------------------------------------- The perlfaq-workers, a group of volunteers, maintain the perlfaq. They are not necessarily experts in every domain where Perl might show up, so please include as much information as possible and relevant in any corrections. The perlfaq-workers also don't have access to every operating system or platform, so please include relevant details for corrections to examples that do not work on particular platforms. Working code is greatly appreciated. If you'd like to help maintain the perlfaq, see the details in perlfaq.pod.
VIEWS ON THIS POST

118

Posted on:

Tuesday 16th October 2012
View Replies!

FAQ 8.16 How can I sleep() or alarm() for under a second?

This is an excerpt from the latest version perlfaq8.pod, which comes with the standard Perl distribution. These postings aim to reduce the number of repeated questions as well as allow the community to review and update the answers. The latest version of the complete perlfaq is at http://faq.perl.org . -------------------------------------------------------------------- 8.16: How can I sleep() or alarm() for under a second If you want finer granularity than the 1 second that the "sleep()" function provides, the easiest way is to use the "select()" function as documented in "select" in perlfunc. Try the "Time::HiRes" and the "BSD::Itimer" modules (available from CPAN, and starting from Perl 5.8 "Time::HiRes" is part of the standard distribution). -------------------------------------------------------------------- The perlfaq-workers, a group of volunteers, maintain the perlfaq. They are not necessarily experts in every domain where Perl might show up, so please include as much information as possible and relevant in any corrections. The perlfaq-workers also don't have access to every operating system or platform, so please include relevant details for corrections to examples that do not work on particular platforms. Working code is greatly appreciated. If you'd like to help maintain the perlfaq, see the details in perlfaq.pod.
VIEWS ON THIS POST

136

Posted on:

Tuesday 16th October 2012
View Replies!

FAQ 7.24 How can I catch accesses to undefined variables, functions, or methods?

This is an excerpt from the latest version perlfaq7.pod, which comes with the standard Perl distribution. These postings aim to reduce the number of repeated questions as well as allow the community to review and update the answers. The latest version of the complete perlfaq is at http://faq.perl.org . -------------------------------------------------------------------- 7.24: How can I catch accesses to undefined variables, functions, or methods The AUTOLOAD method, discussed in "Autoloading" in perlsub and "AUTOLOAD: Proxy Methods" in perltoot, lets you capture calls to undefined functions and methods. When it comes to undefined variables that would trigger a warning under "use warnings", you can promote the warning to an error. use warnings FATAL => qw(uninitialized); -------------------------------------------------------------------- The perlfaq-workers, a group of volunteers, maintain the perlfaq. They are not necessarily experts in every domain where Perl might show up, so please include as much information as possible and relevant in any corrections. The perlfaq-workers also don't have access to every operating system or platform, so please include relevant details for corrections to examples that do not work on particular platforms. Working code is greatly appreciated. If you'd like to help maintain the perlfaq, see the details in perlfaq.pod.
VIEWS ON THIS POST

133

Posted on:

Tuesday 16th October 2012
View Replies!

FAQ 6.3 How can I pull out lines between two patterns that are themselves on different lines?

This is an excerpt from the latest version perlfaq6.pod, which comes with the standard Perl distribution. These postings aim to reduce the number of repeated questions as well as allow the community to review and update the answers. The latest version of the complete perlfaq is at http://faq.perl.org . -------------------------------------------------------------------- 6.3: How can I pull out lines between two patterns that are themselves on different lines You can use Perl's somewhat exotic ".." operator (documented in perlop): perl -ne 'print if /START/ .. /END/' file1 file2 ... If you wanted text and not lines, you would use perl -0777 -ne 'print "$1\n" while /START(.*)END/gs' file1 file2 ... But if you want nested occurrences of "START" through "END", you'll run up against the problem described in the question in this section on matching balanced text. Here's another example of using "..": while () { $in_header = 1 .. /^$/; $in_body = /^$/ .. eof; # now choose between them } continue { $. = 0 if eof; # fix $. } -------------------------------------------------------------------- The perlfaq-workers, a group of volunteers, maintain the perlfaq. They are not necessarily experts in every domain where Perl might show up, so please include as much information as possible and relevant in any corrections. The perlfaq-workers also don't have access to every operating system or platform, so please include relevant details for corrections to examples that do not work on particular platforms. Working code is greatly appreciated. If you'd like to help maintain the perlfaq, see the details in perlfaq.pod.
VIEWS ON THIS POST

140

Posted on:

Tuesday 16th October 2012
View Replies!

FAQ 4.14 How can I compare two dates and find the difference?

This is an excerpt from the latest version perlfaq4.pod, which comes with the standard Perl distribution. These postings aim to reduce the number of repeated questions as well as allow the community to review and update the answers. The latest version of the complete perlfaq is at http://faq.perl.org . -------------------------------------------------------------------- 4.14: How can I compare two dates and find the difference (contributed by brian d foy) You could just store all your dates as a number and then subtract. Life isn't always that simple though. If you want to work with formatted dates, the "Date::Manip", "Date::Calc", or "DateTime" modules can help you. -------------------------------------------------------------------- The perlfaq-workers, a group of volunteers, maintain the perlfaq. They are not necessarily experts in every domain where Perl might show up, so please include as much information as possible and relevant in any corrections. The perlfaq-workers also don't have access to every operating system or platform, so please include relevant details for corrections to examples that do not work on particular platforms. Working code is greatly appreciated. If you'd like to help maintain the perlfaq, see the details in perlfaq.pod.
VIEWS ON THIS POST

167

Posted on:

Tuesday 16th October 2012
View Replies!

FAQ 3.22 How can I get "#!perl" to work on [MS-DOS,NT,...]?

This is an excerpt from the latest version perlfaq3.pod, which comes with the standard Perl distribution. These postings aim to reduce the number of repeated questions as well as allow the community to review and update the answers. The latest version of the complete perlfaq is at http://faq.perl.org . -------------------------------------------------------------------- 3.22: How can I get "#!perl" to work on [MS-DOS,NT,...] For OS/2 just use extproc perl -S -your_switches as the first line in "*.cmd" file ("-S" due to a bug in cmd.exe's "extproc" handling). For DOS one should first invent a corresponding batch file and codify it in "ALTERNATE_SHEBANG" (see the dosish.h file in the source distribution for more information). The Win95/NT installation, when using the ActiveState port of Perl, will modify the Registry to associate the ".pl" extension with the perl interpreter. If you install another port, perhaps even building your own Win95/NT Perl from the standard sources by using a Windows port of gcc (e.g., with cygwin or mingw32), then you'll have to modify the Registry yourself. In addition to associating ".pl" with the interpreter, NT people can use: "SET PATHEXT=%PATHEXT%;.PL" to let them run the program "install-linux.pl" merely by typing "install-linux". Under "Classic" MacOS, a perl program will have the appropriate Creator and Type, so that double-clicking them will invoke the MacPerl application. Under Mac OS X, clickable apps can be made from any "#!" script using Wil Sanchez' DropScript utility: http://www.wsanchez.net/software/ . *IMPORTANT!*: Whatever you do, PLEASE don't get frustrated, and just throw the perl interpreter into your cgi-bin directory, in order to get your programs working for a web server. This is an EXTREMELY big security risk. Take the time to figure out how to do it correctly. -------------------------------------------------------------------- The perlfaq-workers, a group of volunteers, maintain the perlfaq. They are not necessarily experts in every domain where Perl might show up, so please include as much information as possible and relevant in any corrections. The perlfaq-workers also don't have access to every operating system or platform, so please include relevant details for corrections to examples that do not work on particular platforms. Working code is greatly appreciated. If you'd like to help maintain the perlfaq, see the details in perlfaq.pod.
VIEWS ON THIS POST

75

Posted on:

Tuesday 16th October 2012
View Replies!

FAQ 3.28 I've read perlembed, perlguts, etc., but I can't embed perl in my C program; what am I doing wrong?

This is an excerpt from the latest version perlfaq3.pod, which comes with the standard Perl distribution. These postings aim to reduce the number of repeated questions as well as allow the community to review and update the answers. The latest version of the complete perlfaq is at http://faq.perl.org . -------------------------------------------------------------------- 3.28: I've read perlembed, perlguts, etc., but I can't embed perl in my C program; what am I doing wrong Download the ExtUtils::Embed kit from CPAN and run `make test'. If the tests pass, read the pods again and again and again. If they fail, see perlbug and send a bug report with the output of "make test TEST_VERBOSE=1" along with "perl -V". -------------------------------------------------------------------- The perlfaq-workers, a group of volunteers, maintain the perlfaq. They are not necessarily experts in every domain where Perl might show up, so please include as much information as possible and relevant in any corrections. The perlfaq-workers also don't have access to every operating system or platform, so please include relevant details for corrections to examples that do not work on particular platforms. Working code is greatly appreciated. If you'd like to help maintain the perlfaq, see the details in perlfaq.pod.
VIEWS ON THIS POST

178

Posted on:

Tuesday 16th October 2012
View Replies!

FAQ 2.8 Where can I get information on Perl?

This is an excerpt from the latest version perlfaq2.pod, which comes with the standard Perl distribution. These postings aim to reduce the number of repeated questions as well as allow the community to review and update the answers. The latest version of the complete perlfaq is at http://faq.perl.org . -------------------------------------------------------------------- 2.8: Where can I get information on Perl The complete Perl documentation is available with the Perl distribution. If you have Perl installed locally, you probably have the documentation installed as well: type "man perl" if you're on a system resembling Unix. This will lead you to other important man pages, including how to set your $MANPATH. If you're not on a Unix system, access to the documentation will be different; for example, documentation might only be in HTML format. proper perl installations have fully-accessible documentation. You might also try "perldoc perl" in case your system doesn't have a proper man command, or it's been misinstalled. If that doesn't work, try looking in /usr/local/lib/perl5/pod for documentation. If all else fails, consult http://perldoc.perl.org/ which has the complete documentation in HTML and PDF format. Many good books have been written about Perl--see the section later in perlfaq2 for more details. Tutorial documents are included in current or upcoming Perl releases include perltoot for objects or perlboot for a beginner's approach to objects, perlopentut for file opening semantics, perlreftut for managing references, perlretut for regular expressions, perlthrtut for threads, perldebtut for debugging, and perlxstut for linking C and Perl together. There may be more by the time you read this. These URLs might also be useful: http://perldoc.perl.org/ http://bookmarks.cpan.org/search.cgi...ng%2FTutorials -------------------------------------------------------------------- The perlfaq-workers, a group of volunteers, maintain the perlfaq. They are not necessarily experts in every domain where Perl might show up, so please include as much information as possible and relevant in any corrections. The perlfaq-workers also don't have access to every operating system or platform, so please include relevant details for corrections to examples that do not work on particular platforms. Working code is greatly appreciated. If you'd like to help maintain the perlfaq, see the details in perlfaq.pod.
VIEWS ON THIS POST

179

Posted on:

Tuesday 16th October 2012
View Replies!

FAQ 2.8 Where can I get information on Perl?

This is an excerpt from the latest version perlfaq2.pod, which comes with the standard Perl distribution. These postings aim to reduce the number of repeated questions as well as allow the community to review and update the answers. The latest version of the complete perlfaq is at http://faq.perl.org . -------------------------------------------------------------------- 2.8: Where can I get information on Perl The complete Perl documentation is available with the Perl distribution. If you have Perl installed locally, you probably have the documentation installed as well: type "man perl" if you're on a system resembling Unix. This will lead you to other important man pages, including how to set your $MANPATH. If you're not on a Unix system, access to the documentation will be different; for example, documentation might only be in HTML format. proper perl installations have fully-accessible documentation. You might also try "perldoc perl" in case your system doesn't have a proper man command, or it's been misinstalled. If that doesn't work, try looking in /usr/local/lib/perl5/pod for documentation. If all else fails, consult http://perldoc.perl.org/ which has the complete documentation in HTML and PDF format. Many good books have been written about Perl--see the section later in perlfaq2 for more details. Tutorial documents are included in current or upcoming Perl releases include perltoot for objects or perlboot for a beginner's approach to objects, perlopentut for file opening semantics, perlreftut for managing references, perlretut for regular expressions, perlthrtut for threads, perldebtut for debugging, and perlxstut for linking C and Perl together. There may be more by the time you read this. These URLs might also be useful: http://perldoc.perl.org/ http://bookmarks.cpan.org/search.cgi...ng%2FTutorials -------------------------------------------------------------------- The perlfaq-workers, a group of volunteers, maintain the perlfaq. They are not necessarily experts in every domain where Perl might show up, so please include as much information as possible and relevant in any corrections. The perlfaq-workers also don't have access to every operating system or platform, so please include relevant details for corrections to examples that do not work on particular platforms. Working code is greatly appreciated. If you'd like to help maintain the perlfaq, see the details in perlfaq.pod.
VIEWS ON THIS POST

137

Posted on:

Tuesday 16th October 2012
View Replies!