[8081] in Perl-Users-Digest
Perl-Users Digest, Issue: 1700 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Jan 22 06:07:32 1998
Date: Thu, 22 Jan 98 03:00:26 -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: 1700
Today's topics:
Re: [Q] Database Reccomendations for Perl on Unix (Robert Lubej)
Re: Byte Ordering using Perl (Ned Konz)
Re: Calling C from Perl (mike)
CGI / foreach loop question (Robert Goodwin)
Re: CGI / foreach loop question (brian d foy)
Re: CGI / foreach loop question (Mike Heins)
Re: CGI / foreach loop question <e.christensen@netjob.dk>
Re: CGI / foreach loop question (brian d foy)
Re: CGI / foreach loop question (brian d foy)
Re: CGI.pm question <Dave.Cross@gb.swissbank.com>
Executing another Perl script from inside one. <vanucci@sp.dglnet.com.br>
Re: getting info from web users <samk@was.net>
help -- use METHOD::PACKAGE; <mikemort@cadence.com>
Re: HTTP debugger. Does that exist? <aas@sn.no>
Re: living and free software (was: Re: source into bina <pdcawley@bofh.org.uk>
Re: Long integers in PERL <rjk@coos.dartmouth.edu>
Re: LWP/SSLeay memory leak? <aas@sn.no>
Re: Odd syntax problem <NOSPAM_mike808@mvp.net>
Re: Oraperl and long type <reccmo@sc03.sctp.dk>
perl 5.003 negation bug? (Vladimir Z. Nuri)
Re: PERL Newbie Question (mike)
Printing Gymnastics with Perl <crockett@www.er.uic.edu>
Re: Refering to a referenced structure? (mike)
Rexexp and href <e.christensen@netjob.dk>
Re: Rexexp and href (brian d foy)
Re: Running Two Scripts at Once <joel@tou.com>
Re: space searching? <merlyn@stonehenge.com>
Timer measuring time between submit button pushes that <Ingo_Olejak@msn.com>
Re: Trouble with a regex <*@qz.to>
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Thu, 22 Jan 1998 09:47:24 GMT
From: lubej@amis.net (Robert Lubej)
Subject: Re: [Q] Database Reccomendations for Perl on Unix
Message-Id: <34c71532.9657157@news.amis.net>
On Wed, 14 Jan 1998 17:00:36 -0700, Brandon Pulsipher
<Brandon@byu.edu> wrote:
>MS-Access databases (at least that I know of). Therefore, does anyone
>have suggestions for what to convert these database to, so that I can
>work with them thru Perl 5 on Unix? I will be using a virtual host and
>do not have a huge amount of control to install other packages.
>If there may be a better solution to my problem, please let me know.
>Thank you.
mySQL is a free SQL RDBMS, and there are tools to convert to and from
MS Access (but don't remember where).
------------------------------
Date: Thu, 22 Jan 1998 06:15:59 GMT
From: nedkonz@scruznet.com (Ned Konz)
Subject: Re: Byte Ordering using Perl
Message-Id: <34c9dbc7.1565651@news.scruznet.com>
biju@mindless.com wrote:
>Hi friends,
>
>I have a problem of byte ordering on NT using Perl.
>I want to swap the bytes.i.e
>I extracted a unsigned integer from a binary file. The result was
> $value = 0x09c80000.
>Now what i want is 0x000009c8. I have tried the following routine to
>swap
> $value = ($value >> 24) | ($value) & 0xff00 |
> ($value << 8) & 0xff0000 | ($value << 24) ;
>But end result is
> $value = 0xffffffc8
>
>I have ensured that $value is of type unsigned.
>The syntax followed for extracting the value $value before swapping is
>correct, since the result is as expected.
>
>Is there is any efficient way of swapping the bytes on NT using Perl.
>
>Thanks in advance,
>
>With regards,
>Biju
Well, you could look at pack and unpack. Here's the docs on them:
pack TEMPLATE,LIST
Takes an array or list of values and packs it into a binary structure,
returning the string containing the structure. The TEMPLATE is a
sequence of characters that give the order and type of values, as
follows:
A An ascii string, will be space padded.
a An ascii string, will be null padded.
b A bit string (ascending bit order, like vec()).
B A bit string (descending bit order).
h A hex string (low nybble first).
H A hex string (high nybble first).
c A signed char value.
C An unsigned char value.
s A signed short value.
S An unsigned short value.
i A signed integer value.
I An unsigned integer value.
l A signed long value.
L An unsigned long value.
n A short in "network" order.
N A long in "network" order.
v A short in "VAX" (little-endian) order.
V A long in "VAX" (little-endian) order.
f A single-precision float in the native format.
d A double-precision float in the native format.
p A pointer to a null-terminated string.
P A pointer to a structure (fixed-length string).
u A uuencoded string.
w A BER compressed integer. Bytes give an unsigned integer base
128, most significant digit first, with as few digits as
possible, and with the bit 8 of each byte except the last set
to "1."
x A null byte.
X Back up a byte.
@ Null fill to absolute position.
Each letter may optionally be followed by a number which gives a
repeat count. With all types except ``a'', ``A'', ``b'', ``B'', ``h''
and ``H'', and ``P'' the pack function will gobble up that many values
from the LIST. A * for the repeat count means to use however many
items are left. The ``a'' and ``A'' types gobble just one value, but
pack it as a string of length count, padding with nulls or spaces as
necessary. (When unpacking, ``A'' strips trailing spaces and nulls,
but ``a'' does not.) Likewise, the ``b'' and ``B'' fields pack a
string that many bits long. The ``h'' and ``H'' fields pack a string
that many nybbles long. The ``P'' packs a pointer to a structure of
the size indicated by the length. Real numbers (floats and doubles)
are in the native machine format only; due to the multiplicity of
floating formats around, and the lack of a standard ``network''
representation, no facility for interchange has been made. This means
that packed floating point data written on one machine may not be
readable on another - even if both use IEEE floating point arithmetic
(as the endian-ness of the memory representation is not part of the
IEEE spec). Note that Perl uses doubles internally for all numeric
calculation, and converting from double into float and thence back to
double again will lose precision (i.e. unpack(``f'', pack(``f'', $foo)
) will not in general equal $foo).
Examples:
$foo = pack("cccc",65,66,67,68);
# foo eq "ABCD"
$foo = pack("c4",65,66,67,68);
# same thing
$foo = pack("ccxxcc",65,66,67,68);
# foo eq "AB\0\0CD"
$foo = pack("s2",1,2);
# "\1\0\2\0" on little-endian
# "\0\1\0\2" on big-endian
$foo = pack("a4","abcd","x","y","z");
# "abcd"
$foo = pack("aaaa","abcd","x","y","z");
# "axyz"
$foo = pack("a14","abcdefg");
# "abcdefg\0\0\0\0\0\0\0"
$foo = pack("i9pl", gmtime);
# a real struct tm (on my system anyway)
sub bintodec {
unpack("N", pack("B32", substr("0" x 32 . shift, -32)));
}
The same template may generally also be used in the unpack function.
unpack TEMPLATE,EXPR
Unpack does the reverse of pack: it takes a string representing a
structure and expands it out into a list value, returning the array
value. (In a scalar context, it merely returns the first value
produced.) The TEMPLATE has the same format as in the pack function.
Here's a subroutine that does substring:
sub substr {
local($what,$where,$howmuch) = @_;
unpack("x$where a$howmuch", $what);
}
and then there's
sub ordinal { unpack("c",$_[0]); } # same as ord()
In addition, you may prefix a field with a %<number> to indicate that
you want a <number>-bit checksum of the items instead of the items
themselves. Default is a 16-bit checksum. For example, the following
computes the same number as the System V sum program:
while (<>) {
$checksum += unpack("%16C*", $_);
}
$checksum %= 65536;
The following efficiently counts the number of set bits in a bit
vector:
$setbits = unpack("%32b*", $selectmask);
------------------------------
Date: Thu, 22 Jan 1998 06:06:13 GMT
From: mjlee@amherst.edu (mike)
Subject: Re: Calling C from Perl
Message-Id: <34c9df2a.3424434@news.nyu.edu>
On Wed, 21 Jan 1998 20:08:38 -0500, Tack <tack@ican.net> wrote:
>I have (or will have, rather) a perl interpreter in my C program. I
>want to be able to execute perl scripts which can call functions
>provided by the interpreter. For example: (forgive my use of C++
>comments)
perl man - perlxs and perlxstut will show you how to embed C functions
into Perl. "xs" stands for "eXternal Subroutine" - there is also a
small chapter in "Advanced Perl Programming" book. You might want to
also check out SWIG(Simplified Wrapper and Interface Generator)
http://www.cs.utah.edu/~beazley/SWIG/swig.html
I have to say that writing C functions for Perl is not easy as writing
Perl subroutines =). I had a hair-pulling experience with fixing a
module written in C (Fame.pm - a wrapper around C-API of FAME
time-series database).
Good luck.
mike
------------------------------
Date: 22 Jan 1998 01:00:18 -0700
From: goodwin@cuug.ab.ca (Robert Goodwin)
Subject: CGI / foreach loop question
Message-Id: <6a6uai$1fb2@cuugnet.cuug.ab.ca>
Hi there,
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
------------------------------
Date: Thu, 22 Jan 1998 04:05:29 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: CGI / foreach loop question
Message-Id: <comdog-ya02408000R2201980405290001@news.panix.com>
Keywords: from just another new york perl hacker
What does this have to do with CGI?
Please read this information on how to choose a good subject for a post:
<URL:http://www.perl.com/CPAN/authors/Dean_Roehrich/subjects.post>
In article <6a6uai$1fb2@cuugnet.cuug.ab.ca>, goodwin@cuug.ab.ca (Robert Goodwin) posted:
>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;
> }
what does "doesn't seem to work" mean? what have you tried to do
to diagnose this problem? did you do something like
foreach my $key (keys %fields)
{
print "$key: $fields{$key}\n";
}
to see each value?
also, to avoid the creation of new key-value pairs, you might
change your code to
$fields{$item} =~ s/\s//g if exists $fields{$item};
good luck :)
--
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: 22 Jan 1998 09:04:26 GMT
From: mheins@prairienet.org (Mike Heins)
Subject: Re: CGI / foreach loop question
Message-Id: <6a722q$i0b$1@vixen.cso.uiuc.edu>
Robert Goodwin (goodwin@cuug.ab.ca) wrote:
:
: Hi there,
:
: 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) {
^^^^^^^ array
: $fields{$item}=~s/\s//g;
^^^^^^^^^^^^^^ hash
: }
You can't access an array element with {}, it is a numbered
array.
Not knowing which you are really trying to do, here are
both correct ones. It is probably:
foreach $item (@fields) {
$item =~ s/\s+//g;
}
\s+ will be more efficient than just \s.
Or it could be:
foreach $item (keys %fields) {
$fields{$item} =~ s/\s+//g;
}
Style corrected to what I consider a reasonable one. 8-)
Regards,
Mike Heins http://www.minivend.com/ ___
Internet Robotics |_ _|____
If you like what you're gettin', 131 Willow Lane, Floor 2 | || _ \
keep doin' what you're doin'. Oxford, OH 45056 | || |_) |
-- Hector <mikeh@minivend.com> |___| _ <
513.523.7621 FAX 7501 |_| \_\
------------------------------
Date: Thu, 22 Jan 1998 10:16:58 +0100
From: Ernst <e.christensen@netjob.dk>
Subject: Re: CGI / foreach loop question
Message-Id: <34C70E8A.E47@netjob.dk>
Robert Goodwin wrote:
>
> Hi there,
>
> 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;
reg
Ernst
------------------------------
Date: Thu, 22 Jan 1998 04:54:35 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: CGI / foreach loop question
Message-Id: <comdog-ya02408000R2201980454350001@news.panix.com>
Keywords: from just another new york perl hacker
In article <6a722q$i0b$1@vixen.cso.uiuc.edu>, mheins@prairienet.org (Mike Heins) posted:
>Robert Goodwin (goodwin@cuug.ab.ca) wrote:
>: foreach $item (@fields) {
> ^^^^^^^ array
>: $fields{$item}=~s/\s//g;
> ^^^^^^^^^^^^^^ hash
>: }
>
>You can't access an array element with {}, it is a numbered
>array.
the code posted might be what he wanted. that sort of thing
is commonly done if you want to work with a subset of the
keys - one puts the list of keys whose value one wants to
munge in an array then loops through that list.
however, it's difficult to read minds, and the snippet is
hardly enough to guess what is going on :)
--
brian d foy <comdog@computerdog.com>
one of the perl purity questions deals with using $x, @x, and %x.
------------------------------
Date: Thu, 22 Jan 1998 04:56:28 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: CGI / foreach loop question
Message-Id: <comdog-ya02408000R2201980456280001@news.panix.com>
Keywords: from just another new york perl hacker
In article <34C70E8A.E47@netjob.dk>, e.christensen@netjob.dk posted:
>Robert Goodwin wrote:
>> $fields{$item}=~s/\s//g;
>This one should do it, you should have a space between ~ and s.
>
>$item=~ s/ //g;
the space makes no difference, and your solution doesn't remove
other forms of whitespace.
--
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 09:35:23 GMT
From: David Cross <Dave.Cross@gb.swissbank.com>
Subject: Re: CGI.pm question
Message-Id: <y4d7m7sam1w.fsf@gb.swissbank.com>
Andrew Spiers <andrew.spiers@virgin.net> writes:
> I am trying to do a script that displays radio_group and then when the
> user presses the submit button it will display a results page. I cannot
> get this to happen - what happens is that it displays the results page
> below the radio_group. Can someone give me an idea on the way to achieve
> this - just a pointer.
Difficult to give exact advice without seeing your code, but it sounds
like a simple logic problem. If think you want your code to look a bit
like this:
#!/path/to/perl -w
use strict;
use CGI;
my $p = CGI->new;
if ($p->param)
{
# Put code here that displays your results.
}
else
{
# Put code here that displays your radio buttons
}
'param' will return a list ofthe parameters that your script has been
passed. If there are no parameters you need to display the radio buttons.
If you have parameters you need to display the results (based on the
parameters).
If this doesn't hrlp, perhaps you could post a cut down version of your
code.
Dave... .. .
--
"...but Man created all gods equal."
Dave.Cross@gb.swissbank.com
------------------------------
Date: Thu, 22 Jan 1998 03:06:52 -0200
From: "Fabiano Vanucci" <vanucci@sp.dglnet.com.br>
Subject: Executing another Perl script from inside one.
Message-Id: <885445862.689988@citroen>
Can Exec() function execute another script that isn't on the same web site?
I mean....
First, my "post01.pl" that is located at (for example)
"www.ibm.com/cgi-bin/post01.pl"
Then, this "post01.pl" has to execute "rec02.pl" at
"www.compaq.com/cgi-bin/rec02.pl", gets his return value, and process it.
Can it be done? How?
Thanks,
Fabiano Vanucci
------------------------------
Date: Thu, 22 Jan 1998 16:55:33 -0600
From: Samuel King <samk@was.net>
To: Steve Michaels <dyang@mork.uni.uiuc.edu>
Subject: Re: getting info from web users
Message-Id: <34C7CE65.427B032@was.net>
You could use a server side include SSI that calls a perl script to collect
that data and write it to a file
To include a SSI use the
<!--#exec cgi="/cgi-bin/your_script_name_here"-->
this will call what ever script you have written to do whatever it does when
someone visits the page
Samuel King
Steve Michaels wrote:
> is it possible to write a perl script that would get info about people that
> came to your page? My admin allows me to run shell scripts, and I was
> wondering if this is possible.
>
> Steve
>
> (like using the ENV variables and stuff)
------------------------------
Date: Mon, 19 Jan 1998 10:13:09 -0800
From: Michael mortensen <mikemort@cadence.com>
Subject: help -- use METHOD::PACKAGE;
Message-Id: <34C397B5.DF3@NOSPAMcadence.com>
I am new to using packages, so this may be a VERY simple question, but
I scanned the FAQ and didn't see an answer to this.
I downloaded a module from CPAN (RecDescent) and am trying to run
one of the demo programs.
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.
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.
I have tried it without success using Perl for Win32 and Perl for
Unix.
-Thanks
Mike
(Remove NOSPAM from my email to directly reply)
------------------------------
Date: 22 Jan 1998 10:51:05 +0100
From: Gisle Aas <aas@sn.no>
Subject: Re: HTTP debugger. Does that exist?
Message-Id: <m33eig3khi.fsf@furu.g.aas.no>
comdog@computerdog.com (brian d foy) writes:
> In article <6a5070$61s@fridge.shore.net>, nvp@shore.net (Nathan V. Patwardhan) posted:
>
> >Craig (craig@skybound.demon.nl) wrote:
> >
> >: I'm looking for a program to view all the HTTP communication between my
> >: browser and my server to see what my CGI scripts and browser are really
> >: doing. Does something like that exist?
> >
> >Get LWP. http://www.perl.com/CPAN/modules/by-module/LWP/
>
> i would adivse against using LWP in this case. LWP munges some of the
> HTTP headers and adds others, so it's very difficult to see exactly
> what the transaction was. LWP is great, but it's because of it's
> abstraction, which in this case is not good.
If you add:
use LWP::Debug '+';
to your scripts you will see all communication among other noise.
If you turn off the $ua->parse_head() attribute, then no headers
should be munged either. There should probably also be some option to
disable the generation of Client-XXX headers.
--
Gisle Aas
------------------------------
Date: 22 Jan 1998 10:09:58 +0000
From: Piers Cawley <pdcawley@bofh.org.uk>
Subject: Re: living and free software (was: Re: source into binary code)
Message-Id: <54lnw8hlah.fsf@gunnar.aladdin.net>
21 Jan 1998 21:05:48 GMT stanley@skyking.OCE.ORST.EDU (John Stanley) comp.lang.perl.misc
> In article <54soqhhhde.fsf@gunnar.aladdin.net>,
> Piers Cawley <pdcawley@bofh.org.uk> wrote:
> >20 Jan 1998 04:35:09 GMT stanley@skyking.OCE.ORST.EDU (John Stanley) comp.lang.perl.misc
> >> Neither do I. But I don't consider commercial software to be useless
> >> just because I had to pay for it.
> >
> >Heh, I don't consider free software to be worthless, that's why I
> >often pay for it; A decent Linux distribution on CD is better value
> >than the time I spend with my phoneline tied up waiting for it to
> >download.
>
> Oops, the cat's out of the bag. Someone is violating the GPL. Or maybe
> you aren't paying for the software after all?
Go read the GPL again. Please?
> >Hmm I don't think anyone (who hasn't amended their statement) has
> >claimed to be making a living by giving away software.
>
> Of course nobody would claim that THEY are making such a living, because
> they aren't. The claim was that it was possible.
Okay, I'm a latecomer to this thread. Who made the claim that such a
thing was possible without later amending it? Message-ids would be good.
> >Lots of people have claimed to be making a living whilst giving
> >away software, but that's a different matter.
>
> Yes, that is a different matter, as I have already stated. Please
> don't waste time arguing with me about things that you agree with me
> on.
> >> >It is natural and normal to harbor contempt for those who cause
> >> >trouble and are generally harmful to society.
> >>
> >> Please support that statement with proof or retract it. It is a long
> >> way from "I won't give you my code for free" to causing trouble for
> >> society.
> >
> >Hmm... 'It is natural to harbour contempt for those who cause trouble
> >and are generally harmful to society'.
>
> Repeating the statement is not providing support.
>
> >Yeah, I can go with that.
>
> That's nice. Now provide proof that those who hoard code are harmful to
> society.
Why should I? That wasn't the point I was making.
> >I'm not sure I believe that those who don't make their source
> >available are either causing trouble or generally harmful to
> >society, but it doesn't mean that the statement is incorrect.
>
> So people who hoard code are not causing trouble, and the statement
> is completely irrelevant in this discussion? You do remember that
> this statement was in response to a statement about "code hoarders
> be damned" or something similar? Are you saying that it doesn't
> really explain why code hoarders should be damned?
And you pulled said statement out of context and demanded that its
originator retract or prove it. I was pointing out that there was
nothing actually wrong with the statement, but it depended on a
(possibly) dodgy (and certainly subjective) premise to be true.
Ooh... I just checked the rest of your post again and, what a surprise
you cut the following from a later paragraph:
> > It could be argued that not releasing source makes you a parasite
> > on hacker society, but parasites do actual harm to the host,
> > you're just an irritant.
> >> The work is available to anyone who wants to use it. You cannot
> >> see how it was done, just as I cannot walk into HP and expect to
> >> see how they fab the chips for the calculator I just bought, nor
> >> can I learn how by grinding the top off the chips in the one I
> >> bought.
> >
> >But people can and do.
>
> Please read the statement I made. First person. Yes, SOME PEOPLE get
> to walk into HP and get the full tour with disclosure of proprietary
> processes and such. That is hardly what I would call "free
> disclosure".
Tell you what, read the statement I made. Go on, I dare you. Is it
apparent to you that I was refering to the clause that came after the
'nor'? If not, why not? Or did you understand perfectly but decide to
break the paragraph to make a cheap debating point?
> >The equipment needed is not exactly cheap, but the technique is
> >reasonably well understood. Of course it would almost certainly
> >work out cheaper just to buy the damn things from HP.
>
> Yes, but when you have source sitting right in front of you, it is not
> cheaper to buy the right to use to code from the author, it is a simple
> matter of running the code.
Well, I can't comment on your ethics in this situation, but if the
license terms weren't too restrictive and the program had enough
utility I'd pay for it. Hell, I have done.
> >> >No one can benefit from what you've learned.
> >>
> >> Don't be silly. Anyone can benefit from what I've learned, they
> >> just have to pay for it.
> >
> >Ah... anyone who can afford to can benefit from what you've learned.
>
> Well, that is quite different from "no one", now isn't it?
And quite different from 'anyone' too.
> >> The benefit is the operation of the program, not the ability to see
> >> the code itself.
> >
> >The risk is that the code will have bugs at some inappropriate time
> >when you are not around to fix it.
>
> Of course there are those risks. I think it is a much greater risk
> if the technician employed by the hospital to install PC's tries to
> fix the MRI code than if they had to wait to call GE.
Then said technician would be rightly sued to within an inch of its
life, and hopefully beyond. I would assume that the manager who hired
such a terminally stupid luser would get hammered too.
> Or what if the business owner tries to fix the code, and uses
> ">file" to open a critical file instead of >>?
Then he screws up and loses his file. What is your point?
> What is the cost of doing a restore from last backup? What if the
> tinkerer doesn't notice the problem until he's cycled through
> several backups and the file is gone?
Then he would pay for his own stupidity. I still don't see your point.
> >> Did you notice that there is a thing called "tuition" at most
> >> schools? Do you resent all those professors who expect to be paid
> >> to teach you the things they have learned?
> >
> >Me? Nah, it's easier and more effective to pay them to do the
> >teaching than it is to go buy the coursebooks and plough through
> >them unaided.
>
> So people who make you pay to find out things they have learned are
> ok after all.
Um... you missed out the statement where I said that what I was paying
for was not the learning but the piece of paper at the end to prove I
had learnt it (well, actually, I didn't pay for my tuition, my parents
and all the other UK taxpayers did). But of course that would weaken
your argument wouldn't it?
> >> Did you also notice that most of the world would not benefit one tiny
> >> bit by seeing the code, but many may benefit from its use? E.g., the
> >> code that runs the MRI systems sold by GE. I would get no benefit from
> ...
>
> >You keep using this argument, I'm not sure it means what you think it
> >means. Of course the doctors won't benefit from seeing the code.
> >They're almost certainly bright enough to know this and if they did
> >have access to it they wouldn't go near it.
>
> Please show me in the definition of "free software" the part that says
> that only those who are bright enough to know they shouldn't touch the
> code may get copies of the source. If you are going to argue a policy,
> you have to argue the warts, too.
Nowhere. Why should it? If some luser decides to tinker with the code
and breaks it, well, them's the breaks. Hell, if they're that bloody
stupid they probably manage to kill their patients in all kinds of
interesting and more direct ways.
It is for the management in an environment that buys software with
source to decide who should be able to alter it, and what kind of
testing should be done before said software is allowed to be used in
earnest. If those procedures are broken then that is not the fault of
the original programmer. That's why the GPL explicitly disclaims any
warranty.
> >It doesn't mean that I wouldn't be interested in seeing said code,
> >they may have used some clever technique of which I was previously
> >unaware that I can borrow and use in a completely different
> >application.
>
> Yes, you mean that you can use someone's intellectual property
> without paying for the development of that property.
I think we're arguing at different levels here. It is my belief that
making programming *techniques* proprietary is akin to doing the same
with mathematical proofs. Remember that in an environment where source
code is readily available then everyone is free to learn from everyone
else's code. This implies (to me at least) that overall quality of
code will increase at a far greater rate than in an environment where
source code is hidden.
> And who is going to stop you from using this in a competing
> application? Yes, copyright and patent law will allow them to sue
> you if you do, but that is a costly and time-consuming process that
> is much better to avoid.
Indeed. But we already have a situation where people are ripping off
others work where source code is not available. It happens all the
time. Hell, IBM are probably still smarting because people cloned
'their' PC. We're (arguably) better off because of the clones though.
[Quote restored]
> > >You're not contributing to human knowledge.
> >
> > What a wonderfully subjective measure of the value of existance.
> > By this measure, a good 90% of the population of the Earth should
> > be taken out and shot. No, let's be lenient. 50%.
[end]
> >Um... I think you're being a little extreme. Just because you don't
> >contribute to human knowledge doesn't make you a useless member of
> >the wider society.
[and again]
> >It could be argued that not releasing source makes you a parasite
> >on hacker society, but parasites do actual harm to the host, you're
> >just an irritant.
[end]
> Then not contributing to human knowledge isn't such a bad thing. Ok,
> that's all I wanted to hear someone admit.
Well, it's not such a bad thing that you would be justified in
shooting someone because they don't do it. However, if you make use of
techniques which are given freely to (perl|hacker) culture and don't
give something back then you should not be surprised if those whose
shoulders you stand on resent your weight.
--
You're stupid, I'm rude -- Dick Solomon
------------------------------
Date: Thu, 22 Jan 1998 00:30:14 -0500
From: Chipmunk <rjk@coos.dartmouth.edu>
Subject: Re: Long integers in PERL
Message-Id: <34C6D966.AC1A9C67@coos.dartmouth.edu>
brian d foy wrote:
>
> there is a big integer module somewhere on CPAN, if you want to
> use really big numbers.
In fact, Math::BigInt is part of the standard library.
Chipmunk
------------------------------
Date: 22 Jan 1998 10:46:06 +0100
From: Gisle Aas <aas@sn.no>
Subject: Re: LWP/SSLeay memory leak?
Message-Id: <m367nc3kpt.fsf@furu.g.aas.no>
kirbyh@primenet.com (Kirby Hughes) writes:
> The following program will eat memory until you run out.
> s/https/http/ and the problem goes away. I cannot track down the problem
> so far. Any ideas?
You did not say which version of libwww-perl you used. Can you try it
with libwww-perl-5.18_05 and Crypt-SSLeay? It uses a different SSLeay
interface than the previous versions of LWP.
> #!/usr/local/bin/perl -w
>
> use strict 'vars';
> use LWP::UserAgent;
>
> while (1) {
> get_http();
> sleep 2;
> }
>
> sub get_http {
> my ($req, $res);
> my $ua = new LWP::UserAgent;
> $ua->agent("Mozilla/3.01 (X11; I; SunOS 5.5.1 sun4m)");
> $req = new HTTP::Request GET => "https://site/";
> $res = $ua->request($req);
> }
--
Gisle Aas
------------------------------
Date: Wed, 21 Jan 1998 23:13:45 -0600
From: "Michael King" <NOSPAM_mike808@mvp.net>
Subject: Re: Odd syntax problem
Message-Id: <6a6keb$1j7$1@twain.mvp.net>
Martien Verbruggen wrote in message <6a1an6$l3r$1@comdyn.comdyn.com.au>...
>In article <6a11pi$2m7$1@usenet48.supernews.com>,
> root@atrium.cardima.com (System Administrator) writes:
>
>> $_ = join('/', splice(split(/\//, $_), -1, 1)) if (/=/);
>> $ perl -c tasks
>> syntax error in file tasks at line 120, next 2 tokens "(split"
>
>Which version of perl are you using? Mine tells me what is wrong:
>> perl -v
>This is perl, version 5.004_04 built for sun4-solaris
>> perl
>$_ = join('/', splice(split(/\//, $_), -1, 1)) if (/=/);
>Type of arg 1 to splice must be array (not split) at - line 1, near "1)"
>
>I suppose that you will have to give splice a real array, not one that
>is output by a function.
Try this instead:
$_ = join('/', splice( [ split("/",$_) ], -1, 1)) if (/=/);
And if you want to be really efficient (and fast) in simply removing the
trailing stuff
after the last slash in your line, try this:
s {/[^/]*?$} {} if /=/; # remove / and the shortest string of non-/
characters from the end of $_
Is there a real need for using join, splice and split when just a s/// will
do?
Be small. Be fast. Be good.
--
# 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 09:28:52 GMT
From: Christian Mondrup <reccmo@sc03.sctp.dk>
Subject: Re: Oraperl and long type
Message-Id: <6a73gk$9b4$1@news.net.uni-c.dk>
M.J.T. Guy <mjtg@cus.cam.ac.uk> wrote:
: Christian Mondrup <scancm@biobase.dk> wrote:
: >: Monica Fernandez Barreiro <monica@enol.tid.es> wrote:
: >: : Hello:
: >: : I have a problem when I try to insert a variable long type
: >: : in the data base. In a exactly way I'm going to write the
: >: : code and the place where it doesn't work:
: >
: >: : $txt = "insert into cuerpo_certificados
: >: : (email_mayusculas, codigo) values
: >: : ('$email_upper', :1)";
: >
: >Sorry for the error. What I meant was
: >
: > $txt = "insert into cuerpo_certificados
: > (email_mayusculas, codigo) values
: > (\'$email_upper\', :1)";
: What difference is that supposed to make? ' isn't a special character
: inside "". If you want to get a \ into the final string, you'll need
: to write \\' not \'.
Thank you for pointing that out. Until now I _did_ think it was necessary to
escape singe quotes in order to pass them to Oracle - it isn't !
: But I suspect the original error is somewhere entirely different.
: Mike Guy
--
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ Christian Mondrup, Computer Programmer +
+ Scandiatransplant, Skejby Hospital, University Hospital of Aarhus +
+ Brendstrupgaardsvej, DK 8200 Aarhus N, Denmark +
+ Phone: +45 89 49 53 01, Telefax: +45 89 49 60 07 +
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
------------------------------
Date: Thu, 22 Jan 1998 07:25:26 GMT
From: vznuri@netcom.com (Vladimir Z. Nuri)
Subject: perl 5.003 negation bug?
Message-Id: <vznuriEn6CME.7JD@netcom.com>
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.
here's my code rev
This is perl, version 5.003 with EMBED
Locally applied patches:
SUIDBUF - Buffer overflow fixes for suidperl security
built under linux at Apr 22 1997 10:04:46
+ two suidperl security patches
Copyright 1987-1996, Larry Wall
--
~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^
"in theory, there's no difference between
theory and practice, but in practice there is!" vznuri@netcom.com
------------------------------
Date: Thu, 22 Jan 1998 05:48:47 GMT
From: mjlee@amherst.edu (mike)
Subject: Re: PERL Newbie Question
Message-Id: <34c8dc4f.2693842@news.nyu.edu>
On Tue, 20 Jan 1998 21:19:24 GMT, mcintyres@hjc.cc.md.us (Wiley Scott
McIntyre) wrote:
>Hi out there,
>
>I am a real newbie to PERL. I was wondering... I would like to
>install PERL on our Sun Netra web server and would like to know where
>I can get the latest version for Unix System 5 Release 4. Then, I
>would like to know how can I install it?
I am assuming that you are using Solaris 2.x. Since Solaris does not
come with any C compilier, you have two choices.
1. Get a C compilier & "latest.tar.gz" and build Perl yourself.
2. Get a precomilied binary version from
"http://sunfreeware.com". They are in "pkgadd" format.
I would recommend that you get the binary GCC compilier(this is also
available at sunfreeware.com) and build Perl yourself because the
binary Perl @ sunfreeware.com is not always corresponds to the latest
Perl distribution.
Good luck!
Mike
------------------------------
Date: Thu, 22 Jan 1998 01:45:39 -0500
From: "Mark D. Crockett, MD" <crockett@www.er.uic.edu>
Subject: Printing Gymnastics with Perl
Message-Id: <6a6sq1$1222$1@piglet.cc.uic.edu>
I am trying to solve a problem printing with PERL. If anyone can help me, I
would really appreciate it!
I need hard copy documentation in two separate places of a HTML form
submission on an intranet.
Configuration
Machine #1 NT Workstation:HP Laserjet 6:Explorer
Machine #2 NT Server: HP Laserjet 6: HTTP server/PERL Scripts
Machine #1 submits form to www server on machine #2. Script currently
prints to local printer. I need that script to print a "Confirmation of
submission" on Machine #1's printer, and the rest of the scripts output goes
to printer on machine #2. This would mean on-the fly rerouting of a network
printer, or identifying 2 printers to PERL, and I'm having a great deal of
difficulty with this.
Thanks in advance for your assistance
Mark Crockett
crockett@uic.edu/tox911@safeplace.net
------------------------------
Date: Thu, 22 Jan 1998 05:30:56 GMT
From: mjlee@amherst.edu (mike)
Subject: Re: Refering to a referenced structure?
Message-Id: <34c7d87e.1716076@news.nyu.edu>
On Wed, 21 Jan 1998 11:22:08 -0600, wwilliam@cisco.com (Wade Williams)
wrote:
<snipped>
>@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?
You mean you want to add "something" to the end of @array?
############################
$somthing = 4;
push @$theref, $somthing
############################
You can find more info on Perl manual(Perlref). You can also get more
info from "Advanced Perl Programming" or "Effective Perl Programming".
Good luck!
Michael
------------------------------
Date: Thu, 22 Jan 1998 10:03:44 +0100
From: Ernst <e.christensen@netjob.dk>
Subject: Rexexp and href
Message-Id: <34C70B70.359B@netjob.dk>
Hi
I am trying to find all <a href></a> tags in a document like this:
open (file1, "index.html");
@linjer=<file1>;
$linier=join(" ",@linjer);
$linier=~ /(\<a href.*?\/a\>)/ig;
print $1;
But it only gives me one matsch.
On the other hand
$linier=~ /(\<a href.*\/a\>)/ig;
gives the whole document.
What is wrong, please?
reg
Ernst
------------------------------
Date: Thu, 22 Jan 1998 05:24:01 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: Rexexp and href
Message-Id: <comdog-ya02408000R2201980524010001@news.panix.com>
Keywords: from just another new york perl hacker
In article <34C70B70.359B@netjob.dk>, e.christensen@netjob.dk posted:
>I am trying to find all <a href></a> tags in a document like this:
>
>open (file1, "index.html");
even when your script is just an example, you should check the
return value:
open FILE, $filename or die "$filename: $!";
>@linjer=<file1>;
>$linier=join(" ",@linjer);
you could also do it like this:
$/ = undef;
$linier = <FILE>;
>$linier=~ /(\<a href.*?\/a\>)/ig;
>print $1;
[rather than beat the dead horse about matching
HTML tags i'll just make comments on what is already
here. see Dejanews for past threads. Tom C.'s
urlify script would be a good read. ]
you don't need to escape < or > because they aren't
metacahracters, and if you expect to use / within the
pattern, you might want to use a different delimiter to
you don't have to escape it either. leaning toothpicks
make things difficult to read. re-written, the regex is
$linier =~ m| (<a href.*?/a>) |xig;
>But it only gives me one matsch
when you do it like this, the matching operator
faithfully does a global match. since you aren't saving
the results as you go along, it just keeps replacing $1
with the next thingy it finds. at the end you have the
last thingy it found. perhaps you wanted to do something
like
@list = ($_ =~ m| (<a href.*?/a>) |xig );
to capture each match into @list.
>On the other hand
>
>$linier=~ /(\<a href.*\/a\>)/ig;
>
>gives the whole document.
in this case, the .* matches as much as it can until the last
'/a>' it can find - the last </a> in the document probably.
this is not what you wanted.
good luck :)
--
brian d foy <comdog@computerdog.com>
another dead horse post
------------------------------
Date: Wed, 21 Jan 1998 17:15:13 -0800
From: Joel Shellman <joel@tou.com>
To: Schreffman <kschreff@harborcom.net>
Subject: Re: Running Two Scripts at Once
Message-Id: <34C69DA1.FBF9FE21@tou.com>
Schreffman wrote:
>
> Can this be done? I have a HTML form that when submitted, I
> want to split the browser window into two frames and run a perl script
> that will display data in each frame. Any ideas or hints???
>
> Thanks
>
> Ken
Have the first script just output an html file that points to two other
scripts as follows:
<frame
src="http://www.yourdomain.com/cgi-bin/script1.cgi?key1=value1&key2=value2">
<frame
src="http://www.yourdomain.com/cgi-bin/script2.cgi?key1=value1&key2=value2">
Hope this helps,
-joel shellman
TaoTree, Inc.
http://www.tou.com/
------------------------------
Date: 22 Jan 1998 00:25:26 -0700
From: Randal Schwartz <merlyn@stonehenge.com>
To: rjk@coos.dartmouth.edu
Subject: Re: space searching?
Message-Id: <8cyb09dl7d.fsf@gadget.cscaper.com>
>>>>> "Chipmunk" == Chipmunk <rjk@coos.dartmouth.edu> writes:
Chipmunk> Note that if you decide to go the regex route, as many
Chipmunk> people suggested in their replies, there is an important
Chipmunk> difference between:
Chipmunk> /\s\w+\@bcl\.com/
Chipmunk> and
Chipmunk> /\w+\@bcl\.com/
Chipmunk> The first will be be much faster, because it will not have
Chipmunk> to backtrack nearly as much.
But even then, both of them are *wrong*. \w+ is not the proper regex
for the left side of the @. It's much worse than that, since nearly
*any* character is allowed on the left side of the @, provided you
have the proper escaping. But a good replacement is just ".+", which
means you might as well not even look at all. :)
print "Just another Perl hacker," # but not what the media calls "hacker!" :-)
## legal fund: $20,990.69 collected, $186,159.85 spent; just 222 more days
## before I go to *prison* for 90 days; email fund@stonehenge.com for details
--
Name: Randal L. Schwartz / Stonehenge Consulting Services (503)777-0095
Keywords: Perl training, UNIX[tm] consulting, video production, skiing, flying
Email: <merlyn@stonehenge.com> Snail: (Call) PGP-Key: (finger merlyn@teleport.com)
Web: <A HREF="http://www.stonehenge.com/merlyn/">My Home Page!</A>
Quote: "I'm telling you, if I could have five lines in my .sig, I would!" -- me
------------------------------
Date: Wed, 21 Jan 1998 21:05:58 -0800
From: "Chris" <Ingo_Olejak@msn.com>
Subject: Timer measuring time between submit button pushes that determines web page you land at
Message-Id: <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
------------------------------
Date: 22 Jan 1998 04:55:23 GMT
From: Eli the Bearded <*@qz.to>
Subject: Re: Trouble with a regex
Message-Id: <qz$9801212344@qz.little-neck.ny.us>
Keywords: from just another new york perl hacker
Mike Hammernik <mhammer@execpc.com> wrote:
> I would like to obtain only the group of ip address that in the last
> field contain numbers from 01 to 30. expressions thatare like
> 192\.168\.*\.[01-39] of course match 139 as well as 39. In going through
> Mastering regex book and my perl books I have been unable to find a way
> to do this.
Since you have _MRE_ try studying that handy chart on page 115 and
think about the similarities between matching the day of a month and
a block from an IP address. Ask if you have problems understanding
that.
Elijah
------
finds REs for IP addresses to be tedious
------------------------------
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 1700
**************************************