[15480] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 2890 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Apr 28 11:05:26 2000

Date: Fri, 28 Apr 2000 08:05:14 -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: <956934314-v9-i2890@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Fri, 28 Apr 2000     Volume: 9 Number: 2890

Today's topics:
    Re: "tailing" to a filehandle <andrew.mcguire@walgreens.com>
        a simple shopping cart required <mark@markdw.com>
    Re: CGI Programmer Needed (Bart Lateur)
        error building perl/tk cd_root@my-deja.com
        RE: File Parsing <lr@hpl.hp.com>
    Re: File Parsing <sariq@texas.net>
    Re: Finding text in a file and renaming that file <flavell@mail.cern.ch>
    Re: Graphic submit button ? <cobyw@yahoo.com>
    Re: HELP! text file problem! <rootbeer@redcat.com>
    Re: How could I control session with perl? <rootbeer@redcat.com>
    Re: How could I control session with perl? <red_orc@my-deja.com>
    Re: Info about Backtracking in Regex <rootbeer@redcat.com>
    Re: Info about Backtracking in Regex (Bart Lateur)
    Re: mixing STDERR and STDOUT <lwaibel@cwia.com>
    Re: mixing STDERR and STDOUT <lwaibel@cwia.com>
    Re: Need help with file uploading script <andersen+@rchland.ibm.com>
    Re: Need Help!! CGI (Perl) Problem?!! <rootbeer@redcat.com>
    Re: Need regexp guru help <rootbeer@redcat.com>
    Re: newbie needs help with cgi-input... <tony_curtis32@yahoo.com>
    Re: Perl can't find specific XML::DOM package <rootbeer@redcat.com>
    Re: perl in NT .BAT files Question <DNess@Home.Com>
    Re: perl in NT .BAT files Question <DNess@Home.Com>
        Perl to Java Bytecode Compiler? <slu_2@altavista.net>
    Re: PerlScript error with IIS or Win2000 <ronnie@catlover.com>
    Re: PerlScript error with IIS or Win2000 <gellyfish@gellyfish.com>
        Print Just Once When in (<>)? <e.roselli@volusoft.com>
    Re: Random number <tfm@sei.cmu.edu>
        Raw network traffic <csybrandy@nospam.com>
    Re: Raw network traffic <sariq@texas.net>
    Re: Regular Expression Newbie <lr@hpl.hp.com>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Fri, 28 Apr 2000 09:59:13 -0500
From: "Andrew N. McGuire" <andrew.mcguire@walgreens.com>
Subject: Re: "tailing" to a filehandle
Message-Id: <3909A741.3BA34212@walgreens.com>

jim wrote:
> 
> Hi all,
>     I'm trying to tail a log file and access that info using a filehandle
> for proccessing, but I can't get it to work.  The basic idea I'm hung up on
> is this:

perldoc -q tail

anm
-- 
Andrew N. McGuire
andrew.mcguire@walgreens.com


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

Date: Fri, 28 Apr 2000 15:39:25 +0100
From: "m a r k d w" <mark@markdw.com>
Subject: a simple shopping cart required
Message-Id: <8ec7p8$24o$1@gxsn.com>

Dear Group,

I am after a simple shopping cart script. I have looked on the usual freebie
sites but all of the scripts I have found have been really over complicated
and don't really do what I want them to do..
I will be selling advertising space on a website at £5 a go,  so the user
will need to be able to type in the advert subject and sale price and then
submit it to the shopping basket. Then, in the usual shopping cart way, they
should be able to continue shopping and adding, deleting items from their
cart etc. Then at the checkout all I need to calculate is the total price to
send to the payment service I am using and an e-mail containing the items to
be sent to me and a confirmation to be sent the customer.
The scripts I have looked at so far only allow set items to be added to the
cart. Even though all my items are the same price, there needs to be 3 or 4
fields the user can fill in.
If anyone can point me in the right direction I will be very gratefull, or
if someone wants to give me a quote for writing me a script like this please
mail me - mark@markdw.com

Many thanks in advance,

Mark Williams
mark@markdw.com






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

Date: Fri, 28 Apr 2000 14:00:37 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: CGI Programmer Needed
Message-Id: <390a98ce.1892825@news.skynet.be>

dereksas@yahoo.com wrote:

>I'm looking for a cgi coder to create a custom cgi script for use on a
>website I'm working on. Of course, this would be a paying job.

Gee, for a moment I thought your were asking for a SCRIPT that would
generate CGI scripts. A bit like a "CGI wizard" (in MS terms). Of
course, this is Perl, not only can it be done, but it wuldn't be too
hard either.

-- 
	Bart.


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

Date: Fri, 28 Apr 2000 13:51:06 GMT
From: cd_root@my-deja.com
Subject: error building perl/tk
Message-Id: <8ec503$qs6$1@nnrp1.deja.com>

When (*trying*) to build the perl/Tk module on my Solaris system,
immediately after all the copies, I begin receiving errors on the gcc
lines (sample shown below).  It appears that it's trying to build on a
pentium platform (the -x switch) ... I'm on Sparc.  Is this a problem
with the perl/Tk build, or gcc?  I've compiled other code without
problems.  Any/all help appreciated.
jc

Here's a sample line with the error ...

gcc -c -I.. -I/usr/openwin/include -I. -Ibitmaps -
I/usr/openwin/include  -xpentium -xO4     -DVERSION=\"800.020\"  -
DXS_VERSION=\"800.020\" -fPIC - /opt/perl/lib/perl5/sun4-solaris/5.004

gcc: language O4 not recognized


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Fri, 28 Apr 2000 06:33:36 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: RE: File Parsing
Message-Id: <MPG.13733306a6657aa198a99e@nntp.hpl.hp.com>

In article <8ebn3q$c51$1@nnrp1.deja.com> on Fri, 28 Apr 2000 09:54:06 
GMT, scarey_man@my-deja.com <scarey_man@my-deja.com> says...
> 
> > >If I have a file with the following line:
> > >aaaa    bbbb  cccc       dddd
> > >how can I read the line into an array using split, even though the
> > >field separators are different lengths each time e.g. 4 spaces, and
> > >then 2 spaces?
> 
> Thanks to all who replied but here is my solution and it works
> (using $_)
>         $/ = "\w";
>         @items =split;

It is good that it 'works', and the second line is certainly in 
accordance with what you have been shown.  But the first line is at best 
bizarre.  It has nothing to do with the problem at hand.

If you were to try next to read a line from a file, Perl would treat a 
'w' as the record-termination character.  Why would you want that?  (I'm 
pleased to see that perl 5.6.0 gives a warning for that invalid escape 
sequence.)

The value of $/, the input record separator, is a string, not a regex.  
I suggest you look it up in perlvar, and then decide what you really 
want to do.

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


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

Date: Fri, 28 Apr 2000 08:57:27 -0500
From: Tom Briles <sariq@texas.net>
Subject: Re: File Parsing
Message-Id: <390998C7.F66BA607@texas.net>

scarey_man@my-deja.com wrote:
> 
> > >If I have a file with the following line:
> > >aaaa    bbbb  cccc       dddd
> > >how can I read the line into an array using split, even though the
> > >field separators are different lengths each time e.g. 4 spaces, and
> > >then 2 spaces?
> >
> 
> Thanks to all who replied but here is my solution and it works
> (using $_)
>         $/ = "\w";
>         @items =split;

Well, it will "work" in the sense that @items will contain the proper
values.  But who knows what it might *break*.

Why you would want to set the input record separator to the character
'w' is beyond me...

I recommend a hearty dose of perlvar to discover what havoc you've
wreaked.

- Tom


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

Date: Fri, 28 Apr 2000 15:30:27 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: Finding text in a file and renaming that file
Message-Id: <Pine.GHP.4.21.0004281529370.18513-100000@hpplus01.cern.ch>

On Fri, 28 Apr 2000, Morbus Iff wrote:

> Welp, I'm not sure how'd you'd change the name of a file within Perl 
> (anyone know?), 

perldoc -f rename

> but if you can piece together my thoughts,

I didn't know there was any call for that here.




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

Date: Fri, 28 Apr 2000 14:53:31 GMT
From: Coby West <cobyw@yahoo.com>
Subject: Re: Graphic submit button ?
Message-Id: <8ec8l3$v5r$1@nnrp1.deja.com>




In article <Lc3O4.1805$f5.12130@typhoon1.san.rr.com>,
  "Nathan D Hiller" <nhiller@san.rr.com> wrote:
>
>
> Does anyone know how to use a graphic for a submit button in php3 ?
> I would really appreciate any suggestions, I have been working on
> this problem for a week.
>
> Please send me an email in case I do not find your response on the
> newsgroup.
>
> Thanks,
>
> Nathan Hiller
> nhiller@san.rr.com
>
> Do you mean??

<form method=method action=action>
<input type=image src=file path name=name border=0 height=height
width=width>
</form>

This is the only way I've seen it.

Coby


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Fri, 28 Apr 2000 07:03:46 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: HELP! text file problem!
Message-Id: <Pine.GSO.4.10.10004280703200.21722-100000@user2.teleport.com>

On Fri, 28 Apr 2000, Mark wrote:

> Does anyone know how to get the total rows in a text file when using
> perl?

Have you seen the FAQ's entry on "How do I count the number of lines in a
file?" Cheers!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: Fri, 28 Apr 2000 06:55:12 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: How could I control session with perl?
Message-Id: <Pine.GSO.4.10.10004280652550.21722-100000@user2.teleport.com>

On Fri, 28 Apr 2000, netnews wrote:

> Subject: How could I control session with perl?
> 
> as title. Could somebody tell me commonly how to control session in
> perl script?

What do you mean by "commonly"? What's a "session"? These terms aren't
frequently used in these ways around here.

> Beside using form hidden field, how could I do it?

It sounds as if you may be doing something with the web. Perhaps you
should search for the docs, FAQs, and newsgroups about web-related
programming, such as the newsgroup comp.infosystems.www.authoring.cgi. 

Good luck with it!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: Fri, 28 Apr 2000 14:50:53 GMT
From: Rodney Engdahl <red_orc@my-deja.com>
Subject: Re: How could I control session with perl?
Message-Id: <8ec8g4$v48$1@nnrp1.deja.com>

In article <8ebfg8$i33@netnews.hinet.net>,
  "netnews" <ya_hsiung@ms2.url.com.tw> wrote:
> as title. Could somebody tell me commonly how to control session in
perl
> script?
> Beside using form hidden field, how could I do it?
>
>

Assuming that what you are really asking is how to maintain and control
user interactivity with a particular user across several html pages
(session?), you really do need to ask this question in a web authoring
forum rather than here.

You could use hidden fields in forms to maintain the state of the
'session', or you could use cookies if they are enabled on the client
browser, or there are probably other answers that a well-formed question
in a web authoring forum might bring forth.  This question is more of
that nature than about any specific language implementation.

Good luck.


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Fri, 28 Apr 2000 07:11:27 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: Info about Backtracking in Regex
Message-Id: <Pine.GSO.4.10.10004280704560.21722-100000@user2.teleport.com>

On Fri, 28 Apr 2000, Javier Hernandez wrote:

> I am interesting in understanding the backtracking process
> in Regex.
> I am actually reading "Mastering Regular Expressions" but
> I will need more specific information about Backtracking.

Okay; just what do you need to know that's not covered in MRE? It's a
pretty thorough book, although there's always more depth to the problem.

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: Fri, 28 Apr 2000 14:17:37 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: Info about Backtracking in Regex
Message-Id: <390d9c54.2794529@news.skynet.be>

Javier Hernandez wrote:

>I am interesting in understanding the backtracking process
>in Regex.
>I am actually reading "Mastering Regular Expressions" but
>I will need more specific information about Backtracking.

The index page
<http://www.perl.com/reference/query.cgi?section=regexp&x=13&y=12>
contains two particularily interesting links:

 "Backtracking in regular expressions",
<http://language.perl.com/all_about/back.html>, part of TomC's FMTEYWK
series, and 

MJD's article "How regexes work",
<http://www.plover.com/~mjd/perl/Regex/>. (Yes, it's back online.) See
the subsection "Lies".

-- 
	Bart.


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

Date: Fri, 28 Apr 2000 06:21:07 PDT
From: Larry R. Waibel <lwaibel@cwia.com>
Subject: Re: mixing STDERR and STDOUT
Message-Id: <VA.00000032.0213be48@cwia.com>

In article <Pine.GSO.4.10.10004270824060.21722-100000@user2.teleport.com>, 
Tom Phoenix wrote:
> unless (open STDERR, ">>&STDOUT") {
>
Thank; good suggestion.



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

Date: Fri, 28 Apr 2000 06:21:03 PDT
From: Larry R. Waibel <lwaibel@cwia.com>
Subject: Re: mixing STDERR and STDOUT
Message-Id: <VA.00000031.0213ae88@cwia.com>

In article <MPG.1371fddecd1fe90b98a997@nntp.hpl.hp.com>, Larry Rosler wrote:
> $| = 1;
> 
> sets the autoflush on the currently selected output filehandle, which by 
> default is STDOUT.  You have to do it explicitly for STDERR also.
>
Ahhhhh, thanks, missed that in the docs.



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

Date: Fri, 28 Apr 2000 07:48:10 -0500
From: "Paul R. Andersen" <andersen+@rchland.ibm.com>
Subject: Re: Need help with file uploading script
Message-Id: <39098889.C31D9142@rchland.ibm.com>

And the most likely part of  "You did it wrong" is, you forgot to do it in
binary.

Paul Amdersen

Tom Phoenix wrote:

> On Thu, 27 Apr 2000 rockit7515@my-deja.com wrote:
>
> > I put free file uploading script on my server. Everything works fine
> > except little but very impotant detail: after a .JPG image (I need
> > only images to upload) is uploaded, it can't be opened. Can anybody
> > tell me what's the reason for this?
>
> You did it wrong. :-)
>
> Without seeing something more, like some source code, it's pretty hard to
> tell from here. Maybe you should cut your code down to the smallest
> example which demonstrates your problem, then post it here.
>
> --
> Tom Phoenix       Perl Training and Hacking       Esperanto
> Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/

--
Paul Andersen
-- I can please only ONE person per day.
-- Today is NOT your day.
-- Tomorrow isn't looking good either.





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

Date: Fri, 28 Apr 2000 06:51:23 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: Need Help!! CGI (Perl) Problem?!!
Message-Id: <Pine.GSO.4.10.10004280651050.21722-100000@user2.teleport.com>

On Fri, 28 Apr 2000, Kelvin wrote:

> I tried run it in the browser, but the script is not running.

When you're having trouble with a CGI program in Perl, you should first
look at the please-don't-be-offended-by-the-name Idiot's Guide to solving
such problems. It's available on CPAN.

   http://www.perl.com/CPAN/
   http://www.cpan.org/
   http://www.cpan.org/doc/FAQs/cgi/idiots-guide.html
   http://www.cpan.org/doc/manual/html/pod/

Hope this helps!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: Fri, 28 Apr 2000 07:02:15 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: Need regexp guru help
Message-Id: <Pine.GSO.4.10.10004280701420.21722-100000@user2.teleport.com>

On Fri, 28 Apr 2000, Hermann Fass wrote:

> open (DATA ,"<myNotesExportFile.txt");

Even when your script is "just an example" (and perhaps especially in that
case!) you should _always_ check the return value after opening a file.

Thanks!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: 28 Apr 2000 08:26:12 -0500
From: Tony Curtis <tony_curtis32@yahoo.com>
Subject: Re: newbie needs help with cgi-input...
Message-Id: <87snw6mk5n.fsf@shleppie.uh.edu>

>> On Fri, 28 Apr 2000 14:50:17 +0200,
>> Ola Jetlund <jetlund@tele.ntnu.no> said:

> After trying for some time I know have a perl script
> that displays all images in a directory.  Now I need to
> be able to specyfi which directry throug a input in
> netscape:

>     /cgi-bin/dispim.pl?gallery

> or something. How do I read this text into the script
> and use it?

    use strict;
    use CGI;
    
    my $dir = query_string();

(Make sure the directory name is a tag which is mapped to
a real directory explicitly somehow in the program, don't
allow the request to pass real/absolute
I'm-part-of-the-filesystem directory names into the
program.)

hth
t


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

Date: Fri, 28 Apr 2000 07:00:03 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: Perl can't find specific XML::DOM package
Message-Id: <Pine.GSO.4.10.10004280659010.21722-100000@user2.teleport.com>

On Fri, 28 Apr 2000 bbrelin@my-deja.com wrote:

> Undefined subroutine &XML::DOM::DocumentType called at
> /usr/lib/perl5/site_perl/5.6.0/XML/DOM.pm line 3475, <GEN2> line 18.
> 
> Yet in looking at the DOM.pm file, there is a package called
> DocumentType.

Is there a subroutine called &XML::DOM::DocumentType? (It's a subroutine
that matters here, not a package.) Hope this helps!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: Fri, 28 Apr 2000 14:19:23 GMT
From: David Ness <DNess@Home.Com>
Subject: Re: perl in NT .BAT files Question
Message-Id: <39099DF5.3FDC9CFF@Home.Com>

BobS wrote:
> 
> Hi,
> Pardon me for butting in here. You guys seem to be doing what I want to do
> and I could use some general help.  TIA...
> 
> I have a large DOS-based app running under NT. Comm is currently scripted
> via modem using BLAST. I want to integrate an FTP capability using the
> existing executables and my thought is to substitute perl script and
> functions for those now performed by BLAST scripts.
> 
> Unfortunately, I'm new to perl and there is an abundance of info available
> that is not easy to digest. Please point me toward some docs, etc. that
> explain perl in a DOS/NTVDM environment. Any help is definitely appreciated.
> 
> Bob
> 

I'd be happy to try to help, either here or off-list, but I'm afraid your
question is a bit `general' to be answered.

There really isn't much to `say' about DOS/NTVDM and perl. Indeed, the
piece of code I asked for help about is just about the only `special'
thing I use that has any particular thing to do with what OS I happen
to be using. Most of the time I don't have to pay any particular attention.
That is one of the _great_ strengths of perl.


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

Date: Fri, 28 Apr 2000 14:37:49 GMT
From: David Ness <DNess@Home.Com>
Subject: Re: perl in NT .BAT files Question
Message-Id: <3909A247.85F71228@Home.Com>

Steve Kemp wrote:
> 
>  That is actually one of the funkiest pieces of code that I've seen
>  for a long time.
> 
> [DN] The fragment looks like this:
> [DN]    @REM='<$MyName Demonstration File - Ver DN-1A(2) - [BKX-LUSZ]$>
> [DN]    @Echo Off
> [DN]    perl %PerlFlag% %BIN%\MyName.BAT %*
> 
>   I'd change that line, so that you don't have to specify the name
>  of the batch file each time:
>     perl %PerlFlag% %0 %*
>

The problem is pathname and extension. Your suggestion is a worthy try, and I 
don't know why I never thought of it. However, in context it doesn't work as it 
would require pathname and extension be typed on the command line, and that is 
one of the things that it is designed to avoid. AFAIK I'd have to type
`C:\BIN\MYNAME.BAT Arg1 Arg2 ...' for your suggestion to work. As things
stand I type `MYNAME Arg1 Arg2 ...'. PATH lets the system find MYNAME.BAT,
but %0 only gets `MYNAME' (I think) _not_ `C:\BIN\MYNAME.BAT' and the perl
command needs to be able to find the file.

> 
>   Ahh, thats what I said really, I cannot think of another way to do
>  this, except to assign a dummy value to the @REM in your perl.
> 
> [DN] Alternatively, is there some better way to handle this whole problem in
> [DN] Windows/perl?
> 
>   The way that I normally do things is to have two files:
> 
>    a.pl
>    a.bat
> 
>   With a.bat containing :
> 
>   @echo off
>   perl %~d0%~p0a.pl %0
> 
>  Your solution is neater as it only has one file, but mine's probably
>  simpler to understand.

The purpose of the code was precisely to avoid having to maintain two
files while allowing the flexibility to `do some windows' just prior and
just post the perl processing. There are some (a few) problems you can solve
this way that are _very_ hard to handle otherwise, particularly problems that
involve changing the working environment.


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

Date: Fri, 28 Apr 2000 10:20:57 -0400
From: Sydney Lu <slu_2@altavista.net>
Subject: Perl to Java Bytecode Compiler?
Message-Id: <ge7jgscj04voqdqvlnur9qjp60g74ao2tk@4ax.com>

I didn't find anything about this in the FAQs, but apologies in
advance if it was. I read an interview that Larry did a while ago, in
which he talked about the possibility of a Perl to Java Bytecode
'compiler,' of sorts. 

Does anyone have any more information on this? Or should I subscribe
to perl-5-porters?

Thanks,
Sydney



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

Date: Fri, 28 Apr 2000 13:15:12 GMT
From: Ron Grabowski <ronnie@catlover.com>
Subject: Re: PerlScript error with IIS or Win2000
Message-Id: <39098F18.3A398D46@catlover.com>

ActivePerl build 613 doesn't work under Windows2000.

http://www.activestate.com/ActivePerl/docs/RELEASE.html#known issues

---
PerlScript currently does not function correctly when being run in an
ASP environment under IIS 5. This appears to be an issue in the
`MSVCRT.DLL' that ships with Windows 2000. We are working to resolve the
problem for a future release. 
---

I would suggest using build 522.

- Ron


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

Date: Fri, 28 Apr 2000 13:50:43 GMT
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: PerlScript error with IIS or Win2000
Message-Id: <TGgO4.1504$fT4.151190@news.dircon.co.uk>

On Fri, 28 Apr 2000 13:15:12 GMT, Ron Grabowski Wrote:
> ActivePerl build 613 doesn't work under Windows2000.
> 
> http://www.activestate.com/ActivePerl/docs/RELEASE.html#known issues
> 
> ---
> PerlScript currently does not function correctly when being run in an
> ASP environment under IIS 5. This appears to be an issue in the
> `MSVCRT.DLL' that ships with Windows 2000. We are working to resolve the
> problem for a future release. 
> ---
> 
> I would suggest using build 522.
> 

That doesnt say "ActivePerl build 613 doesn't work under Windows2000." 
please be a bit more precise as people who might not understand what they
are reading might take you literally.

/J\


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

Date: Fri, 28 Apr 2000 15:55:04 +0300
From: "Elisa Roselli" <e.roselli@volusoft.com>
Subject: Print Just Once When in (<>)?
Message-Id: <8ec5jp$2s7$1@wanadoo.fr>

I'm having a small bug in a script that combines Perl and Korn Shell.

I want this script to test first whether it has been executed on inputFile
before. It scans inputFile for a line of the type "#This program has already
been run on this file". If so, it stops, shows a message on screen to the
same effect and sends an error code to a log file. Otherwise, it starts on
the Perl part of the program, which involves doing some text substitutions
on inputFile and marking inputFile so as to show that the program has been
run.

OK, so it currently looks like this:

***
# Korn shell :

# Test for evidence of previous run
if (grep "#This program has already been run on this file" $1) > 0
 then
 echo ""#This program has already been run on this file"
 resul=3
 else

# make a backup
 cp $1 sauvegarde_trad/$1.001

# Perl part of program, still part of the "else" condition
perl -i -e '$/ = "\n\n";

# The problem line. If I put it here, it prints to screen rather than in the
file
         print "# This program has already been run on this file\n";

         while (<>)


# Instead, if I put problem line here, it prints at the end of every block,
as defined by $/.
# I only want it to print this once at the beginning of inputFile and not
waste all those needless bytes!

         #print "# This program has already been run on this file\n";

# The substitutions
         s/blah blah/bleh bleh/g;

         print $_;
         }' $1

# Back to shell
resul=0
fi

(echo ` date +"%m:%d  -  %H:%M"  `  " - 001 - $1 - $resul")  >>
sauvegarde_trad/trad_log

***

So my question is, where to put my problem line? After the (<>) it prints at
every block, before the (<>) it prints to screen.

I'm sure this must be simple, but I'm not very intelligent and it's Friday
afternoon.

Thanks for any patient recommendations.

Elisa Francesca Roselli




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

Date: Fri, 28 Apr 2000 09:47:50 -0400
From: Ted Marz <tfm@sei.cmu.edu>
Subject: Re: Random number
Message-Id: <39099686.FE08DF48@sei.cmu.edu>

At the risk of being wrong, here is something.

rand (expr) returns a random number between 0 and expr.

so  lower + rand(upper-lower)  would generate a floating point random
number (probably) in the range of [lower, upper).

You are probably looking for integers, and int() truncates, so
int(lower + rand(upper-lower)) wouldn't do the correct thing, as int
truncates and upper would never be reached.

You probably want equal probability, so rounding instead of truncating
wouldn't be correct either, as the extreme values would appear with half
the probability of the median.

so, something like    int(lower + rand(1+upper-lower)) may work out for
you, as long
as rand() delivers numbers in the range of [0,<expr>), rather than in
the range of [0, <expr>]... Which I would have to verify.

ted

Chello wrote:
> 
> Hi all,
> 
> I have a little problem I have to generate a random number with two limits
> (upper limit and down limit) for example 1 and 4. When I call the script
> this script would have to display "1" or "2" or "3" or "4". Does somebody
> knows how to do it? Do you have an example?
> 
> Thanks a lot
> 
> Stéphane


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

Date: Fri, 28 Apr 2000 10:06:17 -0400
From: csybrandy <csybrandy@nospam.com>
Subject: Raw network traffic
Message-Id: <39099AD9.B29B38EA@nospam.com>

Is there a way to read in raw network traffic into Perl?

csybrandy

P.S.  And yes I did check the FAQ :-)


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

Date: Fri, 28 Apr 2000 09:20:34 -0500
From: Tom Briles <sariq@texas.net>
Subject: Re: Raw network traffic
Message-Id: <39099E32.7B33D834@texas.net>

csybrandy wrote:
> 
> Is there a way to read in raw network traffic into Perl?

Do you mean IP packets?

There's a Net::RawIP module on CPAN.

- Tom


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

Date: Fri, 28 Apr 2000 06:45:13 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: Regular Expression Newbie
Message-Id: <MPG.137335be26dbd8c198a99f@nntp.hpl.hp.com>

In article <morbus-E3A7D2.08134028042000@news.totalnetnh.net> on Fri, 28 
Apr 2000 08:13:40 -0400, Morbus Iff <morbus@disobey.com> says...

 ...

> You could do this:
> 
> 
>    # remove tabs and newlines
>    $line =~ /(\t|\n)//;

Ook.  This is a syntax error (match operator followed by a slash).  
Assuming you overlooked the substitution operator, alternation is still 
the slowest way.  And this removes only the first match.  And why 
capture it?

Better:

     $line =~ s/[\t\n]//g;

Best (fastest by far):

     $line =~ tr/\t\n//d;

>    # remove HTML tags:
>    $line =~ /<([^>]+)>/;

This captures into $1 the *possible* contents of an HTML tag (assuming 
there are no nasty constructs such as 'ALT="a > b"', for example).  But 
your comment says something else.

 ...

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


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

Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 16 Sep 99)
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: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.

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 V9 Issue 2890
**************************************


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