[8082] in Perl-Users-Digest
Perl-Users Digest, Issue: 1701 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Jan 22 10:07:56 1998
Date: Thu, 22 Jan 98 07:00:34 -0800
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, 22 Jan 1998 Volume: 8 Number: 1701
Today's topics:
#Ancor in a jump.pl script (Michael Baehr)
Re: [Q] Modifying \n\r on a directory tree of html file (Emile Heyns)
Re: [Q] Modifying \n\r on a directory tree of html file (Ed Avis)
Re: CGI / foreach loop question (Tad McClellan)
Re: CGI / foreach loop question (Clay Irving)
Re: CGI-BIN script - parameter encryption <yzhou@ra.rockwell.com>
Re: Changing Case <samk@was.net>
Re: Daemon for connection with Oracle <dtauzel@uswest.com>
DOS: command line wildcards (Brendan Macmillan)
Re: DOS: command line wildcards (Gabor)
Re: FAQ too big (Was: Re: PERL forking) (Bart Lateur)
Re: File name from descriptor <jack_h_ostroff@groton.pfizer.com>
getting the full path to a perl script !!! <michaelr@titan.lndn.tensor.pgs.com>
Re: help -- use METHOD::PACKAGE; <vallon@pearl.fi.bear.com>
How do I get the hostname? (Super-User)
How do I get the hostname? (Super-User)
How do I get the hostname? (Super-User)
Re: How do I get the hostname? <xxTony.Curtis@vcpc.univie.ac.at>
Re: How do I get the hostname? (brian d foy)
how to emulate csh "set verbose" in perl <michaelr@titan.lndn.tensor.pgs.com>
Re: How to load local vars from Configfile ? (Clay Irving)
Re: living and free software (was: Re: source into bina <pdcawley@bofh.org.uk>
Re: Multi. Data Base Entries Simotaniously (Tad McClellan)
Non-Parsed Headers (NPH) and Sockets (Scriptman)
NS Communicator wrong filename extention with file down <Hendrik.Klompmaker@net.iend.wau.nl>
Re: perl 5.003 negation bug? (Clay Irving)
Re: Please help me!! (Tad McClellan)
POSIX (?) under perl for Win95 (Lynchqvctc)
Re: Refering to a referenced structure? <NOSPAM_mike808@mvp.net>
Re: Timer measuring time between submit button pushes t (Clay Irving)
Re: Timer measuring time between submit button pushes t <NOSPAM_mike808@mvp.net>
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 22 Jan 1998 12:50:30 GMT
From: mbaehr@softline.de (Michael Baehr)
Subject: #Ancor in a jump.pl script
Message-Id: <6a7fam$rpo$1@news.nacamar.de>
Hello,
I tried to do a redirect in a jump.pl script to an ancor.
http://www.domain.de/test.html#ancor1
http://www.domain.de/test.html#ancor2
I get only the Urls without ancor.
When I look to the QUERY String variable from the webserver the "#" sign
used in the ancor is deleted.
How can I transmit the # Ancor to the perl script,
and how can I place the ancor in the jumpadress ?
here is a standart jump script i use.
###########################################
#!/usr/local/bin/perl
#
#read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
#$http_from =$ENV{"HTTP_FROM"};
if($ENV{'REQUEST_METHOD'} eq "GET")
{
$form = $ENV{'QUERY_STRING'};
if($buffer eq "")
{
print "<HTML>\n";
print "<TITLE>Eingabefehler</TITLE>\n";
print "<BODY>\n";
print "<H1 align=center> Eingabefehler</H1>
\n";
print "Bitte füllen Sie das Formular vollständig aus.\n";
print "</HTML>\n";
print "</BODY>\n";
exit(1);
}
} else {
read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
}
@pairs = split(/&/, $buffer);
foreach $pair (@pairs)
{
($name, $value) = split(/=/, $pair);
$value =~ tr/+/ /;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
print "Location: $value\n\n";
}
######################
Regards and Thanks
Michael Baehr Dipl.-Ing. (FH)
Softline GmbH
Master Distributor von Netscape Communications Inc.
Appenweierer Str. 45
D-77704 Oberkirch
Tel. ++49 7802 / 924-213
Fax. ++49 7802 / 924-242
http://www.softline.de
http://download.softline.de
------------------------------
Date: Thu, 22 Jan 1998 10:15:18 GMT
From: qqehe@st5-oa6.oce.nl (Emile Heyns)
Subject: Re: [Q] Modifying \n\r on a directory tree of html files to \n files for UNIX
Message-Id: <En6KHI.KsA@oce.nl>
On Tue, 20 Jan 1998 05:39:11 GMT, Brian Lavender wrote:
:How can I make this so it traverses down a directory tree and modifies
:all .html files? I could not find a recursive switch in the Camel
:book. It seems that having the -i.bak switch is a good idea, but how
:would I get rid of the .bak files once I determine the perl command
:routine was a success?
If you're on a unix system, see man find
--
Emile
!07/11 PDP a ni deppart m'I !pleH
------------------------------
Date: Thu, 22 Jan 1998 12:04:51 GMT
From: epa@datcon.co.uk (Ed Avis)
Subject: Re: [Q] Modifying \n\r on a directory tree of html files to \n files for UNIX
Message-Id: <34c72d20.85624481@news-direct>
On Tue, 20 Jan 1998 05:39:11 GMT, brian@brie.com (Brian Lavender)
wrote:
>perl -pi.bak -e 's/\r//' joe.pl
>
>(joe.pl.bak will hold the original (DOS) contents)
>
>How can I make this so it traverses down a directory tree and modifies
>all .html files? I could not find a recursive switch in the Camel
>book. It seems that having the -i.bak switch is a good idea, but how
>would I get rid of the .bak files once I determine the perl command
>routine was a success?
[hmmm... see how much I can annoy people by proposing a solution _not_
written in Perl]
>From the Bourne Shell (I presume you are using Unix from the nature of
your problem), try:
find . -type f -exec perl -pi.bak -e 's/\r//' {} \;
and
find . -type f -name \*.bak -exec rm {} \;
to remove all the *.bak files.
--
Ed Avis
------------------------------
Date: Thu, 22 Jan 1998 06:11:55 -0600
From: tadmc@flash.net (Tad McClellan)
Subject: Re: CGI / foreach loop question
Message-Id: <b2d7a6.cg.ln@localhost>
Ernst (e.christensen@netjob.dk) wrote:
: Robert Goodwin wrote:
[snip]
: > $fields{$item}=~s/\s//g;
: This one should do it, you should have a space between ~ and s.
: $item=~ s/ //g;
^
Why should there be a space there?
Makes absolutely no difference...
----------------
#!/usr/bin/perl -w
$item = 'e.christensen';
$item=~s/e/E/;
print "$item\n";
$item = 'e.christensen';
$item=~ s/e/E/;
print "$item\n";
----------------
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: 22 Jan 1998 09:12:53 -0500
From: clay@panix.com (Clay Irving)
Subject: Re: CGI / foreach loop question
Message-Id: <6a7k55$onc@panix.com>
In <34C70E8A.E47@netjob.dk> Ernst <e.christensen@netjob.dk> writes:
>> I'm trying to do something really simple but don't know much about perl and
>> could find anything that talks about this specifically. As in most for
>> interpreters I have an array of keys and contents.
>>
>> I want to go through the values of each of these and remove all the
>> whitespaces. This is what I tried and doesn't seem to work.
>>
>> foreach $item (@fields) {
>> $fields{$item}=~s/\s//g;
>> }
>>
>> Anyone know what I'm driving at?
>>
>> rob
>This one should do it, you should have a space between ~ and s.
>$item=~ s/ //g;
Eh? I don't think that makes any difference. For example:
#!/usr/local/bin/perl5.00403 -w
$item1 = "This is my string. ";
$item2 = "This is my string. ";
$item1=~ s/ //g;
$item2=~s/ //g;
print "$item1\n";
print "$item2\n";
Prints:
Thisismystring.
Thisismystring.
--
Clay Irving <clay@panix.com> I think, therefore I am. I think?
http://www.panix.com/~clay/
------------------------------
Date: Tue, 20 Jan 1998 11:07:11 -0600
From: "CompuWare, Yun Z" <yzhou@ra.rockwell.com>
To: SPLiNTeR <mr.t@umich.edu>
Subject: Re: CGI-BIN script - parameter encryption
Message-Id: <34C4D9BD.26C2700A@ra.rockwell.com>
Yes, in your <form> tag, speciafy that methos as post, then url won't
show up the passing pair,
as: <form method=post name="YourFormName">
Good luck!
Yun Zhou
Software Developer
>Is there any way to either encrypt the parameters before they're sent
to
>my cgi-bin script, or prevent the parameters from being displayed as
>part of the URL in the Location field when the result screen is
>displayed.
------------------------------
Date: Thu, 22 Jan 1998 16:48:36 -0600
From: Samuel King <samk@was.net>
To: Brad Grove <brad.grove@b131.aone.net.au>
Subject: Re: Changing Case
Message-Id: <34C7CCC3.5E369134@was.net>
To change case you can use the
lcfirst() // that is lowercase first
or
ucfirst() // that is uppercase first
Hope that helps
Samuel King
http://www.net-creations.com
Brad Grove wrote:
> Hi
>
> I have only just recently started writing in Perl and am still finding my
> way. How can I change a string to Upper and Lower Case. It is easy to change
> to either lower case or upper case but how can I change a string so that the
> first letter of every word is upper case and the rest is in lower case.
>
> Thanks in advance
>
> Brad Grove
------------------------------
Date: Thu, 22 Jan 1998 08:31:12 -0600
From: David Tauzell <dtauzel@uswest.com>
Subject: Re: Daemon for connection with Oracle
Message-Id: <34C75830.5194DD2B@uswest.com>
A quick thought:
You might be able to use a modified version of the DBI proxy module
(can't think of the name) to do this. You would just have to modify the
server part so that it maintained some kind of connection cache.
Then all you would have to change in your applications is the call that
loads your DBI driver.
Dave.
------------------------------
Date: 22 Jan 1998 12:01:47 GMT
From: bren@fangorn.cs.monash.edu.au (Brendan Macmillan)
Subject: DOS: command line wildcards
Message-Id: <6a7cfb$8ce$1@towncrier.cc.monash.edu.au>
Hi,
I'm new to perl - finally upgrading from awk! Running: Perl, version 4.0; DOS
After looking through the WCS text, and attempting to get the FAQ, I now
turn to you, dear (news) reader-
I want to say something like:
perl -n test.pl *.dat
but the wildcard does not seem to be expanded into all the matching
filenames! This is a fundamental feature of tools like grep and awk -
how do I get perl to do it?
I tried
while (<*>) {print;}
as a test example, and it doesn't seem to work either. (Also, a few other
glob() tests...)
Thanks!
--
Brendan Macmillan
------------------------------
Date: 22 Jan 1998 14:43:03 GMT
From: gabor@vinyl.quickweb.com (Gabor)
Subject: Re: DOS: command line wildcards
Message-Id: <slrn6cemc9.nos.gabor@vinyl.quickweb.com>
In comp.lang.perl.misc, Brendan Macmillan <bren@fangorn.cs.monash.edu.au> wrote :
# Hi,
#
# I'm new to perl - finally upgrading from awk! Running: Perl, version 4.0; DOS
# After looking through the WCS text, and attempting to get the FAQ, I now
# turn to you, dear (news) reader-
#
#
# I want to say something like:
# perl -n test.pl *.dat
#
# but the wildcard does not seem to be expanded into all the matching
# filenames! This is a fundamental feature of tools like grep and awk -
It's not a feature of the tools. It's the shell's feature, a real
shells's, that is.
# how do I get perl to do it?
It's the shell that is supposed to expand the wildcard. In DOS, if I
recall correctly, the shell doesn't expand wildcards. So you have to
do it yourself.
------------------------------
Date: Thu, 22 Jan 1998 13:06:51 GMT
From: bart.mediamind@tornado.be (Bart Lateur)
Subject: Re: FAQ too big (Was: Re: PERL forking)
Message-Id: <34ca408b.6029831@news.tornado.be>
Tom Christiansen <tchrist@mox.perl.com> wrote:
>:>> > P.S. The Perl FAQ is TOO big!!
>
>Ok, which part would you like me to remove? [you != Bart]
Ummm.... What number would I be? Or should that be "ne"? :-)
>:Hmmm... What I think is lacking, is an overview of everything that is
>:covered in the FAQ. A TOC, a list with ALL the questions and where the
>:answers can be found.
>
>% man perltoc
My my! It's all there!
Funny, I expected all this to be in PERLFAQ, not PERLTOC. PERLFAQ only
contains a general description of the 9 FAQ files, while PERLTOC
contains all the questions, plus the contents of all the other files.
Somehow, I would have thought it would make more sense to put the
general overview in PERLTOC, and the FAQ details in PERLFAQ. Silly me.
Bart.
------------------------------
Date: Thu, 22 Jan 1998 09:29:56 -0500
From: "Jack H. Ostroff" <jack_h_ostroff@groton.pfizer.com>
To: David Stashower <rc0230@email.mot.com>
Subject: Re: File name from descriptor
Message-Id: <34C757E4.30A5@groton.pfizer.com>
David Stashower wrote:
>
> Is there a way to retrieve the file name (relative, full pathname,
> whatever) from an "open" file-descriptor ? I.e. such that a routine can
> be passed a descriptor for an open file, but be able to "find out" and
> handle the actual file involved.
>
> Any ideas ?
>
> Thanks,
> David
I'm fairly sure this has been discussed here more than onece.
In general, it can be a very difficult problem, depending on the
operating system (or reallly the file system). On unix (with inodes),
you have to deal with real and symbolic links. You have to know which
directory the file is in and check each file in the directory to see if
it is the one you want. You then have to do the same for .. all the way
up to the root. DOS (FAT systems) doesn't have links, but I'm not sure
if name equivalence is sufficient to determine if two files are the
same. I have no idea about Macs or other file systems.
Jack
------------------------------
Date: Thu, 22 Jan 1998 14:31:14 +1100
From: Mike Renshaw <michaelr@titan.lndn.tensor.pgs.com>
Subject: getting the full path to a perl script !!!
Message-Id: <34C6BD81.8C74AAC@titan.lndn.tensor.pgs.com>
Hi all,
does anyone know a shorter way to get the full path name to a perl
script than, this code..... this is how i do it in csh normally so ive
just
converted it to perl.
$var = `cd \`dirname $0\`;pwd`;
I know its not long winded or anything but it looks ugly, dont you agree
?????
Mike.
------------------------------
Date: 22 Jan 1998 09:45:54 -0500
From: Justin Vallon <vallon@pearl.fi.bear.com>
To: mikemort@cadence.com
Subject: Re: help -- use METHOD::PACKAGE;
Message-Id: <x6eoh14musd.fsf@pearl.fi.bear.com>
Michael mortensen <mikemort@cadence.com> writes:
> One of the lines in the demo is:
>
> use Parse::RecDescent;
>
> I keep getting the message:
>
> Can't locate Parse/RecDescent.pm in @INC at demo_simple.pl line 8.
First, like C, perl is looking for "Parse/RecDescent.pm". RecDescent.pm
must be in a directory named Parse. Then, the path to Parse must be in
@INC.
Also, if you need to adjust @INC, it must be done at compile-time via a BEGIN
block, because the 'use' files are located during compilation, not execution.
So, if you use /home/bob/testlib/Bob/Utils.pm and your library-root is
/home/bob/testlib, you could say something like the following:
BEGIN {
push @INC, "/home/bob/testlib";
}
use Bob::Utils;
BTW, "." is in my @INC.
>
> I have tried using:
>
> use lib() with my current path, but haven't had success. It shoudln't
> matter, though, since RecDescent.pm is in the run directory and "."
> is part of @INC. I added "use RecDescent;" to the beginning of the
> script to try that, and it doesn't complaining about the package,
> only the combination of Function::package.
The problem is that RecDescent.pm still declares itself to be package
Parse::RecDescent (look in the file). Also, the script expects
Parse::RecDescent. If you change all 'Parse::RecDescent's to RecDescent, it
should work. Or, just:
mkdir Parse
mv RecDescent.pm Parse
And try the originals.
>
> I have tried it without success using Perl for Win32 and Perl for
> Unix.
>
> -Thanks
> Mike
>
> (Remove NOSPAM from my email to directly reply)
--
-Justin
vallon@bear.com
------------------------------
Date: 19 Jan 1998 15:52:10 GMT
From: root@news.platinum.com (Super-User)
Subject: How do I get the hostname?
Message-Id: <69vsra$pfp$1@news.platinum.com>
What's the best name to get the current system's
hostname with perl?
Thanks,
Mike
------------------------------
Date: 19 Jan 1998 15:59:43 GMT
From: root@news.platinum.com (Super-User)
Subject: How do I get the hostname?
Message-Id: <69vt9f$pkk$1@news.platinum.com>
What's the best way to get the system's hostname using perl?
Thanks,
Mike
------------------------------
Date: 19 Jan 1998 15:29:53 GMT
From: root@news.platinum.com (Super-User)
Subject: How do I get the hostname?
Message-Id: <69vrhh$p4e$1@news.platinum.com>
What's the best way to get the hostname of the system I'm running on with perl?
Thanks,
Mike
------------------------------
Date: 22 Jan 1998 11:38:39 +0100
From: Remove xx to reply <xxTony.Curtis@vcpc.univie.ac.at>
To: root@news.platinum.com
Subject: Re: How do I get the hostname?
Message-Id: <7xzpko23ps.fsf@beavis.vcpc.univie.ac.at>
Re: How do I get the hostname?, Super-User
<root@news.platinum.com> said:
Super-User> What's the best name to get the current system's
Super-User> hostname with perl?
perldoc Sys::hostname
hth,
tony
------------------------------
Date: Thu, 22 Jan 1998 05:48:40 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: How do I get the hostname?
Message-Id: <comdog-ya02408000R2201980548400001@news.panix.com>
Keywords: from just another new york perl hacker
In article <69vsra$pfp$1@news.platinum.com>, root@news.platinum.com (Super-User) posted:
>What's the best name to get the current system's
>hostname with perl?
have you tried Sys::Hostname?
--
brian d foy <comdog@computerdog.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
Comprehensive Perl Archive Network (CPAN) <URL:http://www.perl.com>
------------------------------
Date: Thu, 22 Jan 1998 14:35:18 +1100
From: Mike Renshaw <michaelr@titan.lndn.tensor.pgs.com>
Subject: how to emulate csh "set verbose" in perl
Message-Id: <34C6BE76.B825829A@titan.lndn.tensor.pgs.com>
Hi all,
does anyone know how to emulate csh "set verbose" so that the script
will print
the code as it runs ? I find verbose a great way to debug scripts. also
can the
debugger print statistics on % of time spent in each subroutine to find
potential
slow bits of code ?
cheers.
Mike.
------------------------------
Date: 22 Jan 1998 08:42:20 -0500
From: clay@panix.com (Clay Irving)
Subject: Re: How to load local vars from Configfile ?
Message-Id: <6a7ibs$md3@panix.com>
Keywords: from just another new york perl hacker
In <comdog-ya02408000R2101982324080001@news.panix.com> comdog@computerdog.com (brian d foy) writes:
>rather than have perl code in a config file, i use a set-up
>similar to the conf files found with the NCSA like server:
> #Directive is some thingy set to Value
> Directive Value
>providing an abstract interface to that file so that one can
>create a configuration object that holds the directives and their
>values.
> my $config = new MyConfig $filename;
>then access the values through the interface
> my $thingy = $config->directive_name
>or simply use the $config instance directly
> some_function($config->directive_name);
>[in anticipation of Tom P.'s response...]
>i've been thinking about whether i should ask the Suits to let
>me release this, but i don't know how it fits into the Config
>set-up that i've seen on CPAN. if anyone is interested i'll
>post more stuff about it :)
I like it. Post more. :)
--
Clay Irving <clay@panix.com> I think, therefore I am. I think?
http://www.panix.com/~clay/
------------------------------
Date: 22 Jan 1998 10:37:13 +0000
From: Piers Cawley <pdcawley@bofh.org.uk>
Subject: Re: living and free software (was: Re: source into binary code)
Message-Id: <54k9bshk12.fsf@gunnar.aladdin.net>
21 Jan 1998 19:50:57 GMT stanley@skyking.OCE.ORST.EDU (John Stanley) comp.lang.perl.misc
> In article <54ra61hg9z.fsf@gunnar.aladdin.net>,
> Piers Cawley <pdcawley@bofh.org.uk> wrote:
> >No he doesn't. Take a look at WebEvent, a rather neat set of perl
> >scripts to do web based calendars and the like. Comes with
> >(unobfuscated) source and requires a keystring to get it working. The
> >license requires the purchaser/evaluator not to either remove or
> >subvert the licence handling code.
>
> So the purchaser removes the keystring code, because he has the
> source and can do so, and takes the code home to use there without
> paying for it.
>
>
> So an employee of the purchaser copies the code, and when he goes to work
> somewhere else, he removes the keystring code ...
>
> So the copy that shows up at the next site no longer has a copyright
> notice or keystring code, and someone there, acting in good faith,
> copies the code a dozen other places. Those dozen go another dozen.
And precisely how is that different from the luser WaReZ d00d who does
the same thing with a copy of _GalactoHaemaroids_ or whatever?
> >We're buying the software. Sure I could dike out the licensing
> >stuff but what would be the point -- we
>
> You could run multiple copies of the code for free. Saves you money.
> You could run it at home, if you wanted, or if you change jobs and
> didn't want to lose the functionality, you could take a copy with you.
> That would be the point.
Whose ethics are you talking about? Yours or mine? You can run
multiple copies of any code for free, whether or not it comes with
source. Lots of people have illicit copies of office software sitting
on their home machines. How does having the source code make this any
different.
> >get value from the code (what's especially neat is the fact that we
> >can tailor it to our own requirements) so we pay for it. I'm an honest
> >guy.
>
> Yep. Not everyone is. If everyone were honest, we wouldn't need
> passwords on computers, now would we?
And your point? The people who write this code are making money.
They're happy people. So there's some lusers out there who aren't
paying for the code, well so what? They'd take likely take it anyway.
> >If the author had compiled it in some way then we could still dike
> >out the licensing code; it would be harder to do, but it could be
> >done.
>
> Yes, yes, yes, of course it could be done. Nobody has said it
> couldn't. It would be much harder to do, and then you have to start
> considering the costs of doing that versus the cost of buying
> another license. As long as it costs more to edit the object code
> than it does for a license, you save money by getting a license.
Not that much harder to do, or the sad geeks who fill up my newsserver
with massive copyright violations wouldn't be posting great big zips
of nominally copyprotected software to alt.binaries.warez.*
> >But in compiling the code one of the advantages of the software goes
> >away; we can't see inside it.
>
> To you this is an advantage. To the author, it isn't.
I'm sorry? Source code availability is one of the features of this
particular code. It's one of the things that helps me make the
decision to buy WebEvent over A.N.Other Calendar Program. The fact
that it makes his software more saleable is surely to the author's
advantage.
> >Of course some unsrupulous lusers are going to circumvent the
> >protection and keep using the software anyway, but they'd be doing
> >that no matter how I distributed said software.
>
> That statement is simply wrong. Those who do not have the ability or
> time to figure out what part of the object code to edit will not be
> able to use the software for free if you don't distribute source. That
> applies to most people. In other words, it does matter how you
> distribute it.
But those who do know how to do it will distribute it with the
protection removed. How else could they demonstrate to the world how
kewl they are?
> >> The question was asked "why would people pay for code they could get
> >> for free?" When that was asked, there were two different programs
> >> written by two different people. In this case, the code was written by
> >> the same person. Why would anyone hire this guy to write code they
> >> already had?
> >
> >Off the top of my head?
>
> Yep, there are reasons, but not as many as when you don't have the
> source and thus can't tinker with the code yourself.
And what reasons would they be?
> >2. Because the GPL explicity disclaims any warranty; the license
> > granted someone who pays for the software may not.
>
> Hmmmm, read the GPL.
I have. What's your point? If I write a reall great piece of software,
lets call it ghostscript and I decide to release it to the world under
the GPL then I still retain the copyright and am perfectly within my
rights to sell the same code to my customers under a different license
with different provisions which give a greater level of support.
That's what Aladdin (the people who write Ghostscript, not the UK ISP
that I'm contracted to at the moment) do.
I think (I've not checked) that Cygnus sell the code under the GPL,
but will only support those people who have actually paid money for
it.
> >Also, from the programmer's point of view, the free version of the
> >software is an advert. Look at Larry for example, I don't know how
> >much O'Reilly are paying him, but I'm fairly sure that they
> >wouldn't have employed him if he hadn't written perl.
>
> Ummmm, stop and think for a minute. I bet O'Reilly employs a lot of
> people who haven't written perl. I bet the majority of people at
> O'Reilly haven't written perl, or any other language.
And your point was? The question is not 'what criteria do O'Reilly use
when they decide to employ J. Random Subeditor?' but 'Would O'Reilly
have hired Larry Wall if he hadn't been the inventor of Perl?'. Maybe
someone who actually knows the answer will be along to disabuse me of
my notion that Larry was primarily employed because of Perl and I'll
be happy to be enlightened, but saying that just because some people
are hired for other reasons doesn't alter my point one iota.
> >Actually, some of them did give it away. Code that comes from UCB for
> >example was not paid for by the US government.
>
> Should we review the funding status of UC or just admit that federal
> money went in the door?
I haven't the faintest idea how UC is funded. But I was under the
impression that several of the guys who wrote the code were there as
as students and still paying tuition...
> >> Now look at someone who is trying to sell his code. He LOSES a sale
> >> if he gives it away. That means he loses money. He isn't being paid
> >> to give it away. He is NOT making a living by giving code away. Do
> >> you get the point yet?
> >
> >Which particular sale does he lose when he gives the code away? Randal
> >and Tom give code away all the time, and they make a decent living
> >(even if it doesn't cover the legal bills...).
<REQUOTED FOR CONTEXT>
> >I'm quite sure that people wouldn't be paying them the kind of
> >money they get paid if they didn't have good reputation which was
> >at least partially gained by giving code/information away on the
> >Internet.
</>
>
> Not by giving code away. They make a living giving classes, writing
> books and articles, and other things that they get paid to do.
I never said they did. But I did suggest (and again I'm sure Tom at
least will correct me (in spectacular fashion) if I'm wrong) that
people go to those classes, buy those books or read those articles
because of the reputation that Tom and Randal have made for themselves
by being generous with code, documentation and occasional sarcasm.
--
Piers Cawley -- Systems Genie for Aladdin
If a `religion' is defined to be a system of ideas that contains
unprovable statements, then Godel taught us that mathematics is not
only a religion, it is the only religion that can prove itself to be
one. -- John Barrow
------------------------------
Date: Wed, 21 Jan 1998 21:38:45 -0600
From: tadmc@flash.net (Tad McClellan)
Subject: Re: Multi. Data Base Entries Simotaniously
Message-Id: <50f6a6.f0b.ln@localhost>
Gary C. New (gnew@southernvirginia.edu) wrote:
: When multipule users try adding info. to a data base via a perl script
: simotaniously, will the perl script be able to handle it?
It will if you write it to handle it.
See flock() in the 'perlfunc' man page, and the series of
Frequently Asked Questions about this very topic in the Perl
FAQ, part 5.
: Email me...
Nope.
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: 22 Jan 1998 13:22:22 GMT
From: scriptman@aol.com (Scriptman)
Subject: Non-Parsed Headers (NPH) and Sockets
Message-Id: <19980122132201.IAA04653@ladder01.news.aol.com>
I am writing a web based application that is a front-end to a set of UNIX
utilities. Each utility MUST run AS a certain UNIX userid since it has the
appropriate file permissions, database access rights, etc. For performance, I
have written a server that logs me in and maintains a persistent TELNET
connection. (For security reasons, it automatically logs me off after 20
minutes of inactivity). The following CLIENT talks to this server. I call it
from my CGI script to execute any UNIX command.
The problem I am having is using non-parsed headers (NPH). You'll notice that
the client contains no HTML at all. That's really the responsibility of the CGI
script (plus sometimes I don't want it formatted). So, I am attempting to
invoke the client from CGI so that I can loop thru the output and send back the
results one line at a time using NPH. All my attempts have failed! The output
is being buffered somewhere. I have even hardcoded some HTML into the client
and run it directly to prove the server and client are not buffering.
Any explainations and/or suggestions are warmly welcomed. My attempts are
shown below. Thanks in advance for the assistance.
Pete Sattler
Chase Manhattan Bank
############################# CGI SCRIPT ########################
#!/usr/bin/perl
select STDOUT; $| = 1;
print "HTTP/1.0 : 200 OK\n";
print "Content-type: text/html\n";
print "Pragma: no-cache\n\n";
print "<HTML>\n";
print "<H2>NPH output coming right up!</H2>\n<PRE>\n";
for (my $i=0; $i < 5; $i++) {sleep 1; print "i=$i\n"}
#WORKS!
open(UTILOUT,"whutilc.pl run p_sattle cvserv ping dmeserv 100 9 |"); #FAILED
open(UTILOUT,"whutilc.pl run p_sattle cvserv ping dmeserv 100 9 & |"); #FAILED
while (<UTILOUT>) {print}
close UTILOUT;
print "</PRE>\n<H2>NPH output all done<H2>\n";
print "</HTML>\n";
exit;
############################# CLIENT ############################
#!/usr/bin/perl
# %W% %G%
#========================================================#
# Script Name: whutilc.pl
#
# Author: Peter Sattler (PJS)
#
# Modified by: None
#
# History: 01/14/98 PJS A client providing persistent connections to
#
# the TELNET protocol server (telnetd) for use by the Common Gateway #
# Interface (CGI).
#
#========================================================#
use IO::Socket; #Socket communications library
my $es = 0; #Exit status (ZERO = success)
my $failed = '500'; #Request failed code
(my $scrName = $0) =~ s#.*/##; #Name of this script
my @serverMsg; #Message returned from server
my $serverMach = 'cvserv'; #Hostname server is running on
my $serverSvcName = 'whutild'; #Service name of server
my $success = '200'; #Request successful code
my $reStatusCode = $success . ' |' . "$failed "; #Match server status code
#---------------------------------------------------------------------------#
# M A I N #
#---------------------------------------------------------------------------#
die "Usage: $scrName command\n" if (@ARGV < 1);
#Connect to the command execution server:
my $server = IO::Socket::INET->new(Proto =>'tcp',
PeerAddr =>"$serverMach",
PeerPort =>"$serverSvcName(4546)");
if ($server)
{
#Send command to server:
my $svrcmd = $ARGV[0]; #Command to send (w/o parms)
$server->autoflush(1);
print $server "@ARGV\n";
while (<$server>)
{
next if (/^$success.* ready$/); #Skip greeting
if (/$reStatusCode/)
{
s/$reStatusCode//g; #Remove status code
($es,@serverMsg) = /(\d+)\W+(.*)/; #Exit status and message
#Show messages for login and failed runs only:
#NOTE: Final run message used to set exit status!
print "@serverMsg\n"
if ($svrcmd =~ /login/ || ($svrcmd =~ /run/ && $es));
next;
} #status code
print; #Command output
} #while
close $server;
}
else
{
$es = 1;
print "Unable to connect to command execution server ($serverSvcName)\n"
}
exit ($es);
------------------------------
Date: Thu, 22 Jan 1998 14:24:13 +0100
From: Hendrik Klompmaker <Hendrik.Klompmaker@net.iend.wau.nl>
Subject: NS Communicator wrong filename extention with file download
Message-Id: <34C7487C.4F6B59B3@net.iend.wau.nl>
Hi,
In a perl cgi script I print something like:
print "<HR><B><FONT FACE=\"Arial, Helvetica\" >Attachment:</FONT></B>
<A
HREF=\"$url/$contentname?".$encoded."\@".$mailserver."/"."\">$contentname\"><P>\n";
This results in:
<a
href=http:\\server.name\script.cgi\myfile.doc?someparameter@my.mailserver.domain>
with IE3 and 4 and NS 3.0x this results in a download/open of the file
myfile.doc with the correct filename.
With Communicator 4.04 however it results in a download of myfile.exe
unless I shift-click on the link. If shift-click the the correct
extention (.doc) is used. In all cases the contenttype is set to
'application/octet-stream'.
What's wrong here. Is this my error or is there something wrong with
Communicator ??
TIA,
Hendrik
--
-----------------------------------------------------------------
|************** Wageningen Agricultural University. ************|
| Department of Information Management and Datacommunication |
-----------------------------------------------------------------
Hendrik Klompmaker: Senior Technologist
Internet : Hendrik.Klompmaker@Net.IenD.Wau.Nl
X400 : c=nl;a=400net;p=surf;o=wau;ou1=IenD
: ou2=Net;s=klompmaker;gi=hendrik
Phone : +31 (0)317-484059
Fax : +31 (0)317-482970
Snail : Dreijenplein 2
6703 HB Wageningen / The Netherlands
--------------------------------------------------------
------------------------------
Date: 22 Jan 1998 09:05:41 -0500
From: clay@panix.com (Clay Irving)
Subject: Re: perl 5.003 negation bug?
Message-Id: <6a7jnl$o04@panix.com>
In <vznuriEn6CME.7JD@netcom.com> vznuri@netcom.com (Vladimir Z. Nuri) writes:
>after a lot of dinking around trying to track down a subtle
>bug, I ran into the following.
>the following program execution baffles me:
>#!/usr/bin/perl5.003
>$x = "-4";
>print(-$x, "\n");
>$x = -4;
>print(-$x, "\n");
>this program outputs:
>+4
>4
>running perl 4.0, I get
>4
>4
>what's going on in my code is that the "+4" messes up the logic
>with the spurious plus sign. also it baffles me why the
>code even prints out the info differently. I am not aware of
>internals but is there some kind of "number" flag on a string
>that is not getting set right or something? this really feels
>like a bug if one is to claim that numbers are always strings.
Just yesterday, Chipmunk wrote:
When converting M to a number, it *is* equivalent to 0:
DB<1> p "M" == 1
DB<2> p "M" == 0
1
When converting "M" to a boolean value, it is equivalent to 1:
DB<3> p !!"M"
1
So:
$x = "-4";
print(-$x, "\n");
$x = -4;
print(-$x, "\n");
$x = "-";
print(-$x, "\n");
$x = "-M";
print(-$x, "\n");
prints:
+4
4
+
+M
--
Clay Irving <clay@panix.com> I think, therefore I am. I think?
http://www.panix.com/~clay/
------------------------------
Date: Thu, 22 Jan 1998 06:05:57 -0600
From: tadmc@flash.net (Tad McClellan)
Subject: Re: Please help me!!
Message-Id: <5nc7a6.cg.ln@localhost>
SHAILKUMAR (shailkumar@aol.com) wrote:
: I'm a novice in perl. I wrote a script which takes in student info like email,
: phone
: and name and the info is stored in a text file. The various fields are stored
: in one
: line seperated by |
: Now, what if I have to store large informations like a resume, paragraph etc.
: How should I do that and then the way to extract it?
Change how you store "records". Maybe use a blank line, or some other
indicator that is guaranteed to not appear in your data.
OR
Leave it as a 'record per line', and replace the newlines when you
read/write it.
write:
s/\n/\\n/g; # a real newline => two chars, a backslash and an 'n'
read:
s/\\n/\n/g; # the other direction
(assuming you don't have any literal \n sequences in your data)
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: 22 Jan 1998 14:49:54 GMT
From: lynchqvctc@aol.com (Lynchqvctc)
Subject: POSIX (?) under perl for Win95
Message-Id: <19980122144901.JAA11968@ladder01.news.aol.com>
I have a wonderful program that I'd like to run on my server (for a local
historical society-- so I'm doing all gratis); my computer is a Win95, and a
basic "Sambar4" server, with perl 5.003 build315. My question is-- anyone know
where "POSIX" is, or whether it will even be recognized under this build of
perl? (Or... whether there is another build for Win95 that contains it?) I have
searched docs, searched my file structure etc., and only find cryptic reference
to POSIX (which I believe is related to UNIX). The module is actully listed on
CPAN... but it is one of a few that is not downloadable separately! It seems
to be my last barrier to running this program (an historical-picture
archive)... I'd appreciate any constructive input/insight on this.
Thanks.... Brian D-L,
------------------------------
Date: Wed, 21 Jan 1998 23:22:35 -0600
From: "Michael King" <NOSPAM_mike808@mvp.net>
Subject: Re: Refering to a referenced structure?
Message-Id: <6a6kus$1up$1@twain.mvp.net>
Wade Williams wrote in message ...
>This one is driving me crazy.
>
>I've learned how to use references, but how do I get the structure pointed
>to by the reference? For example:
>
>@array=(1,2,3);
>
>$theref=\@array;
>
>$theref=($theref,4);
> ^^^^^^^
>I simply want to add something to the array pointed to by $theref. How
>can I dereference theref in such a way that it gives me the array
>structure so I can use it in a line like the third line?
>
>I know how to access the elements, I just can't figure out how to refer to
>the entire structure.
>Thanks,
>Wade
Try this:
push @$theref, 4;
--
# Michael King
# NOSPAM_mike808@mvp.net
# To reply, remove the NOSPAM_ in the address in the line above
# Or, check out my WWW site at:
# http-colon-slash-slash-walden-dot-mo-dot-net-slash-tilde-mike808
#
# These are my views and do not necessarly reflect those of anyone else.
#
# Copyright 1998 Michael King. St. Louis, MO USA
# Internet repost/archive freely permitted.
# Hardcopy newspaper, magazine, etc. quoting requires permission.
==================================================================
By US Code Title 47, Sec.227(a)(2)(B), a computer/modem/printer
meets the definition of a telephone fax machine. By Sec.227(b)
(1)(C), it is unlawful to send any unsolicited advertisement to
such equipment, punishable by action to recover actual monetary
loss, or $500, whichever is greater, for EACH violation.
==================================================================
------------------------------
Date: 22 Jan 1998 08:56:21 -0500
From: clay@panix.com (Clay Irving)
Subject: Re: Timer measuring time between submit button pushes that determines web page you land at
Message-Id: <6a7j65$n7t@panix.com>
In <01bd26f3$96aefa00$aff5fed0@default> "Chris" <Ingo_Olejak@msn.com> writes:
>Could anyone point me to a perl script that could help me create a timer
>that starts when a user pushes a first submit button and that stops when a
>user pushes a second submit button. If the time is > a certain limit, the
>script would direct you to one web page, and if the time is < a certain
>limit, the script would take you to another web page. So in the end, the
>time between the two buttons being pushed determines which page you land
>at.
Umm?
# code for first button
# if the user pushed it:
$start = localtime;
#
# ... do some stuff
#
# code for second button
# if the user pushed it:
$end = localtime;
$time_spent = $end - $start;
if ($time_spent > $how_ever_long) {
# do this
} else {
# do this instead
}
I'd highly recommend CGI.pm -
http://www-genome.wi.mit.edu/ftp/pub/software/WWW/cgi_docs.html
--
Clay Irving <clay@panix.com> I think, therefore I am. I think?
http://www.panix.com/~clay/
------------------------------
Date: Thu, 22 Jan 1998 00:06:29 -0600
From: "Michael King" <NOSPAM_mike808@mvp.net>
Subject: Re: Timer measuring time between submit button pushes that determines web page you land at
Message-Id: <6a6nh6$3a9$1@twain.mvp.net>
Chris wrote in message <01bd26f3$96aefa00$aff5fed0@default>...
>Could anyone point me to a perl script that could help me create a timer
>that starts when a user pushes a first submit button and that stops when a
>user pushes a second submit button. If the time is > a certain limit, the
>script would direct you to one web page, and if the time is < a certain
>limit, the script would take you to another web page. So in the end, the
>time between the two buttons being pushed determines which page you land
>at.
>
>Forgive me for being a newbie, so if I am on the completly wrong newsgroup,
>please advise me where to go.
>
>Thanks
I think what you are looking for is a *client-side* script that runs in the
browser, detecting and timing
the button presses, and then directing the browser to a particular page.
This is not very perl specific, and easliy coded in Jscript or JavaScript if
your browser supports those languages. Try some browser newsgroups.
--
# Michael King
# NOSPAM_mike808@mvp.net
# To reply, remove the NOSPAM_ in the address in the line above
# Or, check out my WWW site at:
# http-colon-slash-slash-walden-dot-mo-dot-net-slash-tilde-mike808
#
# These are my views and do not necessarly reflect those of anyone else.
#
# Copyright 1998 Michael King. St. Louis, MO USA
# Internet repost/archive freely permitted.
# Hardcopy newspaper, magazine, etc. quoting requires permission.
==================================================================
By US Code Title 47, Sec.227(a)(2)(B), a computer/modem/printer
meets the definition of a telephone fax machine. By Sec.227(b)
(1)(C), it is unlawful to send any unsolicited advertisement to
such equipment, punishable by action to recover actual monetary
loss, or $500, whichever is greater, for EACH violation.
==================================================================
------------------------------
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 1701
**************************************