[8718] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 2335 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Apr 16 08:07:48 1998

Date: Thu, 16 Apr 98 05:00:51 -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           Thu, 16 Apr 1998     Volume: 8 Number: 2335

Today's topics:
    Re: array of matches in s/// (Bart Lateur)
    Re: automating a terminal session fiend1@earthling.net
    Re: avoid double-click on submit button <grinch@whoville.com>
        Filename into variable <andreas.puttkammer@ubs.com>
    Re: Filename into variable <rra@stanford.edu>
        Filname into variable <andreas.puttkammer@ubs.com>
        Help with DBM file <mferg@hal.ddntl.didata.co.za>
    Re: Help: to eliminate eval() on a HTML Filling script. <tkho@technologist.com>
        How to run Perl cgi on Nt Server ? <info@shopsmart.com.au>
    Re: How to run Perl cgi on Nt Server ? <joerg@gustavsburg.de>
    Re: Incrementing counter <grinch@whoville.com>
    Re: Incrementing counter (Excession)
    Re: info on cookies (brian d foy)
    Re: IO::Select->can_read not blocking (Matija Grabnar)
    Re: looking for a good win32 perl editor. <nospam-R.J.Rainthorpe@gre.ac.uk>
    Re: looking for a good win32 perl editor. <ad.brandt@nl.origin-it.com>
    Re: looking for a good win32 perl editor. (Jeffrey R. Drumm)
    Re: My macperl scripts don't shut down after 5 minutes  (Rich Morin)
    Re: Numeric validation (Frank D. Cringle)
        OLE and Word with the GS port <ktanis@best.ms.philips.com>
    Re: Opening a filehandle for input amd output. <grinch@whoville.com>
    Re: Perl on VMS <info@web-design.org.uk>
        Perl/CGI : problem writing to E-mail AND new file <laurijsd@se.bel.alcatel.be>
    Re: Perl/CGI : problem writing to E-mail AND new file <grinch@whoville.com>
        question of interest: How does perl compile? <quednauf@nortel.co.uk>
        sleep & print in cycles (Petr Hrbek)
        Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: Thu, 16 Apr 1998 08:35:51 GMT
From: bart.mediamind@tornado.be (Bart Lateur)
Subject: Re: array of matches in s///
Message-Id: <3536c293.4092296@news.tornado.be>

Ronald J Kimball wrote:

>You seem to have already disqualified all the possible solutions to your
>problem.

Which brings me to the kernel of my gripe. I can get an array of matches
in m//:

	@match = /$pattern/;

but not in s///. I sincerely miss it. The translation scheme was really
just an example of how it could be useful.

So I'd like to propose an extension to Perl, in the form of a special
variable array. In agreement with the $& variable, which contains the
whole matched string, @& could be a decent name. 

I'm pretty sure that internally, Perl builds this array of matches. It
surely does in m//. Only, in s/// you can't reach into it except via $1
etc.

Usage:

	s/$key/&interpolate($translate{$key},@&)/e;

That surely would solve my problem in a very neat way, wouldn't you
think?

	Bart.


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

Date: Thu, 16 Apr 1998 02:59:47 -0600
From: fiend1@earthling.net
Subject: Re: automating a terminal session
Message-Id: <6h4dpi$ue$1@nnrp1.dejanews.com>

You need a few flash modules from CPAN...
Expect
IO::Stty
IO::Tty
When you've installed all three, read thru the tutorials
in the directory you unpacked the expect module into.

possibly .cpan/build/Expect.pm-1.04/tutorial

 ...however theres more than one way to do it I guess...



In article <3532a7b5.5053491@news.cims.net>,
  wjr@cims.net wrote:
>
> I have used some modules in Perl, but was wondering if anyone could
> recommend or direct me to a module that can basically do an
> interactive terminal session (e.g. log in remotely, then execute some
> commands -upload a file via x/y/zmodem actually- then logout).
>
> Any suggestions?  I have not used sockets from the nuts up in Perl
> yet, so a module wold be preferred...but source code is always good
> failing that :)  Thanks muchly in advance.
>



-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/   Now offering spam-free web-based newsreading


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

Date: Thu, 16 Apr 1998 03:41:35 -0400
From: "Grinch" <grinch@whoville.com>
Subject: Re: avoid double-click on submit button
Message-Id: <6h4bth$h52@fridge.shore.net>

Abigail wrote in message <6h476m$4tq$2@client3.news.psi.net>...

>Grinch (grinch@whoville.com) wrote on MDCLXXXIX September MCMXCIII in
><URL: news:6h3umc$arr@fridge.shore.net>:


>++ You'll need to use a flag or indicator on the server, to indicate that
the
>++ form has been submitted. You can identify the user by a number of means,
>++ such as password authentication or a cookie. Once the user is
identified,
>                                                         ^^^^^^^^^^^^^^^^^^
>
>                                                Using a stateless protocol?

You're grasping at straws now, if that's the best criticism you can come up
with. Cookies were designed for the express purpose of maintaining state
over HTTP. Basic password authentication provides the capability to 100%
accurately identify individuals when that is required, making it almost
trivial to maintain state.

>++ check that user's flag to see if he's submitted the form previously. If
not,
>++ set the flag and continue. If so, ignore the extra submission and return
a
>++ "204 No Response" header instead of the usual response. The flag can be
>++ stored in a file, or a database, or maintained by a server daemon,
whatever
>++ best fits the needs of your script.
>
>So, what's the Perl aspect of this discussion?


It's at the other end of the URL you conveniently snipped, which pointed to
a HUGE amount of information about implementing the techniques I described
in Perl. That's a lot more germane to this group than the ongoing debate
over O'Reilly's business practices, which you seem content to ignore.

You're also ignoring the fact that your earlier advice in this thread was
potentially destructive, and could quite well have led a beginner to delete
his script. You've shown yourself to be very knowledgable in things Perlish,
so I can only conclude that your "contribution" to this conversation was
intentionally bogus as opposed to simply ill informed.

Like I said before, attitude-laden posts are irritating and useless, but not
really harmful. Posts that intentionally attempt to mislead a beginner into
damaging his or her site are cruel, petty and irresponsible to an extreme.
Posting such a message is like tricking a child into playing with matches.

I may not be able to prevent such posts, but to whatever extent is possible,
I will continue to expose them for what they are: Cruel attempts at showing
how "clever" the poster can be, at the expense of the newbie.

-grinch

-----
"Of course coffee doesn't make the world go around. It
just makes it go faster." - me

Sherm Pendley
grinch@whoville.com
http://www.whoville.com





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

Date: Thu, 16 Apr 1998 11:09:06 +0200
From: Andreas Puttkammer <andreas.puttkammer@ubs.com>
Subject: Filename into variable
Message-Id: <3535CAB2.A1BB1F35@ubs.com>

hi

'haven't found anything in the books. - is it possible to get the
filename used (f.ex. whithin a filehandle) into a variable.

something like this:


open (OPEN, /home/user/file) or die...
$a = needs now to be name of the file /home/user/file


sorry, looks and sounds terrible but you might understand what i'm
looking for.

thanks

-- 
Andreas
-------------------------------------------------------------------
UBS Schweizerische Bankgesellschaft
ESBL/ESCT-pta  +41 1 236 4161    email:  Andreas.Puttkammer@ubs.com


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

Date: 16 Apr 1998 03:03:35 -0700
From: Russ Allbery <rra@stanford.edu>
Subject: Re: Filename into variable
Message-Id: <m390p6t760.fsf@windlord.Stanford.EDU>

Andreas Puttkammer <andreas.puttkammer@ubs.com> writes:

> 'haven't found anything in the books. - is it possible to get the
> filename used (f.ex. whithin a filehandle) into a variable.

> something like this:

> open (OPEN, /home/user/file) or die...
> $a = needs now to be name of the file /home/user/file

No, I'm afraid it's not.  Once you've opened the file, the file handle
just points at the standard sorts of stdio data structures, and the C
library has no way of knowing what the name of the file is any more.  (In
fact, on Unix, this is a completely unsolvable problem, since someone
could rename the file after you opened it and the only way to find it
again would be to troll the file system looking for a file with the same
inode.)

-- 
#!/usr/bin/perl -- Russ Allbery, Just Another Perl Hacker
$^=q;@!>~|{>krw>yn{u<$$<[~||<Juukn{=,<S~|}<Jwx}qn{<Yn{u<Qjltn{ > 0gFzD gD,
 00Fz, 0,,( 0hF 0g)F/=, 0> "L$/GEIFewe{,$/ 0C$~> "@=,m,|,(e 0.), 01,pnn,y{
rw} >;,$0=q,$,,($_=$^)=~y,$/ C-~><@=\n\r,-~$:-u/ #y,d,s,(\$.),$1,gee,print


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

Date: Thu, 16 Apr 1998 09:16:17 +0200
From: Andreas Puttkammer <andreas.puttkammer@ubs.com>
Subject: Filname into variable
Message-Id: <3535B041.72170A27@ubs.com>

hi

haven't found anything in the books. - is it possible to get the
filename used (f.ex. whithin a filehandle) into a variable.

something like this:


open (OPEN, /home/user/file) or die...
$a = needs now to be name of the file /home/user/file


sorry, looks and sounds terrible but you might understand what i'm
looking for.

thanks
-- 
Andreas
-------------------------------------------------------------------
UBS Schweizerische Bankgesellschaft
ESBL/ESCT-pta  +41 1 236 4161    email:  Andreas.Puttkammer@ubs.com


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

Date: Thu, 16 Apr 1998 13:21:59 +0200
From: Mark Fergusson <mferg@hal.ddntl.didata.co.za>
Subject: Help with DBM file
Message-Id: <3535E9D7.80A439BC@hal.ddntl.didata.co.za>

In response to recent queries (thanks to all who replied), I'm trying to
get the following to work:

#!/usr/local/bin/perl

dbmopen (%foo,'/tmp/dbase',0666);

push @{$foo{'John'}},4,9,10;
push @{$foo{'Mark'}},5,6,17;
push @{$foo{'Mary'}},1,2,14;
push @{$foo{'Pat'}},2,3,4;

$foo{'John'}=[2,3,4];

foreach $name (keys %foo) {
        print "$name: @{ $foo{$name} }\n"
};

dbmclose (%foo);

If I comment out the push statements, the
print "$name: @{ $foo{$name} }\n"
prints:

Mary:
Mark:
John:
Pat:

Why are the values not being read from the dbm file ?

$foo{'John'}=[2,3,4]; doesn't seem to do much either?

Any comments would be appreciated. Thanks.

--
_____________________________________________
Mark Fergusson: mferg@hal.ddntl.didata.co.za
Dimension Data:
PO Box 236, Pavillion, 3611, South Africa
(+27)-204-8424 (Work)
(+27)-204-8590 (Fax)
082-771-8519 (Cell)




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

Date: Thu, 16 Apr 1998 00:17:27 -0700
From: Tommy <tkho@technologist.com>
Subject: Re: Help: to eliminate eval() on a HTML Filling script.
Message-Id: <3535B087.9ECCD23C@technologist.com>

Interesting idea. I believe I still have to replace characters line by line,
then join() or push() them, and eval() couple hundred of line together.

$DOC="";
while (<FILE>) {
  s/\"/\\\"/g;     # replace " to \"
  s/\;/\\\;/g;     # replace ; to \;
  s/\@/\\\@/g;     # replace @ to \@
  s/\&/\\\&/g;     # replace & to \& because of "&nbsp;", etc.
  $DOC.= $_;
}
$DOC= "\"$DOC\"\n";       # put quote on ends
print eval($DOC);

Abigail wrote:

> Tommy (tkho@technologist.com) wrote on MDCLXXXVIII September MCMXCIII in
> <URL: news:35352AF7.BD02EBC3@technologist.com>:
> ++
> ++
> ++ The major problem is the speed of eval() of the following lines:
> ++
> ++ if ($L=~ /\$/) {        # foreach chomp line
> ++   $L=~ s/\"/\\\"/g;     # replace " to \"
> ++   $L=~ s/\;/\\\;/g;     # replace ; to \;
> ++   $L=~ s/\@/\\\@/g;     # replace @ to \@
> ++   $L=~ s/\&/\\\&/g;     # replace & to \& because of "&nbsp;", etc.
> ++   $L= "\"$L\"\n";       # put quote on ends
> ++   print eval($L);       # print the eval()- slooooooooooow.
> ++ } else {
> ++   print "$L\n";         # print normal line
> ++ }
> ++
> ++ Is there a way to eliminate the eval()?
>
> Well, there's an easy way to eliminate all but one of them:
> eval the entire template at once, not line by line.
>
> Abigail
> --
> perl -wle '$, = " "; print grep {(1 x $_) !~ /^(11+)\1+$/} 2 .. shift'





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

Date: Thu, 16 Apr 1998 21:13:18 +1000
From: "Sean Kerr" <info@shopsmart.com.au>
Subject: How to run Perl cgi on Nt Server ?
Message-Id: <6h4p9h$cc6$1@the-fly.zip.com.au>

Hello

I would like to find out how to run Perl cgi scripts on NT servers if
someone could help me with this it would be greatly appreciated.

Thank You


Sean Kerr




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

Date: Thu, 16 Apr 1998 13:41:57 +0100
From: Jvrg Lenz <joerg@gustavsburg.de>
To: Sean Kerr <info@shopsmart.com.au>
Subject: Re: How to run Perl cgi on Nt Server ?
Message-Id: <3535FC95.3AB6@gustavsburg.de>

Sean Kerr wrote:
> 
> Hello
> 
> I would like to find out how to run Perl cgi scripts on NT servers if
> someone could help me with this it would be greatly appreciated.
> 
> Thank You
> 
> Sean Kerr

You gotta Register it, depending on the used server, in your registry.
For MS-IIS, start your regedit, lookup

	HKEY_LOCAL_MACHINE
	-> SYSTEM
	  -> CurrentControlSet
	    -> W3SRV
	      -> Parameters
                -> ScriptMap

There, U utilize the new function in the edit menue to add an entry
with key ".pl" and value "c:\<PATH>\perl.exe %s %s".

You gotta restart your www-Server to make the changes happen.
MS Internet Service Manager is the good tool for this action. Be sure to
add the script-path either. It's generally a good idea to have the
PERL.exe in your path and to link all .pl-Files to the perl.exe in order
to test your applications.

Yours
Jvrg Lenz


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

Date: Thu, 16 Apr 1998 03:56:35 -0400
From: "Grinch" <grinch@whoville.com>
Subject: Re: Incrementing counter
Message-Id: <6h4cpm$hdc@fridge.shore.net>

TravisJ wrote in message <6h47kq$5pe@argentina.earthlink.net>...

>Does anyone have any information that might assist me in creating a counter
>that has a constant position (similar to RAM count off at boot up) in a
>command window on WIn32. Thanks


The "\r" escape sequence represents a bare carriage return, which returns
the cursor to the first column without advancing it to the next row.

Here's a simple snippet by way of example:

foreach $i (1..5000) {
    print "$i\r";
}
print "\n";

HTH!

-grinch

-----
"Of course coffee doesn't make the world go around. It
just makes it go faster." - me

Sherm Pendley
grinch@whoville.com
http://www.whoville.com





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

Date: Thu, 16 Apr 1998 08:51:10 GMT
From: daclay@NOSPAMzip.com.au (Excession)
Subject: Re: Incrementing counter
Message-Id: <3536c4df.10586548@news.zip.com.au>

On Tue, 14 Apr 1998 01:18:36 -0700, "TravisJ" <travisj@earthlink.net>
wrote:

>Does anyone have any information that might assist me in creating a counter
>that has a constant position (similar to RAM count off at boot up) in a
>command window on WIn32. Thanks

If you're using the G.Sarathy Perl port for Win32, there is a CURSES
implementation, this will let you position the cursor as you want.

Of course, if you don't know how to use CURSES, you might not be so 
keen to use that package.

the alternative is to use \010 to backspace over chars and then reprint
them,  but I don't know of an easy way to move the cursor back up after a
carraige return.

Dac



---
David Andrew Clayton     # Please remove NO_SPAM when 
dac@NOSPAM.pcug.org.au   # sending email replies.
I post therefore I am.   #


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

Date: Thu, 16 Apr 1998 03:30:52 -0400
From: comdog@computerdog.com (brian d foy)
Subject: Re: info on cookies
Message-Id: <comdog-ya02408000R1604980330520001@news.panix.com>
Keywords: from just another new york perl hacker

In article <3535A21F.740FC1AB@csah.com>, "Gilles L. Chong Hok Yuen" <glchy@csah.com> posted:


>> dilemma - do you give the starving fish or do you teach them to fish?

>wat's the problem if someone ELSE gives some food n then teach the starving how
>to fish?

hunger is a great motivator.

>p.s i thought tt it was a Perl computer programming language newsgroup. N im
>getting stuff like "Toyotas, Golden Gate, starving, fish ......"!

you're not asking Perl questions, so you're not getting Perl answers.

-- 
brian d foy                                  <comdog@computerdog.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
Comprehensive Perl Archive Network (CPAN) <URL:http://www.perl.com>
Perl Mongers <URL:http://www.pm.org>


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

Date: 16 Apr 1998 11:23:17 GMT
From: matija@rzenik.arnes.si (Matija Grabnar)
Subject: Re: IO::Select->can_read not blocking
Message-Id: <6h4pn5$5ds$1@kanja.arnes.si>

In article <3534CC30.4D0D16B8@fmr.com>,
David Boyce  <David.Boyce@fmr.com> wrote:
I suggest you check out File::Tail module, which was designed for non-polling
reading of log files and other "continously written" files.
-- 
"My name is Not Important. Not to friends. 
    But you can call me mr. Important"  - Not J. Important 
Matija.Grabnar@arnes.si


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

Date: 16 Apr 1998 08:30:13 +0100
From: Rob Rainthorpe <nospam-R.J.Rainthorpe@gre.ac.uk>
Subject: Re: looking for a good win32 perl editor.
Message-Id: <un2dmmdfe.fsf@gre.ac.uk>

smcdow@arlut.utexas.edu (Stuart McDow) writes:

> There's a very good port of emacs for win32. It's emacs-19.34, I
> think. Can't get much better than that.  -- Stuart McDow Applied
> Research Laboratories

Ah, but now you can do better. You can now get emacs-20.2.1 from:-
ftp://ftp.cs.washington.edu/pub/ntemacs/20.2/

It's a pre-release, but's its fairly stable. 19.34.6 can be found at:
ftp://ftp.cs.washington.edu/pub/ntemacs/19.34/

You'll need to get the CPerl Module if you want a really easy life:-
http://www.cpan.org/authors/id/ILYAZ/cperl-mode/cperl-mode.el.2.16.gz

Read the NT Emacs FAQ at:-
http://www.cs.washington.edu/homes/voelker/ntemacs.html

Have fun,

Rob.

-- 
Robert Rainthorpe - Central Systems Group, Computing Services          
the University of Greenwich   
16 - 32 Wellington Street,    Tel.   (+44) (0)181 331 8738
Woolwich,                     Fax.   (+44) (0)181 331 8385
London SE18 6PF               Email. (remove nospam- from above)


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

Date: Thu, 16 Apr 1998 12:30:55 +0200
From: "A.P. Brandt" <ad.brandt@nl.origin-it.com>
Subject: Re: looking for a good win32 perl editor.
Message-Id: <01bd6922$f487ffc0$632610ac@nwg102.nwgbak.nl.origin-it.com>

On the Macintosh you have the really fantastic Alpha editor (share ware),
that was a great help programming Perl. I haven't found an equivalent for
Windows yet, but would be very interested in having one!

Ad Brandt


> Anyone know of a Perl editor that i can say 'I want a program to do....'
and
> it will do it all for me?  Now that will be good! :))
> 
> ~Tony--
> 
> 



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

Date: Thu, 16 Apr 1998 11:09:00 GMT
From: drummj@mail.mmc.org (Jeffrey R. Drumm)
Subject: Re: looking for a good win32 perl editor.
Message-Id: <3535e4fc.519165370@news.mmc.org>

On 16 Apr 1998 08:30:13 +0100, Rob Rainthorpe <nospam-R.J.Rainthorpe@gre.ac.uk>
wrote:

(snip)

>Ah, but now you can do better. You can now get emacs-20.2.1 from:-
>ftp://ftp.cs.washington.edu/pub/ntemacs/20.2/
>
>It's a pre-release, but's its fairly stable. 19.34.6 can be found at:
>ftp://ftp.cs.washington.edu/pub/ntemacs/19.34/
>
>You'll need to get the CPerl Module if you want a really easy life:-
>http://www.cpan.org/authors/id/ILYAZ/cperl-mode/cperl-mode.el.2.16.gz
>
>Read the NT Emacs FAQ at:-
>http://www.cs.washington.edu/homes/voelker/ntemacs.html
>
>Have fun,
>
>Rob.

The standard GNU source distribution of 20.2 needs a couple of patches to work
properly with Ilya's CPerl-mode . . . I don't think those patches are rolled
into the NT binary distribution (I switched back to 19.34 because of some
wierdness I experienced). YMMV.  I'd recommend sticking with 19.34 for now;
20.2 does add MULE and Custom, but we've lived without those for a long, long
time . . . :-)

-- 
                               Jeffrey R. Drumm, Systems Integration Specialist
                       Maine Medical Center - Medical Information Systems Group
                                                            drummj@mail.mmc.org
"Broken? Hell no! Uniquely implemented!" - me


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

Date: Thu, 16 Apr 1998 01:02:53 -0700
From: rdm@cfcl.com (Rich Morin)
Subject: Re: My macperl scripts don't shut down after 5 minutes as they are supposed to!
Message-Id: <rdm-1604980102540001@140.174.42.30>

In article <3301166F.6847@callisto.si.usherb.ca>,
eslcafe@callisto.si.usherb.ca wrote:

> OK - we know we are doing something wrong! My macperl apps don't shut
> down automatically after 5 minutes! And my server admin is in a tizzy.

For general information on MacPerl, I recommend the MacPerl Pages:

  http://www.ptf.com/macperl

In particular, I suggest that you peruse the online copy of "MacPerl:
Power and Ease":   http://www.ptf.com/macperl/ptf_book/HTML

Finally, for MacPerl-specific questions of this sort, I suggest that you
try the MacPerl email list: http://www.ptf.com/macperl/depts/mlist.html

-r

-- 
Canta Forda Computer Laboratory       | Prime Time Freeware - quality 
UNIX consulting, training, & writing  | freeware at affordable prices
+1 415-873-7841                       | +1 408-433-9662   -0727 (Fax)
Rich Morin, rdm@cfcl.com              | www.ptf.com, info@ptf.com


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

Date: Thu, 16 Apr 1998 09:19:17 GMT
From: fdc@cliwe.ping.de (Frank D. Cringle)
Subject: Re: Numeric validation
Message-Id: <vtemyyw2cq.fsf@cliwe.ping.de>

kfox@pt0204.pto.ford.com (Ken Fox) writes:
> fdc@cliwe.ping.de (Frank D. Cringle) writes:
> > kfox@pt0204.pto.ford.com (Ken Fox) writes:
> > > I'd prefer the FAQ say:
> > > ...
> > >    if (/^-?\d+\.?\d*$/) { print "is a real number\n" }
> > 
> > ...
> > if (/^-?\d+(\.(\d+(e[+|-]?\d+)?)?)?$/i) { print "$_ is a real number\n" }
> > else { print "oops, $_ is not a real number\n" }
> 
> And your point is?

That the "real number" regexp is incomplete.

>  The real purpose of the FAQ here is to provide
> the idea that regexps can be used to check numbers and secondly to
> give some common examples.  I don't like people just cutting and
> pasting from the FAQ into "real" code, but we might as well make it
> easy to do if we can.  (Less pain in c.l.p.m maybe?)

The examples should either be accurate or carry a health warning.

> Your example seems harder to read than the existing FAQ, obscures
> the regexps and provides weird contradictory output.

I would not be surprised if the regexp could be shortened and made
easier to read.  In what way does it provide contradictory output?  

> If you're trying to tell me that the regexps are wrong, tell that
> to the FAQ owner -- the regexps were copied verbatim from the FAQ.

I had not actually checked what the FAQ had to say on the subject.
Looking at it now, I find this in perlfaq4 ($Revision: 1.19 $, $Date:
1997/04/24 22:43:57 $)

   warn "not a C float"
       unless /^([+-]?)(?=\d|\.\d)\d*(\.\d*)?([Ee]([+-]?\d+))?$/;

That looks OK to me.

-- 
Frank Cringle,      fdc@cliwe.ping.de
voice: (+49 2304) 467101; fax: 943357


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

Date: Thu, 16 Apr 1998 10:19:06 +0200
From: Klaas Tanis <ktanis@best.ms.philips.com>
Subject: OLE and Word with the GS port
Message-Id: <3535BEFA.3D48@best.ms.philips.com>

Hi,

I am working on a script to do some operations on Word files
which have to be published on our Intranet. What I need for
the Intranet is an ascii representation of the file (for a
simple search engine to be build) and a Postscript file
which will be processed by the Acrobat Distiller for creating
a pdf file.

The following script does the trick. However, when I use
a check on Win32::OLE::LastError to see if any errors 
occured, I get an error in some case although the action
was completed successfully. The return error is "Unknown name".
This is a pitty because now I cannot see if a real error 
occured.

Am I doing something wrong? Can real errors be detected (how)?

I am using the Gurusamy Sarathy port:

This is perl, version 5.004_02

Copyright 1987-1997, Larry Wall

Perl may be copied only under the terms of either the Artistic License
or the
GNU General Public License, which may be found in the Perl 5.0 source
kit.

My version of Word is Word97 (Office97) with Service Release 1.

Below are the script that I am using and its output.

Thanks for your help.

			Klaas

=-=-=-=-=-=-=-=-=-=-=-=-=-= script =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

use Win32::OLE;

Win32::OLE::CreateObject( "Word.Application", $app ) || 
    die "Unable to create Word object ($!)\n";

$app->{'Visible'} = 0;
$lastError = Win32::FormatMessage(Win32::OLE::LastError);
print "last error after set invisible is $lastError\n";

$app->Documents->Open("C:\\Temp\\test.doc");
$lastError = Win32::FormatMessage(Win32::OLE::LastError);
print "last error after open is $lastError\n";

$app->ActiveDocument->SaveAs(
        "C:\\Temp\\test.asc",  # filename for the ascii file
        100 );                 # FileFormat for "MS-DOS Text with
Layout"
$lastError = Win32::FormatMessage(Win32::OLE::LastError);
print "last error after SaveAs is $lastError\n";

$app->ActiveDocument->PrintOut(
        1,                    # Background = true
        0,                    # Append     = false
        "",                   # Range      = complete document
        "C:\\Temp\\test.ps"); # filename for the postscript file

$lastError = Win32::FormatMessage(Win32::OLE::LastError);
print "last error after PrintOut is $lastError\n";

sleep 10; # allow printing before quitting

$app->Quit();
$lastError = Win32::FormatMessage(Win32::OLE::LastError);
print "last error after quit is $lastError\n";

=-=-=-=-=-=-=-=-=-=-=-= Output =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=
M:\myPerl>perl cw.pl
last error after set invisible is The operation completed successfully.

last error after open is Unknown name.

last error after SaveAs is Unknown name.

last error after PrintOut is Unknown name.

last error after quit is The operation completed successfully.

M:\myPerl>

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
                   __  __  __  ____ __        __   
           /_/ /  /_/ /_/ /_    /  /_/ /\/ / /_  
          / | /_ / / / / __/   /  / / / / / __/ 
-----------------------------------------------------------
mailto:K.Tanis@best.ms.philips.com     Voice: +31-402762353
mailto:K.Tanis@nl.cis.philips.com      Fax:   +31-402763633
                                   
              PHILIPS Medical Systems Nederland B.V.
              department XRD-CIS, room QA-III-409
              P.O. Box 10000         __o
              5680 DA Best         _ \<_
              The Netherlands     ( )/( )
-----------------------------------------------------------


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

Date: Thu, 16 Apr 1998 04:19:08 -0400
From: "Grinch" <grinch@whoville.com>
Subject: Re: Opening a filehandle for input amd output.
Message-Id: <6h4e3u$hn4@fridge.shore.net>

David Stanaway wrote in message <3534CEF9.795EAAD7@ug.cs.usyd.edu.au>...

>#!/gnu/usr/bin/perl
>open (www,"|telnet www-personal.usyd.edu.au 80|");
>write(www,"GET http://www-personal.usyd.edu.au:80/~dstanawa/");
>while(read(www,$buff,36)) {
>        print $buff;
>}
>
>Am I doing something wrong?

Well, you're doing one thing wrong, and doing the whole operation the hard
way.

Opening a bidirectional pipe can't be done with a simple "open". You'll need
to use the IPC::Open2 module instead. There's also an IPC::Open3 module,
which opens three filehandles, attached to Stdin, Stdout, and Stderr. Both
modules are part of the core distribution.

However, unless your example is contrived, you're making a lot of extra work
for yourself. Remember, when it comes to programming, laziness is a virtue.
Retrieving data over the web is much easier to do with the LWP module.
Here's your example, rewritten to use it:

#!/gnu/usr/bin/perl

use LWP::Simple;

$buff = get("http://www-personal.usyd.edu.au:80/~dstanawa/");
print $buff;

-grinch

----
"Of course coffee doesn't make the world go around. It
just makes it go faster." - me

Sherm Pendley
grinch@whoville.com
http://www.whoville.com





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

Date: 16 Apr 1998 10:30:45 GMT
From: "Webmaster" <info@web-design.org.uk>
Subject: Re: Perl on VMS
Message-Id: <01bd6922$74bba120$6f9999c0@watson.colloquium.co.uk>

I have one, if you email me mailto:webmaster@web-design.org.uk I'll send
you a sample.pl file that sends email via VMS.




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

Date: Thu, 16 Apr 1998 09:58:54 +0200
From: Laurijssen Dirk <laurijsd@se.bel.alcatel.be>
Subject: Perl/CGI : problem writing to E-mail AND new file
Message-Id: <3535BA3E.2F0D220A@se.bel.alcatel.be>

Anyone got an idea about his strange behaviour,

I have a HTML-page that sends an E-mail and writes a few things in a
file. 
The file-name is a parameter passed by the HTML-page.

It sends the Mail, but it doesn't save a thing, except when I test the
program
with the filename of an already excisting (empty) file....

                                          Kind regards,

                                               Dirk L.
Here's the (compressed) source : 

#!/usr/local/bin/perl

$test = "laurijsd\@se.bel.alcatel.be";
 
if ($ENV{'REQUEST_METHOD'} eq 'POST') {
 
                # Get the input
 
    read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
 
                # Split the name-value pairs
 
    @pairs = split(/&/, $buffer);
 
                # Load the FORM variables
 
    foreach $pair (@pairs) {
        ($name, $value) = split(/=/, $pair);
        $value =~ tr/+/ /;
        $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
 
        $FORM{$name} = $value;
    }
 
    # Open up the email message to send the feedback
    # to the help system and the user (as CC).

    #$dataset = $FORM{insp_id}.".issue";
    $dataset = 'test.issue';
  
    open (MESSAGE,"| /usr/bin/mail $test");
 
    # Format email header information
 
    print MESSAGE "To: $test\n";
 
    # Write the actual email message (header part)
 
    print MESSAGE "Subject: $FORM{sub}\n";
    print MESSAGE "From: $FORM{from}\n";
    print MESSAGE "Cc: $FORM{cc}\n";
    # Here starts the body of the message
     &body_msg; 
    close (MESSAGE);
   
    # Here we write some data to a file given by a FORM-parameter

    open (ISSUE,">$dataset")|| die "Can't find article $ISSUE: $!\n";
      print ISSUE "test\n";
    close (ISSUE);
    # Thank the user and acknowledge the feedback
    &thank_you_msg;
} 
else { 
    # Format an error message for the user
    print "Content-type: text/html\n\n";
    print "<HTML>\n";
    print "<HEAD>\n";
    print "<TITLE>Comment Form Error</TITLE>\n";
    print "</HEAD>\n";
    print "<BODY>\n";
    print "<FONT size=3>\n";
    print "<H1>Comment Form Error</H1>\n";
    print "<HR>\n";
    print "<P>\n";
    print "Form input was not proccessed.  Please mail your ";
    print "remarks to $test\n";
    print "</BODY>\n";
    print "</HTML>\n";
}

sub thank_you_msg { 
    print "Content-type: text/html\n\n";
    print "<HTML>\n";
    print "<HEAD>\n";
    print "<TITLE>Thank You</TITLE>\n";
    print "</HEAD>\n";
    print "<BODY>\n";
    print "<H1>Thank You</H1>\n";
    print "<HR>\n";
    print "<P>\n";
    print "Your inspection-form has been submitted !\n";
    print "</BODY>\n";
    print "</HTML>\n";
}

sub body_msg {
print MESSAGE "<HTML> \n";
print MESSAGE "<HEAD> \n";
print MESSAGE "<TITLE> Inspection Issue Log </TITLE>\n";
print MESSAGE "</HEAD>\n";
print MESSAGE "test\n";
print MESSAGE "</BODY> \n";
print MESSAGE "</HTML>\n";
}

-- 
                                              ____________________
______________________________________________\                  /____
 LAURIJSSEN DIRK                               \     ALCATEL    /
 SW-Engineering - Routing - VE330               \    TELECOM   /
 phone : +32-3-240 4360                          \            /
 fax   : +32-3-240 9899                       Francis Wellesplein  1
 mailto:laurijsd@se.bel.alcatel.be.brol          2018  Antwerpen
 	remove the ".brol" to use address           Belgium
_____________________________________________________\    /___________
                                                      \  /
Experience is something you don't get until just after \/  you need it.


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

Date: Thu, 16 Apr 1998 07:31:39 -0400
From: "Grinch" <grinch@whoville.com>
Subject: Re: Perl/CGI : problem writing to E-mail AND new file
Message-Id: <6h4pdm$nhi@fridge.shore.net>

Laurijssen Dirk wrote in message <3535BA3E.2F0D220A@se.bel.alcatel.be>...

>It sends the Mail, but it doesn't save a thing, except when I test the
>program
>with the filename of an already excisting (empty) file....


I'd look at the directory permissions first. Under UNIX, that's what
determines the ability to create new files, as opposed to writing to
existing files. When writing to an existing file, that the server must have
write permission on the file. To create a new file, the server must have
write permission on the directory which is to contain the new file.

This really doesn't have much to do with Perl, exactly. You can probably
find more help in a group dedicated to UNIX discussion.

HTH!

-grinch

--
-----
"Yes, I'm paranoid, but that doesn't mean
no one's out to get me." - me

Sherm Pendley
grinch@whoville.com
http://www.whoville.com





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

Date: Thu, 16 Apr 1998 10:10:46 +0100
From: "Frank L. Quednau" <quednauf@nortel.co.uk>
Subject: question of interest: How does perl compile?
Message-Id: <3535CB15.3D69AEB@nortel.co.uk>

Hi,
now I've heard the story that, say, you have a CGI script, it
gets compiled once called (Apart from teh Apache solution and the
day a perl compiler comes out). Basically I am just curious what
gets compiled when, and how can I influence it?

e.g. I've got a CGI script (Note: The following is no working
code ;)

#!/usr/desolation/perl -w

#some code here

&format_hd                                        if $action=1;
&write_randomly_to_memory     if $action=2;

&format_hd  {
  #terrible things here
}

&write_randomly_to_memory {
  #more terrible things
}

if $action comes from a form and is set to 1, how is the script
compiled? The whole thing or just the code on top and the
&format_hd subroutine? Can I influence that? Is there any FAQ?
(Haven't seen any, though admittedly I only scanned the
titles...)
Note: this is just a question out of interest, no lifes depend on
it, but maybe someone can shed some light on this issue...Cheers.

--
____________________________________________________________
Frank Quednau
Phone: +44 (0)1279 402447
http://www.surrey.ac.uk/~me51fq MailTo:F.L.Quednau@bnr.co.uk
____________________________________________________________





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

Date: 16 Apr 1998 07:28:39 GMT
From: uph@is.pdas.cz (Petr Hrbek)
Subject: sleep & print in cycles
Message-Id: <6h4bv7$nnq$3@dungeon.pdas.cz>

I have problem with this script:

$slp = 1;
for ($i =0 ; $i < 10 ; $i++) 
 {
   print "$slp\n";
   sleep $slp;
 }

In script the output is going to be written after the end of cycle and 
not during that cycle.

How can I force the script output to be written during cycle?

Thanks

Petr Hrbek


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

Date: 8 Mar 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 8 Mar 97)
Message-Id: <null>


Administrivia:

The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc.  For subscription or unsubscription requests, send
the single line:

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.

The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.

The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.

For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V8 Issue 2335
**************************************

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