[8068] in Perl-Users-Digest

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

resending truncated digests issues 1680-1683

daemon@ATHENA.MIT.EDU (Perl-Users-Request@ruby.OCE.ORST.E)
Tue Jan 20 20:27:54 1998

Date: Tue, 20 Jan 98 17:11:54 -0800
From: Perl-Users-Request@ruby.OCE.ORST.EDU
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Tue, 20 Jan 1998     Volume: 8 Number: 1683

Today's topics:
        [Fwd: compiling perl 5.004 on solaris] <George.Mansoor@CSUN.Edu>
        A use question (Brandi Weed)
    Re: A use question <Jan@ChipNET.cz>
        automatically running a perl script <James@cydaps.nospam.co.uk>
        Differences between Unix Perl and Win32 Perl? fuck@off.com
        Dynamic web site using PERL - is this possible? <davesbox@poboxes.com>
    Re: handling <input type=image> (Kenneth A Graves)
    Re: I am still a virgin <sgordon@athena.lbl.gov>
    Re: I need some help pleeze (Clay Irving)
    Re: I need some help pleeze (Clay Irving)
    Re: IsDate and IsNumeric available? (Clay Irving)
    Re: IsDate and IsNumeric available? <trachier@crrel.usace.army.mil>
        Leaner and Meaner:  Is undump an answer? <garym@sympatico.ca>
    Re: living and free software (was: Re: source into bina (John Stanley)
    Re: Logical 'and' in regex? <mthurn@irnet.rest.tasc.com>
        Newbie socket problem, and Dial-Up <sherwin***no_spam***@saltspring.com>
        Running Perl as a Service <NPalmer@photographics.co.uk>
    Re: source into binary code (John Stanley)
    Re: source into binary code <jason@primal.ucdavis.edu>
    Re: What am I missing here? (Mark-Jason Dominus)
        Why warn? (WAS: Re: Critique My Code! (Please)) dg50@chrysler.com
        Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: Tue, 20 Jan 1998 10:46:41 -0800
From: George Mansoor <George.Mansoor@CSUN.Edu>
Subject: [Fwd: compiling perl 5.004 on solaris]
Message-Id: <34C4F110.C3C7C8F4@CSUN.Edu>



George Mansoor wrote:

> I'm trying to compile Perl 5.004 (04) on Solaris 2.4. When I try to make
> after configure I get:
>
> Updating makefile...
> Now you must run a make.
> $ make
> make: Warning: Both `makefile' and `Makefile' exist
> `sh  cflags libperl.a miniperlmain.o`  miniperlmain.c
>           CCCMD =  gcc -DPERL_CORE -c  -O
> `sh  cflags libperl.a perl.o`  perl.c
>           CCCMD =  gcc -DPERL_CORE -c  -O
> `sh  cflags libperl.a malloc.o`  malloc.c
>           CCCMD =  gcc -DPERL_CORE -c  -O
> `sh  cflags libperl.a gv.o`  gv.c
>           CCCMD =  gcc -DPERL_CORE -c  -O
> `sh  cflags libperl.a toke.o`  toke.c
>           CCCMD =  gcc -DPERL_CORE -c  -g
> gcc: Internal compiler error: program as got fatal signal 11
> *** Error code 1
> make: Fatal error: Command failed for target `toke.o'
>
> Any ideas?
>
> Thanks
>
> George





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

Date: Tue, 20 Jan 1998 18:16:31 GMT
From: brandi@wheel.dcn.davis.ca.us (Brandi Weed)
Subject: A use question
Message-Id: <34c4e9bd.7400101@news.cwnet.com>

How do I specify using a module when it is on a completely different
path from the Perl executable? In this case, the binary is
/usr/bin/perl but the library is /var/local/lib/perl5!

[I'm assuming I'm not allowed to berate the ISP's owners until they
see the error of their ways...]

--
Brandi Weed
brandi@wheel.dcn.davis.ca.us
http://www.dcn.davis.ca.us/~brandi/


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

Date: Tue, 20 Jan 1998 19:19:06 -0800
From: Jan Krynicky <Jan@ChipNET.cz>
Subject: Re: A use question
Message-Id: <34C5692A.42A9@ChipNET.cz>

Brandi Weed wrote:
> 
> How do I specify using a module when it is on a completely different
> path from the Perl executable? In this case, the binary is
> /usr/bin/perl but the library is /var/local/lib/perl5!
> 
> [I'm assuming I'm not allowed to berate the ISP's owners until they
> see the error of their ways...]
> 
> --
> Brandi Weed

#!/usr/bin/perl
use lib '/var/local/lib/perl5'; # add this directory to the list of
library
                                # directories (@INC)
use The::Module;

 ...

__END__

Jenda


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

Date: Tue, 20 Jan 1998 18:38:46 +0000
From: James <James@cydaps.nospam.co.uk>
Subject: automatically running a perl script
Message-Id: <laP$tHA28Ox0EwFK@cydaps.co.uk>


Hi,

I have a script that I need to get to automatically startup at 10.00am
GMT each day, everyday. Does anyone know how I can do this?

The script is running on a UNIX server with Perl5. Basically it is a
script that sends emails out to each registered user of the site each
day, but at the moment I cannot figure a way to automatically start the
script at 10.00am without any human involvement.

Thanks for any help!

James

Please remove nospam. if emailing direct.



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

Date: Tue, 20 Jan 98 17:34:05 GMT
From: fuck@off.com
Subject: Differences between Unix Perl and Win32 Perl?
Message-Id: <34c4e0c2.0@news.xtml.co.uk>


Hi Folks,

I wonder if anyone can help me with a small problem I seem to be having with a 
Win NT machine running Win32 Perl.

Previously I have been writting all my Perl scripts on a Unix box and the 
company I work for has just transfered over to Win NT (Wise move, Not!!) and 
all my scripts now either cease to work or enjoy difficulty in working.

Can anyone point me to a web page/book that has a list of the small 
differences between the two versions of Perl.

Yours banging my head against a NT server.
Mike Porter
mykp@zen.co.uk


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

Date: Tue, 20 Jan 1998 08:44:07 -0800
From: "InsideTheWeb" <davesbox@poboxes.com>
Subject: Dynamic web site using PERL - is this possible?
Message-Id: <34c4d4a7.0@concord>

Hi everyone,

I just completed most of a new web site for myself.
My first such attempt. It's at
http://www.detailsfree.com/

I now have some partners who want the same web site
for themselves, but with their own contact info of
course. I'm going to be making this site available
to any partner that joins me. So, I'm trying to figure
out how to save time.

I don't want to move the entire site into a new
directory for each new partner who wants one. I'd have
to reprogram all the links to do it that way. What
I'd like to do is create a new entry point for each
partner. This entry point would then determine what
is displayed on two other pages in the site, the
contact page and the request more info page.
http://www.detailsfree.com/autclub/contact.html
http://www.detailsfree.com/autclub/reqguide.html

The contact page would display name and address info
dynamically depending on where the browser entered
the site, and the page with the form on it would send
the data entered there to an email address that
changed depending on where the browser entered the
site.

I hope this isn't all to confusing. I'm thinking
that there must be some way to accomplis this with
PERL. I'm hoping that someone here could do it, or could
recommend someone who can.

Thanks for your time,

David

208.267.4064
ICQ 4019331





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

Date: 20 Jan 1998 18:15:54 GMT
From: kag@kag.citysource.com (Kenneth A Graves)
Subject: Re: handling <input type=image>
Message-Id: <slrn6c9qfb.a0.kag@kag.citysource.com>

On Mon, 19 Jan 1998 16:37:51 -0600, adam <none@nowhere.net> wrote:
>but, the input image returns a number as value. so i have to give each
>image a different name and check for the name. it seems like there must
>be an easier way to handle this. i have seen any examples of handling
>multiple <input type=image> anywhere on the net.

My code (which uses CGI.pm) is full of constructs like

if (param(name1) || param(name1.x)) {
	...
} elsif (param(name2) || param(name2.x)) {
	...
} else {
	...
}

So, yes, give each submit or image a separate name.  I use the
construction above so that I don't have to think about whether
a given form has standard submit buttons or GIF buttons. The
appearance of a form changes a lot more often than the functionality.
(I never care about where on the button the click occurred.)

Technically, I should probably use "defined param(name1.x)" so that
I correctly handle people clicking the extreme left edge of the button.

Beyond 2 or 3 buttons on a form, you might want to set up a for loop
that tests something like "name$i.x".

--kag


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

Date: Tue, 20 Jan 1998 10:06:51 -0800
From: Shawn Gordon <sgordon@athena.lbl.gov>
To: Jeff Matocha <jmatocha@cs.ua.edu>
Subject: Re: I am still a virgin
Message-Id: <34C4E7BB.2EE038B@athena.lbl.gov>

--deleted--
> You are expecting your browser to act like a shell (and execute the
> program); really, it is really more like a text viewer.  That's why you
> just get the text.  
--deleted--

Actually, I think it is simpler than that, the file is named 'test.pl',
and the server treats *.pl files as text file. As a result, Kati 
sees the text of the file.

Just rename test.pl to test.cgi and that should do it....

Shawn


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

Date: 20 Jan 1998 12:06:41 -0500
From: clay@panix.com (Clay Irving)
Subject: Re: I need some help pleeze
Message-Id: <6a2lj1$9fi@panix.com>

In <dwaring-1901982349130001@blv-lx103-ip24.nwnexus.net> dwaring@nwsr.com (David Waring) writes:

>Just wondering, what is the == doing when comparing two strings?  

It isn't comparing strings -- It's comparing numbers.

>In other words, why is  ($sex == "M") true when $sex = "F"?

($sex == "M") evaluates to true because "M" is non-zero. Maybe this 
illustrates the point:

  #!/usr/local/bin/perl5.00403
  
  while ($string = <DATA>) {
    chomp $string;
    if ($string) {
      print "$string is TRUE\n";
    } else {
      print "$string is FALSE\n";
    }
  }
  
  __DATA__
  A
  B
  C
  0
  
  1
  2

prints:

  A is TRUE
  B is TRUE
  C is TRUE
  0 is FALSE
   is FALSE
  1 is TRUE
  2 is TRUE

-- 
Clay Irving <clay@panix.com>                  I think, therefore I am. I think? 
http://www.panix.com/~clay/


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

Date: 20 Jan 1998 13:06:56 -0500
From: clay@panix.com (Clay Irving)
Subject: Re: I need some help pleeze
Message-Id: <6a2p40$fh3@panix.com>

In <6a2lj1$9fi@panix.com> clay@panix.com (Clay Irving) writes:

>In <dwaring-1901982349130001@blv-lx103-ip24.nwnexus.net> dwaring@nwsr.com (David Waring) writes:

>>Just wondering, what is the == doing when comparing two strings?  

>It isn't comparing strings -- It's comparing numbers.

>>In other words, why is  ($sex == "M") true when $sex = "F"?

>($sex == "M") evaluates to true because "M" is non-zero. Maybe this 
>illustrates the point:

Oops. I should have written: "M" is non-numeric.

>  #!/usr/local/bin/perl5.00403
>  
>  while ($string = <DATA>) {
>    chomp $string;
>    if ($string) {
>      print "$string is TRUE\n";
>    } else {
>      print "$string is FALSE\n";
>    }
>  }
>  
>  __DATA__
>  A
>  B
>  C
>  0
>  
>  1
>  2

>prints:

>  A is TRUE
>  B is TRUE
>  C is TRUE
>  0 is FALSE
>   is FALSE
>  1 is TRUE
>  2 is TRUE

This is what confused another reader:

  #!/usr/local/bin/perl5.00403 -w

  $x = "M" - 1;

  print "Result: $x\n";

The program prints:

  Argument "M" isn't numeric in subtract at ./foo2.pl line 3.
  Result: -1

If I was a bad boy and didn't have warnings turned on, it might look like
"M" was equivalent to 0.


-- 
Clay Irving <clay@panix.com>                  I think, therefore I am. I think? 
http://www.panix.com/~clay/


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

Date: 20 Jan 1998 12:58:08 -0500
From: clay@panix.com (Clay Irving)
Subject: Re: IsDate and IsNumeric available?
Message-Id: <6a2ojg$eiv@panix.com>

In <01bd25a9$cb60c760$e37599c3@peugeot> "Atta Chui" <A.Chui@orbis.co.uk> writes:

>I'm trying to parse some text files. One problem is to find out whether or
>not a sub-string is a valid date. Similarly whether or not a sub-string is
>a valid real number.

>IsNumeric:
>Maybe I can match a string with
>  /[+-]?[1-9]\d*(.\d*)?([Ee][+-]?\d*)?/
>but still I don't know if the number would not be out of range.

>IsDate:
>I can get
>  ($d, $m, $y) =~ m#\d+/\d+/\d+#
>and then test the range for each variable, looks tedious.

>If you have a better way to do it, or there are source codes available,
>please let me know.

[ sounds of trumpets in the background... ]

Perl Modules are your friend.

Try Date::Manip -- One of the nice functions it provides is ParseDate:

      $date=&ParseDate("today"); 
      $date=&ParseDate("1st thursday in June 1992"); 
      $date=&ParseDate("05/10/93"); 
      $date=&ParseDate("12:30 Dec 12th 1880"); 
      $date=&ParseDate("8:00pm december tenth"); 
      if (! $date) { 
            # Error in the date
      }

See: http://reference.perl.com/wrap.cgi?date-manip

-- 
Clay Irving <clay@panix.com>                  I think, therefore I am. I think? 
http://www.panix.com/~clay/


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

Date: 20 Jan 98 13:42:00 -0500
From: "Gary Trachier" <trachier@crrel.usace.army.mil>
Subject: Re: IsDate and IsNumeric available?
Message-Id: <B0EA5A30-D8918@144.3.128.40>

>Hi there,
>
>I'm trying to parse some text files. One problem is to find out whether or
>not a sub-string is a valid date. Similarly whether or not a sub-string is
>a valid real number.
>
>IsNumeric:
>Maybe I can match a string with
>  /[+-]?[1-9]\d*(.\d*)?([Ee][+-]?\d*)?/
>but still I don't know if the number would not be out of range.
>
>IsDate:
>I can get
>  ($d, $m, $y) =~ m#\d+/\d+/\d+#
>and then test the range for each variable, looks tedious.
>
>If you have a better way to do it, or there are source codes available,
>please let me know.
>
>Thanks.
>
>Atta Chui.
>A.Chui@orbis.co.uk
>
>
Here is how I solved the isNumeric problem.  Hope that it helps.
Regards,
-Gary

sub isNumeric {
    my      $lookAtThis = shift;
    local   $isNumeric::warnMsg = '';

#   print STDOUT "[isNumeric] parameter = \"$lookAtThis\"\n";
    
    $SIG {'__WARN__'} = sub {       # set up our own warnings handler
        $isNumeric::warnMsg = shift;
#       print STDOUT "Doing Warning.\n";
    };
    
    $lookAtThis += 0.0;             # try it in a numeric expression
    delete $SIG {'__WARN__'};       # restore the default warnings handler
    
    if ($isNumeric::warnMsg) {
#       print STDOUT "Fail\n";
        return (0);                 # failed, non-numeric;
    }
    else {
#       print STDOUT "Pass\n";
        return (1);                 # passed, is numeric
    }
}





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

Date: Tue, 20 Jan 1998 12:41:17 -0600
From: Gary Lawrence Murphy <garym@sympatico.ca>
To: garym@sympatico.ca
Subject: Leaner and Meaner:  Is undump an answer?
Message-Id: <885321448.385286147@dejanews.com>

The Perl FAQ 3.11 only mentions undump as being something in the
TeX distribution without really saying if it actually works with
Perl.

My problem is having an exceptionally busy webpage which is
generated by a perl-script; it's strangling the (Solaris) server.

Is undump of a Perl core file the answer?  Is there some other
way to effect this? (there is always some other way)  Is there
any way to have one instance of the perl interpreter handle
heavy simultaneous access?

For that matter, what is the multi-threaded status of Perl and
how/where would I find out more about it?

Gary Lawrence Murphy <garym@visitweb.com> --- http://visitweb.com/~garym/
TeleDynamics http://visitweb.com/teledynamics/ RR#1 Sauble Beach, Ont CAN
telecenter design  --  telework systems  --  intranet/extranet consulting
"You don't play what you know; you play what you hear." ----- Miles Davis

-------------------==== Posted via Deja News ====-----------------------
      http://www.dejanews.com/     Search, Read, Post to Usenet


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

Date: 20 Jan 1998 18:02:40 GMT
From: stanley@skyking.OCE.ORST.EDU (John Stanley)
Subject: Re: living and free software (was: Re: source into binary code)
Message-Id: <6a2os0$fm5$1@news.orst.edu>

In article <6a2g9c$koh$1@info.uah.edu>, Greg Bacon <gbacon@adtran.com> wrote:
>In article <6a19ht$cii$1@news.orst.edu>,
>	stanley@skyking.OCE.ORST.EDU (John Stanley) writes:
>: In article <6a0o44$20k$9@info.uah.edu>, Greg Bacon <gbacon@adtran.com> wrote:
>: >I don't have much use for useless software. :-)  
>: 
>: Neither do I. But I don't consider commercial software to be useless
>: just because I had to pay for it.
>
>Why do you refuse to argue sensibly?  I was referring to this statement
>you made:
>
>    ``With perl, if you give the source away, you give the ability to
>      use it away.''
>
>What need does software I can't use meet?

Why do YOU refuse to argue sensibly? The context of this discussion is
paying for code, which would give you the ability to use the code. Thus,
the only reason you claim you can't use the code is because you decided
not to pay for it. You called it useless just because YOU made the
choice that you wouldn't use it. 

>Any sensible person should be able to see two points in this thread:
>1) it's not possible to put food on the table if your only activity is
>giving things away, 

That is exactly what I have been saying, and that is what people, you
included, have been arguing with me about. Unless your sole goal is to
type characters, you have no reason to be arguing unless you have a
different viewpoint than mine. Why are you arguing something that has
been settled?

>and 2) no one is claiming the opposite--giving
>away software is a nice side effect.

Except people HAVE been claiming the opposite. You really ought to read
what has been written. You included such a claim. 

>: >MAKING A LIVING AND GIVING AWAY SOFTWARE ARE INDEPENDENT EVENTS--
>: 
>: Not when they are connected in the same sentence with the word "by".
>: That's a causal relationship. The events "make meatloaf" and "running
>: over cats" are usually independent, until you say "I make meatloaf by
>: running over cats and cooking them." Yes, the word "by" is important.
>
>That is a very rigid and dogmatic reading.  

That is simple english.

>You also missed that other
>important word ``while'' in Phoenix's post.

Sorry. The word 'while' introduced the independent event. "Making
meatloaf by running over cats" is still connected by the word "by" even
if I add "while juggling bowling balls."

>Have you read ``Why Software Should Be Free''?  Richard Stallman makes
>a great case.  Check it out at

Is this the same Richard Stallman who was given money to produce
software for free? Now, if you want to help people, tell them where they
can get Gnu-unix.

>There's a difference between copying software and copying something
>concrete like a calculator.

Yes, there is, but that doesn't make what I said wrong. 

>You're really reaching now, Stanley.  First, using your intentionally
>obfuscated end product, they can only benefit from what you've learned
>in that they're bound by the bugs present and the features that aren't
>present; they can't fix or improve upon your work.  

Now you are reaching. Suppose this end product is the code to run an
MRI. Are you REALLY SERIOUSLY claiming that the only benefit people get
from the use of my code is that they are stuck with bugs and can't
modify the code? Are you REALLY saying that there is NO benefit to them
from the ability to see damage to soft tissue? There is NO benefit to
anyone when a doctor can see where a tumor is in advance of cutting open
someone's head? 

Or maybe you just don't realize that there is software running the MRI.
And CAT scanner. And most laboratory equipment these days. Do you expect
source for all of those or they are useless?

>Second, I'm not
>proposing a Star Trek-esque economic model.  The ideal of free software
>is attainable and fits in our current economic model.

Of course it does. So does the idea of commercial software. I've already
said that I think free software is great. Why are you arguing something
that has already been settled?

>: 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

>Your straw man is burning, Stanley.

I guess when you can't argue the point, ignore it. No, you already said
that there is no benefit to anyone from MRI software that doesn't have
source provided with it.

>: >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%.
>
>I've never suggested shooting Bill Gates because of his proprietary
>software.  I count two burning strawmen.

Ok, so they aren't taken out an shot. They are certainly harmful to
society (your claim), so what DO you want done to them?

>Has anyone suggested intentionally starving oneself or one's family?

So someone chooses to write software for a living. Do you have a problem
with that? No? Good. So he needs to make money to feed his family. Any
problem there? No? Good. So he decides to sell the software he writes.
Any problem there? He learns from his first experience at selling Perl
software that once he makes the SOURCE available he can no longer charge
for the ability to use the software -- very few people will pay for
something they can get and use for free. So he decides to distribute his
work in a form that requires a license to use it. Do you have a problem
with people requiring a license to use code? But to distribute it this
way, for Perl, he needs to hide the source. Oops, seems to be a problem.
He must release his code for free or he is harming society.

>That would be preposterous!  

Of course it would be. Thanks for agreeing with me.

>Many can and do earn good money by selling
>the service of writing or modifying software.  

Of course they do. But they aren't writing cheap software, they are
writing software that is complicated enough and specialized enough that
people will pay a living wage to them while they do it. 

>They also happen to make that software freely available.  

Excuse me, but let's travel down memory lane. Yesterday I read an
article from someone who was arguing for free software based on his
experiences with programmers who joined cults. He claimed that the
current version of the code he was paying to have written for him was
"free software", even though the person who was writing it did not
"make it freely available" to anyone except himself. Did you forget
that he was paid to write it? Did you forget that he had already
written it for someone else, and was just modifying it for his new
customer, and the only reason it was made available to that customer
was because he paid for it? How many jobs would that fellow get if he
"gave it away free" to anyone who asks?  

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?

>Bingo!  Did I see a light bulb above your head?  It seems you're finally
>getting the point after three rounds.  That's the same model we've been
>describing all along.

No, it is not. Those people did not make a living by giving it away.
They made a living by working for Uncle Sam. It didn't cost them
anything to give it away to others also working on the same project.

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?

>: No Utopia exists when people are hungry. Somehow, equating the Internet
>: to Utopia lessens the value of Utopia, or inappropriately agrandizes
>: the Internet. 
>
>This remark leads me to believe that either you haven't been using the
>Internet for very long or that you haven't realized the full potential,
>perhaps both.

I have been around long enough that I am not taken in by the hyperbole
about the "Information Superhighway" and all the warm fuzzies of people
wandering the great museums of Italy via cyberspace. I'm sorry that the
AOL/IBM advertising hype has taken you in. The telephone system is not a
Utopia, and it has been around a lot longer. Oh, that's because AT&T and
Nortel and DCC don't hand out the source to the switches that process
the traffic for free, I bet. I bet the telephone system would be Utopia
if every user had a listing of all source, and they could all make
modifications to fix bugs...

>: Had an MRI recently? Used a modem? Those greedy software hoarders at
>: Hayes...
>
>There's a difference between copying software and making a copy of a
>modem.

Why do you refuse to argue sensibly? Or are you unaware that there is
SOFTWARE in a MODEM? When did Hayes offer you the source to this
software? Never? Gee, they must be "greedy software hoarders". The
programmers at Hayes wrote one piece of software and Hayes sells it
over and over and over again. You must hate them. How can you possibly
get any benefit from a modem when you don't have the software to
improve upon? How can you possibly benefit from a modem when you are
stuck with all the myriads of bugs that Hayes has in their code?




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

Date: 20 Jan 1998 12:51:03 -0500
From: Kingpin <mthurn@irnet.rest.tasc.com>
Subject: Re: Logical 'and' in regex?
Message-Id: <euu3azm3ug.fsf@irnet.rest.tasc.com>

Vladimir Alexiev <vladimir@cs.ualberta.ca> writes:
> >perl -wle 'print "Prime" if (1 x shift) !~ /^1?$|^(11+?)\1+$/'
>                                                        ^
> Can someone confirm that and explain why a version with no ? in the
> indicated position takes more user, but less system time?

  Run, do not walk, to your nearest bookstore and buy and read
"Mastering Regular Expressions" by Jeffrey Friedl, ISBN 1-56592-257-3. 

-- 
 - - Martin "Kingpin" Thurn                    mthurn@tasc.com
     Research Software Engineer           (703) 834-5000 x2926
     The Information Refinery              http://tir.tasc.com
     TASC, Inc.                            http://www.tasc.com

Bring them on! I prefer a straight fight to all this sneaking around. -- Han, Star Wars


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

Date: Tue, 20 Jan 1998 10:09:28 -0800
From: Sherwin <sherwin***no_spam***@saltspring.com>
Subject: Newbie socket problem, and Dial-Up
Message-Id: <34C4E858.53BA@saltspring.com>

I used the simple client server socket connection, for my program.
Which look like the following:

  ...
  $sockaddr = 'S n a4 x8';
  ($name,$aliases,$proto) = getprotobyname('tcp');
  ($name,$aliases,$port)  = getservbyname($port,'tcp')
     unless $port =~ /^\d+$/;;
  ....
  if (connect(S,$that)) 
    {print "connect ok\n";}
  else 
    {die $!;}
  select(S); $| = 1; select(STDOUT);

I didn't write it all down, because we all know it.

When I am on a network with a T1 or greater connection everything
works.  With dial-up 56K or lower the command
  
  (connect(S, $that))  doesn't work.  It doesn't connect at all!!
Can anyone help me on this!!  Oh, one other thing, I am working in
Windows 95 and NT, if that can explain it.

  Oh, the error I get is: 
    Unknown error: 0x0000247c at foo.pl line 80.

 Thanks,

   Sherwin
   sherwin***nospam***@saltspring.com


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

Date: 20 Jan 1998 17:28:30 GMT
From: "Nick Palmer" <NPalmer@photographics.co.uk>
Subject: Running Perl as a Service
Message-Id: <01bd25c9$06219400$47c809c0@nic>

Please can anyone offer some help.

I am currently writing a Perl Script to run as a service on windows NT 4.0.

The problem I am having is that I need to know what signal(s) are sent to
my script when the service is stopped, either by the OS, or manually from
the services applet in control panel.

If I receive such a signal I want to gracefully end the service by writing
important info. to disk before terminating the program.

I know you can do the following

---
$SIG{"INT"} = "clear_up"; # this will run routine &clear_up when an
interupt is received, i.e. CTRL-C. e.g...

sub clear_up
{
	print "I am now clearing up my program\n";
	............
	exit 0;
} # sub
---

but I'm not sure that an interupt is sent to the program. I know services
are sent the WIN32 TerminateProcess() API when they are stopped.

Please can someone help me deal with this.

Thanks

Nick





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

Date: 20 Jan 1998 18:18:08 GMT
From: stanley@skyking.OCE.ORST.EDU (John Stanley)
Subject: Re: source into binary code
Message-Id: <6a2pp0$luj$1@news.orst.edu>

In article <m390sbb42u.fsf@windlord.Stanford.EDU>,
Russ Allbery  <rra@stanford.edu> wrote:
>John Stanley <stanley@skyking.OCE.ORST.EDU> writes:
>
>> If you don't believe that what I suggested can be a factor, then explain
>> 1) creeping featuritis, which shows that "does more than foo" is
>> generally desirable,
>
>The fact that people buy things for a particular feature does not
>necessarily indicate that the feature is an improvement in the product,
>even from the perspective of those people.  There are mass psychology
>factors that enter the equation when things hit the marketing department
>that you have to take into account.

By default, if people buy a product because they want a feature, then
that feature is an improvement in the product from the perspective of
those people. Yes, the perspective can be shifted by advertising, but
that still results in them thinking it is an improvement from their
perspective. 

It may not be an improvement from someone else's perspective, and I did
not claim it was. I just gave a reason why SOMEONE might pay for
software that wasn't free instead of using something else that was.
Whether the reason stands up to the glaring light of reason is
irrelevant. I didn't expect we would enter a drawn out fistfight over
the validity of those reasons, because the validity doesn't matter --
for the reason you state. It's all from "their" perspective.

>> 2) Cygnus Software, which will sell you support for gcc -- which, if you
>> might notice, changes gcc not a whit
>
>I'm afraid this is not correct.  Cygnus feeds their mods back into the gcc
>development tree.

Hmmm. Then this makes the free gcc better, which 1) improves society
and 2) means there is still no difference between the code which people
pay for and that which they do not. Why get gcc from Cygnus when you can
get it for free?

>> Hmmmm. Maybe. Maybe not. But when I have a perl question, there is
>> nobody to call to say "what's the answer".
>
>Sure there is.  There are people who sell commercial Perl support.  

Oh my God! You mean they won't give me code for free, they will sell me
the answer I want? Don't tell Greg. He'll call them 'greedy code
hoarders' and think they have no altruism at all.

>Many
>of them post to this newsgroup.  With free software, the source of the
>software and the source of the support are simply divided.

Perl is a poor example of this, for this discussion. There are lots of
people who understand Perl. The example was Dan's and Betty's code, and
for that, there are many fewer people who could support it, especially
if it does some complicated "foo" that people would actually be willing
to pay for.



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

Date: Tue, 20 Jan 1998 10:43:33 -0800
From: Jason Christian <jason@primal.ucdavis.edu>
Subject: Re: source into binary code
Message-Id: <Pine.OSF.3.95.980120101020.31207H-100000@primal.ucdavis.edu>

On 20 Jan 1998, John Stanley wrote:

> In article <Pine.OSF.3.95.980119141329.24048A-100000@primal.ucdavis.edu>,
> Jason Christian  <jason@primal.ucdavis.edu> wrote:
> [almost entire article quoted, deleted]
> 
> >Bahamas on the royalties, and he wrote a lot of highly restrictive
> >language into the contract which essentially ensured that he (and only
> >he) could do anything with the source when he was finished.  
> 
> If you are trying to educate me about commercial software, then why in
> God's name did you agree to such terms in the first place? Why didn't
> you find someone else who would do what you wanted the way you wanted
> it?  Did someone hold a gun to your head?

(1) I am not trying to educate you about commercial software, I am
trying to educate you about (some|one) buyer(s) of software (services).
Why did I agree to such terms in the first place?  Because,
unsophisticated dolt that I am, I wasn't totally clued in to the costs
of proprietary contracts.  


> >that only our programmer used, so it was as impossible to upgrade as the
> >first program.  
> 
> My, two programmers who work for you run off and join cults. Hmmm.
> It must be something in the water, huh?
 
Probably the fluoride.  Actually, the second guy is still doing what he
was doing, making accounting systems for small businesses, albeit on more
current platforms.  In so doing, he has moved towards "free software,"
since others can now read and modify his code.

You may wish to adjust your humor filter, btw.


> >clients.  We pay him, quite well, for his time; the cost of our project
> 
> So he isn't making a living by giving away code, either. 
> 
> >I believe that our relationship is consistent with "free software."  We
> 
> You pay him quite well, and then say this is "free software". 

Aha!  We're not speaking the same language!  "Free software" means, to
me, that the code is available for reading and modifying.  It is free,
like, like...Joy Addams Lions (cue Tony Bennet...Born Free, as Free as
the Wind.  I wonder if the Free Lions used to eat Free Gnus?)

I don't understand "free software" to mean "lacking a price."


> >are not asking, nor receiving, "something for nothing," and our
> >programmer is not using us to create a package to sell for a zillion
> >dollars down the road.
> 
> Hmmm. Let's see. You said that it was costing less because he was
> adapting something he wrote for someone else. That means he was saving
> a LOT of cost of development and passing some of that on to you. That's
> called "profit". If it was alright for him to do that for you, and he
> actually DID it for you, why do you expect that there won't be someone
> else down the line that he adapts YOUR code for, etc. If he does this
> enough times, it will be "making a living". Maybe not a "zillion", but
> a living. But he isn't giving his code away for free, now is he?

Oh, I expect that he may make a living adapting that code.  Indeed, I
have given him leads of other people in the industry.  The way I see it,
if they pay him to adapt the software to their needs, he will likely
come up with a few new tricks that will work for us.  But as to thes
"YOUR code," etc., "MY" code is in files sitting on my machine, where I
can look at it and fix|screw it up.  


> 
> >There are two different ethoses (what the hell is the plural of ethos?)
> >here.  One is the ethos of the manufacturer of products, who wants to
> >crank out a zillion, err, widgets, and charge a price for those widgets.
> >That is an okay ethos, but need not apply to all transactions.  
> 
> Nor does the other need apply to all transactions. That is all I would
> like people to admit. 

My opinion is that there is a lot more opportunity to make a living as a
professional provider of software services than as a manufacturer of
geegaws, and that most of the people who think they will strike it rich
by writing some product for the mass market are deluding themselves.
But I Could Be Wrong.

> 
> >That's true.  But I will not employ you to develop software for me if
> >you won't let me fix the software after you go join a cult.  
> 
> You have that right. Please show me where I told you that you do not.
> But explain why you will employ Microsoft to write software for you
> when you have no such control?

Alas, compromises are necessary. (1)  Microsoft has its "O"S on the cheapo
hardware that we bought. (2) The programmer is working in a Windows
environment, and I value his expertise and approach to our problem.  I
think he could write a better system using a linux/X setup, but what he
is doing is acceptable, and at a reasonable price.



> >"Free Software" is really, I think, a statement of professionalism and
> >professional ethics, 
> 
> I note that your definition of "free software" is probably the same one
> where the only reason you have the software is because you paid someone
> for it, and thus it really isn't free.

No sir.  "freedom" relates to our ability to have the *code*, as opposed
to the functionality.  It does not relate to the necessity of paying for
services.  The software is free; the programmer's time certainly is not.

> 
> The differentiation you have made is really one between a
> "manufacturing" and a "service" model. It isn't a differentiation
> between "professional, ethical" and "non-professional unethical", and I
> resent the implication that the manufacturing model is necessarily
> unethical and unprofessional. There are lots of professionals who work
> in manufacturing just so you can buy those widgets, and they do it quite
> ethically.

You in the straw business, or what?  One of the things that characterizes
the professions is that they develop well-defined bodies of ethics,
which are necessary to govern the usually-personal relationships in their
service industries.  Although they also have some nastier sides, the
professional bodies, such as the AMA, ABA, AIAA (architects, I might
have the acronym wrong) establish various well-specified rules to
prevent abuses on either side of the professional relationship.  "Professional
ethics," usually formally spelled out and a condition for practice in
the industry, characterize the professions.

Such codes are not necessary in the widget industries.  I surmise that
this is because competition renders them unnecessary.  Shoddy products
eventually develop a bad reputation, and vanish.  

The lack of a formal ethical code in no way implies that subscribers to
the other ethos are unethical.  It is just another way of doing
business.




> Is software a "widget" or is it a service? It can be treated both ways.
> Both ways are ethical, both can be used by professionals. Shrink-wrapped
> commercial software follows the manufacturing model. The one-off stuff
> you are paying to have written, in addition to not being free, falls
> under the "service" model. 
> 
> >and can in a great many places serve both client and server.  
> 
> Show me where I said it cannot.

I believe I have described what most of us understand by "free
software."  If you agree that that is a functional business model, and
can understand why at least this *user* shies away from your obfuscated
code, then I have no argument with you.

> >The world is full of businesses large and small for which
> >the canned solutions offered by micro$oft just don't suffice; if you
> >want to serve us, you must follow the path of the professional, which is
> >a different occupation from the inventor of and manufacturer of geegaws
> >and toys.
> 
> I have absolutely no desire to serve you, if you demand that I give you
> what I produce for free or be called unethical for not giving it to you.

I never called you unethical, nor demanded that you not be paid for your
time.  But yes, give me the code after I have paid for your time, or go
away.  And yes, you should not accept attempts by me to restrict *your*
further use of the code.  

I think it *ought* to be considered unethical for a professional in the
software services industry to lock up code.  I do not believe that someone
with training and talent in program ought to be restricted to being a
Professional Software Engineer.  Physicians and attorneys are often
employed by businesses, or are entrepreneurs in their own businesses; so
long as they do not claim to be "practicing medicine" or "practicing
law," such activities are not unethical.

I would be delighted to take this discussion somewhere else. 
Comp.society.professional-ethics.bork.bork.bork?

---------------------------------------------------------------------------
Jason Christian                          University of California, Davis 
jason@primal.ucdavis.edu                  Agricultural and Resource Economics
Office:(530)752-1357 FAX:(530)752-5614   Davis, CA 95616



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

Date: 20 Jan 1998 13:09:31 -0500
From: mjd@op.net (Mark-Jason Dominus)
Subject: Re: What am I missing here?
Message-Id: <6a2p8r$dfs$1@monet.op.net>
Keywords: accost career hill loophole


In article <34c4d176.1184064@news.cwnet.com>,
Brandi Weed <brandi@wheel.dcn.davis.ca.us> wrote:
>
>	$missing = 1 if (not param('name'));

This calls the function `param' with argument `name'.  Is that what
you meant?  I bet it's not; I suspect you wanted to 
look in the hash variable %param, which would look like this:

	$missing = 1 if not $param{'name'};

Personally, I would prefer

sub all_needed_fields {
  my @required = qw(name address city state zipcode email);
  for (@required) {
    return 0 unless defined $param{$_};
  }
  return 1;
}


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

Date: Tue, 20 Jan 1998 11:11:07 -0600
From: dg50@chrysler.com
Subject: Why warn? (WAS: Re: Critique My Code! (Please))
Message-Id: <885315855.97255428@dejanews.com>

In article <69m4e9$jp2$1@news.fm.intel.com>,
  tfletche@pcocd2.intel.com (Terry Michael Fletcher - PCD ~) wrote:
>
> dg50@chrysler.com so eloquently and verbosely pontificated:
> > Here's a little (heh - it got a little bloated) utility I wrote to strip
> > those annoying ^M characters from the ends of files imported from MS/DOG
> > or WinDoze.

(yes, this can be done with a one-liner if one is familiar with RegExen,
and yes, this same task can be done via an FTP filter. But sometimes, one
has users that want a simple-to-use solution, no a programatically
elegant one...)

> > What I'd like though, is some constructive de-construction of my code.

[code snipped]

> as long as you are printing to STDERR, and using newlines at the end of your
> strings, you might as well look up what "warn" does (see 'perlfunc' for
> that).

OK, I did so.

>From where I sit,

"warn "foo\n";

is functionally equivelent to:

"print STDERR "foo\n";

So why use the former over the latter?

DG

-------------------==== Posted via Deja News ====-----------------------
      http://www.dejanews.com/     Search, Read, Post to Usenet


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

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

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