[12180] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 5779 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue May 25 18:07:28 1999

Date: Tue, 25 May 99 15:00:24 -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, 25 May 1999     Volume: 8 Number: 5779

Today's topics:
    Re: $var =~ s/string/pattern/i does not work... (Larry Rosler)
    Re: $var =~ s/string/pattern/i does not work... (Tad McClellan)
    Re: Baffled by regexp behaviour (Kevin D. Clark)
    Re: Changing <STDIN> (David Walford)
    Re: Changing <STDIN> (Tad McClellan)
    Re: FAQ 9.2: Thanks Big Tom! <sstarre@my-dejanews.com>
        form2mail include page data <netpro@flashmail.net>
    Re: Help experts!!!: SEMAPHORE question <jdporter@min.net>
    Re: leeches, compilers, and perl, oh my (all mine?) <gbartels@xli.com>
    Re: leeches, compilers, and perl, oh my (all mine?) <tchrist@mox.perl.com>
    Re: leeches, compilers, and perl, oh my (all mine?) <tchrist@mox.perl.com>
    Re: leeches, compilers, and perl, oh my (all mine?) <gbartels@xli.com>
    Re: leeches, compilers, and perl, oh my (all mine?) (Tad McClellan)
    Re: leeches, compilers, and perl, oh my (all mine?) <gbartels@xli.com>
    Re: mySQL books available NOW?? <emschwar@rmi.net>
    Re: need an anti-leech script <tchrist@mox.perl.com>
        Need more optimization help tbsmith@deltacom.net
        Newbie needs help with search! <phanson@colorado.edu>
    Re: Newbie needs help with search! (Tad McClellan)
    Re: Open a textfile with a cgi-programm <jeromeo@atrieva.com>
        open(X, ">&Y") on Win32, and ::Process::Create <cdkaiser@delete.these.four.words.concentric.net>
        Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: Tue, 25 May 1999 13:09:19 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: $var =~ s/string/pattern/i does not work...
Message-Id: <MPG.11b4a34ff26a8110989af1@nntp.hpl.hp.com>

[Posted and a courtesy copy mailed.]

In article <7iem39$50n$1@nnrp1.deja.com> on Tue, 25 May 1999 17:19:41 
GMT, lpacania@my-dejanews.com <lpacania@my-dejanews.com> says...
> I'm trying to build a rule based substitution engine
> to clean up some flat files.
> 
> I've got my substitution patterns in a seperate file, I read that file
> as an input file.
> 
> $rule = <RULEFILE>;
> $line = <INFILE>;
> 
> while ($rule ne"") {
>        while ($line ne "");
>        $line =~ $rule; <------- this does not work...
>        print ($line);
>        print OUTFILE ($line);
>        $line = <INFILE>;
> }
> 
> I step through the debugger and PERL picks up the rule and the line
> fine but does not do anything with the $line =~ $rule.  I remember when
> I used to code in awk you had to enclose strings that were to be
> interpreted as commands some way.  Is this the same for perl?
> 
> RULEFILE CONTENTS: (1,000 rules)
> s/auto(?!motive)/automotive/i
> s/dlr/dealers/i

         $line =~ $rule; <------- this does not work...

because you are trying to execute Perl code read in as a string.  To do 
this, you must compile it using eval().  As this is very expensive, you 
don't want to do it in a loop on each line of the data file.  Nor do you 
want to read the data file more than once.

Here is a working program based on what you want to do (without your 
data files of course, but you should be able to generate and read them 
appropriately).

I added a way of preserving the case of the first letter (just in case 
:-).  I also added /g to your substitutions, because you probably want 
to do this on every occurrence on a line, rather than just the first 
occurrence.

Have the appropriate amount of fun!  I did.


#!usr/bin/perl -w
use strict;

my @rules = (
    q{s/(a)uto(?!motive)/$1utomotive/gi},
    q{s/(d)lr/$1ealers/gi},
);
@rules = map { eval "sub { $_ }" or die "'$_': $@\n" } @rules;

while (<DATA>) {
       for my $rule (@rules) { &$rule }
       print;
#       print OUTFILE;
}
__END__
No changes here
Change Auto to Automotive and DLR or dlr


Output:

No changes here
Change Automotive to Automotive and Dealers or dealers



-- 
(Just Another Larry) Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


------------------------------

Date: Tue, 25 May 1999 11:41:35 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: $var =~ s/string/pattern/i does not work...
Message-Id: <fbgei7.slk.ln@magna.metronet.com>

lpacania@my-dejanews.com wrote:

: I'm trying to build a rule based substitution engine
: to clean up some flat files.

: I've got my substitution patterns in a seperate file, I read that file
: as an input file.

: $rule = <RULEFILE>;
: $line = <INFILE>;

: while ($rule ne"") {


   I don't see where $rule got chomp()ed.

   Nor do I see where it is modified in the body of the while().

   This loop may run for a pretty long time...


:        while ($line ne "");


   Oh. At least you don't have to worry about it running for
   a long time, since it will not run at all.

   You have a syntax error there...


:        $line =~ $rule; <------- this does not work...


   Of course not. The code won't even compile...



: RULEFILE CONTENTS: (1,000 rules)
: s/auto(?!motive)/automotive/i
: s/dlr/dealers/i


   If it _did_ work, it would make this substitution for you:

      automatically   ==>  automotivematically

   Is that what you want?



   Post real code if you want real help.



--
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


------------------------------

Date: 25 May 1999 15:00:27 -0400
From: kclark@cabletron.com (Kevin D. Clark)
Subject: Re: Baffled by regexp behaviour
Message-Id: <k5pv3potys.fsf@cabletron.com>


simon@whitestar99.demon.co.uk writes:

> I have some text from a file which is slurped into string and I am
> trying to remove some lines off the end. Now I have got a solution but
> I am unsure as to why the first idea failed.
> 
> Take the following where I want to lose everything after and including
> the last occurence of 'SIMON':
> 
> $string = 'aaaaaaSIMONbbbbbbSIMONccccccc';
> $string =~ s/SIMON.*?$//;
> 
> After this $string is 'aaaaaa', not what I want so I have resorted to
> doing:

This expression works the way it does because of this rule:

   ``The [regular expression] Engine tries to match as far left in
     the string as it can...''

	- The Blue Camel book, page 60.

> $string =~ s/(.*)SIMON.*?$/$1/;
> 
> Which gives 'aaaaaaSIMONbbbbbb' which is what I want.

The reason why this works this way is because the "(.*)" in your
expression is "greedy".  First the regular expression engine tries to
match *all* of 'aaaaaaSIMONbbbbbbSIMONccccccc' to ".*".  Then the
engine realizes that there's more to your regular expression, so it
has to backtrack.  In this manner, the second "SIMON" in your sample
string is gotten to by the Engine before the first "SIMON".

> I can't understand why the first example didn't choose the 2nd of the
> two possible matches as then the '.*?' has matched as little as
> possible.

You might want to consider reading Jeff Friedl's _Mastering Regular
Expressions_ book.

This expression also would have done what you wanted:

   s/SIMON(?!.*SIMON).*//;

For information about this technique, read the fine manual
(perldoc perlre) and look for "zero width negative look-ahead
assertion".

Hope this helps,

--kevin
-- 
Kevin D. Clark (kclark@cabletron.com)          Give me a decent UNIX
Cabletron Systems, Inc.                      and I can move the world
Durham, N.H. (USA)


------------------------------

Date: 25 May 1999 21:05:16 GMT
From: davewal@echo.corp.sgi.com (David Walford)
Subject: Re: Changing <STDIN>
Message-Id: <7if3ac$37n$1@murrow.corp.sgi.com>

|> : For instance, after a script goes into a while
|> : loop, could I enter variables into it from over the network or from a
|> : webpage without re-executing the script?

Let me explain this better.  Here is an example.
(sorry for the web reference.)  
Open two browser windows.
One browser would execute a perl script that would enter into a while loop.
I would like the second browser window to be able to pass information to the
scipt that is caught in a while loop.
So, how can the second browser pass variables into the first browsers while
loop.

Thanks,
David



In article <7ieq7g$rs9$1@info2.uah.edu>, gbacon@itsc.uah.edu (Greg Bacon) writes:
|> Organization: The University of Alabama in Huntsville
|> Lines: 65
|> Message-ID: <7ieq7g$rs9$1@info2.uah.edu>
|> References: <7ieo20$se3$1@murrow.corp.sgi.com>
|> Reply-To: Greg Bacon <gbacon@cs.uah.edu>
|> NNTP-Posting-Host: ettsn.itsc.uah.edu
|> Mime-Version: 1.0
|> Content-Type: text/plain; charset=us-ascii
|> X-Trace: info2.uah.edu 927657008 28553 146.229.2.36 (25 May 1999 18:30:08 GMT)
|> X-Complaints-To: news@news.uah.edu
|> NNTP-Posting-Date: 25 May 1999 18:30:08 GMT
|> X-Newsreader: knews 1.0b.0
|> Xref: news.corp.sgi.com comp.lang.perl.misc:222668
|> 
|> In article <7ieo20$se3$1@murrow.corp.sgi.com>,
|> 	davewal@echo.corp.sgi.com (David Walford) writes:
|> : When executing a script from a unix shell a line like;
|> : chomp ($dir = <STDIN>);
|> : will suspend the script and allow me to enter variables into the
|> : script from the command line.
|> : 
|> : Could someone give me an example or point me in the right direction to
|> : redirect the <STDIN> to another input.
|> 
|> This is a function of your shell.  For example:
|> 
|>     [13:23] ettsn% cat try
|>     #! /usr/bin/perl -w
|> 
|>     use strict;
|> 
|>     my $input;
|>     while ( defined($input = <STDIN>) ) {
|>         chomp $input;
|> 
|>         print "I got: `$input'\n";
|>     }
|>     [13:23] ettsn% ./try <try
|>     I got: `#! /usr/bin/perl -w'
|>     I got: `'
|>     I got: `use strict;'
|>     I got: `'
|>     I got: `my $input;'
|>     I got: `while ( defined($input = <STDIN>) ) {'
|>     I got: `    chomp $input;'
|>     I got: `'
|>     I got: `    print "I got: `$input'\n";'
|>     I got: `}'
|> 
|> My shell happens to be tcsh.  Yours may be another.  Consult your
|> shell's documentation and look for redirection.
|> 
|> : For instance, after a script goes into a while
|> : loop, could I enter variables into it from over the network or from a
|> : webpage without re-executing the script?
|> 
|> Oh, sure:
|> 
|>     [13:23] ettsn% GET http://www.w3c.org/ | ./try
|>     I got: `<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"'
|>     I got: `   "http://www.w3.org/TR/REC-html40/loose.dtd">'
|>     I got: `<html>'
|>     I got: `<head>'
|>     I got: `<meta http-equiv="Content-Type" content="text/html;
|> charset=iso-8859-1">'
|>     I got: `<meta http-equiv="PICS-Label" content='(PICS-1.1   '
|>     I got: `"http://www.classify.org/safesurf/" l gen true for
|> "http://www.w3.org"     by'
|>     I got: `"philipd@w3.org" r (SS~~000 1 SS~~100 1))'>'
|>     I got: `<meta http-equiv="PICS-Label" content='(PICS-1.1   '
|>     I got: `"http://www.rsac.org/ratingsv01.html" l gen true comment   
|> "RSACi North'
|>     [...]
|> 
|> GET is part of the LWP distribution (available on the CPAN).
|> 
|> Hope this helps,
|> Greg
|> -- 
|> Because you can't just make shit up and expect the computer to magically
|> know what you mean, Retardo!
|>     -- mjd

-- 
--------------------------------------------------------------
 David M. Walford           | email: davewal@corp.sgi.com
 RealityCenter Tech. Engr.  | m/s: 06U-122 
 Silicon Graphics, Inc.     | voice: 650-933-6451 
 Corporate Briefing Center  | fax: 650-932-6451 


------------------------------

Date: Tue, 25 May 1999 12:33:48 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Changing <STDIN>
Message-Id: <cdjei7.6rk.ln@magna.metronet.com>

David Walford (davewal@echo.corp.sgi.com) wrote:

: One browser would execute a perl script 


   Perl runs on servers, not on browsers.


--
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


------------------------------

Date: Tue, 25 May 1999 21:36:08 GMT
From: S Starre <sstarre@my-dejanews.com>
Subject: Re: FAQ 9.2: Thanks Big Tom!
Message-Id: <7if548$h67$1@nnrp1.deja.com>



This POST was just the ticket for a frustrated perlgirl. Minnows is cool
but CARP ROCKS! It might not be a pretty name but it sure works..
Expecially after I beat my head on the keyboard all weekend trying to
get this critter to work.


Tom you are TOO COOL...

(you deserve a) HUG (for some values of HUG),
S

********************************



In article <37367b8e@cs.colorado.edu>,
  perlfaq-suggestions@perl.com (Tom and Gnat) wrote:
> (This excerpt from perlfaq9 - Networking
>     ($Revision: 1.25 $, $Date: 1999/04/14 03:46:19 $)
> part of the standard set of documentation included with every
> valid Perl distribution, like the one on your system.
> See also http://language.perl.com/newdocs/pod/perlfaq9.html
> if your negligent system adminstrator has been remiss in his duties.)
>
>   How can I get better error messages from a CGI program?
>
>     Use the CGI::Carp module. It replaces `warn' and `die', plus the
>     normal Carp modules `carp', `croak', and `confess' functions with
>     more verbose and safer versions. It still sends them to the normal
>     server error log.
>
>         use CGI::Carp;
>         warn "This is a complaint";
>         die "But this one is serious";
>
>     The following use of CGI::Carp also redirects errors to a file of
>     your choice, placed in a BEGIN block to catch compile-time
warnings
>     as well:
>
>         BEGIN {
>             use CGI::Carp qw(carpout);
>             open(LOG, ">>/var/local/cgi-logs/mycgi-log")
>                 or die "Unable to append to mycgi-log: $!\n";
>             carpout(*LOG);
>         }
>
>     You can even arrange for fatal errors to go back to the client
>     browser, which is nice for your own debugging, but might confuse
>     the end user.
>
>         use CGI::Carp qw(fatalsToBrowser);
>         die "Bad error here";
>
>     Even if the error happens before you get the HTTP header out, the
>     module will try to take care of this to avoid the dreaded server
>     500 errors. Normal warnings still go out to the server error log
>     (or wherever you've sent them with `carpout') with the application
>     name and date stamp prepended.
>
> --
> Emacs is a fine programming language, but I still prefer perl. -me
>


--== Sent via Deja.com http://www.deja.com/ ==--
---Share what you know. Learn what you don't.---


------------------------------

Date: Tue, 25 May 1999 16:15:34 -0400
From: "Les Mower" <netpro@flashmail.net>
Subject: form2mail include page data
Message-Id: <vpD23.1138$Rl3.43992@ord-read.news.verio.net>

I am a sorcerer's assistant when it comes to perl. I have a problem where I
need to modify a webpage that currently would include the following code
sample

<table BORDER="2" CELLPADDING="10" COLS="1" WIDTH="75%" BGCOLOR="#FFFFFF">
  <tr>
    <td><b><font COLOR="#3366FF">Vistana Resort </font><font
COLOR="#000000">$6200.00 </font><font
    COLOR="#FF0000">Original Price $12,800.00&nbsp;</font></b> <br>
    <a HREF="mailto:mailreciepient@aol.com"><img SRC="em8.gif" BORDER="0"
HEIGHT="50" WIDTH="50"></a>
    <b><font COLOR="#3366FF">RCI Gold Crown</font></b> <br>
    <b><font COLOR="#000000">Floating Prime Time &quot;Fountains&quot; 2
Bedroom 2 Bath, King
    Bed in Master Bedroom, 2 Beds in 2nd Bedroom, Queen Sofa-Sleeper, 7
Heated Pools with
    Kiddie Pools &amp; Hot Tub Spas, 15' Tornado Water Slide, 14 Tennis
Courts, Basketball
    Courts, Volleyball Sandlots, Shrffleboards, 2
Restaurants&nbsp;</font></b></td>
  </tr>
  <tr>
    <td><b><font COLOR="#3366FF">Vistana Resort </font><font
COLOR="#000000">$4700.00 </font><font
    COLOR="#FF0000">Original Price $9900.00&nbsp;</font></b> <br>
    <a HREF="mailto:mailreciepient@aol.com"><img SRC="em2.gif" BORDER="0"
HEIGHT="30" WIDTH="60"></a>
    <b><font COLOR="#3366FF">RCI Gold Crown&nbsp;</font></b> <br>
    <b><font COLOR="#000000">Week 11, &quot;Canadian Break&quot;, 2 Bedroom
2 Bath,Sleeps 6-8,
    King bed in Master, 2 beds in 2nd bedroom, Queen sofa-sleeper, Fully
equipped condo,
    Washer &amp; Dryer in unit, 7 Heated Adult Pools, &amp; Children Pools,
7 Whirlpool Spas,
    15' Tornado Water Slide</font></b></td>
  </tr>
</table>

The list goes on forever and the user adds/modifies the info through some
mechanism on AOL.

The problem is that they receive email from a prospective buyer with no
reference to the property. I would like to replace the mailto: with a .pl
and capture all the text from the href to the next </tr> as well as the
sender's info.

With many perl based form-mail products out there, I still can't find one th
at will allow this. I really don't want to move them from AOL (well not
really, they don't want to be moved) and would hate to completely redesign
the site.

Is there any way to capture the needed text?

Please help this foolish helper.

Thanks,
Les




------------------------------

Date: Tue, 25 May 1999 19:53:36 GMT
From: John Porter <jdporter@min.net>
Subject: Re: Help experts!!!: SEMAPHORE question
Message-Id: <7iev3u$c41$1@nnrp1.deja.com>

In article <374AEE15.7E94EC19@juno.com>,
  Bouty_Bouty@juno.com wrote:
> What is the correct combination for the semaphore option?:
> One process constantly runs and writes shared memory. It needs to lock
> the semaphore and then release it. It should always be able to control
> the semaphore state.
> The second process only reads and can only do so when the semaphore is
> not locked.
>
> No need to specify the whole command, just the semaphore option before
> and after will do... Thanks!!!

Please post the code you have so far, and point to the spot where
you're having problems.  JUST the code illustrating your problem
will be sufficient, not the whole bloody program.  Thanks.

--
John Porter
Put it on a plate, son.  You'll enjoy it more.


--== Sent via Deja.com http://www.deja.com/ ==--
---Share what you know. Learn what you don't.---


------------------------------

Date: Tue, 25 May 1999 15:03:35 -0400
From: Greg Bartels <gbartels@xli.com>
Subject: Re: leeches, compilers, and perl, oh my (all mine?)
Message-Id: <374AF407.4BC701F3@xli.com>

Eli the Bearded wrote:
> 
> In comp.lang.perl.misc, Greg Bartels  <gbartels@xli.com> wrote:
> > there's a thread on this group with the subject:
> > "need an anti-leech script"
> >
> > the gist of it being a guy has a website with
> > publicly accessible images, and other sites are
> > linking to his images, slowing down his server
> > as the other sites use his hardware.
> >
> >
> > There's another thread on this group with the subject:
> > "Perl compiler.. if or when"
> >
> > the gist of that was a guy who wanted to compile
> > his software as a means to protect his perl script.
> >
> >
> > Both threads have been going on for some time now,
> > and everyone is dancing around the same issue.
> > the issue is "how do I protect what is mine?"
> 
> Yes, but unless I skimmed the 'anti-leech' one too
> fast, the 'what is mine' thing there was bandwidth, while
> the other was intellectual property and one of those
> has a much higher per-unit cost than the other.
> 
> It is quite easy to restrict access to images to only
> people who have visited some previous page on a site
> first. I would argue that it is reasonable for the
> administrator of a web site to configure the server
> to serve things underwhat ever conditions the
> administrator wants. Similarlly I am free to not use
> said server if I do not agree to the conditions (eg,
> I have so far refused to register with the New York
> Times to see their online edition).
> 
> Elijah
> ------
> if you have some source of free bandwidth, please tell me


my bad. I never meant that someone should provide
free server bandwidth. I just never put that in my
first post.  my point wasn't so much about
solving either thread as much as it was about
identifying what both threads were wrangling with.

there are technical solutions for both, and that would
be the end of the story. 

one guy wanted a compiler: give him a compiler (soon available)
one guy wanted to stop other web sites from referencing his
images: filter the reqests so that external sites have to 
store their own copy of the images.

the thing that is keeping both threads going is the 
non-technical issues. i.e. whether or not people
should protect their code in the first place,
(via a compiler or other means)
and debates on whether a publicly available image
is publicly available via links or if it should
be copied first.

Greg


------------------------------

Date: 25 May 1999 14:53:49 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: leeches, compilers, and perl, oh my (all mine?)
Message-Id: <374b0ddd@cs.colorado.edu>

     [courtesy cc of this posting mailed to cited author]

In comp.lang.perl.misc, 
    Greg Bartels <gbartels@xli.com> writes:
:The advent of inexpensive and widespread
:computers and internet connections is bringing
:the notion of software copyright to an end.

Do you honestly believe this?  

As books find other media of expression in our post-literate
age, you don't see copyright disappaering.

Which reminds me: I cannot see what copyright has to with source hoarding.
You copyright a book, but you don't source hoard it.

Now, if you're talking about inventing a new N*loglogN sort algorithm,
that's something else.  Of course, these days you're allowed to 
patent natural laws, and even other people's genomes.  Scary.

--tom
-- 
"Hey, did you hear Stallman has replaced /vmunix with /vmunix.el?  Now
 he can finally have the whole O/S built-in to his editor like he always wanted.


------------------------------

Date: 25 May 1999 15:16:41 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: leeches, compilers, and perl, oh my (all mine?)
Message-Id: <374b1339@cs.colorado.edu>

     [courtesy cc of this posting mailed to cited author]

In comp.lang.perl.misc, Greg Bartels <gbartels@xli.com> writes:
:> Yes, but unless I skimmed the 'anti-leech' one too

It's funny.  To me, the person hiding things is the leech.

:one guy wanted a compiler: give him a compiler (soon available)

He has a compiler.  He wants a code generator.  Well, he
has one of those, too, but it's too bad he intends to 
use it to leech off the public knowledgebase.

--tom
-- 
"Software engineering phase plans are something you make so your manager
can explain to his manager how things are going" 
    --Rob Pike (On the subject of managerial "bullshit")


------------------------------

Date: Tue, 25 May 1999 16:29:59 -0400
From: Greg Bartels <gbartels@xli.com>
Subject: Re: leeches, compilers, and perl, oh my (all mine?)
Message-Id: <374B0847.AA8EB62B@xli.com>

Tom Christiansen wrote:
> 
>      [courtesy cc of this posting mailed to cited author]
> 
> In comp.lang.perl.misc,
>     Greg Bartels <gbartels@xli.com> writes:
> :The advent of inexpensive and widespread
> :computers and internet connections is bringing
> :the notion of software copyright to an end.
> 
> Do you honestly believe this?

yes, but let me reemphasize:
"the notion of ***software*** copyright to an end."
(asterisks added)
I dont think copyright laws will go away, nor do I want them to,
but the argument will become mute sometime within my lifetime.

at some point, Linux will become sophisticated enough that 
it will be the defacto standard. at which point, copyright
law or not, no company will make money trying to sell some
non-linux OS for desktop consumers.

the place left to make profit in software will be whatever
isnt covered by open source. as time progresses, and people
contribute more code to open-source, the profitability of 
software will become a smaller and smaller market share.

software companies will have to find other means to make
money, like buying cable companies, or new networks....
or developing specialty software such as real-time 
flight software for fly-by-wire aircraft, or something
equally obscure, that isn't likely to exist in open source
form.

> As books find other media of expression in our post-literate
> age, you don't see copyright disappaering.

again, I'm speaking specifically towards computer software.
and the laws may still exist, but the market share of 
for-profit software will shrink as it is replaced by
open-source.

and as far as books go, their copyright's eventually expire
at which point, it becomes, in effect, open-source. 
so Mel Gibson playing Hamlet is a literary 
example of code-reuse and open-source literature.
 
;)

> Which reminds me: I cannot see what copyright has to with source hoarding.
> You copyright a book, but you don't source hoard it.

If you do secure a copyright for some code, I believe that means you
can do whatever you wish to do with it. If you wish to hoard it, that's
your perogative. If you wish to compile it in an attempt to obfuscate
it, that's your choice. Whether its a good choice or not is mute. 
if you own it, you can do whatever you want with it.
most vendors have given up on making disks difficult to copy.
but I work in engineering where a lot of software tools are
shipped with dongles, license managers, and a bunch of other
enforcement methods.

> Now, if you're talking about inventing a new N*loglogN sort algorithm,
> that's something else.  Of course, these days you're allowed to
> patent natural laws, and even other people's genomes.  Scary.
> 
> --tom
> --
> "Hey, did you hear Stallman has replaced /vmunix with /vmunix.el?  Now
>  he can finally have the whole O/S built-in to his editor like he always wanted.


by my estimate, 2050 should see the end of all natural reserves
of oil on this planet, and open-source software will have
a majority share of the market. it should be a very intereting
year.

Greg


------------------------------

Date: Tue, 25 May 1999 12:07:13 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: leeches, compilers, and perl, oh my (all mine?)
Message-Id: <hrhei7.5pk.ln@magna.metronet.com>

Greg Bartels (gbartels@xli.com) wrote:

: if anyone can point me to a good website
: that answers the questions around open source,
: copyrights, proprietary software, intellectual
: property, etc, in a clear succinct manner,
: these threads could end, simply by referring
: to that URL.


   You might have better luck finding references about
   intellectual property rights in a newsgroup about
   intellectual property rights, such as:


      misc.int-property


--
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


------------------------------

Date: Tue, 25 May 1999 16:55:36 -0400
From: Greg Bartels <gbartels@xli.com>
Subject: Re: leeches, compilers, and perl, oh my (all mine?)
Message-Id: <374B0E48.7855C216@xli.com>

Tom Christiansen wrote:
> 
>      [courtesy cc of this posting mailed to cited author]
> 
> In comp.lang.perl.misc, Greg Bartels <gbartels@xli.com> writes:
> :> Yes, but unless I skimmed the 'anti-leech' one too

actually that quote was from someone replying to me, but oh well.

> It's funny.  To me, the person hiding things is the leech.
> 
> :one guy wanted a compiler: give him a compiler (soon available)
> 
> He has a compiler.  He wants a code generator.  Well, he
> has one of those, too, but it's too bad he intends to
> use it to leech off the public knowledgebase.
> 
> --tom
> --
> "Software engineering phase plans are something you make so your manager
> can explain to his manager how things are going"
>     --Rob Pike (On the subject of managerial "bullshit")

as long as open-source is protected under copyright (copyleft),
then no one can take away from the public knowledgebase.

they might use it for their own profit, but then again I use
perl, perl newgroups, and free help from perl hackers
to write code for my job for which I get paid. That doesn't
take anything away from the public knowledgebase.

so the guy wants to use a free tool so he can hoard his
source code, so what?  if his application is anything
useful, someone will eventually write an open-source 
version of it.

leech is a very charged word, by the way. 
we all take benifit from those who came before us.
is that leaching?
I say we all stand on the shoulders of giants.

Greg


------------------------------

Date: 25 May 1999 15:29:06 -0600
From: Eric The Read <emschwar@rmi.net>
Subject: Re: mySQL books available NOW??
Message-Id: <xkfzp2sg7od.fsf@valdemar.col.hp.com>

"Thom Lee" <hotister@hotmail.com> writes:
> Hi, after searching on the web and the local bookstore, I only found that
> O'Reilly will publish a mySQL book called:

<snip>

#!/usr/bin/perl -w
use strict;
use NewsfroupsList;

{ local $/ = undef; $_ = <>; }

if(!/perl/oisg) {
  my $betterFroup = $froupList[rand $#froupList];
  
  print "This is not a perl question.  Please don't post off-topic\n".
        "messages to c.l.p.m.  A better 'froup would be $betterFroup.\n";
}
__END__

Improvements welcome. :^)

-=Eric


------------------------------

Date: 25 May 1999 15:18:16 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: need an anti-leech script
Message-Id: <374b1398@cs.colorado.edu>

     [courtesy cc of this posting mailed to cited author]

In comp.lang.perl.misc, Jerome O'Neil <jeromeo@atrieva.com> writes:
:If one were to use, say, an image of a camel off of some publisher's web
:site, you wouldn't have a problem with that?

This is an unrelated issue.  Please don't strawman.

--tom
-- 
 "... the whole documentation is not unreasonably transportable in a
 student's briefcase." - John Lions describing UNIX 6th Edition


------------------------------

Date: Tue, 25 May 1999 21:21:32 GMT
From: tbsmith@deltacom.net
Subject: Need more optimization help
Message-Id: <7if48o$gcq$1@nnrp1.deja.com>

@info has lots of different numbers.
get_file just returns the file $f as a list.

for $f (@files) {
        print "Starting work on $f ... ";
        for (get_file($f)) {
                @info = unpack $pack, $_;
                push @{$avg_lat{$info[0]}},  ($info[9] + $info[11]) / 2;
                push @{$avg_long{$info[0]}}, ($info[10]+ $info[12]) / 2;
        }
        print "finished.\n";
}


What would make it go faster?



--
----------------
Todd Smith -japh
ITC^DeltaCom
tbsmith@deltacom.net


--== Sent via Deja.com http://www.deja.com/ ==--
---Share what you know. Learn what you don't.---


------------------------------

Date: Tue, 25 May 1999 13:00:54 -0600
From: Paul Hanson <phanson@colorado.edu>
Subject: Newbie needs help with search!
Message-Id: <374AF362.BF3B27B@colorado.edu>

Hi, everyone,
  I'm trying to learn Perl and gettin' an ass-whuppin' in the process.
*lol*  Here's what I've got written,
#!/usr/bin/perl
$pattern = shift(@ARGV);        #Extract first arg. into $pattern
while (<>){                               #Treat the rest of @ARGV as
filenames
        if(/$pattern/) {                   #If the pattern matches
        open(test, ">> foo")
                || die "Can't open foo.\n";
        print test;
        }
}
What I'm trying to get this little program to do is print the line which
matches $pattern, as well as the line directly below it, to the file
foo.  What I can't figure out is how to tell the computer to read the
line below the $pattern match.  I would really, really love some help.
Thanks a bunch.

Paul Hanson
phanson@colorado.edu



------------------------------

Date: Tue, 25 May 1999 12:22:13 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Newbie needs help with search!
Message-Id: <lniei7.5pk.ln@magna.metronet.com>

Paul Hanson (phanson@colorado.edu) wrote:

:   I'm trying to learn Perl and gettin' an ass-whuppin' in the process.

: #!/usr/bin/perl


   You deserve your burning fanny for not enabling warnings.

   You should enable warnings on *all* of your perl programs:

      #!/usr/bin/perl -w


: $pattern = shift(@ARGV);        #Extract first arg. into $pattern
: while (<>){                               #Treat the rest of @ARGV as
: filenames
:         if(/$pattern/) {                   #If the pattern matches
:         open(test, ">> foo")


   You should use UPPER CASE for filehandles.

   Your program will mysteriously stop working when the next
   version of Perl introduces a "test" keyword...

   perl would have mentioned this if you had asked it to
   (by enabling warnings).


:                 || die "Can't open foo.\n";

   if (defined $another_line = <>) {  # see if there is another line
:         print test;
         print TEST $another_line;
   }
   else {
       warn "there is no line following the matched line...\n";
   }


:         }
: }
: What I'm trying to get this little program to do is print the line which
: matches $pattern, as well as the line directly below it, to the file
: foo.  What I can't figure out is how to tell the computer to read the
: line below the $pattern match.  I would really, really love some help.



--
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


------------------------------

Date: Tue, 25 May 1999 13:12:29 -0700
From: Jerome O'Neil <jeromeo@atrieva.com>
Subject: Re: Open a textfile with a cgi-programm
Message-Id: <374B042D.1095908B@atrieva.com>

Larry Rosler wrote:

> > Because you aren't asking perl to tell you.  Check the $! variable for
> > the answer.
> 
> Yes.  And it will probably say "no such file or directory".

If that is the problem, what else would you have it say?

>  As has been
> posted several times this morning alone (!), there is no assurance that
> your concept of the current directory and the web server's concept of
> the current directory are the same.

You can rest assured that my concept of the current working directory
and my web server's concept of the current working directory are one and
the same.

>  It's imperative to use an absolute
> pathname, or to chdir to an absolutely-named directory and go relative
> from there.

Well, I'll sort-of-disagree with that for two reasons.  Technically, for
maximum portability,  absolute filenames aren't always the best
solution, although resolution to one is certainly desirable. 
Philosophically,  you have no idea what this particular programmer did
or did not do prior to his open attempt, as it was the only line of code
provided.  Any "You should do X" answer other than "Check the error
message" is pure speculation, and beyond the scope of the original
question.  

Regardless, "no such file or directory" is the proper error.  If a
programmer doesn't know what the current working directory is, or
doesn't understand relative and absolute file paths,  that is a
completely different problem.

-- 
Jerome O'Neil, Operations and Information Services
Atrieva Corporation, 600 University St., Ste. 911, Seattle, WA 98101
jeromeo@atrieva.com - Voice:206/749-2947 
The Atrieva Service: Safe and Easy Online Backup  http://www.atrieva.com


------------------------------

Date: 25 May 1999 13:08:50 PDT
From: Cameron Kaiser <cdkaiser@delete.these.four.words.concentric.net>
Subject: open(X, ">&Y") on Win32, and ::Process::Create
Message-Id: <7if00i$3a3@chronicle.concentric.net>

This code works in Win32 (yes, there is a reason why I'm not using Socket.pm,
warn, strict or my):

#!perl

$sockaddr = 'S n a4 x8';
$bindthis = pack($sockaddr, 2, 9704, pack('l', chr(0).chr(0).chr(0).chr(0)));
socket(S, 2, 1, 6);
setsockopt(S, 65535, 4, 1);
bind(S, $bindthis) || die("$0: while binding port 9704:\n\"$!\"\n");
listen(S, 1024);

for (;;) {
	$addr=accept(NS,S);
	select(NS); $|++;
	$rin = $win = $ein = 0;
	vec($rin, fileno(NS), 1) = 1;
	vec($win, fileno(NS), 1) = 1;
	$ein = $rin | $win;
	$q = select($rout=$rin, $wout=$win, $eout=$ein, undef);
	while(<NS>) {
		chomp;
		last if (/quit/i);
		print NS (reverse(split(//, $_)));
		print NS "\r\n";
	}
}

If I start this up, and telnet to 9704 on my Win32 box, I get

stockholm:/home/spectre/% telnet spectre 9704
Trying...
Connected to spectre.notyourproblem.net.
Escape character is '^]'.
yobaby
ybaboy
yo baby
ybab oy
quit
Connection closed.

This change, however, does not work:

for (;;) {
        $addr=accept(NS,S);
        select(NS); $|++;
        $rin = $win = $ein = 0;
        vec($rin, fileno(NS), 1) = 1;
        vec($win, fileno(NS), 1) = 1;
        $ein = $rin | $win;
        $q = select($rout=$rin, $wout=$win, $eout=$ein, undef);
        open(J, ">&NS"); select(J); $|++;
        open(K, "<&NS"); select(K); $|++;
        while(<K>) {
                chomp;
                last if (/quit/i);
                print J (reverse(split(//, $_)));
                print J "\r\n";
        }
        close(J); close(K);
}

but it works just dandy on Unix. What's the difference? Is there any way
to dup filehandles properly in Win32?

What I eventually intend to do is dup STDIN and STDOUT off NS and hand
then to a child process using Win32::Process::Create(), sort of like a
miniature inetd. However, not even that seems to work right, even with
1 for the inherit handles option.

Any ideas?

--
Cameron Kaiser * cdkaiser.cris@com * powered by eight bits * operating on faith
  -- supporting the Commodore 64/128:  http://www.armory.com/~spectre/cwi/ --
   head moderator comp.binaries.cbm * cbm special forces unit $ea31 (tincsf)
personal page http://calvin.ptloma.edu/~spectre/ * "when in doubt, take a pawn"


------------------------------

Date: 12 Dec 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Special: Digest Administrivia (Last modified: 12 Dec 98)
Message-Id: <null>


Administrivia:

Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing. 

]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body.  Majordomo will then send you instructions on how to confirm your
]subscription.  This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.

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 5779
**************************************

home help back first fref pref prev next nref lref last post