[11749] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 5349 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Apr 10 15:07:29 1999

Date: Sat, 10 Apr 99 12:00:20 -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           Sat, 10 Apr 1999     Volume: 8 Number: 5349

Today's topics:
        ANN and Call for Articles (Andrew Johnson)
    Re: Couple of Questions <ffchopin@worldnet.att.net>
    Re: Couple of Questions <tchrist@mox.perl.com>
    Re: Couple of Questions <ffchopin@worldnet.att.net>
    Re: Couple of Questions <tchrist@mox.perl.com>
    Re: Couple of Questions <ffchopin@worldnet.att.net>
    Re: dir list utility (BLUESRIFT)
    Re: dir list utility (Alastair)
    Re: How do i write a program that will spell a word eve <boylel@worldnet.att.net>
    Re: How do i write a program that will spell a word eve (Scott Porter)
    Re: How do i write a program that will spell a word eve <collin.starkweather@colorado.edu>
    Re: How do i write a program that will spell a word eve <poohba@io.com>
    Re: How to Restrict CGI access? (Randal L. Schwartz)
        I realy need some help... eldorado@eudoramail.com
    Re: I realy need some help... <ffchopin@worldnet.att.net>
        Is it possible to have "..." appear while processing? <poohba@io.com>
    Re: Is it possible to have "..." appear while processin <wells@cedarnet.org>
    Re: leap year? <Russell_Schulz@locutus.ofB.ORG>
    Re: liars vs. non-liars (was Re: does perl discourage o <Russell_Schulz@locutus.ofB.ORG>
        LWP::UserAgent and POST <doug@weboneinc.com>
        ODBC.pm and INSERT problem <greg2@surfaid.org>
    Re: perl and y2k (was Re: The millennium cometh -- even <Russell_Schulz@locutus.ofB.ORG>
    Re: Perl/Solaris 7 Compilation Problems (Tom Mornini)
        pretty print SQL statements <phlip@politizen.com>
    Re: Simple Question :-) <naf@commercestudio.com>
    Re: Text Search Program dana@oz.net
    Re: Trouble with Oraperl, and simple select statement <joshnarins@my-dejanews.com>
        Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)

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

Date: Sat, 10 Apr 1999 18:35:11 GMT
From: andrew-johnson@home.com (Andrew Johnson)
Subject: ANN and Call for Articles
Message-Id: <zRMP2.5675$%5.1055272@news1.rdc1.on.wave.home.com>

[a little long, I didn't have the time to make it shorter...
 and I can't recall who I'm paraphrasing.]

Hello from Winnipeg.pm,

We here at Winnipeg.pm would like to announce the birth of a new free
Perl newsletter/journal --- its actually quite premature, but as with
many ideas, the gestational period was indefinite so we induced labor
in the hopes that the community at large might witness the struggling
infant and help us to bring it out of the incubator and into the real
world.

Taking a cue from the TeX Users Group publication, TUGboat, and after
much deliberation and a little beer (or was it much beer and a little
deliberation) we have given the infant newsletter its name: PUBcrawl.
Ostensively, PUB is an acronym for Perl Users Bimonthly, but with all
perl monger meetings that appear to take place in pubs, it strikes us
as rather fitting in its other connotations. While we do hope that we
can bring it out on a bimonthly basis, we *officially* don't care and
we won't be changing its name to reflect a different and perhaps more
realistic publication schedule.

The intent is a forum for publishing well documented perl code in the
form of literate programs as articles. Literate Programming (LP) is a
style of writing programs in which source code is interwoven with its
documentation (source documentation, not user documentation) --- much
like POD only more flexible. We will be using the 'noweb' LP tool for
the publication, which will be typeset using LaTeX and made available
in both PDF and Postscript formats at our website.

Think of the LP tool as an elaborate pre-processor --- you write your
article in plain text, describing and defining small chunks of source
code (and their inter-relations in a hierarchical manner). This, then
is the literate source of the program from which you can either build
the executable version of the code or create a typeset version of the
article. A process called 'tangling' is used to extract the chunks of
code and assemble them into their proper order. Typeset documentation
is produced by a process called 'weaving', which creates output ready
for typesetting with LaTeX --- the weaving process inserts additional
cross-reference information if desired.

We have chosen the LP style for source-code articles for a variety of
reasons, but mainly because it is flexible and allows you to describe
and present your code in an order independent of that required by the
compiler/interpreter. Also, not a lot of extra syntax is required for
you to create literate source that can be used by the noweb LP tools.
Correctness of the code within your article can be checked because we
can tangle out the code and test it --- as can you because we've also
created a little perl script (pqtangle) you can use in place of noweb
to tangle your program out from the article for testing and debugging
purposes (line directives can be optionally inserted by pqtangle into
your tangled code so that any error messages will point to the proper
place in the literate source file). The other nice thing is that with
LaTeX as the tyepsetting backend you are free to include mathematical
formulae and/or diagrams (using the proper LaTeX markup) as needed to
help you describe or explain some algorithm.

What extra syntax do you need to learn? Not much, and it is explained
in the newsletter section of our website along with pointers to other
Literate Programming resources:

http://winnipeg.pm.org/

There are really only 4 things you'll need to learn, how to start and
finish a code chunk definition, how to refer to another chunk that is
defined elsewhere from within a code chunk definition, and how to tag
text as code within documentation:

(note: the <-- comments are not part of any syntax, they are just for
labelling the various constructs in this example only)

--------Example----
This is documentation, we can describe and explain the code
chunk definition that follows:

<<chunk name>>=              <-- start a chunk definition
#!/usr/bin/perl -w           <-- raw code goes here 
my $foo = 'blah';            <-- more code
<<another chunk>>            <-- embedded chunk, no trailing = sign
@                            <-- end a chunk definition

Back in documentation, maybe we refer a variable, [[$foo]],
(the double square brackets tag it as code for typesetting)
and we can explain another chunk of code and define it:

<<another chunk>>=      <-- starting definition for 'another chunk'.
print "$foo\n";         <-- code
@                       <-- end chunk definition
 ...
--------End Example ----

In other words, unlike POD where the syntax allows you to insert your
documentation within the program, in LP the model is reversed and the
assumption is that you are writing the description of the program and
the syntax allows you to embed the formal definition of each chunk of
code within your description of the program. The flexibility comes in
because we could have swapped the order of the chunks above and still
the tangled out code would come out the same.

At the site you can also find PDF and Postscript versions of the tiny
infant newsletter (issue 0 volume 0) which contains a little up-front
filler material and one example article. I generate the PDF file from
the postscript version using 'ps2pdf' and the quality of the PDF file
seems substandard (it may not even work with some PDF viewers) --- we
are investigating 'pdflatex' as an alternative. You can also find the
rough hack of the 'pqtangle' script at the above mentioned site.

OK, now you know about it --- the only thing left for you to do is to
submit your articles so that we can have a Real first issue with Real
literate-program articles. If you have a simple program that might be
used to good effect in teaching some aspect of perl or programming to
novices, please consider turning it into a literate article. Or maybe
you have a module that does rocket science, I'd sure like to read the
literate program that teaches me how to write rocket science code. We
are tentatively planning to release issue 1 at the end of May, but we
have no idea what to expect in the way of production problems and the
like --- so please try to get your submissions in no later than about
the 10th of May. Actually, if you could get them in before our groups
April meeting (April 28) it would be even better.

We also welcome any comments or suggestions.

Thanks,
andrew

[the deadlines are not written in stone --- anytime is a good time to
 submit. Those were deadlines we thought up a couple weeks ago --- so
 we will probably not have issue 1 ready until early June or so]


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

Date: Sat, 10 Apr 1999 10:55:42 -0400
From: "Jason Simms" <ffchopin@worldnet.att.net>
Subject: Re: Couple of Questions
Message-Id: <7enq2a$bdu$1@bgtnsc03.worldnet.att.net>

> When working with CGI is it possible to have .pl excute a .pl within
> itself??? If so how is it done?

Use the "system" function:

#!usr/bin/perl -w

system "otherscript.pl";

> Also it is possible to get a .pl to parse a text into itself????

What exactly do you mean?  Do you mean include the text from another file
into the script?  If so, use the "require" function:

#!usr/bin/perl -w

require include::thisfile;

#END SCRIPT

This will look for a file name thisfile.pm in the directory include
(include/thisfile.pm) and put it in to your file.  Also, make sure and
include a 1; as the last line of the include file (it must return a true
value) or you'll get all sorts of fun error messages.

Jason Simms




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

Date: 10 Apr 1999 09:38:13 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Couple of Questions
Message-Id: <370f7065@csnews>

 [courtesy cc of this posting sent to cited author via email]

In comp.lang.perl.misc, 
    Robert Smith <robsmith@yahoo.com> writes:
:When working with CGI is it possible to have .pl excute a .pl within
:itself??? If so how is it done?
:

"execute"?
"pl"?

You need:

    require "otherfile.pl";

But this should probably be

    use OtherFile;

--tom
-- 
    signal(i, SIG_DFL); /* crunch, crunch, crunch */
        --Larry Wall in doarg.c from the perl source code


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

Date: Sat, 10 Apr 1999 12:08:10 -0400
From: "Jason Simms" <ffchopin@worldnet.att.net>
Subject: Re: Couple of Questions
Message-Id: <7ent2i$1r2$1@bgtnsc02.worldnet.att.net>

> :When working with CGI is it possible to have .pl excute a .pl within
> :itself??? If so how is it done?
> :
>
> "execute"?
> "pl"?
>
> You need:
>
>     require "otherfile.pl";
>
> But this should probably be
>
>     use OtherFile;

I noticed that someone asked this question a few days ago, and the reply was
to use "system" to execute the other script.  When I did some looking, I
found that the docs say that with system "...a fork is done first, and the
parent process waits for the child process to complete."  So my question is,
when would it be better to use system and wait for execution to complete, or
when should "use" (or "require") be the better choice?  Is there a marked
advanage to one over the other?

Jason Simms




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

Date: 10 Apr 1999 10:20:33 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Couple of Questions
Message-Id: <370f7a51@csnews>

 [courtesy cc of this posting sent to cited author via email]

You sent me a stealth CC.  *BAD*!  Look at my header line
above.  Go thou and do likewise.

system() is only used to run separate standalone scripts and programs
(foo), not to load in libraries (foo.pl) and modules (Foo.pm).
For libraries and modules, one employs use "do", "require", or "use",
depending on the desired semantics.  Since you said "foo.pl", you must
have a library not a module, program, or script, so you'll want "do" or
"require".

--tom
-- 
    echo "Congratulations.  You aren't running Eunice."
        --Larry Wall in Configure from the perl distribution


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

Date: Sat, 10 Apr 1999 13:39:26 -0400
From: "Jason Simms" <ffchopin@worldnet.att.net>
Subject: Re: Couple of Questions
Message-Id: <7eo2dp$mb3$1@bgtnsc02.worldnet.att.net>

> You sent me a stealth CC.  *BAD*!  Look at my header line
> above.  Go thou and do likewise.

Yes, yes...  Sorry about that - the wrong reply option was inadvertantly
selected from the menu...

Jason Simms




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

Date: 10 Apr 1999 17:19:49 GMT
From: bluesrift@aol.com (BLUESRIFT)
Subject: Re: dir list utility
Message-Id: <19990410131949.02690.00001000@ng96.aol.com>

> Jonathan Feinberg suggests using something like:

>use LWP::Simple;
>   $content = get('http://www.foo.com');

This captures the contents of an individual file which would be the index or
default html file for the given http address.  My goal is to capture the names
of files contained in a directory.  The purpose is to allow users to choose
among these files (even if those files are not referenced by an index or
default html file).

I apologize for stating my needs unclearly.

Rob Bell


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

Date: Sat, 10 Apr 1999 17:31:50 GMT
From: alastair@calliope.demon.co.uk (Alastair)
Subject: Re: dir list utility
Message-Id: <slrn7gv694.52.alastair@calliope.demon.co.uk>

BLUESRIFT <bluesrift@aol.com> wrote:
>
>Actually, I have already tried that and am able to get a listing when I supply
>an absolute path eg  /absolutepath/  but when I substitute a valid http:// path
>no listing is produced. What am I doing wrong?
>
>print "Directory Listing\n";
>opendir THEDIR, "http://www.myplace.com/" || &dienice('nodir',$!);
>@allfiles = readdir THEDIR;
>closedir THEDIR;
>foreach $file (@allfiles) {
>print "$file\n";
>}
>print "-list complete-\n";}

Right. The above code snippet doesn't compile as is. Strip that last '}'. Note
that opendir is operating on a list (dirhandle,expression) - you should be using
'or' not '||'. Then you would see the error that the 'directory' doesn't exist.

If you want to operate over the HTTP protocol, you can't use the above. Look
into the LWP package (libwww). If you don't have this package, find it on CPAN
(http://www.cpan.org) in the WWW section. Read the readme first. It also comes
with docs - including the cookbook (lwpcook).

Note that to do what you want will depend on interacting with a web server whose
setup and security might prohibit certain things.

HTH.

-- 

Alastair
work  : alastair@psoft.co.uk
home  : alastair@calliope.demon.co.uk


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

Date: Sat, 10 Apr 1999 08:50:13 -0700
From: Lee Boyle <boylel@worldnet.att.net>
Subject: Re: How do i write a program that will spell a word every way possible?
Message-Id: <370F7335.A9A5082F@worldnet.att.net>

Judging by the responses you've received, the first step is
to clarify your requirements.

When you say "every way possible" do you mean that you want
the letters of the word printed in every possible order, or
do you want every way that a person is likely to type (or
mistype) the word.

Using "hello" as an example, "llheo" is an instance of the
former and "helo" is an instance of the latter.

As others have said, it's very easy to print all possible
permutations of a set of characters, and it's very difficult
to print all possible misspellings.


Poohba wrote:
> 
> I want the program to ask for a work then print that word out every way
> possible.  So if the word is "hello" it will print out (hello, holle,
> helol) etc.  Or if it possible, it will print out (hell, hole) or anything
> else that might be a word.


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

Date: Sat, 10 Apr 1999 18:15:13 GMT
From: scott@quick-silver.demon.co.uk (Scott Porter)
Subject: Re: How do i write a program that will spell a word every way possible?
Message-Id: <3710948a.649260@news.demon.co.uk>

On Sat, 10 Apr 1999 08:50:13 -0700, Lee Boyle <boylel@worldnet.att.net> wrote:

>As others have said, it's very easy to print all possible
>permutations of a set of characters, and it's very difficult
>to print all possible misspellings.

I saw the original request and assumed it would be quite a lengthy
piece of code to iterate through every possible permutation without
duplicating (ie, not using random mixing and/or building a huge array).

I'm curious, which is the easy way? (not that I have any use for it :)

-- 
Scott               <http://www.javascript-games.org/ >

            < Homepage: http://www.quick-silver.demon.co.uk/ >
            Dynamic site: DHTML games/music/general eye candy!


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

Date: Sat, 10 Apr 1999 12:31:39 -0600
From: Collin Starkweather <collin.starkweather@colorado.edu>
To: boylel@worldnet.att.net, scott@quick-silver.demon.co.uk
Subject: Re: How do i write a program that will spell a word every way possible?
Message-Id: <370F990B.848C1BCF@colorado.edu>

This is a multi-part message in MIME format.
--------------654AAFBAFF08A4DAE1C76C43
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

It would require one loop for each letter, so you would have to build a
scratch file which is a perl script itself, then perl the scratchfile.

Here's how:

Put all of the characters in a list.  The outer loop loops over all of
the characters.  Each successive loop loops over a list consisting of
the set of characters less the character chosen by the previous loop.

For example, to permute "yes",

@first = @yes = ('y','e','s');

$n=1;
for $first (@first) {
   @second = @first;
   for $i (0..$#second) {
      if ($second[$i] eq $first) { splice @second, $i, 1 }
   }
   for $second (@second) {
      @third = @second;
      for $i (0..$#third) {
         if ($third[$i] eq $second) { splice @third, $i, 1 }
      }
      for $third (@third) {
         print "Permutation $n:  ", $first, $second, $third, "\n";
         $n++
      }
   }
}

The output will by

Permutation 1:  yes
Permutation 2:  yse
Permutation 3:  eys
Permutation 4:  esy
Permutation 5:  sye
Permutation 6:  sey

The trick is to write a perl script that will write the above logic in
the form of a perl script for a string of arbitrary length.

Regards,

Collin

-- 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Collin Starkweather                                 (303) 492-4784
University of Colorado            collin.starkweather@colorado.edu
Department of Economics          http://ucsu.colorado.edu/~olsonco
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Scott Porter wrote:
> 
> On Sat, 10 Apr 1999 08:50:13 -0700, Lee Boyle <boylel@worldnet.att.net> wrote:
> 
> >As others have said, it's very easy to print all possible
> >permutations of a set of characters, and it's very difficult
> >to print all possible misspellings.
> 
> I saw the original request and assumed it would be quite a lengthy
> piece of code to iterate through every possible permutation without
> duplicating (ie, not using random mixing and/or building a huge array).
> 
> I'm curious, which is the easy way? (not that I have any use for it :)
> 
> --
> Scott               <http://www.javascript-games.org/ >
> 
>             < Homepage: http://www.quick-silver.demon.co.uk/ >
>             Dynamic site: DHTML games/music/general eye candy!
--------------654AAFBAFF08A4DAE1C76C43
Content-Type: text/x-vcard; charset=us-ascii;
 name="collin.starkweather.vcf"
Content-Transfer-Encoding: 7bit
Content-Description: Card for Collin Starkweather
Content-Disposition: attachment;
 filename="collin.starkweather.vcf"

begin:vcard 
n:Starkweather;Collin
tel;work:(303) 492-4784
x-mozilla-html:FALSE
url:http://ucsu.colorado.edu/~olsonco
org:University of Colorado;Department of Economics
version:2.1
email;internet:collin.starkweather@colorado.edu
title:Research Assistant
adr;quoted-printable:;;University of Colorado=0D=0ACampus Box 0256;Boulder;Colorado;80309-0256;USA
fn:Collin Starkweather
end:vcard

--------------654AAFBAFF08A4DAE1C76C43--



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

Date: Sat, 10 Apr 1999 10:38:39 -0500
From: Poohba <poohba@io.com>
To: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: How do i write a program that will spell a word every way possible?
Message-Id: <Pine.BSF.4.05.9904101037450.19025-100000@schultz.io.com>

Thank u very much...
I will learn this lang and its resources if it kills me.

On Fri, 9 Apr 1999, David Cassell wrote:

> [cross-post to c.l.javascript dropped]
> 
> Poohba wrote:
> > 
> > I want the program to ask for a work then print that word out every way
> > possible.  So if the word is "hello" it will print out (hello, holle,
> > helol) etc.  Or if it possible, it will print out (hell, hole) or anything
> > else that might be a word.
> > 
> >               *         Web Page Designs          *
> >              / poohba@io.com  |  www.io.com/~poohba\
> >              ---------------------------------------
> >              \ For info about me send message with /
> >               *      subject "send file help"     *
> > 
> 
> Since you're crossposting, I'll assume you have no code written in
> anything
> yet.  In Perl, it's simple.  Use Mark-Jason Dominus' code for
> permutations
> of a set of letters [get it from DejaNews or his website].  Pluck 
> /usr/dict/words up for your dictionary [or any other dictionary you
> prefer]. 
> Then use the code straight out of the FAQ to find 'the intersection of
> two
> arrays'.  Presto!  You're done.
> 
> HTH,
> David
> -- 
> David Cassell, OAO                               
> cassell@mail.cor.epa.gov
> Senior Computing Specialist                          phone: (541)
> 754-4468
> mathematical statistician                              fax: (541)
> 754-4716
> 
> 

	      *		Web Page Designs	  *
	     / poohba@io.com  |  www.io.com/~poohba\
	     ---------------------------------------
	     \ For info about me send message with /
	      *      subject "send file help"     * 
		



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

Date: 10 Apr 1999 10:35:07 -0700
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: How to Restrict CGI access?
Message-Id: <m1hfqotm44.fsf@halfdome.holdit.com>

>>>>> "global3" == global3  <global3@my-dejanews.com> writes:

global3> I am trying to modify the access.conf server configuration file to
global3> restrict CGI access from remote hosts to CGI files in a particular
global3> directory yet allow CGI access in the same directory for visitors to my
global3> web site (i.e., people who come using their browsers). I have been trying
global3> this code:

Hmm.  I missing something here, or perhaps you are.

What is the difference between "access from remote hosts" and "access
in the same directory for visitors"?  How does it look any different
to the web server?

I suspect it doesn't, and hence, your problem is unsolveable.

And, for the record, this is *not* a Perl question.  You would have
gotten much more precise response posting in
comp.infosystems.www.authoring.cgi.

-- 
Name: Randal L. Schwartz / Stonehenge Consulting Services (503)777-0095
Keywords: Perl training, UNIX[tm] consulting, video production, skiing, flying
Email: <merlyn@stonehenge.com> Snail: (Call) PGP-Key: (finger merlyn@teleport.com)
Web: <A HREF="http://www.stonehenge.com/merlyn/">My Home Page!</A>
Quote: "I'm telling you, if I could have five lines in my .sig, I would!" -- me


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

Date: Sat, 10 Apr 1999 18:04:28 GMT
From: eldorado@eudoramail.com
Subject: I realy need some help...
Message-Id: <7eo3ra$trr$1@nnrp1.dejanews.com>

I am very new to perl but willing...

I wanted to make a programm to test, within my web server, one after an
other, zillions of links in my site's database (text file with one record per
line) to weed-out dead links.

I can do it from my computer, but transferring the few MB database files back
and forth is not very easy.

After, I nearly crashed the server with my "home brew", I think it's time to
ask experts for help.

Any suggestions...

Rafal Swiecki, a miner up to its ears in a perl pit... digging.


<A href="http://www.mininglinks.com/">Mining Web Directory</A>
<A href="http://www.geolinks.org/anizer/">Rafal in Green Hell</A>
<A ref="http://www.minelinks.com/html/rafal.html">Eloorado</A>

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: Sat, 10 Apr 1999 14:22:10 -0400
From: "Jason Simms" <ffchopin@worldnet.att.net>
Subject: Re: I realy need some help...
Message-Id: <7eo4u2$1ur$1@bgtnsc02.worldnet.att.net>

> I wanted to make a programm to test, within my web server, one after an
> other, zillions of links in my site's database (text file with one record
per
> line) to weed-out dead links.
>
> I can do it from my computer, but transferring the few MB database files
back
> and forth is not very easy.
>
> After, I nearly crashed the server with my "home brew", I think it's time
to
> ask experts for help.
>
> Any suggestions...

I don't have my copy handy, so I can't give exact details, but there is a
recipe to do exactly this in the Perl Cookbook, along with many other nifty
web/cgi-related tasks.

Jason Simms





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

Date: Sat, 10 Apr 1999 10:50:37 -0500
From: Poohba <poohba@io.com>
Subject: Is it possible to have "..." appear while processing?
Message-Id: <Pine.BSF.4.05.9904101039090.19025-100000@schultz.io.com>

If so how?...I have a program that takes a little while to complete but i
don't want the user to abort so i would like something to be happening so
i thought maybe i could have ... appear as long as it is processing.  When
I say ... i mean the dots keep coming til program is complete.

	      *		Web Page Designs	  *
	     / poohba@io.com  |  www.io.com/~poohba\
	     ---------------------------------------
	     \ For info about me send message with /
	      *      subject "send file help"     * 
		



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

Date: Sat, 10 Apr 1999 16:43:52 +0000
From: Steve Wells <wells@cedarnet.org>
Subject: Re: Is it possible to have "..." appear while processing?
Message-Id: <370F7FC8.DAD7F6BC@cedarnet.org>

Poohba wrote:
> 
> If so how?...I have a program that takes a little while to complete but i
> don't want the user to abort so i would like something to be happening so
> i thought maybe i could have ... appear as long as it is processing.  When
> I say ... i mean the dots keep coming til program is complete.
> 
>               *         Web Page Designs          *
>              / poohba@io.com  |  www.io.com/~poohba\
>              ---------------------------------------
>              \ For info about me send message with /
>               *      subject "send file help"     *
> 

Hmm.. without much to go on I'm going to make a leap of faith.

Your program is running from the web.  

I derived this because of your sig and the fact that anyone 
who can write a hello world program can output information 
as a program runs.

So going with that assumption first you need to stop the
normal buffering that goes on between your perl script and
your web server.

On apache you do this by changing the filename to nph-FILENAME.

Secondly you need to remove the normal buffering that perl
takes into effect.   select((select(STDOUT), $|=1)[0]);

Now you need to send the nph headers back to the browser.  The
easiest way is to use Lincoln Stein's CGI module.

There are several documented ways to implement this but the one
I use is:  print $cgi->header(-nph=>1);

You now have a direct unbuffered connection to the browser
so you can write to it.  There are several ways to implement 
this depending on your code but if the program is taking a long
time to run and it's a loop just output your '.' char within
the loop.  If you want it to output routinely try using the
alarm signal.

or...

You could try Randal's approach of forking the program and having
the parent redirect to another web page while the child does
it's thing.  Then the child's information rebuilds the webpage
and your done.

Check out his implementation here:
http://www.stonehenge.com/merlyn/WebTechniques/col20.html

HTH,
STEVE
-- 
-----------
Stephen D. Wells
http://expert.cc.purdue.edu/~bgannon/booksearch/
http://www.iren.net/wellss/


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

Date: Sat, 10 Apr 1999 13:04:46 -0400
From: Russell Schulz <Russell_Schulz@locutus.ofB.ORG>
Subject: Re: leap year?
Message-Id: <19990410.130446.5W6.rnr.w164w@locutus.ofB.ORG>

"David L. Cassell" <cassell@mail.cor.epa.gov> writes:

>> > [Note first make sure to add 1900 to the $year variable if it
>> >  is coming from the C struct tm or from localtime() .]
>> 
>> Now that is good advice.  The FAQ for cl.c states that C does not
>> have any year 2000 problems, but poorly written C programs might.
>
> Ssshhhhh...  Or else Russell Schulz will join the thread.  :-)

<yawn>  Hmm?  What?  <stretch>  Am I awake?  Hello?  Is anyone there?

(And did you notice the first test posted was as obscure as possible?  :-| )
-- 
Russell_Schulz@locutus.ofB.ORG  Shad 86c


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

Date: Sat, 10 Apr 1999 12:16:05 -0400
From: Russell Schulz <Russell_Schulz@locutus.ofB.ORG>
Subject: Re: liars vs. non-liars (was Re: does perl discourage obfuscated code?...)
Message-Id: <19990410.121605.5i0.rnr.w164w@locutus.ofB.ORG>

bart.lateur@skynet.be (Bart Lateur) writes:

>>> I didn't call you a liar.  I said that what you said are lies.  That's
>>> different (at least to me it is).
>>
>> I don't see any difference; but then, all I speak is English.
>
> There *is* a difference. Randal said that the things you said were lies.
> It could be that you are just repeating things that you heard other
> people say,

Let's look at the actual post to see if that's the case.  Did I say
things like `I believe' or `in my experience'?  Or did I say things
like `I have heard' and `rumor has it'?

Though this is answered multiple times in the thread, in my posts, the
first answer is in the first line of the original thread:

> Newsgroups: comp.lang.perl.misc
> From: Russell Schulz <Russell_Schulz@locutus.ofB.ORG>
> Subject: does perl discourage obfuscated code? (was Re: Perl evangelism)
> Message-ID: <19990227.183452.7J7.rnr.w164w_-_@locutus.ofB.ORG>
> Date: Sat, 27 Feb 1999 18:34:52 -0500
>
> I believe it.  Perl encourages hard-to-read code.

Now, can you still tell me Randal read that and felt he could claim I
was lying without calling me a liar?

Well, obviously, yes he _did_ claim that, but do you think he could do
it accurately?
-- 
Russell_Schulz@locutus.ofB.ORG  Shad 86c


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

Date: Sat, 10 Apr 1999 14:37:40 -0400
From: Douglas Clifton <doug@weboneinc.com>
Subject: LWP::UserAgent and POST
Message-Id: <370F9A74.944A745C@weboneinc.com>

I have learned how to use:

HTTP::Request::Common qw(POST);
LWP::UserAgent;

to automate POSTing form variables to a CGI script.

However this does not work under the https protocol. I realize the
security issues and no, I'm not trying to hack into anyone's secure
server -- there is a perfectly valid reason I need to solve this
problem.

Thanks for any insights,

-- 
Douglas Clifton
Unix/C/Perl/CGI/HTML Programmer
doug@weboneinc.com


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

Date: Sat, 10 Apr 1999 19:41:39 +0100
From: Greg Griffiths <greg2@surfaid.org>
Subject: ODBC.pm and INSERT problem
Message-Id: <370F9B63.C4F8EBC2@surfaid.org>

I'm using Win32::ODBC on Activestate's Perl and am having a problem with
the INSERT command. The command works fine when I use the following :

INSERT INTO tblStaff (Name, UserName, Password, Activated, Email)
VALUES (\'$Name\',\'$UserName\',\'Temp User\',Date(),\'$Email\')

but when I use the following :

INSERT INTO tblStaff (Name, UserName, Password, Activated, Email, Level)
VALUES (\'$Name\',\'$UserName\',\'Temp User\',Date(),\'$Email\',\'S')

I get :

INSERT INTO tblStaff (Name, UserName, Password, Activated, Email, Level)
VALUES ('Nigel Hardy','OP6','Temp User',Date(),'nwh@aber.ac.uk','S')SQL
failed. Error: [-3502] [1] [0] "[Microsoft][ODBC Microsoft Access 97
Driver] Syntax error in INSERT INTO statement."


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

Date: Sat, 10 Apr 1999 13:56:55 -0400
From: Russell Schulz <Russell_Schulz@locutus.ofB.ORG>
Subject: Re: perl and y2k (was Re: The millennium cometh -- eventually)
Message-Id: <19990410.135655.9y7.rnr.w164w@locutus.ofB.ORG>

"David L. Cassell" <cassell@mail.cor.epa.gov> writes:

>> > Oh no!  He's right!  All programming languages are Y2K noncompliant,
>> > since someone somewhere can misuse them!
>> 
>> Does your response mean:
>
> [e]  I was trying to lighten up this thread a little.

I've done that; I once posted a followup asking how to do graphics in
Turbo Pascal saying it could only be done in C, and set followups to
alt.silly -- one person responded, and complained bitterly and rudely
about my stupidity, and when I pointed out their own headers said
`alt.silly', they thought I was harassing them.

The tragedy, and the reason I responded, is that people have _seriously_
posted these exact things -- that it's up to the programmer to read and
memorize every odd representation in the language and its libraries, and
that Perl has no more y2k problem than would a pencil.

Scary, isn't it?  It's hard to work on fixing a problem when you can't
even acknowledge the problem exists.
-- 
Russell_Schulz@locutus.ofB.ORG  Shad 86c


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

Date: Sat, 10 Apr 1999 16:44:57 GMT
From: tmornini@netcom.com (Tom Mornini)
Subject: Re: Perl/Solaris 7 Compilation Problems
Message-Id: <tmorniniF9zFuy.Frt@netcom.com>

andrew@benevolent-tech.com wrote:

: Sun Enterprise 250 machine, dual 300 mhz processors, 2 9 GB disks.

I just installed a single 400MHz.

: Solaris 2.7 successfully installed, disks partitioned the way I want.

Did you install the 64 bit version? Current patches?

: gcc 2.8.1 installed cleanly.

I installed 2.8.1 from sunfreeware.com and then compiled and installed
egcs 1.1.2 from egcs.cygnus.com. I've had problems with bad code from
2.8.1 (confirmed by author of MySQL!)

: Various small things (bash, less, etc) and some large things (emacs, apache)
: compiled and installed successfully.

OK so far.

: The problem has been with Perl. I tried installing the latest stable release
: (5.005_03) and while the configure and initial make looked clean, make test
: delivered a bunch of errors where the thing would core dump seemingly -after-
: all the tests were completed. Sometimes, it says 'bus error, core dumped'.
: When I re-run the test, it fails on the same things.

I had weird errors, but not those, when I declined to install 64 bit support.

: Being an optomistic type, I installed it anyway, but whenever I run tests on
: the various modules I need to do my job (DBI/DBD, LWP) it delivers the same
: sort of errors, and ultimately gives seg. faults with little test scripts I
: run.

Well, that WAS optimistic! :-)

: Being a persistent type, I wiped out all previous perl installs and tried an
: earlier Perl, 5.004_04 - same results.

I had it working at one point, and then it stopped working...

: Looking around on Usenet, I noticed some folks were using egcs to build perl.
: I tried this but egcs of course failed to compile...

That's bad! I fixed my problems 100% by wiping the system, installing Hardware
3/98 plus the updates patches on CD, then installing current recommended
patches.

Everything is cool now.

-- Tom Mornini
-- InfoMania


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

Date: 10 Apr 1999 10:16:07 PDT
From: "Phlip" <phlip@politizen.com>
Subject: pretty print SQL statements
Message-Id: <7eo10n$e6r@chronicle.concentric.net>

Newsgroupies

Like many of us, I have numerous SQL statements completely generated
from string manipulation. At run time, I'd prefer they were as short
as possible; they have no excess blanks or linefeeds.

At debug time... you can see where I'm going with this. I want the
program to emit a log on command of every SQL statement it runs. But
I want these statements to be formatted neatly so they'r useful at a
glance.

The ideal (towards which I'd migrate any simpler script) would use
the style promoted by the O'Rielly PL/SQL Ant Book:

    Select * From Warthogs
     Where TuskLength > 5
      (And Irritability > 9
        Or HadABadDay = True)

Viewed with a monospaced font, that has a gutter down the left side
between each leading keyword and its operand.

Any takers? Any contest winners for a Least Lines prize?

--
 Phlip at politizen dot com                  (address munged)
======= http://users.deltanet.com/~tegan/home.html =======




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

Date: Sat, 10 Apr 1999 14:45:37 -0400
From: Naphtali Visser <naf@commercestudio.com>
Subject: Re: Simple Question :-)
Message-Id: <370F9C51.1DA09B48@commercestudio.com>

Something like this?

open(READFILE,'file1');
open(WRITEFILE,'>file2');

$lookfor='hello';

while (<READFILE>){
    if (/$lookfor/o){
        print WRITEFILE $_;
        last;
    }
}

close(READFILE);
close(WRITEFILE);



Ophir Marko wrote:

> Thanks, but what I'm trying to do is find a certain word in the text, copy the
> whole line in which it appears to a file and then close both files.
>
> Thanks,
> Ophir Marko
>
> Oscar Frowijn wrote:
>
> > >#!/usr/bin/perl -w
> > >
> > >open FILE1, 'file1' or die "open file1: $!\n";
> > >open FILE2, 'file2' or die "open file2: $!\n";
> > >open FILE3, 'file3' or die "open file3: $!\n";
> > >
> > >my ($line1, $line2, $line3);
> > >
> > >LOOP:
> > >while ( 1 ) {
> > >    $line1 = <FILE1>;
> > >    $line2 = <FILE2>;
> > >    $line3 = <FILE3>;
> > >
> > >    last LOOP if ( defined($line1) + defined($line2) + defined($line3) ==
> > 0 );
> > >
> > >    for ( $line1, $line2, $line3 ) {
> > >        $_ = defined($_) ? $_ : "";
> > >        chomp;
> > >    }
> > >
> > >    printf "%s%s%s\n", $line1, $line2, $line3;
> > >}
> > >
> > >close FILE1;
> > >close FILE2;
> > >close FILE3;
> > >
> >
> > This will do the trick :-)
> >
> > Thanks a lot !!!!

--
Naphtali C. Visser, President
Commerce Studio, Inc.
(p) 617.357.7642 (e) naf@commercestudio.com
(f) 617.482.1346 (w) www.commercestudio.com




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

Date: Sat, 10 Apr 1999 15:43:42 GMT
From: dana@oz.net
Subject: Re: Text Search Program
Message-Id: <OkKP2.17453$R3.147904@news7.ispnews.com>

In comp.lang.perl Michael O'Connor <mfo@home.com> wrote:

: I'm working on a project that is to have a user input a text string and then
: search for that text string in a bunch of text files.  Then I am to display
: those text files that have that text string in it.  I would like to use
: windows or an internet browser to ask for the input and to display the
: output.  I am using Windows 98 on a stand alone machine.  I have been
: investigating Perl for doing the text searching.  I have had difficulty
: using Perl to drive my internet browser.  Perl is designed for a Unix
: environment not for a windows environment.  Perl wants to only open up a
: text window.

If you _really_ want to use Perl, the easiest would be to make a dialog
in C++, and call Perl from within to do the text search by passing the
result of the dialog.

-- 

---------------------------
Dana Booth <dana[at]oz.net>
Tacoma, Wash., USA
---------------------------


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

Date: Sat, 10 Apr 1999 15:18:30 GMT
From: JoshNarins <joshnarins@my-dejanews.com>
Subject: Re: Trouble with Oraperl, and simple select statement
Message-Id: <7enq42$mlc$1@nnrp1.dejanews.com>

Why aren't you using ???

  use DBI;

  $dbh->connect( params like username, password, database name);
  $sth->$dbh->prepare("Select Snow from Mountain where season = 'spring'");
  @a = $sth->fetchrow();
       # OR # while ( (@row = $sth->fetchrow() ) { ... };
  $sth->finsish;
  $dbh->disconnect();



People were yelling at me to move from the ora_ platform specific methods to
the generic OO db independent ones a few years ago.




In article <37094222.269464559@news.qgraph.com>,
  drgreer@qtiworld.com (Darren Greer) wrote:
> This select statement takes less
> than a 1/4 of a second to do from sqlplus, so something is messed up.
> Below is my simple code.
>
> #!/usr/bin/perl
>
> use Oraperl;
>
> &ora_version;
>
> $home = $ENV{'ORACLE_HOME'};
> $sid = $ENV{'ORACLE_SID'};
> $userid = "login";
> $passwd = "password";
>
> $lda = &ora_login($sid,$userid,$passwd) || die $ora_errstr;
>
> $partsearch = "select partno, partdescr from partmaster where partno =
> '108755'";
>
> $csr = &ora_open($lda, $partsearch);
>
> &ora_bind($csr);
>
> $test = &ora_fetch($csr)
>
> &ora_close($csr);
>
> &ora_logoff($lda);
>
> print $test;
>
>

Rip my heart out for the sun god, throw my body down the stairs

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

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

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