[31083] in Perl-Users-Digest
Perl-Users Digest, Issue: 2328 Volume: 11
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Apr 9 14:09:40 2009
Date: Thu, 9 Apr 2009 11:09:07 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Thu, 9 Apr 2009 Volume: 11 Number: 2328
Today's topics:
Re: Function alias QoS@invalid.net
Re: Function alias <uri@stemsystems.com>
Re: Function alias <someone@example.com>
Re: Function alias (Tim McDaniel)
Re: Function alias <uri@stemsystems.com>
how to check missing breaks in switch case blocks <kernus@gmail.com>
Re: how to check missing breaks in switch case blocks <smallpond@juno.com>
new CPAN modules on Thu Apr 9 2009 (Randal Schwartz)
Pipe Between Programs <edgrsprj@ix.netcom.com>
Re: Pipe Between Programs <tadmc@seesig.invalid>
Re: Pipe Between Programs <RedGrittyBrick@spamweary.invalid>
Re: Pipe Between Programs <edgrsprj@ix.netcom.com>
Re: Pipe Between Programs <edgrsprj@ix.netcom.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Thu, 09 Apr 2009 13:20:40 GMT
From: QoS@invalid.net
Subject: Re: Function alias
Message-Id: <ICmDl.2565$6n.1928@nwrddc01.gnilink.net>
neilsolent <n@solenttechnology.co.uk> wrote in message-id: <ea137925-54c3-4490-8608-5e6b5996377c@o6g2000yql.googlegroups.com>
>
> I have a question on Perl syntax. Given a couple of functions:
>
> #########
> sub Test1
> {
> print "Test1\n";
> }
>
> sub Test2
> {
> print "Test2\n";
> }
>
> #######
>
> How can I call the subroutine that is named in a scalar variable
> $func?
> Here, the scalar $func will contain either "Test1" or "Test2"
>
> e.g. this doesn't work:
>
> &($func)
>
> Thanks,
> Neil
Have a look a this code snippet taken from a majormud client i made in Perl.
Near the bottom (within the else) you may see the tecnique you describe above.
my $w; my @labels; my $c = -1;
while(@opts) {
my $i = shift @opts;
if ($i =~ m/^\+\+$/) {
my $l = shift @opts || 'UNDEFINED';
push(@labels, "$l");
$w = $mw->Menu(-tearoff => '0',);
$menu->cascade(-menu => $w, -label => $l,);
$c++;
}
elsif ($i =~ m/^--$/) {
$w->separator();
}
else {
my $l = lc($labels[$c]);
$w->command(
-label => $i,
-underline => '0',
-command => sub {
my $sub = \&{ $l; };
&$sub($i); #&menu_label(menuitem_label)
}
);
}
}
HtH
Jason
------------------------------
Date: Thu, 09 Apr 2009 10:21:59 -0400
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: Function alias
Message-Id: <x7myap7vqw.fsf@mail.sysarch.com>
>>>>> "Q" == QoS <QoS@invalid.net> writes:
Q> my $w; my @labels; my $c = -1;
single letter names are nasty. they convey no meaning to the reader. and
you use them all over
Q> while(@opts) {
Q> my $i = shift @opts;
if @opts are always defined or true you can reduce that to:
while( my $opt = shift @opts ) {
while( defined( my $opt = shift @opts ) ) {
Q> if ($i =~ m/^\+\+$/) {
that is the same as $i eq '++'. no need for a regex there
Q> my $l = shift @opts || 'UNDEFINED';
what if the opt was 0 or ''?
Q> push(@labels, "$l");
quoting scalars is a bug waiting to happen. FAQ too.
Q> $w = $mw->Menu(-tearoff => '0',);
are you sure that should be '0' and not 0? they are different and could
affect some things.
Q> $menu->cascade(-menu => $w, -label => $l,);
Q> $c++;
c++ is not perl! :)
Q> }
Q> elsif ($i =~ m/^--$/) {
same as above: $i eq '--'
Q> $w->separator();
Q> }
Q> else {
Q> my $l = lc($labels[$c]);
Q> $w->command(
Q> -label => $i,
Q> -underline => '0',
Q> -command => sub {
Q> my $sub = \&{ $l; };
Q> &$sub($i); #&menu_label(menuitem_label)
ewww, symrefs again! use a dispatch table. google for it.
Q> HtH
sorry, but it didn't. we already admonished the OP for wanting to use or
even learn symrefs.
uri
--
Uri Guttman ------ uri@stemsystems.com -------- http://www.sysarch.com --
----- Perl Code Review , Architecture, Development, Training, Support ------
--------- Free Perl Training --- http://perlhunter.com/college.html ---------
--------- Gourmet Hot Cocoa Mix ---- http://bestfriendscocoa.com ---------
------------------------------
Date: Thu, 09 Apr 2009 07:36:48 -0700
From: "John W. Krahn" <someone@example.com>
Subject: Re: Function alias
Message-Id: <5KnDl.14012$Qh6.12463@newsfe14.iad>
Uri Guttman wrote:
>>>>>> "Q" == QoS <QoS@invalid.net> writes:
>
> Q> }
> Q> elsif ($i =~ m/^--$/) {
>
> same as above: $i eq '--'
Or: $i eq "--\n"
John
--
Those people who think they know everything are a great
annoyance to those of us who do. -- Isaac Asimov
------------------------------
Date: Thu, 9 Apr 2009 14:57:33 +0000 (UTC)
From: tmcd@panix.com (Tim McDaniel)
Subject: Re: Function alias
Message-Id: <grl2ct$b3s$1@reader1.panix.com>
In article <x7myap7vqw.fsf@mail.sysarch.com>,
Uri Guttman <uri@stemsystems.com> wrote:
>>>>>> "Q" == QoS <QoS@invalid.net> writes:
> Q> $w = $mw->Menu(-tearoff => '0',);
>
>are you sure that should be '0' and not 0? they are different and
>could affect some things.
I'm not seeing the difference, so would you please educate me?
(Personally, I do distinguish them in practice, depending on whether
the variable is usually used as an integer or as a string.)
--
Tim McDaniel, tmcd@panix.com
------------------------------
Date: Thu, 09 Apr 2009 12:16:40 -0400
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: Function alias
Message-Id: <x7skkh6bvb.fsf@mail.sysarch.com>
>>>>> "TM" == Tim McDaniel <tmcd@panix.com> writes:
TM> In article <x7myap7vqw.fsf@mail.sysarch.com>,
TM> Uri Guttman <uri@stemsystems.com> wrote:
>>>>>>> "Q" == QoS <QoS@invalid.net> writes:
Q> $w = $mw->Menu(-tearoff => '0',);
>>
>> are you sure that should be '0' and not 0? they are different and
>> could affect some things.
TM> I'm not seeing the difference, so would you please educate me?
in general you will rarely see a difference as perl will coerce between
them as needed. there may be some odd code where it can make a
difference. one trivial difference is how you test for 0 (not just
boolean testing). if the option wants a numeric 0 or looks for it and
you pass '0', then you waste a (minor but real) coercion to the number
version. also it can mislead the reader as to whether a number or string
is the arg type. again, minor but i do nitpick a lot as is my wont.
i just don't like to see coders doing what may work vs what is more
accurate so i try to ejimicate them.
TM> (Personally, I do distinguish them in practice, depending on whether
TM> the variable is usually used as an integer or as a string.)
that is pretty much my view as stated above but s/variable/value/! :)
uri
--
Uri Guttman ------ uri@stemsystems.com -------- http://www.sysarch.com --
----- Perl Code Review , Architecture, Development, Training, Support ------
--------- Free Perl Training --- http://perlhunter.com/college.html ---------
--------- Gourmet Hot Cocoa Mix ---- http://bestfriendscocoa.com ---------
------------------------------
Date: Wed, 8 Apr 2009 19:53:39 -0700 (PDT)
From: kernus <kernus@gmail.com>
Subject: how to check missing breaks in switch case blocks
Message-Id: <447901c2-fa75-4fe0-871d-805213110762@q16g2000yqg.googlegroups.com>
I want to know how to do a static code analysis with my C code in
Perl, instead of splint.
anyone give and ideas or some perl scripts?
thanks in advance.
------------------------------
Date: Thu, 9 Apr 2009 08:56:35 -0700 (PDT)
From: smallpond <smallpond@juno.com>
Subject: Re: how to check missing breaks in switch case blocks
Message-Id: <ddac0660-ed7a-4888-b3e2-f14b673b30d2@f11g2000vbf.googlegroups.com>
On Apr 8, 10:53 pm, kernus <ker...@gmail.com> wrote:
> I want to know how to do a static code analysis with my C code in
> Perl, instead of splint.
>
> anyone give and ideas or some perl scripts?
>
> thanks in advance.
Since falling through to the next case is legal in C
and C syntax does not provide any kind of explicit
indication your task is hopeless.
Other than break, common last lines of a case include
goto, continue and return - all perfectly valid.
Putting a break after any of these would be likely to
generate an unreachable statement warning.
My advice is to port your application to perl which is
known for its clean, maintainable syntax.
Here is a free rexexp for checking for using '=' when you
meant '==' in an if statement. Enjoy.
/\Wif\W.*[^=><!]=[^=].*\)/
------------------------------
Date: Thu, 9 Apr 2009 04:42:26 GMT
From: merlyn@stonehenge.com (Randal Schwartz)
Subject: new CPAN modules on Thu Apr 9 2009
Message-Id: <KHtH2q.1tLr@zorch.sf-bay.org>
The following modules have recently been added to or updated in the
Comprehensive Perl Archive Network (CPAN). You can install them using the
instructions in the 'perlmodinstall' page included with your Perl
distribution.
Algorithm-Dependency-1.109
http://search.cpan.org/~adamk/Algorithm-Dependency-1.109/
Base class for implementing various dependency trees
----
Algorithm-Dependency-MapReduce-0.02
http://search.cpan.org/~adamk/Algorithm-Dependency-MapReduce-0.02/
A Map/Reduce implementation for Alg:Dep graphs
----
App-PM-Announce-0.023
http://search.cpan.org/~rkrimen/App-PM-Announce-0.023/
Announce your PM meeting via Meetup and LinkedIn
----
CGI-Application-Plugin-JSON-1.02
http://search.cpan.org/~wonko/CGI-Application-Plugin-JSON-1.02/
easy manipulation of JSON headers
----
CPAN-Mini-Webserver-0.45
http://search.cpan.org/~lbrocard/CPAN-Mini-Webserver-0.45/
Search and browse Mini CPAN
----
CPANTS-Weight-0.07
http://search.cpan.org/~adamk/CPANTS-Weight-0.07/
Graph based weights for CPAN Distributions
----
CSS-DOM-0.06
http://search.cpan.org/~sprout/CSS-DOM-0.06/
Document Object Model for Cascading Style Sheets
----
Class-DBI-Lite-0.024
http://search.cpan.org/~johnd/Class-DBI-Lite-0.024/
Lightweight ORM for Perl
----
DBD-SQLite-1.22_02
http://search.cpan.org/~adamk/DBD-SQLite-1.22_02/
Self Contained RDBMS in a DBI Driver
----
DBIx-Class-Snowflake-0.09
http://search.cpan.org/~mfollett/DBIx-Class-Snowflake-0.09/
----
Data-GUID-Any-0.001
http://search.cpan.org/~dagolden/Data-GUID-Any-0.001/
Generic interface for GUID creation
----
DateTimeX-Format-00.01_06
http://search.cpan.org/~ecarroll/DateTimeX-Format-00.01_06/
Moose Roles for building next generation DateTime formats
----
Devel-RemoteTrace-0.1
http://search.cpan.org/~pmakholm/Devel-RemoteTrace-0.1/
Attachable call trace of perl scripts
----
GNTP-Growl-0.04
http://search.cpan.org/~mattn/GNTP-Growl-0.04/
Perl implementation of GNTP Protocol (Client Part)
----
Geography-Countries-2009040801
http://search.cpan.org/~abigail/Geography-Countries-2009040801/
2-letter, 3-letter, and numerical codes for countries.
----
Glib-Ex-ObjectBits-3
http://search.cpan.org/~kryde/Glib-Ex-ObjectBits-3/
----
Gtk2-Ex-WidgetBits-9
http://search.cpan.org/~kryde/Gtk2-Ex-WidgetBits-9/
miscellaneous Gtk widget helpers
----
HTML-DOM-0.023
http://search.cpan.org/~sprout/HTML-DOM-0.023/
A Perl implementation of the HTML Document Object Model
----
HTML-DOM-0.024
http://search.cpan.org/~sprout/HTML-DOM-0.024/
A Perl implementation of the HTML Document Object Model
----
HTML-Perlinfo-1.56
http://search.cpan.org/~accardo/HTML-Perlinfo-1.56/
Display a lot of Perl information in HTML format
----
Imager-AverageGray-0.0.0
http://search.cpan.org/~vvelox/Imager-AverageGray-0.0.0/
Finds the average gray for a Imager object or image.
----
KiokuDB-0.26
http://search.cpan.org/~nuffin/KiokuDB-0.26/
Object Graph storage engine
----
Lexical-Attributes-2009040801
http://search.cpan.org/~abigail/Lexical-Attributes-2009040801/
Proper encapsulation
----
Logger-0.15
http://search.cpan.org/~efl/Logger-0.15/
Configurable time-stamped logging module with timing utility
----
MOBY-1.09
http://search.cpan.org/~ekawas/MOBY-1.09/
API for hosting and/or communicating with a MOBY Central registry
----
MOSES-MOBY-0.89
http://search.cpan.org/~ekawas/MOSES-MOBY-0.89/
Perl extension for the automatic generation of BioMOBY web services
----
Module-Changes-ADAMK-0.02
http://search.cpan.org/~adamk/Module-Changes-ADAMK-0.02/
Parse a traditional Changes file (as ADAMK interpretes it)
----
Module-Install-0.82
http://search.cpan.org/~adamk/Module-Install-0.82/
Standalone, extensible Perl module installer
----
MojoX-Session-0.09
http://search.cpan.org/~vti/MojoX-Session-0.09/
Session management for Mojo
----
MooseX-Emulate-Class-Accessor-Fast-0.00801
http://search.cpan.org/~flora/MooseX-Emulate-Class-Accessor-Fast-0.00801/
Emulate Class::Accessor::Fast behavior using Moose attributes
----
MooseX-Getopt-0.17
http://search.cpan.org/~rjbs/MooseX-Getopt-0.17/
A Moose role for processing command line options
----
MooseX-Types-DateTime-ButMaintained-0.05
http://search.cpan.org/~ecarroll/MooseX-Types-DateTime-ButMaintained-0.05/
DateTime related constraints and coercions for Moose
----
MooseX-Types-DateTime-ButMaintained-0.06
http://search.cpan.org/~ecarroll/MooseX-Types-DateTime-ButMaintained-0.06/
DateTime related constraints and coercions for Moose
----
Moxy-0.55
http://search.cpan.org/~tokuhirom/Moxy-0.55/
Mobile web development proxy
----
Moxy-0.56
http://search.cpan.org/~tokuhirom/Moxy-0.56/
Mobile web development proxy
----
Net-Domain-ExpireDate-0.95
http://search.cpan.org/~despair/Net-Domain-ExpireDate-0.95/
obtain expiration date of domain names
----
Net-IMAP-Server-1.16
http://search.cpan.org/~alexmv/Net-IMAP-Server-1.16/
A single-threaded multiplexing IMAP server implementation, using Net::Server::Coro.
----
Net-Mollom-0.05
http://search.cpan.org/~wonko/Net-Mollom-0.05/
interface with Mollom web API
----
Net-OpenSocial-Client-0.01_01
http://search.cpan.org/~lyokato/Net-OpenSocial-Client-0.01_01/
OpenSocial REST/RPC Client
----
Net-Whois-Raw-2.00
http://search.cpan.org/~despair/Net-Whois-Raw-2.00/
Get Whois information for domains
----
OAuth-Lite-1.17
http://search.cpan.org/~lyokato/OAuth-Lite-1.17/
OAuth framework
----
ORDB-CPANTesters-0.06
http://search.cpan.org/~adamk/ORDB-CPANTesters-0.06/
An ORM for the published CPAN Testers SQLite database
----
ORDB-CPANUploads-0.02
http://search.cpan.org/~adamk/ORDB-CPANUploads-0.02/
An ORLite-based ORM Database API
----
POE-Component-Client-DNS-Recursive-0.06
http://search.cpan.org/~bingos/POE-Component-Client-DNS-Recursive-0.06/
A recursive DNS client for POE
----
POE-Component-Client-NRPE-0.16
http://search.cpan.org/~bingos/POE-Component-Client-NRPE-0.16/
a POE Component that implements check_nrpe functionality
----
POE-Component-Client-Whois-1.20
http://search.cpan.org/~bingos/POE-Component-Client-Whois-1.20/
A one shot non-blocking RFC 812 WHOIS query.
----
POE-Component-DHCP-Monitor-1.02
http://search.cpan.org/~bingos/POE-Component-DHCP-Monitor-1.02/
A simple POE Component for monitoring DHCP traffic.
----
POE-Component-Server-NRPE-0.16
http://search.cpan.org/~bingos/POE-Component-Server-NRPE-0.16/
A POE Component implementation of NRPE Daemon.
----
POE-Filter-Finger-0.06
http://search.cpan.org/~bingos/POE-Filter-Finger-0.06/
A POE Filter for creating FINGER servers.
----
POE-Wheel-Run-Win32-0.16
http://search.cpan.org/~bingos/POE-Wheel-Run-Win32-0.16/
portably run blocking code and programs in subprocesses
----
Padre-Plugin-Catalyst-0.02
http://search.cpan.org/~garu/Padre-Plugin-Catalyst-0.02/
Simple Catalyst helper interface for Padre
----
Parse-RPN-2.46
http://search.cpan.org/~fdulau/Parse-RPN-2.46/
----
Perl-Squish-1.06
http://search.cpan.org/~adamk/Perl-Squish-1.06/
Reduce Perl code to a few characters as possible
----
Process-0.24
http://search.cpan.org/~adamk/Process-0.24/
Objects that represent generic computational processes
----
RDF-Simple-0.408
http://search.cpan.org/~mthurn/RDF-Simple-0.408/
read and write RDF without complication
----
Smolder-1.36
http://search.cpan.org/~wonko/Smolder-1.36/
Web-based Continuous Integration Smoke Server
----
Sphinx-Search-0.16
http://search.cpan.org/~jjschutz/Sphinx-Search-0.16/
Sphinx search engine API Perl client
----
String-Perl-Warnings-1.00
http://search.cpan.org/~bingos/String-Perl-Warnings-1.00/
Determine if a string looks like a perl warning
----
Sunpower-Cryocooler-0.1.5
http://search.cpan.org/~kerr/Sunpower-Cryocooler-0.1.5/
a module for interfacing with Sunpower Cryocoolers
----
TM-IP-Documents-0.03
http://search.cpan.org/~drrho/TM-IP-Documents-0.03/
REST service for Topic Maps document subspaces
----
TM-IP-Surface-0.02
http://search.cpan.org/~drrho/TM-IP-Surface-0.02/
REST service for Topic Maps surfaces
----
Term-Sprog-0.06
http://search.cpan.org/~keichner/Term-Sprog-0.06/
Perl extension for displaying a progress indicator on a terminal.
----
Test-MockTime-0.12
http://search.cpan.org/~ddick/Test-MockTime-0.12/
Replaces actual time with simulated time
----
Text-Template-Simple-0.62_09
http://search.cpan.org/~burak/Text-Template-Simple-0.62_09/
Simple text template engine
----
Text-Template-Simple-0.62_10
http://search.cpan.org/~burak/Text-Template-Simple-0.62_10/
Simple text template engine
----
Text-Template-Simple-0.62_11
http://search.cpan.org/~burak/Text-Template-Simple-0.62_11/
Simple text template engine
----
UUID-Generator-PurePerl-0.02
http://search.cpan.org/~banb/UUID-Generator-PurePerl-0.02/
Universally Unique IDentifier (UUID) Generator
----
WWW-MobileCarrierJP-0.31
http://search.cpan.org/~tokuhirom/WWW-MobileCarrierJP-0.31/
scrape mobile carrier information
----
XML-Reader-0.09
http://search.cpan.org/~keichner/XML-Reader-0.09/
Reading XML and providing path information based on a pull-parser.
----
forks-0.33
http://search.cpan.org/~rybskej/forks-0.33/
drop-in replacement for Perl threads using fork()
If you're an author of one of these modules, please submit a detailed
announcement to comp.lang.perl.announce, and we'll pass it along.
This message was generated by a Perl program described in my Linux
Magazine column, which can be found on-line (along with more than
200 other freely available past column articles) at
http://www.stonehenge.com/merlyn/LinuxMag/col82.html
print "Just another Perl hacker," # the original
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc.
See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion
------------------------------
Date: Wed, 8 Apr 2009 22:48:14 -0500
From: "E.D.G." <edgrsprj@ix.netcom.com>
Subject: Pipe Between Programs
Message-Id: <BZKdnSFGdvtu8kDUnZ2dnUVZ_gqdnZ2d@earthlink.com>
CREATING A PIPE BETWEEN TWO PERL PROGRAMS
Windows and ActiveState Perl are being used
Can anyone supply the code for creating two direction pipes between two Perl
programs that are running at the same time?
A separate goal is to learn how to establish two direction pipes between a
Perl program and some other language program. It is assumed that the same
type of procedure would be used.
The following code is presently being used to create a one direction pipe
between a Perl program and the Gnuplot graphics program. I have not yet
been able to learn how to easily modify it so that a connection can be
established between two Perl programs.
open gnuplot, 'pgnuplot.exe';
use FileHandle;
gnuplot->autoflush(1);
print gnuplot 'some command', "\n";
close gnuplot;
Using that code, the Gnuplot graphics programs pgnuplot.exe and wgnuplot.exe
both need to be in the same directory as the Perl program.
After the pipe is created, how does one Perl program input information from
the other? I am guessing that it is some variation of the readline command
such as:
$temp = readline program2;
One of the goals here is to develop procedures that will enable researchers
around the world to work on the same scientific projects while using
whatever computer languages they prefer.
------------------------------
Date: Thu, 9 Apr 2009 06:37:18 -0500
From: Tad J McClellan <tadmc@seesig.invalid>
Subject: Re: Pipe Between Programs
Message-Id: <slrngtrnfe.v8s.tadmc@tadmc30.sbcglobal.net>
E.D.G. <edgrsprj@ix.netcom.com> wrote:
> Can anyone supply the code for creating two direction pipes
Can anyone check the Perl FAQ before asking a Perl question?
perldoc -q pipe
How can I open a pipe both to and from a command?
> The following code is presently being used to create a one direction pipe
If you say so...
> open gnuplot, 'pgnuplot.exe';
> use FileHandle;
> gnuplot->autoflush(1);
>
> print gnuplot 'some command', "\n";
>
> close gnuplot;
> After the pipe is created,
What pipe?
There is no pipe in the code you've posted.
--
Tad McClellan
email: perl -le "print scalar reverse qq/moc.noitatibaher\100cmdat/"
------------------------------
Date: Thu, 09 Apr 2009 12:48:06 +0100
From: RedGrittyBrick <RedGrittyBrick@spamweary.invalid>
Subject: Re: Pipe Between Programs
Message-Id: <49dde077$0$26448$da0feed9@news.zen.co.uk>
E.D.G. wrote:
> CREATING A PIPE BETWEEN TWO PERL PROGRAMS
>
> Windows and ActiveState Perl are being used
>
> Can anyone supply the code for creating two direction pipes between two
> Perl programs that are running at the same time?
perldoc -f open
will lead you to
perldoc IPC::Open2
>
> A separate goal is to learn how to establish two direction pipes between
> a Perl program and some other language program. It is assumed that the
> same type of procedure would be used.
s/would/could/
>
> The following code is presently being used to create a one direction
> pipe between a Perl program and the Gnuplot graphics program. I have
> not yet been able to learn how to easily modify it so that a connection
> can be established between two Perl programs.
>
>
> open gnuplot, 'pgnuplot.exe';
Please read `perldoc -f open`
$program = 'c:\some\path\pgnuplot.exe';
open my $gnuplot, '-|', $program
or die "unable to open '$program' because $!';
> use FileHandle;
> gnuplot->autoflush(1);
>
> print gnuplot 'some command', "\n";
>
> close gnuplot;
>
> Using that code, the Gnuplot graphics programs pgnuplot.exe and
> wgnuplot.exe both need to be in the same directory as the Perl program.
>
Only because you didn't specify a directory path when invoking the program.
>
> After the pipe is created, how does one Perl program input information
> from the other? I am guessing that it is some variation of the readline
> command such as:
>
> $temp = readline program2;
>
SInce we are guessing, I'd guess it is a s simple as one program writing
to STDOUT in any of the many ways available whilst the other reads from
STDIN in any of the many ways provided by Perl.
e.g.
while (<>) {
process_input_line($_);
}
AFAIK it's then just a question of buffering, of using binary I/O
functions for binary data and of using appropriate character encodings
for character data.
>
> One of the goals here is to develop procedures that will enable
> researchers around the world to work on the same scientific projects
> while using whatever computer languages they prefer.
>
http://tinyurl.com/clz7q5
“When I was still a rather precocious young man, I already realized most
vividly the futility of the hopes and aspirations that most men pursue
throughout their lives.” - Albert Einstein.
--
RGB
------------------------------
Date: Thu, 9 Apr 2009 08:20:53 -0500
From: "E.D.G." <edgrsprj@ix.netcom.com>
Subject: Re: Pipe Between Programs
Message-Id: <evidnR7S49-2a0DUnZ2dnUVZ_oWdnZ2d@earthlink.com>
"Tad J McClellan" <tadmc@seesig.invalid> wrote in message
news:slrngtrnfe.v8s.tadmc@tadmc30.sbcglobal.net...
> E.D.G. <edgrsprj@ix.netcom.com> wrote:
I did check the Perl FAQ and did not understand the information.
The "open gnuplot" command in the computer program I am already using has
the correct path in it. I simply did not include it in my post.
That code does actually do a good job of starting and running the Gnuplot
program. If it is not creating a "pipe" then what is that type of data
transfer mechanism called?
------------------------------
Date: Thu, 9 Apr 2009 08:55:53 -0500
From: "E.D.G." <edgrsprj@ix.netcom.com>
Subject: Re: Pipe Between Programs
Message-Id: <f8udnRvhHcP8Y0DUnZ2dnUVZ_rCdnZ2d@earthlink.com>
"RedGrittyBrick" <RedGrittyBrick@spamweary.invalid> wrote in message
news:49dde077$0$26448$da0feed9@news.zen.co.uk...
> E.D.G. wrote:
Your answers are appreciated. But they are beyond my level of programming
skills. As I said in the other post, I did look over the Perl documentation
but did not understand the information.
These projects all involve volunteer work. There is no funding available to
hire professional computer programmers to do a better job. However, I am
trying to get governments around the world to take over the work on at least
one of the projects.
I will go over the information a few more times. And if it still cannot be
understood then researchers involved with these efforts will just have their
programs exchange data through data files. They know less than I do about
computer programming. At least that Gnuplot graphics program control code
works and makes things a lot easier.
That URL you listed is actually quite helpful. I was fairly sure there were
Newsgroup archives out there somewhere. The main project being discussed in
notes going back a decade in time is now fully operational and as of early
March, 2009 became available as a freeware downloadable computer program.
------------------------------
Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>
Administrivia:
#The Perl-Users Digest is a retransmission of the USENET newsgroup
#comp.lang.perl.misc. For subscription or unsubscription requests, send
#the single line:
#
# subscribe perl-users
#or:
# unsubscribe perl-users
#
#to almanac@ruby.oce.orst.edu.
NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
#To request back copies (available for a week or so), send your request
#to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
#where x is the volume number and y is the issue number.
#For other requests pertaining to the digest, send mail to
#perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
#sending perl questions to the -request address, I don't have time to
#answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V11 Issue 2328
***************************************