[18891] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1059 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Jun 5 03:05:43 2001

Date: Tue, 5 Jun 2001 00:05:11 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <991724711-v10-i1059@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Tue, 5 Jun 2001     Volume: 10 Number: 1059

Today's topics:
    Re: "The Camel Book", "The Ram Book" or "Perl : The Pro (Martin Vorlaender)
    Re: accept input from client (David Efflandt)
    Re: Background start of program in CGI? (David Efflandt)
    Re: Best way to do this? <c_clarkson@hotmail.com>
        Compile Perl to Exe Prog <keng@spinalfluid.com>
    Re: Count Occurences of a character in a string (Abigail)
    Re: Deleting old files <godzilla@stomp.stomp.tokyo>
    Re: Deleting old files (Craig Berry)
    Re: Deleting old files (Abigail)
        Help with subroutines. <taboo@comcen.com.au>
    Re: Help with subroutines. <buggs-clpm@splashground.de>
    Re: Help with subroutines. <taboo@comcen.com.au>
    Re: Help with the $0 equivalent, portable for use in DO (codeslayer)
    Re: How to add a 0 in front of single number??? <ren@tivoli.com>
        instaling perl on windows newbie question (rabs)
    Re: instaling perl on windows newbie question (Clinton A. Pierce)
    Re: instaling perl on windows newbie question <keng@spinalfluid.com>
    Re: locking files before writing data (?) (Abigail)
    Re: Newbie Post : Flushing output for long scripts <bholness@nortelnetworks.com>
    Re: Newbie Post : Flushing output for long scripts <buggs-clpm@splashground.de>
    Re: Newbie question ... (Paul Cho)
        Perl + Windows <Frank.bederke@debeka.de>
    Re: Perl and SHTML <nospam@newsranger.com>
        Perl Dummy! <kknguyen@epicworld.com.au>
    Re: Perl Dummy! (Clinton A. Pierce)
        perl prog for win2k file manipulation <joycefive@earthlink.net>
    Re: To all the Newbies and Lurkers outthere <buggs-clpm@splashground.de>
        todo console script jmd2121@email.com
    Re: Web Host that supports Gimp or Image Magick... <cyberjeff@sprintmail.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Tue, 05 Jun 2001 06:20:03 +0200
From: martin@radiogaga.harz.de (Martin Vorlaender)
Subject: Re: "The Camel Book", "The Ram Book" or "Perl : The Programmer's Companion - Nigel Chapman"
Message-Id: <3b1c5df3.524144494f47414741@radiogaga.harz.de>

Harry Putnam (reader@newsguy.com) wrote:
> For that matter, I wondered how good the search tools on the current
> CD are?  For example, is it possible to do a full body search of the
> whole thing by regexp?  How is the html stripping or rewriting
> handled?

AFAIK, they have a prepared index stored on the CD.

> Someone mentioned a Java based search engine... Is it also regexp
> based or some less accurate technique?  Is it WAIS like?

From the page describing the search engine (of the V1 bookshelf):

<QUOTE>
This CD includes search technology from Astaware technologies Inc.[1]
Your Web browser uses an ordinary HTML form like this one to perform the
search by communicating with a single-purpose Web server, written in Java. 

Therefore, in order to search the CD, the search server must be running.
In order for the search server to run, you must have a Java interpreter,
either the Java Developers' Kit (JDK) or the Java Runtime Engine (JRE).
[...]

The search engine supports basic Boolean operators: AND, OR, and NOT.
You can use these to refine your search. Example: 

     pipe AND stderr NOT stdout

You can use an asterisk (*) as a wildcard operator: 

bob*  will match "Bob", "bobwhite", and "bobsled". 
*bob  will match "Bob", "kabob", and "nabob". 
*bob* will match "Bob", "bobsled", "kabob", and "discombobulate". 

[...]

The search engine does not search for punctuation; it only indexes words
of letters and numbers. For example, to find <STDIN>, search for STDIN
or stdin (case does not matter).
</QUOTE>

I was able to tweak the configuration to have that server also serve
the search engine to the network (and not only to the local machine).

cu,
  Martin

[1] http://www.netresults-search.com/
-- 
So long, and thanks        | Martin Vorlaender  |  VMS & WNT programmer
for all the fish...        | work: mv@pdv-systeme.de
In Memoriam Douglas Adams  |       http://www.pdv-systeme.de/users/martinv/
            1952-2001      | home: martin@radiogaga.harz.de


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

Date: Tue, 5 Jun 2001 02:15:18 +0000 (UTC)
From: see-sig@from.invalid (David Efflandt)
Subject: Re: accept input from client
Message-Id: <slrn9hog5l.nj8.see-sig@typhoon.xnet.com>

On Mon, 4 Jun 2001 15:06:28 -0500, nguyentn <nguyentn@utdallas.edu> wrote:
> hello,
> What syntax command should I use to let the Server program get the input
> from a Client program.
> Righnow, I could send a statement from a server to a client by using a print
> statement with a client name.
> I couldn't do the reverse.
> Please help.

Not enough info.  What communication method are you using, open(), a
socket, fifo, ???  Maybe it would help if you posted the code snippet or a
link to a text copy of the code.

-- 
David Efflandt  (Reply-To is valid)  http://www.de-srv.com/
http://www.autox.chicago.il.us/  http://www.berniesfloral.net/
http://cgi-help.virtualave.net/  http://hammer.prohosting.com/~cgi-wiz/


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

Date: Tue, 5 Jun 2001 02:18:47 +0000 (UTC)
From: see-sig@from.invalid (David Efflandt)
Subject: Re: Background start of program in CGI?
Message-Id: <slrn9hogc7.nj8.see-sig@typhoon.xnet.com>

On Mon, 04 Jun 2001 19:02:09 +0200, Steen Suder <CAB@earthling.net> wrote:
> I have a script, A, that conditionally starts another script, B. B runs
> some commands and executes a program, C, that will continue after B is
> done, on the box (Linux).
> 
> Problem: when B, and in turn, C, is run, the webpage either hangs and
> the program runs or the webpage returns (a redirect) and the program is
> not run.

See "Complete Dissociation of Child from Parent" in:  perldoc perlipc

-- 
David Efflandt  (Reply-To is valid)  http://www.de-srv.com/
http://www.autox.chicago.il.us/  http://www.berniesfloral.net/
http://cgi-help.virtualave.net/  http://hammer.prohosting.com/~cgi-wiz/


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

Date: Mon, 4 Jun 2001 20:10:26 -0500
From: "Charles K. Clarkson" <c_clarkson@hotmail.com>
Subject: Re: Best way to do this?
Message-Id: <B4675604A00E48E1.6DD8D642FA712334.60C8C215CC2BF9CB@lp.airnews.net>


Bryan <bcoon@sequenom.com> wrote:

: I have an some arrays like this:
: 
: @array  = (1, 0, 0, 0, 2, 2, 0, 0, 3, 0, 4, 0, 0, 0);
: @align  = ();
: @switch = ("A", "B");
: 
: I was playing around, and thought it would be cool
: to do some sort of switch, like this:
: 
: for ($i = 0; $i < @array; $i++) {
:   push(@align, $switch[$i%2]);
: }
: 
: Which generates a nice array like this:
: @align = ("A", "B", "A", "B", "A", "B", etc.....
: 
: But then I was trying to build an array that would
: correspond to groupings in @array, i.e.:
: @array = (1, 0, 0, 0, 2, 2, 0, 0, 3, 0, 4, 0, 0, 0);
: @align = ("A", "A", "A", "A", "B", "B", "B", "B",
:             "A", "A", "B", "B", "B", "B");
: 
: Where the logic assigns the same switch for any
: value and anything that follows it that is either
: an equal value or a 0.  And the switch alternates
: 

  So the rules seem to be:
   1 - start with $switch[0].
   2 - switch if the current > 0
            and current != previous.

: I tried several variations on this one:
: for ($i = 0; $i < @array; $i++) {
:   if ($tmp = $array[$i] || $array[$i] == 0) {
:     push(@align, $switch[0]);
:   } else {
:     push(@align, $switch[1]);
:   }
:   $tmp = $array[$i];
: }
: 
: I know the $switch[1] and [0] are wrong in push.

    I don't see why:

my @array  = qw(1 0 0 0 2 2 0 0 3 0 4 0 0 0);
my @switch = qw(A B);
my @align;

push @align, $switch[0];
foreach (1 .. $#array) {
 @switch = reverse @switch
    if $array[$_] > 0 && $array[$_] != $array[$_ - 1];
 push @align, $switch[0];
}


HTH,
Charles K. Clarkson


You can lead a man to logic, but you can't make him think.





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

Date: Tue, 5 Jun 2001 13:48:09 +0800
From: "keng" <keng@spinalfluid.com>
Subject: Compile Perl to Exe Prog
Message-Id: <9fhrrv$r6j$1@clematis.singnet.com.sg>

Dear All,

anyone knows where i can get a FREE compiler that compiles *.pl to *.exe.

Thanks

--
regards
isaac




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

Date: Tue, 5 Jun 2001 06:02:19 +0000 (UTC)
From: abigail@foad.org (Abigail)
Subject: Re: Count Occurences of a character in a string
Message-Id: <slrn9hotfb.icp.abigail@tsathoggua.rlyeh.net>

Gary Baker (bakerg@volpe.dot.gov) wrote on MMDCCCXXXIV September MCMXCIII
in <URL:news:3580d191.0106040553.2e187ba5@posting.google.com>:
,,  How can you count the number of times a character occurs in
,,  a string?


Use the `tr' operator, as described in `man perlop'.


Abigail
-- 
$_ = "\nrekcaH lreP rehtona tsuJ"; my $chop; $chop = sub {print chop; $chop};
$chop -> () -> () -> () -> () -> () -> () -> () -> () -> () -> () -> () -> ()
-> () -> () -> () -> () -> () -> () -> () -> () -> () -> () -> () -> () -> ()


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

Date: Mon, 04 Jun 2001 18:15:43 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: Deleting old files
Message-Id: <3B1C32BF.3382BFE0@stomp.stomp.tokyo>

Randal L. Schwartz wrote:
 
> >>>>> Craig Berry  wrote:
 
> > Randal L. Schwartz wrote:
> > Godzilla! wrote:

> > : Godzilla! > You could simply reset $1 to null after use.

> : A read-only variable?  Hmm.


I twisted Randal's head around with,  /()/;   HA!!!

 
> >   'z' =~ /(a)/;    # Reset $1 to null :)
 
> No, that doesn't change $1 a bit.  If you want $1 to be undef,
> it's 'z' =~ /z/.
 
> But that still doesn't provide any gain over simply testing the next
> match properly.  In fact, it wastes cycles.
 
> There's no way to deliberately set $1 without invoking the regex
> engine, and that's silly to do when proper coding prevents the need
> for it.


Silly? Shirley Silly!

Shirley!

Shirley, Shirley
Bo, Birley
Banana, Fanna, Foe, Firley
Fee, Fie, Moe, Mirley
Shirley!



I benchmarked those three codes below a few days back,
with a series of alternating match - no match.

For one-hundred-thousand iterations, use of

$a =~ /()/;

runs an average of two to three seconds slower
over those one-hundred-thousand iterations.
However, with increasing regexes or more
complex regexes, this time difference would
increase quite quickly.

Yeah, invoking a regex engine to null a read
only variable is Shirley silly!

Works great though for just a few regex expressions!
Perfect for a single regex as shown in this thread.


  $a="warning";

  $a =~/^wa(.*)ng/; $a =~/()/;

  $r = $1 if $a=~/^wa(.*)ng/;

  $r = $a =~ /^wa(.*)ng/;



Godzilla!   Queen of Blasphemous Perl.


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

Date: Tue, 05 Jun 2001 05:14:27 -0000
From: cberry@cinenet.net (Craig Berry)
Subject: Re: Deleting old files
Message-Id: <thoqlj96ndah70@corp.supernews.com>

Randal L. Schwartz (merlyn@stonehenge.com) wrote:
: Craig>   'z' =~ /(a)/;    # Reset $1 to null :)
: 
: No, that doesn't change $1 a bit.  If you want $1 to be undef,
: it's 'z' =~ /z/.

Mea culpa.  It's one of those things I always expect to work differently
from the way it does...

: But that still doesn't provide any gain over simply testing the next
: match properly.  In fact, it wastes cycles.
: 
: There's no way to deliberately set $1 without invoking the regex
: engine, and that's silly to do when proper coding prevents the need
: for it.

 ...but, as you say, good practice avoids the issue entirely.  It was
intended as a silly post, and ended up being inaccurate, too.  Ah well.

-- 
   |   Craig Berry - http://www.cinenet.net/~cberry/
 --*--  "God becomes as we are that we may be as he is."
   |               - William Blake


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

Date: Tue, 5 Jun 2001 06:08:00 +0000 (UTC)
From: abigail@foad.org (Abigail)
Subject: Re: Deleting old files
Message-Id: <slrn9hotq0.icp.abigail@tsathoggua.rlyeh.net>

Steve (cochise@sky.net) wrote on MMDCCCXXXIV September MCMXCIII in
<URL:news:3B1BE7CF.81D804ED@sky.net>:
^^  Is there a way to delete files that are older that a certain time?  

I would use find, using either `-exec rm {}' or `| xargs rm'. If you
want to keep it Perl only, you could use File::Find, but I find that
too much hassle compared to find.



Abigail
-- 
#!/opt/perl/bin/perl -w
$\ = $"; $SIG {TERM} = sub {print and exit};
kill 15 => fork for qw /Just another Perl Hacker/;


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

Date: 5 Jun 2001 11:27:06 +1000
From: "Kiel R Stirling" <taboo@comcen.com.au>
Subject: Help with subroutines.
Message-Id: <3b1c356a$1@nexus.comcen.com.au>


Hi all,

Can anyone see where I'm going wrong?

_START_
 
my $rsh = sub {
        my $rsh_whereis = `whereis rsh 2>/dev/null`;
        my( $null, $paths );
        ( $null, $path )  = split ":", $rsh_whereis;
        return $path;
};

print $rsh;

_END_

prints CODE(0x8101748) which looks like a ref.


Any help would be great.

Regard,

Kiel R Stirling


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

Date: Tue, 5 Jun 2001 04:20:15 +0200
From: buggs <buggs-clpm@splashground.de>
Subject: Re: Help with subroutines.
Message-Id: <9fhfmr$6du$03$1@news.t-online.com>

Kiel R Stirling wrote:

> my $rsh = sub {
>         my $rsh_whereis = `whereis rsh 2>/dev/null`;
>         my( $null, $paths );
>         ( $null, $path )  = split ":", $rsh_whereis;
>         return $path;
> };
> 
> print $rsh;

> prints CODE(0x8101748) which looks like a ref.

It is a ref.
You could dereference with $rsh->() or &$rsh.

What about:

my $rsh = sub
{
        my($path) = `whereis rsh 2>/dev/null` =~ m!(/.*)!;
        return $path if (-e $path);
};
 
print &$rsh;


Buggs


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

Date: 5 Jun 2001 13:22:15 +1000
From: "Kiel R Stirling" <taboo@comcen.com.au>
Subject: Re: Help with subroutines.
Message-Id: <3b1c5067$1@nexus.comcen.com.au>


buggs <buggs-clpm@splashground.de> wrote:
>Kiel R Stirling wrote:
>
>> my $rsh = sub {
>>         my $rsh_whereis = `whereis rsh 2>/dev/null`;
>>         my( $null, $paths );
>>         ( $null, $path )  = split ":", $rsh_whereis;
>>         return $path;
>> };
>> 
>> print $rsh;
>
>> prints CODE(0x8101748) which looks like a ref.
>
>It is a ref.
>You could dereference with $rsh->() or &$rsh.
>
>What about:
>
>my $rsh = sub
>{
>        my($path) = `whereis rsh 2>/dev/null` =~ m!(/.*)!;
>        return $path if (-e $path);
>};
> 
>print &$rsh;
>
>
Buggs,
Thanks 4 that ;)

Regards,

Kiel R Stirling



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

Date: 4 Jun 2001 18:49:33 -0700
From: weedmonster_99@yahoo.com (codeslayer)
Subject: Re: Help with the $0 equivalent, portable for use in DOS/Windows/Win32-based environment.
Message-Id: <4b459565.0106041749.6bfff5f0@posting.google.com>

Thank you all for your responses:

I am sorry; the $0 does work!  I kept seeing the output of $0 and it
just looked like clutter, until I realized that it was the fully
qualified path to the file, not just the file name. I put in some
white space and then it looked good.

I discovered from another post how to use:

    use File::Basename;
          my $progname = basename($0);

 ... and I implemented that in my code to give me just the file name
w/o the path. Now it works and I am good to go!

Thanks again to all.

-----

"Charles K. Clarkson" <c_clarkson@hotmail.com> wrote in message news:<BD3B46323E48E9C0.2C8936796E0D029D.635E13AE4BBE4E20@lp.airnews.net>...
> codeslayer <weedmonster_99@yahoo.com> wrote:
> : Greetings:
> : 
> : I have a simple question:
> : 
> : I am not using UNIX, (though I usually do at work),
> : and I need a RELIABLE method for automatically grabbing
> : the name of a PERL program and telling the user what it
> : is, in DOS or Windows. I have already tried the
> : following:
> : 
> :    print "The name of this file is $0 \n";
> 
>     This works fine on my win98 machine.
> 
> :      and
> : 
> :    print "The name of this file is $ARGV[0] \n";
> 
>     $ARGV[0] is not the program name in perl. You may
> be thinking of C and argv[0]. perl uses $ARGV[0] as
> the first argument on the command line.
> 
> HTH,
> Charles K. Clarkson
> 
> 
> Successful people do the things
>  unsuccessful people don't like to do.


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

Date: 04 Jun 2001 18:43:47 -0500
From: Ren Maddox <ren@tivoli.com>
Subject: Re: How to add a 0 in front of single number???
Message-Id: <m3r8wzvmj0.fsf@dhcp9-173.support.tivoli.com>

On Mon, 04 Jun 2001, rsherman@ce.gatech.edu wrote:

> not certain whether OP wants formatting solution (in which case
> sprintf works) or pattern matching, but if the latter:
> 
> perl -e '$d="jabber67foo7widget 8 bar 8000";
> $d=~s/(?<=\D)(\d)(?=\D)/0$1/g; print $d."\n";'

A slight change handles solitary digits at the beginning or end of the
string as well:

  s/(?<!\d)(\d)(?!\d)/0$1/g

-- 
Ren Maddox
ren@tivoli.com


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

Date: 4 Jun 2001 18:36:06 -0700
From: ric_j_hill@hotmail.com (rabs)
Subject: instaling perl on windows newbie question
Message-Id: <36218de0.0106041736.5d1f56db@posting.google.com>

sorry if this is to basic but Ive been trying for 6 hours to instal
perl on a windows 98 system.I cant get this to work.I know I should
use linux but this pc needs to use windows. I am using active state
perl but I need to know where i put it and what i do with it.


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

Date: Tue, 05 Jun 2001 02:57:01 GMT
From: clintp@geeksalad.org (Clinton A. Pierce)
Subject: Re: instaling perl on windows newbie question
Message-Id: <1UXS6.30357$DG1.5211867@news1.rdc1.mi.home.com>

[Posted and mailed]

In article <36218de0.0106041736.5d1f56db@posting.google.com>,
	ric_j_hill@hotmail.com (rabs) writes:
> sorry if this is to basic but Ive been trying for 6 hours to instal
> perl on a windows 98 system.I cant get this to work.I know I should
> use linux but this pc needs to use windows. I am using active state
> perl but I need to know where i put it and what i do with it.

If you followed the defaults, it wound up in c:\perl.  The actual perl
interpreter is at c:\perl\bin\perl.exe and associated with the file
extension .pl.

If you didn't take the defaults, you're on your own.

-- 
    Clinton A. Pierce              Teach Yourself Perl in 24 Hours  *and*
  clintp@geeksalad.org         Perl Developer's Dictionary -- May 2001
"If you rush a Miracle Man,     for details, see http://geeksalad.org     
	you get rotten Miracles." --Miracle Max, The Princess Bride


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

Date: Tue, 5 Jun 2001 13:33:34 +0800
From: "keng" <keng@spinalfluid.com>
Subject: Re: instaling perl on windows newbie question
Message-Id: <9fhr0a$qu9$1@clematis.singnet.com.sg>

hi
pls try http://www.netcat.co.uk/rob/perl/win32perltut.html

i had successfully installed & run
ActivePerl-5.6.0.623-MSWin32-x86-multi-thread.msi
downloaded from ActivePerl and following a bit of his instructions :)

ya i agree that for newbie, it may be easier to use the defaults first.
Anyway Rob's tutorial is pretty clear

regards
another newbie
------------------------------------------
"Clinton A. Pierce" <clintp@geeksalad.org> wrote in message
news:1UXS6.30357$DG1.5211867@news1.rdc1.mi.home.com...
> [Posted and mailed]
>
> In article <36218de0.0106041736.5d1f56db@posting.google.com>,
> ric_j_hill@hotmail.com (rabs) writes:
> > sorry if this is to basic but Ive been trying for 6 hours to instal
> > perl on a windows 98 system.I cant get this to work.I know I should
> > use linux but this pc needs to use windows. I am using active state
> > perl but I need to know where i put it and what i do with it.
>
> If you followed the defaults, it wound up in c:\perl.  The actual perl
> interpreter is at c:\perl\bin\perl.exe and associated with the file
> extension .pl.
>
> If you didn't take the defaults, you're on your own.
>
> --
>     Clinton A. Pierce              Teach Yourself Perl in 24 Hours  *and*
>   clintp@geeksalad.org         Perl Developer's Dictionary -- May 2001
> "If you rush a Miracle Man,     for details, see http://geeksalad.org
> you get rotten Miracles." --Miracle Max, The Princess Bride




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

Date: Tue, 5 Jun 2001 05:58:32 +0000 (UTC)
From: abigail@foad.org (Abigail)
Subject: Re: locking files before writing data (?)
Message-Id: <slrn9hot88.icp.abigail@tsathoggua.rlyeh.net>

Bart Lateur (bart.lateur@skynet.be) wrote on MMDCCCXXXIV September
MCMXCIII in <URL:news:knnnhtc7t4073hnp9pl7kgn4ji74h3ejrb@4ax.com>:
**  Muddy Cat wrote:
**  
** >Oddly... the code has just been appending
** >to the end of the file, rather than overwriting. The "seek" bit has since
** >been taken out. I originally did want "newest at the top" but, as you say,
** >it's a bit too much of a chore.
**  
**  Perhaps you want a different approach. Removing the first line from a
**  log every time a new line gets added, is a bit of a chore. Hav you
**  thought of rotating logs? Once a file gets too big, you open a new log
**  file, archiving older logs. After some files are opened, the oldest log
**  file gets discarded.

But that means your recent logs are not always on the same place.

Use a database. ;-)



Abigail
-- 
perl -wle\$_=\<\<EOT\;y/\\n/\ /\;print\; -eJust -eanother -ePerl -eHacker -eEOT


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

Date: Mon, 4 Jun 2001 15:43:37 +0100
From: "Ben Holness" <bholness@nortelnetworks.com>
Subject: Re: Newbie Post : Flushing output for long scripts
Message-Id: <9fg6uu$if$1@qnsgh006.europe.nortel.com>

Unfortunately neither of these options solve my problem.

$|=1, which I had already tried, doesn't make any difference.

CGI::Push documentation says that it won't work for IE, which is our
corporate standard, so no-one uses netscape :(

It's a real pain, because I have a perl script that reads a file, processes
it, prints a line of text, then reads the next file and so on...

The problem is that the user gets bored waiting, or I get a timeout before
the script has finished, so it would be nice to be able to feed them a line
at a time...

Cheers,

Ben

"John Imrie" <07950232225@one2one.net> wrote in message
news:3B174D66.87A211F8@one2one.net...
>
>
> Stefan Weiss wrote:
>
> > Ben Holness <bholness@nortelnetworks.com> wrote:
> >
> > > I put this in a print statement, but that doesn't seem to get to the
browser
> > > until the whole script is finished, or the user presses stop. Is there
any
> > > way to force it out while the script is still running?
> >
> > Yes.
> > $| = 1;
> > see `perldoc perlvar`
> >
> > cheers,
> > stefan
>
> Actualy that probably wont work either as a web browser does not have to
display a
> page untill it has it all.
>
> What you require is Server Push with a multipart document see the
documentation
> for CGI.pm
>




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

Date: Tue, 5 Jun 2001 05:23:48 +0200
From: buggs <buggs-clpm@splashground.de>
Subject: Re: Newbie Post : Flushing output for long scripts
Message-Id: <9fhje0$9g$06$1@news.t-online.com>

Ben Holness wrote:

> CGI::Push documentation says that it won't work for IE, which is our
> corporate standard, so no-one uses netscape :(

Try it out.
Note that the docu does not specify a version of IE.
Don't believe no documentation without sanity check ;-)

Buggs



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

Date: 4 Jun 2001 20:00:28 -0700
From: cybok@nobreak.com (Paul Cho)
Subject: Re: Newbie question ...
Message-Id: <36e3e8b9.0106041900.60ebfa8@posting.google.com>

Thanks for your advice.

So bellow is the complete code followed your advice.

But it still yield any thing.

Can you look into it?
--------------------------------------
sub crazy_look {

     opendir(DIR, "$BaseDir/$MesgDir") || die
"'$BaseDir/$MesgDir'&#47484; &#50676;&#51648;
&#47803;&#54664;&#49845;&#45768;&#45796;.:$!";
        @list = grep{ -T && /\.txt$/} map { "$BaseDir/$MesgDir"}
readdir(DIR);
     close(DIR);

     foreach my $file(@list) {

     open(FILE, $list) || die "'$file'&#51012; &#50676;&#51648;
&#47803;&#54664;&#49845;&#45768;&#45796;.:$!";

     while (my $data= <FILE>) {

       @v = split(/\|/, $data);

print <<__END_OF_PRINT__;
       $v[0].Date=$v[5]
           $v[0].Name=$v[3]
           $v[0].Email=$v[4]
           $v[0].Thread=0
           $v[0].Lines=2
           $v[0].Domain=61.74.200.21
           $v[0].Subject=$v[6]
           $v[0].Access=0
           $v[0].Text=$v[7]
__END_OF_PRINT__

         }

        close(FILE);

    }
}
===============================

Thanks.

--
Yeon Bok, Cho  <cybok@nobreak.com> Sales Manager.
"Whatever you can do, or dream you can, begin it.
Boldness has genius, power and magic in it."
http://www.CrazyWWWBoard.com ... http://www.cgiserver.net

mgjv@tradingpost.com.au (Martien Verbruggen) wrote in message news:<slrn9hgtju.tjn.mgjv@martien.heliotrope.home>...
> On 1 Jun 2001 21:22:02 -0700,
>     Paul Cho <cybok@nobreak.com> wrote:
> 
> 1) You need to start using -w
> 2) You need to start using strict.
> 3) You need to start using -w and strict.
> 4) Use -w and strict.
> 5) Always program with -w and strict, unless you know why not.
> 
> Did I mention that you probably should use -w and strict?
> 
> > 
> >     opendir(DIR, "$BaseDir/$MesgDir");
> 
> Always check system calls and such for errors:
> 
> opendir(DIR, "$BaseDir/$MesgDir") or 
>     die "Cannot opendir '$BaseDir/$MesgDir': $!"
> 
> >         @list = grep(-T, /(.*).txt/, readdir(DIR));
> 
> What is your goal here? To only get files with the extension .txt? or
> only files that are "text files" according to -T? or both?
> 
> @list = grep { -T && /\.txt$/ } readdir(DIR);
> 
> -T is quite expensive. If you think you have files with a .txt extension
> that contain something else than ascii text, maybe you should choose a
> different extension.
> 
> AND:::: this will ONLY work if $BaseDir/$MesgDir happens to be your
> current directory.
> 
> Readdir only contains the name of the file as it appears in the opened
> directory. it does _not_ return the whole path. If you want the whole
> path, maybe you should do something like this, instead of the line
> earlier:
> 
> @list = grep { -T && /\.txt$/ } 
>         map { "$BaseDir/$MesgDir" } 
>         readdir(DIR);
> 
> This gives you the 'full' paths to the files in @list, so that your
> opens later on also know where to get them,
> 
> Read about opendir, grep, -T and map in perlfunc, and about regular
> expressions in perlre.
> 
> >     foreach $list(@list) {
> 
> I'd rather say something like:
>     
>     foreach my $file (@list) 
>     {
> 
> but I'll leave $list in there.
> 
> >          open(FILE, $list);
> 
> See above:
> 
>             open(FILE, $list) or die "Cannot open '$file': $!"
> 
> >          while (<FILE>) {
> 
> Here you read a line in $_
> 
> >            $data = <FILE>;
> 
> And here you read the next line in $data.
> 
> Did you mean:
> 
>             while (my $data = <FILE>)
>             {
> 
> instead?
> 
> Read perlop.
> 
> >            @v = split(/\|/, $data);
> > 
> >           print "$v[0].Date=$v[5]\n";
> >           print "$v[0].Name=$v[3]\n";
> >           print "$v[0].Email=$v[4]\n";
> >           print "$v[0].Thread=0\n";
> >           print "$v[0].Lines=2\n";
> >           print "$v[0].Domain=61.74.200.81\n";
> >           print "$v[0].Subject=$v[6]\n";
> >           print "$v[0].Access=0\n";
> >           print "$v[0].Text=$v[7]\n";
> 
> print <<EOFOO;
> $v[0].Data=$v[5]
> $v[0].Name=$v[3]
> etc..
> EOFOO
> 
> Look up here-docs in perldata.
> 
> > Can anybody look into it?
> > it's not working.
> 
> Next time you have a problem, don't say "it isn't working". Say WHICH
> bit isn't working, and what you need it to do. What do you expect? What
> happens?
> 
> And please, LEARN to ask perl for help, by using -w, strict, and by
> religiously checking all important function calls.
> 
> Also, you could have easily printed out the values in @list, to see if
> there's anything there at all. You have several errors in your program,
> each of which may have caused problems that you saw, but you didn't even
> try to get any information from Perl itself. 
> 
> > Yeon Bok, Cho  <cybok@nobreak.com> Sales Manager.
> > "Whatever you can do, or dream you can, begin it.
> > Boldness has genius, power and magic in it."
> 
> So does Perl, once you use it correctly.
> 
> Martien


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

Date: 05 Jun 2001 06:35:56 +0200
From: Frank Bederke <Frank.bederke@debeka.de>
Subject: Perl + Windows
Message-Id: <3b1c61ac$1@netnews.web.de>

Hallo,



ich beschäftige mich recht kurz mit Perl und brauche dringend Eure Hilfe!! 
Ich will auf einem Win2k Server ein Perlskript als Dienst laufen lassen, das mir 
alle Event des Eventlogs sofort nach der Entstehung in eine Datei auf einem 
anderen Rechner schreibt. 
Falls jemand eine Idee hat wäre ich für eine Antwort dankbar.



Bis dahin
Frank
 

-- 
__________________________________________________________
News suchen, lesen, schreiben mit http://newsgroups.web.de


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

Date: Tue, 05 Jun 2001 01:34:14 GMT
From: Dan <nospam@newsranger.com>
Subject: Re: Perl and SHTML
Message-Id: <qGWS6.4502$v4.229285@www.newsranger.com>

In article <hZSS6.4226$v4.216429@www.newsranger.com>, Dan says...
>
>I have a page that contains a text box and when it is submitted it calls a Perl
>file.  That Perl file then takes the input and loads the selected stock quote.
>This part works fine, but I want to integrate this .pl file into a .shtml file
>so I can put it wherever I want to in my layout.  The .shtml layout file
>contains top and bottom includes which have exec commands inside of them.  I
>cannot think of a way to get input from a input box into a .shtml file.  Would
>it be possible to retrieve the MSFT portion using an exec command with a .pl
>file on a page like quote.shtml?MSFT
>
>Can I use an exec command or something similar to that in a .pl file?  I have
>not been able to come up with any good answers to this problem...  Any ideas?
>
>Thanks,
>Dan
>
>

I did think of a solution for the problem using LWP::Simple to retrieve the
layout .shtml files.  Thanks to those who replied.

Dan




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

Date: Tue, 5 Jun 2001 11:54:38 +1000
From: "KayKay" <kknguyen@epicworld.com.au>
Subject: Perl Dummy!
Message-Id: <9fhe3r$7f0$1@perki.connect.com.au>

Hi All,

I am a Perl dummy, no nothing about Perl! :-).
I got this little function in Perl below. Could anyone please help me to
translate it into plan English or to other languages such C, C++, Java or VB
that would very much appreciated!

Thanks in Advance!
Regards,
Kaykay
---------------
%checkTable = (0 => 0, 1 => 2, 2=> 4, 3 => 6, 4 => 8,

5 =>1, 6 => 3, 7 => 5, 8 => 7, 9 => 9);

sub cardCheck {

local ($card) = $_[0];


@digits = split(//, $card);


local ($sum) = 0;

local ($mult) = 0;

while( scalar(@digits) ){

if($mult) {

        $sum += $checkTable{pop(@digits)};

}else{

        $sum += pop(@digits);

}

$mult = !$mult;

}


# $sum now contains the check sum. We simply need to make sure that

# it is a multiple of 10.

if ( ( $sum % 10 ) == 0 ){

return 0;

}else{

    return 1;

    }

  }

1. What is Checktable support to do here?
2. Scalar, what is that?
3. Pop, is it built in function?






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

Date: Tue, 05 Jun 2001 02:55:29 GMT
From: clintp@geeksalad.org (Clinton A. Pierce)
Subject: Re: Perl Dummy!
Message-Id: <BSXS6.30356$DG1.5210419@news1.rdc1.mi.home.com>

[Posted and mailed]

In article <9fhe3r$7f0$1@perki.connect.com.au>,
	"KayKay" <kknguyen@epicworld.com.au> writes:
> I am a Perl dummy, no nothing about Perl! :-).
> I got this little function in Perl below. Could anyone please help me to
> translate it into plan English 

Sure!

>or to other languages such C, C++, Java or VB
> that would very much appreciated!

*GAK* *GAK*

Begin verboseness.  I _am_ going to oversimplify and use small words
here.  The nitpickers in the audience should go sit on their thumbs.

Setup a hash, associating the key 0 with the value 0,
key 1 with the value 2, the key 2 with the value 4, etc..

> %checkTable = (0 => 0, 1 => 2, 2=> 4, 3 => 6, 4 => 8,
> 5 =>1, 6 => 3, 7 => 5, 8 => 7, 9 => 9);


Define a subroutine named cardCheck.  The variable $card's value is going
to be localized to this subroutine (and any called subroutines).  The
variable is initialized to the first argument value passed to cardCheck.

> sub cardCheck {
> local ($card) = $_[0];  

Take the value in $card and split it up into a list.  Each character
of $card becomes an element in the list which is assigned to @digits.

> @digits = split(//, $card);

Two more localized variables $sum and $mult are initialized to 0.

> local ($sum) = 0;
> local ($mult) = 0;

[This is actually a pretty strange way of coding this loop, but I'll
explain it as it sits.]  

"So long as the number of elements in @digits is nonzero..loop"

@digits in a scalar context gives the number of elements in it.  The
scalar operator "casts" the operand into a scalar context, and is actually
redundant here.
 
> while( scalar(@digits) ){


If $mult is true (defined, nonzero, nonnull) then...
 
> if($mult) {

Take the last element from @digits and use that as a key into the hash
%checkTable.  Take the looked-up value and accumulate it into $sum.
 
>         $sum += $checkTable{pop(@digits)};
> 
> }else{

Just add in the last character from @digits, whatever that is.

>         $sum += pop(@digits);
> 
> }

Flip $mult from 0 to 1, or from 1 to 0.

> $mult = !$mult;
> 
> }

> # $sum now contains the check sum. We simply need to make sure that
> # it is a multiple of 10.
> if ( ( $sum % 10 ) == 0 ){
> return 0;
> }else{
>  return 1;
>   }
> 
>   }
> 
> 1. What is Checktable support to do here?
> 2. Scalar, what is that?
> 3. Pop, is it built in function?

Might I suggest a good book on Perl?  See the .signature for a suggested
title.  Others have been recommended as well, see http://groups.google.com
to search for old discussions on this topic.

-- 
    Clinton A. Pierce              Teach Yourself Perl in 24 Hours  *and*
  clintp@geeksalad.org         Perl Developer's Dictionary -- May 2001
"If you rush a Miracle Man,     for details, see http://geeksalad.org     
	you get rotten Miracles." --Miracle Max, The Princess Bride


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

Date: Tue, 05 Jun 2001 05:07:58 GMT
From: "Patrick Joyce" <joycefive@earthlink.net>
Subject: perl prog for win2k file manipulation
Message-Id: <OOZS6.2965$fI.302979@newsread1.prod.itd.earthlink.net>

hey im a newbie and i need some direction.
I want to create a program that reads all the filenames in the current
directory and then renames them to incrementing names. for instance where i
may have the files.
foowho.jpg, foome.jpg, fooyou.jpg
and id want to rename them to somethinglike this
aaa.jpg, aab.jpg, aac.jpg....aba.jpg, abb.jpg, abc.jpg
or even
1.jpg, 2.jpg, 3.jpg

also i dont care which filename is changed to what just as long as they are
all changed and renamed to an incrementing value. I am also on a Win 2000,
system.
Thanks,
Patrick Joyce
joycefive@earthlink.net





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

Date: Tue, 5 Jun 2001 08:22:19 +0200
From: buggs <buggs-clpm@splashground.de>
Subject: Re: To all the Newbies and Lurkers outthere
Message-Id: <9fhtsk$ng1$01$1@news.t-online.com>

Hoi,

We have met our minimum of 3 participants.

Project has been approved by sourceforge. See:
https://sourceforge.net/projects/lilproxy/
http://sourceforge.net/projects/lilproxy/

Put up a Mailinglist there.
But if it is as crappy slow as it appears
we'll use our own ;-)

Michael Schilli author of the original programm
has approved that we can use his source :-)

There was some confusion about the word "Newbie".
I did not know of any negativ meaning.
So Beginners are also welcome.

Last update posted on comp.lang.perl.misc will be
at Sunday. If you say hello until then your
opinion concerning certain parameters,
like if we should use sourceforge,
will be taken into account.


THX,
Buggs




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

Date: Tue, 05 Jun 2001 06:44:17 GMT
From: jmd2121@email.com
Subject: todo console script
Message-Id: <3b1c7d0e.127601371@nntp.stanford.edu>

I wrote a script to manage a 'todo' list

it is here:
http://bowser.stanford.edu/cgi-bin/scripts#todo

I'm pretty new to perl, and I was wondering if people could give me
comments on it.  Maybe other people would find it useful too.

Some areas I'd like to have comments on:

-  Coding style...  any criticism would be helpful.  I'm sure there
are things I could do better / more eloquently.

-  I tried to write a signal handler, but it only appears to catch the
first SIGINT (which I expected).  I tried to reset the handler after
the call, (or even in the main loop) but I wasn't ableto get the
handler to continue work.  Am I missing something?

-  It currently will not work on Windows platforms -- some of the
changes are obvious, but others, (like calling system (stty)) are not.
Any suggestions for making it portable?

I'd appreciate any (constructive) comments people have!


Thanks!
Jon
jmd2121@email.com



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

Date: Tue, 05 Jun 2001 03:43:20 GMT
From: Jeff Thies <cyberjeff@sprintmail.com>
Subject: Re: Web Host that supports Gimp or Image Magick...
Message-Id: <3B1C54A5.13CCEB80@sprintmail.com>

> Anyways, I am in search of a Web Host that supports either
> GIMP or Image Magick. Any recomendations or would I have to get a
> Dedicated Server?

I use this (Image::Magick) fairly often. My host is: cedant.com , they
may have to install it on the server that you wind up on. Also,
bluegenesis.com has this module.  Neither would have had it if I hadn't
convinced them to install it and provided the install routine. It wasn't
easy.

 It is almost impossible (well maybe it is impossible) to install
Image::Magick without root access.

Jeff


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

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.  

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


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