[24215] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 6407 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Apr 15 18:05:57 2004

Date: Thu, 15 Apr 2004 15:05:10 -0700 (PDT)
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, 15 Apr 2004     Volume: 10 Number: 6407

Today's topics:
        A serious question about cgi (intermediate-newbie) <robin @ infusedlight.net>
    Re: A serious question about cgi (intermediate-newbie) <vetro@online.no>
    Re: Changing from C thought to Perl <vetro@online.no>
        Checking whether a socket has been closed by the peer <jlell@jakoblell.de>
    Re: Earthquake and tornado data evaluation Perl program <bik.mido@tiscalinet.it>
        Handling international characters in filenames on Win32 <stephanebourdeaud@hotmail.com>
        Hey, Corporate America! Show Taxpayers Some Appreciatio morris@votenader.org
    Re: Many filename arguments: EOF in "while(@slurp=<>){. <Joe.Smith@inwap.com>
    Re: One question <edgrsprj@ix.netcom.com>
    Re: One question <spamtrap@dot-app.org>
    Re: One question <spamtrap@dot-app.org>
    Re: One question <edgrsprj@ix.netcom.com>
    Re: One question <tadmc@augustmail.com>
    Re: One question <edgrsprj@ix.netcom.com>
        Perl Script Not Running From Crontab. (Matt Cluver)
    Re: question about substr <remorse@partners.org>
    Re: question about substr <bmb@ginger.libs.uga.edu>
    Re: question about substr ctcgag@hotmail.com
    Re: question about substr <tadmc@augustmail.com>
    Re: searching a structured text data base ctcgag@hotmail.com
        setting system wide value for SYSTEM_FD_MAX <shah@typhoon.xnet.com>
    Re: Two mini-golfish problems <xxala_qumsiehxx@xxyahooxx.com>
    Re: WebExplorer as Perl-CGI <Joe.Smith@inwap.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Thu, 15 Apr 2004 13:54:23 -0700
From: "Robin" <robin @ infusedlight.net>
Subject: A serious question about cgi (intermediate-newbie)
Message-Id: <c5mtvq$sb7$1@reader2.nmix.net>

I'm beginng to understand cgi.pm....and I'm wondering if there's any way to
deny a client side user their privelege to submit a form over and over again
by clicking back on their browser and submitting it again or clicking the
button to submit the form before the page with the form goes on to the next
page...do I have to log ips or something?

Thanks in advance.


--
Regards,
-Robin
--
robin @ infusedlight.net






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

Date: Thu, 15 Apr 2004 23:14:37 +0200
From: Vetle Roeim <vetro@online.no>
Subject: Re: A serious question about cgi (intermediate-newbie)
Message-Id: <m33c75ndtu.fsf@quimby.dirtyhack.org>

* robin @ infusedlight.net
> I'm beginng to understand cgi.pm....and I'm wondering if there's any
> way to deny a client side user their privelege to submit a form over
> and over again by clicking back on their browser and submitting it
> again or clicking the button to submit the form before the page with
> the form goes on to the next page...do I have to log ips or
> something?

  You can generate a "ticket" that can only be used
  once. I.e. generate a ticket when the form is accessed, and check
  that the ticket is valid in the Perl code that recieves the form
  data when the user clicks the submit button.

[...]
-- 
#!/usr/bin/vr


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

Date: Thu, 15 Apr 2004 22:50:24 +0200
From: Vetle Roeim <vetro@online.no>
Subject: Re: Changing from C thought to Perl
Message-Id: <m3r7upney7.fsf@quimby.dirtyhack.org>

* Rob Perkins
> Vetle Roeim <vetro@online.no> wrote:
>
>>* Rob Perkins
>>>
>>> Someone who doesn't know Perl, but knows programming, ought to be able
>>> to read the code, much the same way as a well-read German speaker can
>>> make out the gist of Dutch when he reads it. 
>>
>>  Why? Is the same true for languages like Common Lisp? For an
>>  example: if I know C++, should I be able to read CL code? :)
>
> Name six useful products written for a non-programming end user, in
> Common Lisp. 

  You got me there, but that's not necessarily because there aren't
  any products like that, but rather because I don't know they're
  written in CL. Also; there are a lot of products out there that I
  don't know about.


>>  If a programmer knows C and C++, he may be able to understand _some_
>>  Perl code, but not everything. He would understand even less Common
>>  Lisp.
>>
>>  Errr... I think I have a point.
>
> Well *my* point is that since Perl can be organized in such a way that
> a C, Pascal, Java, or BASIC programmer could easily see the algorithm,
> people who share code ought to program for readability. That's "why".

  You use "readability" wrong here... Perl code may be readable even
  if C or Java coders can't read it. *However*; if you have to share
  your code with programmers like that, you should by all means
  program so that they can read it.


-- 
#!/usr/bin/vr


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

Date: Thu, 15 Apr 2004 21:44:47 +0200
From: Jakob Lell <jlell@jakoblell.de>
Subject: Checking whether a socket has been closed by the peer
Message-Id: <pan.2004.04.15.19.44.47.191471@jakoblell.de>

Hello,
how can I check whether the client has closed an IO::Socket::INET?
According to the description, the connected-Method of IO::Socket should
return undef if the socket isn't connected. However, this doesn't work
when the peer has closed the connection. When you run the script below
and connect to port 1234 from another terminal using netcat or telnet and
then close the connection, the script will continue to write "connected\n"
to STDOUT every second.

use IO::Socket;
my $sock=IO::Socket::INET->new(LocalPort=>1234,Listen=>5,ReuseAddr=>1)||die $!;
while(my $client=$sock->accept()){
    next unless defined($client);
    $client->blocking(0);
    while(defined $client->connected){
        print "connected\n";
        sleep(1);
    }
}

Is there any way to check whether the connection has been closed by the
peer? I've already tried eof and the has_exception method from
IO::Select, but neither solved my problem. I know I could try to read
anything from the socket but as I'm using nonblocking IO, this is no
solution for the problem.

I'm using Linux 2.6.5 and Perl 5.8.3.

Regards
  Jakob


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

Date: Thu, 15 Apr 2004 23:35:17 +0200
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: Earthquake and tornado data evaluation Perl program  Apr. 14, 2004
Message-Id: <5gat70p8ssbq5u8ugm2c44dmll2aqk1i1o@4ax.com>

On Wed, 14 Apr 2004 19:55:23 -0500, Tad McClellan
<tadmc@augustmail.com> wrote:

>None of these semicolons do anything, so they should not be there:
>
>   for $npr(1..length($outputchoice)){;
>
>   if ($sopc eq 'o'){$num = $dbsortlon[$num1]};
                                               ^

FWIW *that* semicolon should be there IMHO; i.e. I generally find it
more stylistically correct to put the semicolon after blocks that fit
on one line, even if it wouldn't be necessary.

OTOH I wrote "generally" because in some cases indeed I prefer to
avoid it:

  BEGIN { do_something }

But then as far as the OP's code above is concerned, of course I'd
write

  $num=$dbsortlon[$num1] if $sopc eq 'o';


Michele
-- 
you'll see that it shouldn't be so. AND, the writting as usuall is
fantastic incompetent. To illustrate, i quote:
- Xah Lee trolling on clpmisc,
  "perl bug File::Basename and Perl's nature"


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

Date: Thu, 15 Apr 2004 23:00:05 +0200
From: "Stéphane Bourdeaud" <stephanebourdeaud@hotmail.com>
Subject: Handling international characters in filenames on Win32
Message-Id: <c5mt4r$tfc$1@news-reader3.wanadoo.fr>

Hi,

I am struggling with handling accented characters in Win32 long filenames
correctly in Perl.

If I try to get a recursive list of directories in a given path by doing
something like this:

my @list = `dir /a:d /b /s $path`;

Where $path is a user specified path (and yes, the path does exist, yes I
chomp @list before using it, and yes this does work when there are no
international characters in the sub directories names).

If I then look at the values stored in @list or try to use them, if they do
contain an international character (such as an accented vowel), then the
call fails because the path can't be found (even though it does exist).

Any ideas on how I could get Perl to store the path names correctly in that
array?

Any help would be appreciated.

Cheers,

S. Bourdeaud




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

Date: Thu, 15 Apr 2004 21:22:43 GMT
From: morris@votenader.org
Subject: Hey, Corporate America! Show Taxpayers Some Appreciation!
Message-Id: <b4ab4369.6624a646@host-69-48-73-244.roc.choiceone.net>

Hey, Corporate America! Show Taxpayers Some Appreciation!
By Ralph Nader 

If you work for a corporation, ask your own employer to support
Taxpayer Appreciation Day. (We?ve included contact information at the
end of the article.)

Take Action Now! April 15 is just around the corner. Please let us know
what action you?ve taken and what type of response you receive at
taxday@votenader.org

I'm going to go out on a limb here and suggest that April 15th of each
year be designated Taxpayer Appreciation Day, a day when corporations
receiving taxpayer subsidies, bailouts, and other forms of corporate
welfare can express their thanks to the citizens who provide them. 

Though it may not be evident, quite a few industries -- and the profits
they generate -- can be traced back to taxpayer-financed programs whose
fruits have been given away to (mostly) larger businesses. 

Taxpayer dollars have often funded discoveries made by NASA, the
Department of Defense, and the National Institutes of Health and other
federal agencies. In many instances the rights to those discoveries were
later given away to companies that brag about them as though they were
the fruits of their own investments. Taxpayer dollars have played a
major role in the growth of the aviation and aerospace, biotechnology,
pharmaceutical, and telecommunications industries -- to name only a few.

Though corporate America insists it must file yearly income taxes just
like everyone else, it is responsible for a sharply decreasing portion
of federal tax dollars -- despite record profits. Despite record
profits, corporate tax contributions to the federal budget have been
steadily declining for fifty years and now stand at a mere 7.4% of the
federal government income because of the loopholes they driven into our
tax laws. The average citizen pays more than four to five times that in
federal income tax revenues (with the single exception of payroll
taxes). 

Clearly corporations that believe they are self-reliant are often, in
fact, dependent on taxpayer funds to maintain their financial viability.
The least they could do is thank us. Which is why we need something like
Taxpayer Appreciation Day. Consider the following: 

General Electric bought RCA (which owned NBC) in the mid-1980s with
funds it was able to save by using an outrageous tax loophole passed by
Congress in 1981. That loophole allowed GE to pay no federal taxes on
three years of profits, totaling more than $6 billion dollars. It also
gave them a $125 million refund! That gave GE the money to buy RCA. GE
should arrange a media extravaganzas on NBC to say "Thank you,
taxpayers.? Pharmaceutical companies constantly ballyhoo their
discoveries in advertisements. What they don't tell us is that many of
the important nonredundant therapeutic drugs -- including most
anticancer drugs -- were developed, in whole or in part, with taxpayer
money and then given to them by the NIH and the Defense Department.
Bristol-Meyers Squibb, for example, controls the rights to Taxol, an
anticancer drug developed all the way through human clinical trials at
the National Institutes of Health with $31 million of taxpayer moneys. 

Pharmaceutical companies spend billions on advertisements each year.
Perhaps they should consider a big "Thank You, Taxpayers" ad campaign
every April 15, if only to remind them where their drug research and
development subsidies come from. 

Mining companies often receive vast sweetheart deals from taxpayers.
Under the 1872 Mining Act hard rock mining companies are allowed to
purchase mining rights to public land for only $5 an acre, no matter how
valuable the minerals on (or in) that land might be. A Canadian company
recently mined $9 billion in gold on federal land in Nevada after using
the Mining Act to purchase the mining rights to it for about $30,000.
Mining companies owe the taxpayers their gratitude. 

Television broadcasters were given free license to use public airwaves
(worth around $70 billion) by a supine Congress in 1997. They too should
thank us. What about all those professional sports corporations that
play and profit in taxpayer-funded stadiums and arenas? The owners and
players should thank the fans/taxpayers who -- in spite of their largess
-- still must pay through the nose for tickets. For years McDonalds
received taxpayer subsidies to promote its products overseas as part of
a foreign market access program. Now McDonalds is a ubiquitous brand
name worldwide, but has it ever thanked the taxpayers who underwrote its
efforts? Then there are the HMOs, hospitals, and defense contractors
that have had their legal fees reimbursed by the taxpayers when our
government prosecutes them for fraud or cost overruns. Those companies
have great public relations firms that can help them show us their
gratitude. Corporate America has taken too much from us for too long.
It's time it shows us a little bit of appreciation. 

Corporate Contacts: 

General Electric (NBC): 
   David Frail 
   Financial Communications 
   1--203-373-3387 
   david.frail@corporate.ge.com 

Bristol-Meyers Squibb: 
   Peter R. Dolan, CEO 
   345 Park Avenue 
   New York, New York, USA 10154-0037 
   1-212-546-4000 
   peter.dolan@bms.com 

Viacom (CBS, MTV, Nickelodeon, VH1, BET, Paramount Pictures, Viacom Outdoor, Infinity, UPN, Spike TV, TV Land, CMT: Country Music Television, Comedy Central, Showtime, Blockbuster, and Simon & Schuster): 
   Sumner M. Redstone , Chairman and CEO 
   1515 Broadway 
   New York, NY 10036 
   1-212-258-6000 
   (refused to provide email addresses) 

Walt Disney Co. (ABC):
   David Eisner, CEO 
   500 S. Buena Vista Street 
   Burbank, CA 91521 ABC, Inc. 
   1-818-460-7477 
   netaudr@abc.com 

McDonalds USA: 
   Jim Cantalupo, Chairman and CEO 
   McDonald?s Plaza 
   Oak Brook, IL 60523 
   1-800-244-6227 
   Email on-line form. 

Halliburton (Kellogg Brown & Root):
   David J. Lesar, Chairman, President & CEO 
   5 Houston Center 
   1401 McKinney, Suite 2400 
   Houston, TX 77010 
   1-713-759-2600 
   communityrelations@halliburton.com 

In addition to these, pursue your favorite and let us know what they say! 

--
Brotherhood and Hamas.

Abdeen Jabara also works closely with another IFCO project called the
Coalition Against the "Counter Terror" Act. He distributes its flyers and
has appeared in a video for the group, which may be purchased for $15 a
copy - from IFCO.

Apparently someone is buying. According to a New York Post report, "the most
recent IRS records available for IFCO, from the year 2000, show that the
foundation took in $1,119,564 in contributions. A Not In Our Name statement
report that they have taken in more than $400,000 in recent months for the
purpose of publishing their statement."

NION and Narco-terrorism

As disturbing as NION's relationships with IFCO and Muslim organizations
are, just as disturbing is its relationship to the Revolutionary Communist
Party (RCP). Not In Our Name's administration cadre comes from the
Revolutionary Communist Party (RCP), through such luminaries as C. Clark
Kissinger and Mary Lou Greenberg, both of whom are Directors of NION and
members of the Revolutionary Communist Part




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

Date: Thu, 15 Apr 2004 20:55:49 GMT
From: Joe Smith <Joe.Smith@inwap.com>
Subject: Re: Many filename arguments: EOF in "while(@slurp=<>){..}"?
Message-Id: <pFCfc.47488$rg5.96896@attbi_s52>

Fred Ma wrote:

> I extrapolated based on what I saw in perldoc perlintro:
> 
>    |   You can read from an open filehandle using the <> operator. In
>    |   scalar context it reads a single line from the filehandle, and
>    |   in list context it reads the whole file in, assigning each line
>    |   to an element of the list: 
>    |
>    |       my $line  = <INFILE>;
>    |       my @lines = <INFILE>;  
>    |
>    |   Reading in the whole file at one time is called slurping. It
>    |   can be useful but it may be a memory hog.

The things to remember are:
   After {my $line = <INFILE>} returns anything, the file handle is
   still open.  It stays that way until eof, when it returns undef.
   Using this syntax in a while() loop is the usual practice.

   After {my @lines = <INFILE>}, the entire file has been read
   all the way to eof.  It is not wise to attempt to read any more.

   <> is magic.  It reads all the files whose names are in @ARGV,
   all the way to eof on all of them.  (A "-" in $ARGV[0] or an
   empty @ARGV means to read from STDIN.)

Therefore: Putting a slurp from <> in a while statement is not
what you want to do.  It's going to return undef the second time
around and STDIN on the third.

Do not slurp when using "perl -pi.bak".
	-Joe


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

Date: Thu, 15 Apr 2004 18:25:22 GMT
From: "edgrsprj" <edgrsprj@ix.netcom.com>
Subject: Re: One question
Message-Id: <msAfc.7709$l75.2036@newsread2.news.atl.earthlink.net>

"Jim Gibson" <jgibson@mail.arc.nasa.gov> wrote in message
news:150420040937523216%jgibson@mail.arc.nasa.gov...

Thanks much.

NASA?  I'm impressed.  Last January I contacted one of your groups working
at the following Web site and tried to get them involved with this effort.

http://www-aig.jpl.nasa.gov/public/dus/quakesim/

But I never heard from anyone.  My letter was also sent to the head of NASA
and the U.S. Presidential Science Advisor.  Again, no responses.

I believe that the Nexrad weather people would like to know about the
program.  But I have not had time to respond to one of their notes about it
which was posted to another Newsgroup.

>Here is what I get on my Mac running Mac OS 10.2.8 and perl 5.8.2:

>Jim 64% perl -c ETDPROG.pl
>ETDPROG.pl syntax OK

So, your version of Perl said the Perl commands in the program were Ok.  And
the file itself was readable.  That is nice to hear.

>Assigning values to the initial program variables
>Loading the earthquake and warning signal database file
>Loading the test data file

The fact that it got this far means that it read the earthquake database
file Ok.  So it will read data from text files.  Again, nice to hear.

>Extracting data from the earthquake and warning signal data file

That statement means that it did the fairly complex data processing on that
file Ok.

>Extracting datalines from the testdata file
>program error

I had to look at the program to determine what that means.

I have an error trap in there which tells it to count the number of array
lines it is checking.  If that number exceeds 1000 it ends the program.  The
testdata.txt file should never contain more than 100 lines of text.

The program was looking for the following line in the testdata.txt file:

***** END OF THE CONTROL SETTINGS SECTION *****

It did not find it probably because the line length is apparently different
for the Mac.  I will make a change in the program to compensate for that and
another error you would have eventually encountered.  Originally I had the
program set so that it could not make that error.  But changes get made etc.
etc.




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

Date: Thu, 15 Apr 2004 15:04:20 -0400
From: Sherm Pendley <spamtrap@dot-app.org>
Subject: Re: One question
Message-Id: <IqmdnUzStMs-QePdRVn_iw@adelphia.com>

edgrsprj wrote:

> Yes, I would be interested in seeing the results.out file, and if it is
> not proprietary information to you, the testdata.txt file that you used
> and also the copy of the program that you managed to get running.

You can get the results.out from my site:

<http://www.dot-app.org/results.out>

I used the testdata.txt file from the .zip archive you provided. The changes
to the text files were trivial, just converting line-endings. Transferring
the files via ASCII mode FTP would have done the same - StuffIt Expander
also has an option to do that automatically when unpacking archives.

The only relevant change I made to the .pl file was to comment out lines 31
& 32. The current working directory is already correct when your script is
run from a shell prompt, so the chdir() is redundant. Filling in the
correct path to the data files would have worked just as well, but I'm
lazy. ;-)

> The program does not really open the results.out file using Notepad.exe.

I understand about filename extensions, yes. My point is that calling
start.exe doesn't work on non-Windows systems. The moral equivalent on Mac
OS X, for example, is:

open -a TextEdit results.out

Or, if you give the output file a known extension - .txt or .doc, for
example - you can omit the app name:

open results.txt

> I am also looking for a free Web site which lets you do CGI work.

SF supports CGI, and PHP as well. But they only host web sites that are
associated with the open-source apps hosted there. So if your proposed site
is a place for collecting data to be used with your app, it would probably
be kosher. You'll have to ask them to be sure.

> If you would like to communicate regarding another version of the program
> then I am "all ears."

It would be somewhat pointless if no one in your community uses Macs. That's
why I asked you about your community. Ask around and see if there's any
interest in a Mac version - if there is, I'll see what I can do about
making one.

sherm--

-- 
Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org


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

Date: Thu, 15 Apr 2004 15:10:53 -0400
From: Sherm Pendley <spamtrap@dot-app.org>
Subject: Re: One question
Message-Id: <79ednXY8n4SxQ-PdRVn-ug@adelphia.com>

edgrsprj wrote:

>>Extracting datalines from the testdata file
>>program error
> 
> The program was looking for the following line in the testdata.txt file:
> 
> ***** END OF THE CONTROL SETTINGS SECTION *****
> 
> It did not find it probably because the line length is apparently
> different for the Mac.

That's caused by the DOS line endings in the text files.

Wait, a horrible thought occured to me - are you reading a fixed number of
chracters at a time, instead of just using <> to read a line at a time?
Egads...

Well, that would certainly explain the difference in line sizes -
DOS/Windows uses a 2-character sequence at the end of each line, while UNIX
& Macs both use a single character.

sherm--

-- 
Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org


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

Date: Thu, 15 Apr 2004 20:34:20 GMT
From: "edgrsprj" <edgrsprj@ix.netcom.com>
Subject: Re: One question
Message-Id: <glCfc.7834$l75.3937@newsread2.news.atl.earthlink.net>

"Sherm Pendley" <spamtrap@dot-app.org> wrote in message
news:79ednXY8n4SxQ-PdRVn-ug@adelphia.com...
> edgrsprj wrote:

> Wait, a horrible thought occured to me - are you reading a fixed number of
> chracters at a time, instead of just using <> to read a line at a time?
> Egads...

The number of characters in the lines on different system is confusing it.
With my system I told it to compare the string with the complete line minus
one character.  With other systems that apparently causes an error.  This is
easy to correct.  When it reads a fixed number of characters on the line it
runs Ok.

The program was assembled from parts of other programs including one or two
spreadsheet programs written over more than a 5 year period of time.  So its
creation was a little ragged.  I was not planning to circulate it so soon.
But it worked so well that I decided to do that.

I am enjoying working with Perl.  It is a little unforgiving regarding code
violations but quite versatile and fast.  And it can digest and work with
mountains of data without blinking.  My full earthquake dataset has records
of more than 20,000 earthquakes.  And it gets larger each day.




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

Date: Thu, 15 Apr 2004 17:20:21 -0500
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: One question
Message-Id: <slrnc7u2l5.efa.tadmc@magna.augustmail.com>

edgrsprj <edgrsprj@ix.netcom.com> wrote:

> I am enjoying working with Perl.  It is a little unforgiving regarding code
> violations


What programming language _is_ forgiving regarding code violations?

Your comment applys to all of programming, not only to
programming using Perl.


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


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

Date: Thu, 15 Apr 2004 21:43:35 GMT
From: "edgrsprj" <edgrsprj@ix.netcom.com>
Subject: Re: One question
Message-Id: <bmDfc.10155$zj3.9498@newsread3.news.atl.earthlink.net>

"Sherm Pendley" <spamtrap@dot-app.org> wrote in message
news:IqmdnUzStMs-QePdRVn_iw@adelphia.com...

Here is another question for anyone who wishes to answer.  And I will store
it here at the start of the note before commenting on the previous note
itself.

I looked at the documentation but am not yet familiar enough with Perl that
I could understand what was being said.

Q:  Is it possible to have Perl generate a copy of a program which can run
by itself as an .exe program for example without the need to have Perl on
the system?

If it is possible, how do you do that?

The reason for my asking is that I would like to make copies of my program
available to people who do not have Perl on their systems or who cannot run
it for some reason.  They would then not be able to modify those copies on
their own.  But I doubt that they would be interested in doing that anyway.


>You can get the results.out from my site:

I took a look at it.  Your data output file is a perfect match for mine.


>I used the testdata.txt file from the .zip archive you provided. The
changes
to the text files were trivial, just converting line-endings. Transferring
the files via ASCII mode FTP would have done the same - StuffIt Expander
also has an option to do that automatically when unpacking archives.

This is something I am going to have to give some thought to.  It is
important that the files be readable by any system.  What might work is
having Perl load each file it needs to use, clip off the return codes etc.
at the end, and then store the data in another file it will use for
subsequent runs.  That should make them readable for the system being used.
Well, that is a future project.


>The only relevant change I made to the .pl file was to comment out lines 31
& 32. The current working directory is already correct when your script is
run from a shell prompt, so the chdir() is redundant. Filling in the
correct path to the data files would have worked just as well, but I'm
lazy. ;-)

I am finding that the chdir statement is creating problems.  And I
think I will just dump it and simply tell the program to assemble a complete
address for each file whenever one is accessed.


>Or, if you give the output file a known extension - .txt or .doc, for
example - you can omit the app name:

>open results.txt

This looks like another future project, collecting text file startup
commands
for all the different operating systems and storing them at the end of the
program so that program users can choose the one which is appropriate for
their operating system.


>SF supports CGI, and PHP as well. But they only host web sites that are
associated with the open-source apps hosted there. So if your proposed site
is a place for collecting data to be used with your app, it would probably
be kosher. You'll have to ask them to be sure.

Sounds like it is worth investigating.


>It would be somewhat pointless if no one in your community uses Macs.
That's
why I asked you about your community. Ask around and see if there's any
interest in a Mac version - if there is, I'll see what I can do about
making one.

I am sure that there would be some interested people.  But at this point I
wouldn't recommend getting anything started.  Things are going to take a
little while to settle down.






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

Date: 15 Apr 2004 15:02:24 -0700
From: cluver@netdepict.com (Matt Cluver)
Subject: Perl Script Not Running From Crontab.
Message-Id: <9332dd12.0404151402.56b6578f@posting.google.com>

Hello All,

I'm having a problem with crontab running my perl script, it runs
perfectly fine from the prompt while logged in. The script is chmodded
to 777, I have included a lib statement to take care of possible
enviroment variable issues.

I would appreciate someone taking a look, thanks in advance. 

Cheers!

Matt

Crontab:
0 0 * * * perl /full/path/to/qotd.pl

Perl:
#!/usr/bin/perl

use lib '/full/path/to/cgi-bin';
require ".sys.conf";
use rcgi;
use Mysql;

my $cgi  = new rcgi;
my %d = $cgi->get_data();
my $dbh = Mysql->connect($db_host, $db_name, $db_user, $db_pass);


if ($d{'cmd'} eq "prcsAdd") {
$cgi->print_header();
&page_header();
&process_add();
&page_footer();
exit();
}

else { &printRandomQuote(); }

sub printRandomQuote()
{

$q = "select qid from qotd";
$sth = $dbh->Query($q) || &error_exit("<b>Error running query</b>:
$q");
$num = $sth->NumRows();

$i=0;
while (my @res = $sth->FetchRow())
{
$res2[$i] = $res[0]; 
$i++;
}
$i=0;

$index = rand @res2;
$rand_id = $res2[$index];

$query = "select qotd from qotd where qid='$rand_id'";
$sth = $dbh->Query($query) || &error_exit("<b>Error running query</b>:
$query");
my @quote = $sth->FetchRow();

open (QUOTE, ">/full/path/to/quote.html");
print QUOTE "$quote[0]";
close (QUOTE);

}


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

Date: Thu, 15 Apr 2004 14:23:16 -0400
From: Richard Morse <remorse@partners.org>
Subject: Re: question about substr
Message-Id: <remorse-810E7C.14231615042004@plato.harvard.edu>

In article <0wxfc.985$KG2.1629@reggie.win.bright.net>,
 "Chuck" <EatMeSpammers_cwtart@commpay.tv> wrote:

> I am a new perl learner and have a question about substr
> 
> Does the starting string position x in substr("string",x,y) need to be set
> to zero to start reading at the 1st postion or set to one? I found some
> examples that seem to show it both ways - am I assuming correctly that the
> starting postion parameter is always one less than the position you want to
> start at?

substr uses a zero-based string.  So the starting index is 0 to start at 
the beginning of the string.  In the (limited) context of substrs using 
only 0 + positive integers, you can think of the index as how many 
characters into the string to start (ie, substr($var, 1) will get you 
everything after first skipping one character).

Ricky

-- 
Pukku


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

Date: Thu, 15 Apr 2004 15:11:56 -0400
From: Brad Baxter <bmb@ginger.libs.uga.edu>
Subject: Re: question about substr
Message-Id: <Pine.A41.4.58.0404151454510.5960@ginger.libs.uga.edu>

On Thu, 15 Apr 2004, Chuck wrote:

> I checked the docs and the book "perl in a nutshell" and found two different
> examples with conflicting data - that is why I posted here - I am a new
> "perl" programmer - not a new programmer and would not have asked for
> information if I could have found it elsewhere. I have been programming for
> over 30 years and have never encountered such a bunch of self-centered
> arrogant pricks as you guys in this newsgroup. Don't assume that each new
> poster here is a wet-behind-the-ears computer geek.

I guess you could say it's a winnowing process.  Otherwise a bazillion new
posters would ask questions here instead of looking it up for themselves.
They do anyway.

Actually, it seems you got several answers to your question, some of which
pointed out the answer is in the documentation. And you got mine which
asked simply, what did you see when you tried it.  I mean, trying it out
is so trivial.

I think your reaction is overblown, and you paint with an awfully broad
brush.  I have been programming for over 20 years and have never
encountered such a bunch of selflessly helpful, intelligent, and
challenging folks as the guys and gals in this newsgroup.

Of course, there are some pricks, too, with whom I may be included
depending on your point of view.

Regards,

Brad


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

Date: 15 Apr 2004 19:59:03 GMT
From: ctcgag@hotmail.com
Subject: Re: question about substr
Message-Id: <20040415155903.161$MB@newsreader.com>

"Chuck" <EatMeSpammers_cwtart@commpay.tv> wrote:
> I checked the docs and the book "perl in a nutshell" and found two
> different examples with conflicting data - that is why I posted here

You should run the example you found in "perl in a nutshell" and see if it
produces the results it says it does.  And if you are going to post here
about the conflicting examples, you should include an excerpt of the
examples to show the conflict.  Otherwise we have no way of knowing if
there actually is a conflict, or if you are just misinterpreting it.

> - I
> am a new "perl" programmer - not a new programmer and would not have
> asked for information if I could have found it elsewhere. I have been
> programming for over 30 years

Well cripes, in that case you should damn well know better than to ask
others to resolve putative conflicts without first demonstrating them.

> and have never encountered such a bunch of
> self-centered arrogant pricks as you guys in this newsgroup. Don't assume
> that each new poster here is a wet-behind-the-ears computer geek.

Some people have 30 years of experience.  Some people have one year
of experience repeated 30 times.

Xho

-- 
-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service                        $9.95/Month 30GB


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

Date: Thu, 15 Apr 2004 16:53:00 -0500
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: question about substr
Message-Id: <slrnc7u11s.efa.tadmc@magna.augustmail.com>

Chuck <EatMeSpammers_cwtart@commpay.tv> wrote:

> and have never encountered such a bunch of self-centered
> arrogant pricks as you guys in this newsgroup.


We assume then that you won't be coming back.

Clearly, our loss is great.


> poster here is a wet-behind-the-ears computer geek.


You've lurked here for several days and have not seen a significant
portion of wet-behind-the-ears posts?

Must have been a statistical anomaly.


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


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

Date: 15 Apr 2004 21:11:21 GMT
From: ctcgag@hotmail.com
Subject: Re: searching a structured text data base
Message-Id: <20040415171121.576$eD@newsreader.com>

Michael Friendly <friendly@yorku.ca> wrote:
> I have a LaTeX document composed of historical items with structured
> fields (on the history of data visualization,
> http://www.math.yorku.ca/SCS/Gallery/milestone/)
>
> I'd like to create a web-based facility to provide searching of these
> items.  As a first step, I've written a perl script to translate the
> LaTeX stuff into various formats: tagged, CSV, HTML, XML.  But I don't
> know how to choose a data format and appropriate software tools to
> accomplish this most easily.

I think that you are starting at the wrong end.  What do you want the
interface to look like and do, and what tools if any do you have in mind
for making the interface?  How many hits per minute do you want to support?
I would make those decisions first, and then look into the data storage
format secondarily.

Xho

-- 
-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service                        $9.95/Month 30GB


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

Date: Thu, 15 Apr 2004 21:33:46 +0000 (UTC)
From: Hemant Shah <shah@typhoon.xnet.com>
Subject: setting system wide value for SYSTEM_FD_MAX
Message-Id: <c5mv3q$6tl$1@flood.xnet.com>


Folks,

  We have several perl scripts that passes a file description to another perl
  script. This was working fine under perl 5.6 and also work fine under perl
  5.8.3 under AIX. Recently we upgraded our linux systems to 5.8.3 and the
  scripts stopped working unless I manually increase the valuse of 
  SYSTEM_FD_MAX in the script. 

  What is difference between perl 5.8.3 on AIX and Linux?
  How can I set system wide value to SYSTEM_FD_MAX or ^F?

  Thanks.


-- 
Hemant Shah                           /"\  ASCII ribbon campaign
E-mail: NoJunkMailshah@xnet.com       \ /  --------------------- 
                                       X     against HTML mail
TO REPLY, REMOVE NoJunkMail           / \      and postings      
FROM MY E-MAIL ADDRESS.           
-----------------[DO NOT SEND UNSOLICITED BULK E-MAIL]------------------
I haven't lost my mind,                Above opinions are mine only.
it's backed up on tape somewhere.      Others can have their own.


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

Date: Thu, 15 Apr 2004 20:32:02 GMT
From: "Ala Qumsieh" <xxala_qumsiehxx@xxyahooxx.com>
Subject: Re: Two mini-golfish problems
Message-Id: <6jCfc.23017$YF5.21584@newssvr27.news.prodigy.com>

"J Krugman" <jkrugman@yahbitoo.com> wrote in message
news:c5kvm6$oi3$1@reader2.panix.com...
>
>
> OK, here's a little problem that I'd like to propose in the Perl
> golf (mini-golf?) vein.

Btw, your title says "Two" problems .. what is the second one?

--Ala




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

Date: Thu, 15 Apr 2004 20:31:25 GMT
From: Joe Smith <Joe.Smith@inwap.com>
Subject: Re: WebExplorer as Perl-CGI
Message-Id: <xiCfc.148181$K91.374473@attbi_s02>

Matthias Klein wrote:

> It requires some sort of web-based file-explorer so that users can upload
> and download even large files: the user browses to a certain URL, types in
> his passwd and can then browse in the existing files on the remote host,
> download them and upload new ones. That is what I am hoping for...
> 
> Does anybody know a program like this?

Yes, it's called Internet Explorer.

Fire up IE6, go to any FTP site, then change IE's settings:
Tools -> Internet Options -> Browsing -> Enable folder view for FTP sites.
Drag and drop, click to explore, etc.

Just about any FTP client with a graphical interface will do this;
do you really have to use HTTP?
	-Joe


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

Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 6 Apr 01)
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.  

NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice. 

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.

#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 V10 Issue 6407
***************************************


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