 2010/03/22
|
Last update 2001/02/22
 The Labs - Design & Functionality For The NetPerl, The Joy of Programming
Perl is surely the most powerful language for the UNIX platform to handle
system-adminstration tasks. I nearly write everything in Perl nowadays, even
graphic applications, not to mentioned 95% of all my CGIs (exceptions
are heavy used CGIs, ie. web-counter, or webchat).
- Introduction
- Online Documentation
- Comprehensive Perl Archive Network (CPAN)
- Perl & HTML
- Perl Examples
- Misc Perl Prgs
- Perl Compiler
- Perl
-
- Inline
Perl is certainly the best script-language I have encountered, and
use it for all purposed. I only use to write C for resource-sensitive
applications, I always try to find a way to use Perl.
| Perl Lab2. Online Documentation
|
Enter 'faq' to read the Perl-FAQs.
| Perl Lab3. Comprehensive Perl Archive Network (CPAN)
|
There you find all the modules you likely will use to write
your applications:
Install Modules

| | |
perl -MCPAN -e 'install Time::HiRes'
|
as example install the HiRes package.
|
Using Perl within HTML isn't really support officially, but there are
some more or less consistent approaches worthwhile to consider:
Best is learning from the experts:
| Perl Lab6. Misc Perl Prgs
|
Here some of our perl-stuff we did:
| SystemViuwSmall PerlTK script show cpu/memory and disk-space |
NetViuwSmall PerlTK script shows netstat |
PerlFlashWriting flash .swf via perl |
| DNSToolMaking life easier with bind-4.x and bind-8.x |
and more programs, as we use perl almost for everything . . .
The long expected is finally here, the perl compiler.
test.pl:
|
#!/usr/local/bin/perl
|
|
print "Hi there!\n";
|
Byte Code

| | First level of compiling (as the interpreter usually does) is the
byte-code:
and you get test.plc, which is machine-independent, executed
by perl test.plc.
|
Compiled

| | To compile it truly into a binary (via C-source and cc)
and you get test, which is now machine-dependent.
|
Reversing Byte Code

| | You can also translate byte-code back to source (great feature!):
|
perlcc -MO=Deparse test.pl
|
which creates byte-code and gives out the source-code; great feature
to make source-code readable again.
|
The module Inline provides a nifty interface (API) to other
compiled or interpreted languages.
Inline::C

| | The Inline::C allows to include
C functions within the perl-source. Inline::C extracts the C-source and
compiles the code into binary and is then called with appropriate arguments.
Advantage: fast and easy integration of performance sensitive C/C++ code.
Disadvantage: code is compiled first (once or when code changes) and binary is cached,
may compromise perl-portability.
Many Perl5 modules provide interface to existing C/C++ libraries, Inline::C will
provide a very fast and handy implementation approach; most useful for prototyping.
Example:
|
use Inline C => <<'END_C';
|
|
|
|
void greet() {
|
|
printf("Hello, world\n");
|
|
}
|
|
END_C
|
|
greet;
|
|
Download

| |
|
It is to be expected more languages will be supported very soon (Jan 2001).
We certainly will start to use Inline::C now extensively in our existing
perl-programs (e.g. ProgrammerHTML and PicArt) which worked as interface
to implement or interface another script- or compiled language.

Hipocrisy of the finest: "I agree that no single company can create all the hardware and software. Openness is central because it's the foundation of choice." -- Steve Balmer (Microsoft) blaming Apple regarding iPhone, February 18, 2009Last update 2001/02/22 
All Rights Reserved - (C) 1997 - 2009 by The Labs.Com |