[7478] in Perl-Users-Digest
Perl-Users Digest, Issue: 1104 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Sep 30 12:17:15 1997
Date: Tue, 30 Sep 97 08:00:45 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Tue, 30 Sep 1997 Volume: 8 Number: 1104
Today's topics:
[Q] multi-dim hash -> DB? <geissler@heidelbg.ibm.com>
ANNOUNCE: MSDOS::Attrib 1.00 (get/set MS-DOS style file (Christopher J. Madsen)
Re: Autmatically invoking Perl code at script startup t <rootbeer@teleport.com>
Re: CGI script question (Jay Flaherty)
Re: connect() <tekman@aimnet.com>
Devel::WeakRef 0.003 alpha on CPAN <jglick@sig.bsh.com>
Re: Generating bit patterns "00000000" .. "11111111" <seay@absyss.fr>
Re: Generating bit patterns "00000000" .. "11111111" <eike.grote@theo.phy.uni-bayreuth.de>
Re: Help with system() <rootbeer@teleport.com>
Re: How to run Perl? (Tad McClellan)
Re: Java CGI Post to Perl Script <rootbeer@teleport.com>
Re: Many CGI/PERL forms don't work with Lynx? <chatmaster@nstate.net>
mon-0.37d - Service Monitoring Daemon (Jim Trocki)
Re: Net::FTP doesn't seem to work... (Jay Flaherty)
Re: New Perl syntax idea <ghowland@hotlava.com>
Re: New Perl syntax idea <rootbeer@teleport.com>
Obfuscated Perl Contest Victors (Jon Orwant)
ObjStore 1.15 <pritikin@mindspring.com>
Re: Options & No Wrong Answers <rootbeer@teleport.com>
Re: output of cms in $_ instead of print ? <seay@absyss.fr>
Perl and MAPI (COWBYS)
PERL and serial port <vincent.rabah@hol.fr>
Re: Perl equivalent to #ifdef in C? <dformosa@st.nepean.uws.edu.au>
Re: Perl equivalent to #ifdef in C? <seay@absyss.fr>
perl script don't execute <lafor@hotmail.com>
Re: References - saving & using (newbie) <rootbeer@teleport.com>
SGI::FAM 1.002 trial release <jglick@sig.bsh.com>
Re: Syntax on assignment and undef <rootbeer@teleport.com>
web-based mail reader in perl? (darrel berry)
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 30 Sep 1997 12:16:49 +0200
From: Stefan Geissler <geissler@heidelbg.ibm.com>
Subject: [Q] multi-dim hash -> DB?
Message-Id: <3430D191.41C6@heidelbg.ibm.com>
Hi,
in my latest perl-script I build a trie structure for a lexicon
by using multi-dimensional hashes. That is, the information
"sleep verb"
is stored as
"$Trie{s}{l}{e}{e}{p}{cat} = "verb";
It's a big lexicon, and once the trie is computed, I'd like to
store it in a file for later reuse.
dbmopen(%FileTrie,"myhash",0666);
%FileTrie = %Trie;
dbmclose(%FileTrie);
But when I reopen the "myhash" file the information about
the second and all the further "dimensions" seems to be lost.
I'm sure there more than one way to do it. But how?
(Is there a simple one which doesn't require any non-standard
DB modules?)
Thanks a lot for every hint,
--stefan
--
_______________________________________________________________________
: Stefan Geissler, stefan.geissler@heidelbg.ibm.com :
:Inst. fuer Logik und Linguistik, IBM Deutschland Informationssysteme :
:Vangerowstr 18, D-69115 Heidelberg, Tel/Fax. 0049-6221-59-{4482/3200}:
:_____________________________________________________________________:
------------------------------
Date: 30 Sep 1997 13:27:00 GMT
From: ac608@yfn.ysu.edu (Christopher J. Madsen)
Subject: ANNOUNCE: MSDOS::Attrib 1.00 (get/set MS-DOS style file attributes)
Message-Id: <60qun4$oak$1@news1.teleport.com>
MSDOS::Attrib 1.00 is now available on CPAN, the Comprehensive Perl
Archive Network. You can get it from the CPAN multiplexer at
http://www.perl.com/CPAN/authors/id/CJM/MSDOS-Attrib-1.00.zip
which will pick an FTP site near you.
MSDOS::Attrib allows you to get or set file attributes under OS/2 or
Windows 95/NT. These are the standard file attributes (read-only,
hidden, system, archive, and directory).
MSDOS::Attrib was previously known as OS2::Attrib. I renamed it
because it now works on Win32 systems as well as OS/2. To upgrade,
simply replace "OS2::Attrib" with "MSDOS::Attrib" in any programs that
use it.
To install MSDOS::Attrib, you will need a C compiler capable of
compiling Perl modules. It has been tested with Perl 5.004_01, under
OS/2 with EMX 0.9c and gcc 2.7.2.1, and under Windows NT with Visual
C++ 5.0 and the README.win32 instructions. If you find that a
different compiler does/doesn't work, please let me know.
--
Chris Madsen chris_madsen@geocities.com ac608@yfn.ysu.edu
------- http://www.geocities.com/SiliconValley/Heights/3222/ -------
------------------------------
Date: Tue, 30 Sep 1997 07:49:17 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Lloyd Zusman <ljz@asfast.com>
Subject: Re: Autmatically invoking Perl code at script startup time.
Message-Id: <Pine.GSO.3.96.970930074448.16316H-100000@usertest.teleport.com>
On 29 Sep 1997, Lloyd Zusman wrote:
> I would like to install some Perl code that will automatically run at
> the start of every Perl script that runs on my system.
As stated, I'm not sure that that's possible. Couldn't somebody
potentially compile their own perl binary which doesn't run your bit of
code?
You could modify your perl binary to do what you want, but that doesn't
mean that you should... :-)
What are you hoping to accomplish here?
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
Ask me about Perl trainings!
------------------------------
Date: 30 Sep 1997 12:51:14 GMT
From: fty@hickory.engr.utk.edu (Jay Flaherty)
Subject: Re: CGI script question
Message-Id: <60qsk2$2gs$2@gaia.ns.utk.edu>
Wes Mills (wesmills@poboxes.com) wrote:
: I've written a program for my web site called makealias.cgi that is
: supposed to take the fields 'alias' and 'email' from a submitted HTML
: form and echo them, with a space between, into a text file, currently
: called test.txt, and it should return an HTML page that says alias ...
: has been created and will forward to ... etc. However, the strings
: that hold this data are always returned as empty. Why does it do this?
: I have copied the library, forms-lib.pl from a book ("60 minute guide to
: CGI programming with Perl 5"), and makealias.cgi is just slightly
: modified from a program out of that book, so I fail to see why it
: wouldn't work.
It is probably one of two things.
1. the field names in the html form are not the same as defined in the
cgi program. ie: alias and email
2. the library forms-lib.pl is not being used. Try using the full path
to the library in the require statement and that it it readable by the
uid the web server runs as. ie:
require "/usr/local/apache/lib/forms-lib.pl";
Use your perl debugger to step through the program and see what happens.
Good luck...jay
--
**********************************************************************
Jay Flaherty fty@utk.edu
"Once in awhile you get shown the light, in the strangest of places if
you look at it right" - R. Hunter
**********************************************************************
------------------------------
Date: Tue, 30 Sep 1997 04:44:46 -0700
From: Khayman <tekman@aimnet.com>
Subject: Re: connect()
Message-Id: <3430E62E.10BE@aimnet.com>
Doug Seay wrote:
>
> Khayman wrote:
> >
> > Hey there, I'm working on an IRC Bot in Perl, had one previously but my
> > isp got hacked and all my coding was lost. I can't get my connection
> > routine working again and it's terribly frustrating. If someone could
> > please drop me an email to tekman@aimnet.com with some help, or even a
> > complete connection routine I would be most thankful :-)
>
> perldoc IO::Socket should do the trick
>
> - doug
It's being stubborn, won't compile on my system. I'm not advers to
setting up my socket the hard way, I just can't remember how to do it
again ;-) And my lil Camel book ain't helping for once.
Khayman
------------------------------
Date: 30 Sep 1997 13:27:59 GMT
From: "Jesse N. Glick" <jglick@sig.bsh.com>
Subject: Devel::WeakRef 0.003 alpha on CPAN
Message-Id: <60quov$odp$1@news1.teleport.com>
Devel::WeakRef attempts to provide "weak references" for Perl--things
that can be stored in a scalar, and act like references (to other
reference types only), but do not "tie up" the referred-to object with a
reference count. If the target is destroyed (loses all normal
references), the weak reference will point to undef.
If you are interested, please try it out and let me know if you have
problems with it, or are successful with it. The module uses C and
definitely requires more testing on various platforms.
--
Jesse N. Glick * mailto:jglick@sig.bsh.com
Sr. Programmer/Analyst * Strategic Interactive Group
800 Boylston St. Boston MA 02199 * 617-867-1017 (tel) 617-867-1111 (fax)
------------------------------
Date: Tue, 30 Sep 1997 12:46:35 +0200
From: Doug Seay <seay@absyss.fr>
To: Ricky Roque <ricky.roque@bigfoot.com>
Subject: Re: Generating bit patterns "00000000" .. "11111111"
Message-Id: <3430D88B.70A3DBAF@absyss.fr>
[posted and mailed]
Ricky Roque wrote:
>
> I'm trying to generate pattern like the following
> "00000000"
> "00000001"
> "00000010"
> :
> :
> "11111110"
> "11111111"
> with the following scripts.
>
> > #!/usr/local/bin/perl
> > $start = pack('B8','00000000');
> > $end = pack('B8','11111111');
Usually Perl doesn't work with pack()ed data, that is more for other
things to mess with. Try
$start = unpack('I', pack('B8', '0'x8));
$end = unpack('I', pack('B8', '1'x8));
But why go through all that? Will you be supplying your values in a
string binary format? Why not just
$start = 0;
$stop = 255;
> > for($start..$end)
> > { for($i=0;$i<16;$i++)
> > { unshift @vector, vec($_,$i,1); }
> > print @vector,"\n";
> > $#vector = -1; print ;
> > }
>
also ($start .. $end) has to build an array that isn't really used.
Just use a loop here as it is faster and cleaner.
- doug
------------------------------
Date: Tue, 30 Sep 1997 14:01:02 +0200
From: Eike Grote <eike.grote@theo.phy.uni-bayreuth.de>
Subject: Re: Generating bit patterns "00000000" .. "11111111"
Message-Id: <3430E9FE.15FB@theo.phy.uni-bayreuth.de>
Hi,
Ricky Roque wrote:
>
> > #!/usr/local/bin/perl
> > $start = pack('B8','00000000');
> > $end = pack('B8','11111111');
> >
> > for($start..$end)
> > { for($i=0;$i<16;$i++)
> > { unshift @vector, vec($_,$i,1); }
> > print @vector,"\n";
> > $#vector = -1; print ;
> > }
>
> It stops at $start and doesn't increment upto $end.
> Why? Please help.
It's because the range operator '..' uses the "magical autoincrement
algorithm" if applied to nun-numerical values (e.g. strings). And
this algorithm only works with letters and numbers ([a-zA-Z0-9])
(see Camel, 2nd ed., pp.79 and 91).
> Any other method of doing the task?
You could write a loop like this:
for(0..255) {
$v = chr($_); # $v contains the values from $start
# to $end (see your code)
}
Bye, Eike
--
======================================================================
Eike Grote, Theoretical Physics IV, University of Bayreuth, Germany
----------------------------------------------------------------------
e-mail -> eike.grote@theo.phy.uni-bayreuth.de
WWW -> http://www.phy.uni-bayreuth.de/theo/tp4/members/grote.html
http://www.phy.uni-bayreuth.de/~btpa25/
======================================================================
------------------------------
Date: Tue, 30 Sep 1997 06:53:40 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Ron Yacketta <RonYak@mindspring.com>
Subject: Re: Help with system()
Message-Id: <Pine.GSO.3.96.970930061919.16316A-100000@usertest.teleport.com>
On Mon, 29 Sep 1997, Ron Yacketta wrote:
> I have the following piece of code that works fine, except that I get
> unwanted output from the command being issued from inside the system(). I
> would like to have the command inside the system() execute without any
> output to STDOUT/STDERR.
> eval {$do = system '/etc/vgcfgbackup', "/dev/$_"};
How about if you do the fork&exec yourself?
my $do = eval {
FORK: {
my $pid = fork;
if ($pid) {
# Parent process here
waitpid($pid,0); # Let child die
$?; # Return value
} elsif (defined $pid) {
# Child process here
#
# First, close streams and do anything else needed.
# (We could also set or clear ENV vars here,
# or change directories, or maybe even chroot.)
close STDIN;
close STDOUT;
close STDERR;
# Now exec the process. If that fails, though,
# we have no way to complain except by exit status!
exec '/usr/bin/perl', '-we', 'print <STDIN>,"Hey!\n"'
or die;
} elsif ($! =~ /No more proc/) { # non-portable message
# Recoverable fork error
sleep 5;
redo FORK;
} else {
# Unexpected fork error
die "Can't fork: $!";
}
}
};
print "Error: $@\n" if $@;
print "Status: $do\n";
Hope this helps!
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
Ask me about Perl trainings!
------------------------------
Date: Tue, 30 Sep 1997 07:31:06 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: How to run Perl?
Message-Id: <aerq06.j11.ln@localhost>
Bernhard K|gle (Bernhard.Kuegle@lottery.co.at) wrote:
: I am an absolute beginner to Perl and I4d like to run it on my
: NT-System. But it doesn4t work really although I think that I have tried
: everything (permissions checked, Perls scripts associated).
: When I run a Perl script on the command line it works fine. But when I
: try to run it from my browser (Explorer, Netscape) it doesn4t work. I
: see only the file content, not the result.
So, you do not have a Perl question.
You have a server/CGI question.
Ask in a server/CGI newsgroup:
comp.infosystems.www.authoring.cgi
comp.infosystems.www.servers.ms-windows
: Within the Perls script I have also used the recommended header
: print "HTTP/1.0 200 OK\n";
: print "Content-type: text/html\n\n";
: So what to do else? Thanks for your help in advance.
Start with the Perl FAQ, part 9:
---------------------------
=head2 My CGI script runs from the command line but not the browser. Can you help me fix it?
Sure, but you probably can't afford our contracting rates :-)
Seriously, if you can demonstrate that you've read the following FAQs
and that your problem isn't something simple that can be easily
answered, you'll probably receive a courteous and useful reply to your
question if you post it on comp.infosystems.www.authoring.cgi (if it's
something to do with HTTP, HTML, or the CGI protocols). Questions that
appear to be Perl questions but are really CGI ones that are posted to
comp.lang.perl.misc may not be so well received.
The useful FAQs are:
http://www.perl.com/perl/faq/idiots-guide.html
http://www3.pair.com/webthing/docs/cgi/faqs/cgifaq.shtml
http://www.perl.com/perl/faq/perl-cgi-faq.html
http://www-genome.wi.mit.edu/WWW/faqs/www-security-faq.html
http://www.boutell.com/faq/
---------------------------
--
Tad McClellan SGML Consulting
tadmc@flash.net Perl programming
Fort Worth, Texas
------------------------------
Date: Tue, 30 Sep 1997 07:01:52 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Peter <peterpan@mailexcite.com>
Subject: Re: Java CGI Post to Perl Script
Message-Id: <Pine.GSO.3.96.970930065511.16316B-100000@usertest.teleport.com>
On Mon, 29 Sep 1997, Peter wrote:
> I have checked that FAQ before. It didn't help.
Okay, you say you've checked the so-called "Idiot's Guide" and the other
docs and FAQs in trying to find why you're getting the dreaded "500 server
error" from your CGI script, and none of this has helped. (Is that right?)
My best suggestion is to try all of that again. :-)
Despite the smiley, I'm not making a joke. All of the best advice we've
come up with so far is distilled and encapsulated in the various docs and
FAQs. If we had something better, we would add it to those files! So
there's really nothing more we can give you here. I'm sure you read
carefully, but there is quite a bit of information there; could you check
again, to see that you didn't overlook anything?
But that's not to say that those docs have everything you'll ever need for
debugging your CGI script. When you've succeeded in finding the problem,
please take another look at the "Idiot's Guide" and the other docs to see
whether you can tell how they could be more helpful for someone in the
same situation as you. We'd like your ideas so that we can make the docs
more complete and useful. Thanks!
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
Ask me about Perl trainings!
------------------------------
Date: Tue, 30 Sep 1997 03:16:28 -0700
From: Chat Central <chatmaster@nstate.net>
To: brian d foy <comdog@computerdog.com>
Subject: Re: Many CGI/PERL forms don't work with Lynx?
Message-Id: <3430D17C.7A8B@nstate.net>
[Posted and Mailed]
actually, this person perhaps had the problem of failing to add a path
for the <form action="/path/to/script.pl" METHOD=POST> Many Lynx
browsers won't work without reading a path, as opposed to <form
action="script.pl" METHOD=POST>. Maybe that was the problem he spoke
of?. Not a perl problem though :-)
Ciao..
Tim...
brian d foy wrote:
>
> In article <Pine.GSO.3.96.970927123929.11874C-100000@usertest.teleport.com>, Tom Phoenix <rootbeer@teleport.com> wrote:
>
> >On 27 Sep 1997, Patrick Kellum wrote:
> >
> >> I've noticed for a while that quite a few PERL scripts have trouble with
> >> Forms and Lynx.
> >
> >Perl doesn't know whether the browser at the other end is Lynx or not. In
> >fact, when the perl binary starts up a CGI script, it doesn't even know
> >that there's a server involved - if there is.
>
> perl doesn't know, but the script might... i think that the point is that
> neither *care* what the browser is - they get data and they give data
> on an equal opportunity basis. :)
>
> if a certain client is acting wierd, it's normally the client's fault,
> though i've never had any trouble with Lynx
>
> --
> brian d foy <comdog@computerdog.com>
> NY.pm - New York Perl M((o|u)ngers|aniacs)* <URL:http://ny.pm.org/>
> CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
--
Chat Central
In the top 5 most accessed sites on WebCrawler
since the first week up, and holding strong!!!
Receiving up to and over 10,000 visitors a day worldwide
Administrator - Chat Hub / Chat Central:
http://www.chathub.com - OR - http://chat.nstate.net
E-Mail Contact:
chatmaster@chathub.com, webmaster@chathub.com, sales@chathub.com,
info@chathub.com, admin@chathub.com, chatmaster@nstate.net
Webmaster Northstate Net:
http://www.nstate.net
E-Mail Contact:
webmaster@nstate.net
------------------------------
Date: 30 Sep 1997 13:26:22 GMT
From: trockij@transmeta.com (Jim Trocki)
Subject: mon-0.37d - Service Monitoring Daemon
Message-Id: <60qulu$oad$1@news1.teleport.com>
Mon version 0.37d
INTRODUCTION
------------
"mon" is a tool for monitoring the availability of services. Services
may be network-related, environmental conditions, or nearly anything
that can be tested with software. It is extremely useful for system
administrators, but not limited to use by them. It was designed to
separate the tasks of monitoring a service for availability and sending
out alerts when things fail. To achieve this, "mon" is implemented as a
scheduler which runs the programs which do the testing, and triggering
alert programs when these scripts detect failure. None of the actual
service testing or reporting is actually handled by "mon". These functions
are handled by auxillary programs.
This model was chosen because it is very extensible, and does not require
changing the code of the scheduler to add new tests and alert types. For
example, an alphanumeric paging alert can be added simply by writing a
new alert script, and referencing the alert script in the configuration
file. Monitoring the temperature in a room can be done by adding a script
that gathers data from a thermistor via a serial port. Often these
monitoring scripts can just be wrappers for pre-existing software.
The "mon" scheduler also can communicate with network clients, allowing
manipulation of run-time parameters, disabling and enabling of alerts
and tests, listing failure and alert history, and reporting of current
states of all monitors.
AVAILABILITY
------------
The latest version of mon is available at:
http://consult.ml.org/~trockij/mon
REQUIREMENTS
------------
"mon" uses Perl 5.n, where n >= 003.
You'll need the Time::Period module, available from your local
CPAN archive (http://www.perl.com/perl).
"mon" uses the Sys::Syslog module that comes with Perl 5. If you're
running this under Linux, you must patch "Syslog.pm" with one of the
supplied patches written by Sean Robinson (robinson_s@sc.maricopa.edu).
These patches can be found in the patches/ directory.
You need the "File::Df" module from CPAN for freespace.monitor
to operate.
To use "telnet.monitor", "tcp.monitor", and "fping.monitor" (which all
come with the mon distribution), you need the "fping" and "tcp_scan"
utilities from Wietse Venema and Dan Farmer's Satan package to make
monitoring easier and more efficient. If you're building under Linux,
you'll need the 4.4BSD netinet headers (distributed separately), and a
patch to tcp_scan.c that fixes arguments to select(2).
----------
Jim Trocki
Computer System and Network Engineer
Transmeta Corporation
Santa Clara, CA
trockij@transmeta.com
------------------------------
Date: 30 Sep 1997 12:40:59 GMT
From: fty@hickory.engr.utk.edu (Jay Flaherty)
Subject: Re: Net::FTP doesn't seem to work...
Message-Id: <60qs0r$2gs$1@gaia.ns.utk.edu>
Bob Brown (bbrown2@lindy.stanford.edu) wrote:
:
: I'm writing a script to ftp files to my current file system from
: several different file systems. It doesn't seem to be working and
: there are no error reports.
:
: I'm not especially familiar with using packages like Net:FTP, but
: it seems like this should work.
:
: If someone could point out the errors of my ways-- I'd appreciate it.
Here are some suggestions:
1. put some print statements after your regular expressions to make
sure they do what you want them to.
2. put some error trapping routines in. ie:
$ftp{$host}->login("LoginName","LoginPassword")
or die "Unable to log into $ftp{$host}: !$\n";
$ftp{$host}->get($fullfile, "./$file")
or die "Unable to get file $fullfile: !$\n"
3. Run the script through the perl debugger.
Good luck...Jay
--
**********************************************************************
Jay Flaherty fty@utk.edu
"Once in awhile you get shown the light, in the strangest of places if
you look at it right" - R. Hunter
**********************************************************************
------------------------------
Date: Tue, 30 Sep 1997 14:46:50 +0100
From: Gary Howland <ghowland@hotlava.com>
Subject: Re: New Perl syntax idea
Message-Id: <343102CA.5957@hotlava.com>
Doug Seay wrote:
>
> Chris Schoenfeld wrote:
> >
> > Greg Bacon wrote:
> > >
> > > In article <342FE73B.41C2@ixlabs.com>,
> > > Chris Schoenfeld <chris@ixlabs.com> writes:
> > > : How about aliasing 'method' to 'sub' and passing the object reference
> > > : through a magic variable when 'method' is used?
> > >
> > > What potential benefits do you see for such an addition?
> >
> > To eliminate the repetitive use of:
> > my $self = shift;
> >
> > Whose verbosity smells unperlish.
> >
> > Does that make sense?
>
> Yes and no. Perl is terse, but only because it cuts out needless fluff.
Well, he's not alone in thinking that "$self = shift" at the start of
every method is needless fluff. (After all - Perl is happy to define $a
and $b for sort - why not $self for methods?) In addition to a 'method'
definition, a 'constructor' definition may also be useful to save all
that repetitive "my $class = shift; $self = {}; bless $self, $class".
And then we should start thinking about replacing $x->{'y'} with $x->y
or something a little more typable. But of course all this is heresy to
the perl community, who get very pissed off with these sort of
recommendations. I remember when Java first got released, I got heavily
flamed for suggesting that it would be nice if perl could produce Java
byte codes. But now, two years later, my wish may have come true. I
wonder how long it will be before they acknowledge method declarations
might be a useful addition after all? (along with fixing die/eval
exceptions, adding threads, and restoring the dbm interface due to the
tied interface eating all my memory)
I had a quick bash at trying to emulate what you want, and came up with
something like this:
sub method ($&) { my $subname = shift; my $sub = shift; sub $subname
$sub; }
so that syntax like this could be used:
method x { ... }
but then I found out that the '&' prototype only lets you change the
language syntax (which the perl boys are so fond of explaining) when '&'
is the first argument in the list.
So, looks like this approach is a dead end. It wouldn't have been able
to cope with method prototypes anyway (and neither would an AUTOLOAD
solution)
Looks like you'll have to write some sort of perl preprocessor ...
Gary
--
pub 1024/C001D00D 1996/01/22 Gary Howland <gary@hotlava.com>
Key fingerprint = 0C FB 60 61 4D 3B 24 7D 1C 89 1D BE 1F EE 09 06
------------------------------
Date: Tue, 30 Sep 1997 07:20:07 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Chris Schoenfeld <chris@ixlabs.com>
Subject: Re: New Perl syntax idea
Message-Id: <Pine.GSO.3.96.970930071314.16316E-100000@usertest.teleport.com>
On Mon, 29 Sep 1997, Chris Schoenfeld wrote about a proposal for a special
syntax for method declarations in Perl:
> To eliminate the repetitive use of:
> my $self = shift;
It may someday happen; it's being considered by various members of the
Perl development team. One of the ongoing arguments is whether the implied
start of the method should say
my $self = shift;
or
my $me = shift;
or something else. :-) Other arguments concern the handling of
prototypes, calling the method as a traditional sub, and whether the
self/me debate should be resolved by using prototypes.
But don't ask me for more details; for the most part, I've just ignored
this discussion. :-)
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
Ask me about Perl trainings!
------------------------------
Date: 30 Sep 1997 13:30:07 GMT
From: orwant@fahrenheit-451.media.mit.edu (Jon Orwant)
Subject: Obfuscated Perl Contest Victors
Message-Id: <60qusv$og9$1@news1.teleport.com>
The 1st Annual Obfuscated Perl Contest, sponsored by The Perl Journal,
was a smashing success. The judging committee has thrown in the
towel, and so the results are in. The full writeup (including code)
is on the TPJ web site, http://tpj.com, but here are the winners:
MOST POWERFUL
1st place: Daniel Rinehart, self-uncompressing square root finder
and custom bignum library
2nd place: Aaron Sherman, Perl-enabled spreadsheet
3rd place: Kalai Kandasamy, orbital fractal pixmap generator
MOST CREATIVE
1st place: Stephen McCamant, an 8-bit Apple ][-like virtual machine which
runs opcodes that pretend to calculate pi
2nd place: Robert Klep, a curses-based graphics hack that rotates
the word 'Perl'
3rd place: David Powell, a curses-based real-time skiing game
BEST "THE PERL JOURNAL"
1st place: Joe Futrelle, a gorgeously formatted entry using the UNIX
chargen service
2nd place: Jim Lawless, a self-uncompressing six-instruction virtual
machine
3rd place: Frank Sheiness, a very alarming obfuscation
BEST YEAR 2000 ERROR
First Place: Stephen McCamant
BEST OF SHOW: Stephen McCamant, for his Apple ][-like virtual machine
in seven lines of Perl.
Congratulations to the winners, and thanks to all who entered!
The $100 cash prizes and trophies for the first place winners
will be mailed shortly.
Special thanks to Felix "Robotron Poser" Gallo for organizing the contest.
-Jon
------------------------------------
Jon Orwant http://tpj.com
Editor & Publisher, The Perl Journal
------------------------------
Date: 30 Sep 1997 13:28:56 GMT
From: Joshua Pritikin <pritikin@mindspring.com>
Subject: ObjStore 1.15
Message-Id: <60quqo$oel$1@news1.teleport.com>
Name DSLI Description Info
----------- ---- -------------------------------------------- -----
ObjStore Rm+O ObjectStore OODBMS Interface JPRIT
Interface to ObjectStore OODBMS (http://www.odi.com). Stores scalars,
arrays, hashes, sets, and references directly in the database without
any flattening of nested or circular structures. Virtual memory
mechanism used to make read/write access nearly as fast as memory
mapped files.
Available via http://www.perl.org/CPAN/modules/by-module/ObjStore
<< This is the relational database killer app! >>
** 09-27-97 Released 1.15
- Expanded analysis of Perl, Java, C++, and SQL as database languages.
- Partial arrays. Mileage may vary.
- Automatic retry in the event of deadlock (69).
- Blessed classes now try to 'require' themselves the first time they
are instantiated in transient memory.
- Renamed $Exception to $EXCEPTION.
- PHTML.pm and Eval.pm moved to their own distribution.
------------------------------
Date: Tue, 30 Sep 1997 07:53:31 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: "April D. Melton" <MELTON@PITNET.NET>
Subject: Re: Options & No Wrong Answers
Message-Id: <Pine.GSO.3.96.970930075135.16316I-100000@usertest.teleport.com>
On Tue, 30 Sep 1997, April D. Melton wrote:
> How do I reconvert the numerical choice back to a text choice?
Is this all you're looking for?
$text = ('Needs Work', qw/Fair Good Excellent/)[$number];
Hope this helps!
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
Ask me about Perl trainings!
------------------------------
Date: Tue, 30 Sep 1997 16:00:14 +0200
From: Doug Seay <seay@absyss.fr>
To: hw vantyen <henq@phsoft.knoware.nl>
Subject: Re: output of cms in $_ instead of print ?
Message-Id: <343105EE.30333075@absyss.fr>
[posted and mailed]
hw vantyen wrote:
>
> Hi,
>
> I am struggling with the following:
> I CAN do:
>
> open (CMD, "|myCmd myArguments") or die "no $!";
> print CMD;
>
> The output myCmd produces is lost. I want to capture it into a variable.
>
> I can NOT do:
>
> open (CMD, "|myCmd myArguments|") or die "no $!";
> $myVar = <CMD>;
> -UHenq -Phenkie -s@ -w512
>
> wh
> or something similar.
>
> Can anyone point me towards a solution ?
Doing input and output with the same process is dangerous, think about
the deadlock issues. If you must, look in "perldoc perlipc" for Open2()
or Open3(). Hope this points you in the right direction.
- doug
------------------------------
Date: 30 Sep 1997 13:32:36 GMT
From: cowbys@aol.com (COWBYS)
Subject: Perl and MAPI
Message-Id: <19970930133200.JAA10452@ladder01.news.aol.com>
Are there any hooks in Perl to allow it to use MAPI?
for example, I want to be able to monitor an email inbox, and check for
incoming messages. as well as using the MS Exchange Client to send reply
emails..
any info appreciated TIA Dave_Fortenberry@attcapital.com
I am using Perl 5.004_01 for Win32 on NT 4.0
------------------------------
Date: Tue, 30 Sep 1997 16:12:59 +0200
From: Vincent RABAH <vincent.rabah@hol.fr>
Subject: PERL and serial port
Message-Id: <343108EA.C78189D8@hol.fr>
Does anybody knows how to get data from a serail port ?
I'm actually trying to use a modem with a perl script, I can send Hayes
command and so on, but I couldn't read echo, data from the COM port
!!!....
Please help me....
vincent.rabah@hol.fr
------------------------------
Date: 27 Sep 1997 13:51:34 GMT
From: ? the platypus {aka David Formosa} <dformosa@st.nepean.uws.edu.au>
Subject: Re: Perl equivalent to #ifdef in C?
Message-Id: <875368262.912983@cabal>
In <eli$9709181345@qz.little-neck.ny.us> Eli the Bearded <usenet-tag@qz.little-neck.ny.us> writes:
>In article <341FB593.4C7848C@absyss.fr>, Doug Seay <seay@absyss.fr> wrote:
>> lynn kasdorf wrote:
>> > What is an easy way to enable/disable blocks of code in perl. In C I
>> > would go...
>> > #ifdef THIS_WAY
[...]
>Not equivalent.
>#define EFFICIENT_SHORTCUT 0
>#ifdef EFFICIENT_SHORTCUT
>At some point I will implement this function, but not yet.
[...]
There is a question that I have been wondering about and it now seems like
a good time to ask. Will
BEGIN {
if ($config_option) {
sub foo {
#Foo code for config_option true
}
} else {
sub foo {
#Foo code for config_option false
}
}
do what I thinnk its doing?
--
Please excuse my spelling as I suffer from agraphia see the url in my header.
Never trust a country with more peaple then sheep. Buy easter bilbies.
Save the ABC Is $0.08 per day too much to pay? ex-net.scum and proud
I'm sorry but I just don't consider 'because its yucky' a convincing argument
------------------------------
Date: Tue, 30 Sep 1997 15:25:02 +0200
From: Doug Seay <seay@absyss.fr>
To: ? the platypus {aka David Formosa} <dformosa@st.nepean.uws.edu.au>
Subject: Re: Perl equivalent to #ifdef in C?
Message-Id: <3430FDAE.A843303@absyss.fr>
[posted and mailed]
? the platypus {aka David Formosa} wrote:
>
> There is a question that I have been wondering about and it now seems like
> a good time to ask. Will
>
> BEGIN {
> if ($config_option) {
>
> sub foo {
> #Foo code for config_option true
> }
> } else {
>
> sub foo {
> #Foo code for config_option false
>
> }
> }
>
> do what I thinnk its doing?
No, subs are declared where ever they are seen. You'd need an eval()s
around your subs, otherwise the second foo() will replace the first and
you'll get a warning (at least with -w and strict you will).
- doug
------------------------------
Date: Tue, 30 Sep 1997 11:33:23 +0200
From: lafor <lafor@hotmail.com>
Subject: perl script don't execute
Message-Id: <3430C763.9D492D65@hotmail.com>
Hi all.
I have read everything I got about perl, cgi, apache, linux...
And I think is time to put this message out of my hard disk.
I have the next couple of scripts:
---
Name: cmd-cgi-perl
---
#!/usr/bin/perl
print "Content-Type: text/plain\n\n";
print "Hi.";
exit 0;
---
Name: cmd-cgi-sh
---
#!/bin/sh
echo Content-Type: text/plain
echo
echo
echo hello!
---
Problem: the perl script doesn't work. Apache server returns a
"Premature end of script headers".
(Or something similar). The shell scripts works right.
More: perl (I think) is correctly installed and /bin/perl is ok. BUT I
can't execute a perl script
directly. See:
---
root> chmod a+x cmd-cgi-perl
root> cmd-cgi-perl
Error: Command not found.
root> ./cmd-cgi-perl
Error: Command not found.
---
I suposse this is the problem. Apache can't call correctly the script
and then returns a error.
Any help trick or advice will be welcome. I wouldn't install a web
server in Windows to avoid my
head-ache :(
Please cc me via email if you can.
Thanks.
Regards,
lafor-@-hotmail.com
(without -'s )
------------------------------
Date: Tue, 30 Sep 1997 07:42:42 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: samdie@ibm.net
Subject: Re: References - saving & using (newbie)
Message-Id: <Pine.GSO.3.96.970930072644.16316G-100000@usertest.teleport.com>
On Mon, 29 Sep 1997 samdie@ibm.net wrote:
> sub config_line() { while (<STDIN>) { if (!(/^$/)) { chomp; return 1; } } }
I get grumpy when I work with subs which implicitly use $_ (or other
globals) to pass or return data. :-)
> sub make_HoL() {
> $h={};
> while (config_line() and substr($_,0,1) ne "#") {
> ($key,@vals)=split /,\s*/; $h{$key}=[ @vals ];
Here's another good reason to 'use strict': You seem to have intended to
use $h as a hashref, but now you're using %h instead!
> }
> return \$h;
> }
And here you've returned a scalarref. That's allowed, but probably not
what you wanted. I'd re-write that sub (and the one it calls) something
like this. (Although this doesn't work quite like yours... :-)
sub make_HoL {
my %h; # The hash you really want
while (<STDIN>) {
s/\#.*$//; # Strip comments
s/^\s+//; # Strip leading whitespace
s/\s+$//; # Strip trailing whitespace
next unless $_ ne ''; # Skip blank lines
my($k, @v) = split /\s*,\s*/;
$h{$k} = [ @v ]; # Stash into hash
}
\%h; # Return value
}
Does that do anything good? Hope this helps!
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
Ask me about Perl trainings!
------------------------------
Date: 30 Sep 1997 13:27:29 GMT
From: "Jesse N. Glick" <jglick@sig.bsh.com>
Subject: SGI::FAM 1.002 trial release
Message-Id: <60quo1$ob3$1@news1.teleport.com>
This is to announce the trial release of a Perl extension module which
interfaces to SGI Irix's "FAM", or File Access Monitor. This service
(consisting of kernel support, and a FAM daemon with local and NFS
modes) allows SGIs to monitor files and directories for various kinds of
activity; SGI::FAM provides a fairly simple Perl wrapper around it. It
is alpha-level.
Also included is magicrcs, an experimental script which uses SGI::FAM to
keep files under RCS control without (much) user intervention.
The package is available for the time being from
<ftp://ftp.sig.bsh.com/pub/perl/SGI-FAM-1.002.tar.gz>. Please email me
at <mailto:jglick@sig.bsh.com> with questions or comments.
--
Jesse N. Glick * mailto:jglick@sig.bsh.com
Sr. Programmer/Analyst * Strategic Interactive Group
800 Boylston St. Boston MA 02199 * 617-867-1017 (tel) 617-867-1111 (fax)
------------------------------
Date: Tue, 30 Sep 1997 07:08:42 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Jason Gloudon <jgloudon@bbn.remove.com>
Subject: Re: Syntax on assignment and undef
Message-Id: <Pine.GSO.3.96.970930070816.16316D-100000@usertest.teleport.com>
On 29 Sep 1997, Jason Gloudon wrote:
> Interesting sideline here.
> This compiles and does absolutely nothing.
>
> () = (1,23);
What would you want it to do?
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
Ask me about Perl trainings!
------------------------------
Date: Tue, 30 Sep 1997 14:36:19 GMT
From: darrellb@hhcl.com (darrel berry)
Subject: web-based mail reader in perl?
Message-Id: <34310dd2.22114378@news.demon.co.uk>
Looking for a free/shareware www-based mail client (sendmail/pop)
written in perl...i've seen a few commercial offereings, but i bet
there's something better out there with a GNU license ;-)
looking for basic funtionality only, really (compose/read/reply/delete
messages)
any ideas?
pls email replies
------------------------------
Date: 8 Mar 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 8 Mar 97)
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.
To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.
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.
The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.
The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.
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 V8 Issue 1104
**************************************