[16629] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4041 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Aug 17 06:05:29 2000

Date: Thu, 17 Aug 2000 03:05:15 -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: <966506715-v9-i4041@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Thu, 17 Aug 2000     Volume: 9 Number: 4041

Today's topics:
    Re: 'open' and '$!' on Win32 <gellyfish@gellyfish.com>
    Re: [Perl] offline mode <bart.lateur@skynet.be>
        ANNOUNCE : AI::NeuralNet::BackProp v 0.89 <jdb@wcoil.com>
    Re: archive of perl scripts- first language <gellyfish@gellyfish.com>
    Re: cookie problem <daniel@blackomega.com>
        Copying Files <john@leatherbarrowj.freeserve.co.uk>
    Re: Copying Files (Rafael Garcia-Suarez)
    Re: GD.pm Test Fails? <gellyfish@gellyfish.com>
    Re: How to know if a scalar contain string or numeric d (Anno Siegel)
    Re: How to know if a scalar contain string or numeric d (Rafael Garcia-Suarez)
    Re: Large Pieces of Code <gellyfish@gellyfish.com>
    Re: Mail with attachments <gellyfish@gellyfish.com>
    Re: Negativity in Newsgroup...Newbie Perspective <bkennedy99@home.com>
        Newbie - print here problem scottfreez@my-deja.com
        Newbie: DBI gives "Begin Failed " error <bGhassemlou@home.com>
        Newbie; is Perl a good choice? <eaks@worldnet.att.net>
    Re: Problem with IIS4 <gellyfish@gellyfish.com>
    Re: problems installing DBD::oracle for oracle-db-acces <gellyfish@gellyfish.com>
    Re: redirect script just providing an HREF, not redirec (Jens)
    Re: redirection problems <pete@alphanetcoms.co.uk>
        Regex Alternation Question <Jonas.Reinsch@ppi.de>
    Re: RegExp Puzzle <bart.lateur@skynet.be>
    Re: Replacing lines in a file (Smylers)
    Re: Substituting newlines for HTML equivalent <bart.lateur@skynet.be>
    Re: windows headache <yhvhboy1@home.com>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: 16 Aug 2000 21:55:25 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: 'open' and '$!' on Win32
Message-Id: <8nev3t$oe1$1@orpheus.gellyfish.com>

On Wed, 16 Aug 2000 18:47:22 GMT djberg96@my-deja.com wrote:
> Hi,
> 
> Running NT 4.0, sp5 and Perl 5.6
> 
> I noticed that when I perform an 'open' command, $! appears to be set
> to true, even if the open was successful.  I checked some of the FAQ
> docs, but didnt' see anything.
> 
> e.g.
> 
> open(FH, "someFile.txt") or die "\nUnable to open file"; # Works
> 
> if($!){                              # $! is set! (?)
>    print "\nOops!  OS error.";
> }
> 
> I don't get this behavior on Unix.  What's going on?  Thanks in
> advance for
> any help provided.

It's irrelevant what OS you get behavior like this on.  The value of
$! is of no use (and should not be referred to ) unless a previous
use of a system function returned false.  $! may well retain its value
from some completely unrelated initiation.  You check whether, say, the
open was unsuccesfull and then print the value of $! - you don't test
the value of $! after the use of a system function just the same you
wouldnt test errno in a C program - you read the documentation of the
functions and behave accordingly.

/J\
-- 
yapc::Europe in assocation with the Institute Of Contemporary Arts
   <http://www.yapc.org/Europe/>   <http://www.ica.org.uk>


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

Date: Thu, 17 Aug 2000 09:18:15 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: [Perl] offline mode
Message-Id: <84bnpsgs91ncmdrjlg6g45olcs3p1h5lmn@4ax.com>

bolero92@my-deja.com wrote:

>I found that Apache error logs generate the following error message
>while running this script:
>
>(offline mode: enter name=value pairs on standard input)
>
>What does this line mean?

Eh? This is in your Apache log?

Something really funky is going on. CGI.pm checks the REQUEST_METHOD
environment variable to see if the script is run as a CGI script, or
not. Apparently it thinks it's not. So, it looks as if your environment
variable(s) isn't/aren't set. Is this a server configuration error?

Do try to create a simple script without CGI.pm, which shows your
environment variables. For example:

	print "Content)type: text/plain\n\nEnvironment variables:\n";
	foreach (sort keys %ENV) {
	    print "$_: $ENV{$_}\";
	}

Do note that this doesn't work on MS-IIS, for which a environment
variable magically springs to life when you access it. If explicitely
printing $ENV{REQUEST_METHOD} reveals nothing, something strange really
is going on. Then, take it to the server newsgroup.

-- 
	Bart.


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

Date: 17 Aug 2000 07:38:41 GMT
From: "Josiah Bryan" <jdb@wcoil.com>
Subject: ANNOUNCE : AI::NeuralNet::BackProp v 0.89
Message-Id: <8ng4q1$4t0$0@206.230.71.42>

Greetings Perlfolk:

Announcing the release of:
    AI::NeuralNet::BackProp, version 0.89

You can download the latest version from:  (** recomended download URL **)

http://www.josiah.countystart.com/modules/AI/cgi-bin/rec.pl?comp.lang.perl.m
isc

It is also available on your favorite CPAN mirror:
  file:    $CPAN/authors/id/J/JB/JBRYAN/AI-NeuralNet-BackProp-0.89.zip
  size:   52051 bytes

** What is this?

AI::NeuralNet::BackProp is a simply back-propagation,
feed-foward neural network designed in Perl to learn using
a generalization of the Delta rule and a bit of Hopefield
theory.

** What's new?

From the POD:
This is version 0.89. In this version I have included a
new feature, output range limits, as well as automatic
crunching of run() and learn*() inputs. Included in the
examples directory are seven new practical-use example
scripts. Also implemented in this version is a much cleaner
learning function for individual neurons which is more
accurate than previous verions and is based on the LMS
rule. See range() for information on output range limits.
I have also updated the load() and save() methods so that
they do not depend on Storable anymore. In this version you
also have the choice between three network topologies, two
not as stable, and the third is the default which has been
in use for the previous four versions.

Checkout the nifty HTML-format docs in "docs.htm"

** What do you think?

Now I know you people are out there that are using the module...
I can hear the fists hitting the keyboards in frustration. :-) Relieve
some of that frustration by e-mailing me and letting me know what
you think of the module and any suggestions you got. Especially you
guys in HP Labs and at Xerox! :-)

Use it, let me know what you all think. This is just a
groud-up write of a neural network, no code stolen or
anything else. It uses the -IDEA- of back-propagation
for error correction, with the -IDEA- of the delta
rule and hopefield theory, as I understand them. So, don't expect
a classicist view of nerual networking here. I simply wrote
from operating theory, not math theory. Any die-hard neural
networking gurus out there? Let me know how far off I am with
this code! :-)

Regards,

~ josiah

--
Josiah Bryan
VP of Product Development
TDCJ, Inc.
"Anything is possible."

vp@tdcj.com
http://www.josiah.countystart.com/

Tel: 937.316.6256





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

Date: 16 Aug 2000 21:39:14 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: archive of perl scripts- first language
Message-Id: <8neu5i$ocn$1@orpheus.gellyfish.com>

On Wed, 16 Aug 2000 13:14:12 -0400 John A Timmons wrote:
> 
> I also have Lemay's "Perl in 21 days". It's good, with lot's of examples but
> I've found a few typos that kind of screwed me up for a while.
> 

I don't think this book comes highly recommended.  I have been programming
for twenty one *years* and I have never found that trying to learn  by these
kind of specific examples has any done any good .

/J\
-- 
yapc::Europe in assocation with the Institute Of Contemporary Arts
   <http://www.yapc.org/Europe/>   <http://www.ica.org.uk>


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

Date: Thu, 17 Aug 2000 10:38:03 +0100
From: "Daniel Foster" <daniel@blackomega.com>
Subject: Re: cookie problem
Message-Id: <8ngce8$22v$1@news5.svr.pol.co.uk>

> Thanks for your help first, but because I am new to perl programming
and the
> deadline is coming, I don't have enough time to study the CGI.pm, so
I need
> to use the current method to implement the cookie program.

Learning how to use CGI.pm is very easy.  You don't have to use the
vast majority of it's functions, and in your case you could certainly
restrict yourself to using CGI::cookie and CGI::header.  It really
will take you a matter of minutes to figure them out.  The actual
usage info can be obtained in the usual way - perldoc CGI.

---
I will never cease to be amazed by the human capacity for hyperbole.
                                                - Data

Daniel Foster - daniel@blackomega.com





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

Date: Thu, 17 Aug 2000 08:18:51 +0100
From: "John Leatherbarrow" <john@leatherbarrowj.freeserve.co.uk>
Subject: Copying Files
Message-Id: <8ng3cg$vll$1@newsg4.svr.pol.co.uk>

Can anyone help

I can copy a file from one directory to another using File :: Copy

but I can not get it to work using a URL for the file

Please does anyone know the answer

John Leatherbarrow




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

Date: Thu, 17 Aug 2000 07:49:02 GMT
From: rgarciasuarez@free.fr (Rafael Garcia-Suarez)
Subject: Re: Copying Files
Message-Id: <slrn8pn6i0.8e3.rgarciasuarez@rafael.kazibao.net>

John Leatherbarrow wrote in comp.lang.perl.misc:
>Can anyone help
>
>I can copy a file from one directory to another using File :: Copy
>
>but I can not get it to work using a URL for the file

If you want to download a file from a URL, you should look at the LWP
modules. LWP::Simple (the simplest) may be what you want.

-- 
Rafael Garcia-Suarez


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

Date: 17 Aug 2000 07:06:24 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: GD.pm Test Fails?
Message-Id: <8nfvd0$phj$1@orpheus.gellyfish.com>

On Wed, 16 Aug 2000 17:23:59 GMT brudden@goebusiness.com wrote:
> I'm having problems with the GD.pm module on sun sparc solaris 2.6 
> system.
> No errors durring make, only in the test:
> 
> 
> PERL_DL_NONLAZY=1 /raid1/perl5.6.0/bin/perl -Iblib/arch -Iblib/lib 
> -I/raid1/perl5.6.0/lib/5.6.0/sun4-solaris -I/raid1/perl5.6.0/lib/5.6.0 -e 
> 'use Test::Harness qw(&runtests $verbose); $verbose=0; runtests @ARGV;' t/*.t
> t/GD................Can't load './blib/arch/auto/GD/GD.so' for module GD: 
> ld.so.1: /raid1/perl5.6.0/bin/perl: fatal: relocation error: file 
> /usr/local/lib/libgd.so.4: symbol jpeg_resync_to_restart: referenced 
> symbol not found at /raid1/perl5.6.0/lib/5.6.0/sun4-solaris/DynaLoader.pm 
> line 200.
>  at t/GD.t line 11
> Compilation failed in require at t/GD.t line 11.
> BEGIN failed--compilation aborted at t/GD.t line 11.
> t/GD................dubious                                               
>    
>         Test returned status 255 (wstat 65280, 0xff00)
> DIED. FAILED tests 1-10
>         Failed 10/10 tests, 0.00% okay
> Failed Test  Status Wstat Total Fail  Failed  List of failed
> ------------------------------------------------------------------------
> -------
> t/GD.t          255 65280    10   10 100.00%  1-10
> Failed 1/1 test scripts, 0.00% okay. 10/10 subtests failed, 0.00% okay.
> make: *** [test_dynamic] Error 2
> 
> 
> I have the libs installed :libpng, libz.  Everything built with the same 
> compiler (gcc).  Looking at the README.unix, they mention a similar issue 
> on Linux related to dynamicaly loading modules but no mention of how to 
> fix it on solaris(if that issue is even related).  Any ideas? 

libgd itself is not designed to be made dynamically loadable ordinarily -
it might be that remaking the library statically will solve the problem.

/J\
-- 
yapc::Europe in assocation with the Institute Of Contemporary Arts
   <http://www.yapc.org/Europe/>   <http://www.ica.org.uk>


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

Date: 17 Aug 2000 07:16:00 -0000
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: How to know if a scalar contain string or numeric data?
Message-Id: <8ng3fg$l5a$1@lublin.zrz.tu-berlin.de>

 <sth@ms1.hinet.net> wrote in comp.lang.perl.misc:
>Anno Siegel (anno4000@lublin.zrz.tu-berlin.de) wrote:
>: jason  <elephant@squirrelgroup.com> wrote in comp.lang.perl.misc:
>: >sth@ms1.hinet.net wrote ..
>: >  perldoc perlfaq4
>: >  "How do I determine whether a scalar is a number/whole/integer/float?"
>: I'm not entirely sure if that is what the OP meant.  Even in Perl it 
>: occasionally makes a difference whether you say $x = 123; or $x = '123';
>: None of the regular expressions in the faq can tell these cases apart,
>: but
>:     ~$x ne ~"$x" ? 'numeric' : 'string'
>: can.
>: Anno
>
>Hello
>
>     Actually, I got this question when I needed to compare a lot of data
>     to see if any item contains a negtive number. However, the raw data
>     contains not only numeric data but also strings. I would like not to
>     compare string with 0 or a warnning message will show up.
>
>     Anno, would you please tell me how the following works? particully
>     the "~" part.
>         ~$x ne ~"$x" ? 'numeric' : 'string'

~ is bitwise negation.  It works differently on strings and on numeric
values, so if $x is numeric then ~$x (numeric negation) and ~"$x"
(string negation) have different results.  If $x is a string in the
first place, the results are the same.

But, seeing the more explicit description of your problem, this
isn't what you need.  One of the FAQ solutions that have been
presented should be fine.

Anno


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

Date: Thu, 17 Aug 2000 07:19:37 GMT
From: rgarciasuarez@free.fr (Rafael Garcia-Suarez)
Subject: Re: How to know if a scalar contain string or numeric data?
Message-Id: <slrn8pn4qs.84u.rgarciasuarez@rafael.kazibao.net>

sth@ms1.hinet.net wrote in comp.lang.perl.misc:
>     Anno, would you please tell me how the following works? particully
>     the "~" part.
>         ~$x ne ~"$x" ? 'numeric' : 'string'

~ is the bitwise negation operator. (see perlop).
It does not negate integers and strings in the same way.

Example:
$ perl -e 'print ~1,"\n"'
4294967294
$ perl -e 'print ~"1","\n"'
Î
(character which ASCII code is 255 - ord('1'))

-- 
Rafael Garcia-Suarez


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

Date: 16 Aug 2000 21:28:54 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Large Pieces of Code
Message-Id: <8neti6$oc2$1@orpheus.gellyfish.com>

On Tue, 15 Aug 2000 19:25:10 GMT mr_curmudgeon@my-deja.com wrote:
> In article
> <g60m5.44012$eS6.783649@news1.rdc1.md.home.com>,
>   "Robert Brooks" <studentfl@hotmail.com> wrote:
>> Question, I am writing a large program and I am trying to find a good
>> way to lessen the load on my server. The code is around 200kb. What
>> is the best way to break it down so it runs faster and doesn't take
>> up as much space in memory?
> 
> Rewrite it in Java.
> 

Why not rewrite in RPG/III ?

This is a Perl newsgroup.

/J\
-- 
yapc::Europe in assocation with the Institute Of Contemporary Arts
   <http://www.yapc.org/Europe/>   <http://www.ica.org.uk>


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

Date: 16 Aug 2000 21:43:09 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Mail with attachments
Message-Id: <8neuct$od4$1@orpheus.gellyfish.com>

On Wed, 16 Aug 2000 03:48:57 +0000 (UTC) David Efflandt wrote:
> On 14 Aug 2000 18:25:14 -0500, Teodor Zlatanov <tzz@iglou.com> wrote:
>><8n9esf$bqe$16$1@news.t-online.com>:Thomas (maibaum@bigfoot.com):comp.lang.perl.misc:Mon, 14 Aug 2000 20:50:39 +0200:quote:
>>: does anybody know, how I can send or receive mails with attachments in an
>>: easy way, for instance with a CPAN-Module?
>>
>>If you mean MIME attachments, then yes, there are CPAN modules for that:
>>
>>MIME-tools (the full-featured kit)
>>MIME::Lite (if you only need to create and send simple MIME messages)
> 
> Use the CGI module for creating forms and handling the file upload.
> It works well with MIME::Lite to e-mail uploaded files as attachments.
> 

I have posted examples in this group that can be found with Deja News
that do both things.

/J\
-- 
yapc::Europe in assocation with the Institute Of Contemporary Arts
   <http://www.yapc.org/Europe/>   <http://www.ica.org.uk>


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

Date: Thu, 17 Aug 2000 07:09:55 GMT
From: "Ben Kennedy" <bkennedy99@home.com>
Subject: Re: Negativity in Newsgroup...Newbie Perspective
Message-Id: <7dMm5.107147$A%3.1416784@news1.rdc2.pa.home.com>


"What A Man !" <whataman@home.com> wrote in message
news:399B5F63.50E00423@home.com...
> To answer your question, Randall, this is one of your posts where I
understood you to be
> saying that if someone doesn't "get it" they should "stay out of coding."
To me, that's
> arrogant, and has nothing to do with netiquette... though I think you knew
that already. The
> whole tone of your reply to Petri, below, appears to support a superior
attitude. FWIW, I
> didn't come to that conclusion on this one post of yours. Another post of
yours that you
> refer to below also seems to support that. I hope that I misunderstood.

With all due respect, I think you may have been missing his point.  He used
variable scoping to illustrate the point that some people just don't "get
it".  This wasn't directed to the new user who is first learning about
variables or hobbyists, but at people who chose programming as as
profession - this was the thrust of the message.  Its definitely true that
some people don't have a mind for programming, and they probably shouldn't
try to pass themselves off as professionals.  I wouldn't want people who
don't know how to drive to be cab drivers either, nor would I want people
who can't swim to be a lifeguard.  I do find it annoying when people who
really non-programmers wastes my time interviewing for a programmer
position, or uses this newsgroup as a substitute for actually learning this
language.  Now if it was a complex concept, such as say Perl internals, then
it would be an arrogant thing to say - but variable score is a pretty basic
and vital concept, which every professional should understand well.

--Ben Kennedy






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

Date: Thu, 17 Aug 2000 08:44:45 GMT
From: scottfreez@my-deja.com
Subject: Newbie - print here problem
Message-Id: <8ng8lq$5qh$1@nnrp1.deja.com>

print<<FINISH;
Content-type: text/html

hey there
FINISH


Can anyone tell me why this doesn't work?

Here's the error message:
CGI Error

The specified CGI application misbehaved by not returning a complete set
of HTTP headers. The headers it did return are:

Can't find string terminator "FINISH" anywhere before EOF at
C:\Inetpub\wwwroot\perl\flockansi.pl line 1.

Thanks very much.
scottfreez


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


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

Date: Thu, 17 Aug 2000 09:37:27 GMT
From: "bjg" <bGhassemlou@home.com>
Subject: Newbie: DBI gives "Begin Failed " error
Message-Id: <rnOm5.35789$c5.1332081@news2.rdc1.on.home.com>

This is the first time I am using DBP.pm, I get the error:

Can't locate loadable object for module DBI in @INC (@INC contains:
D:/Perl/lib D:/Perl/site/lib .) at D:/Perl/lib/DBI.pm line 179
BEGIN failed--compilation aborted at D:/Perl/lib/DBI.pm line 179.
BEGIN failed--compilation aborted at d:\Xitami\webpages\cgi-bin\Behzad.pl
line 2.

Can someone explain what is the problem?????
Thanks

Line 179 of DBI.pm is "{"

# If you get an error here like "Can't find loadable object ..."
# then you haven't installed the DBI correctly. Read the README
# then install it again.
bootstrap DBI;

}             ## Line 179
*trace_msg = \&DBD::_::common::trace_msg;

use strict;

my $connect_via = "connect";

# check if user wants a persistent database connection ( Apache + mod_perl )
if ($INC{'Apache/DBI.pm'} && substr($ENV{GATEWAY_INTERFACE}||'',0,8) eq
'CGI-Perl') {
    $connect_via = "Apache::DBI::connect";
    DBI->trace_msg("DBI connect via $INC{'Apache/DBI.pm'}\n");
}






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

Date: Thu, 17 Aug 2000 08:52:02 GMT
From: J Eaks <eaks@worldnet.att.net>
Subject: Newbie; is Perl a good choice?
Message-Id: <399BA7EA.6F4BBFF9@worldnet.att.net>

I've been making websites for several years and used many scripts on
them. I'm beginning to learn to write my own scripts and I am wondering
if this is a practical direction to go to get away from website design.

Will the demand still be there a year from now or is the market already
saturated with Perl programmers?

It seems to be coming easily to me, but I know I have a long way to go
and I'm wondering if it's a good idea to keep going with it.

Thanks for any insight,
JE


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

Date: 16 Aug 2000 21:25:41 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Problem with IIS4
Message-Id: <8netc5$obt$1@orpheus.gellyfish.com>

On Tue, 15 Aug 2000 16:05:14 +0200 Dr. Peter Dintelmann wrote:
>     Hi,
> 
> Felix Brack schrieb in Nachricht <39991cfb@news.datacomm.ch>...
>>I just setup Perl on a IIS4 server. When I type the name of
>>a perl script at the commandline on the server, perl.exe takes
>>the script and everything comes out fine.
>>When I want to run the same perl script from within a html page,
>>perl.exe does not seem to run, since the data returned is just
>>the contents of the perl script, not the output perl.exe should generate
>>from my script.
> 
>     this is a webserver configuration issue.
>     Attached find a MS WinWord document
>     (you are running Windows anyway ;-)
>     how the app config has to look like.
> 
>     Best regards,
> 
>         Peter Dintelmann
> 
> 
> 
> begin 666 iis5pl.doc

Can I suggest that you convert that into conformant HTML and then post
a URL ....

/J\
-- 
yapc::Europe in assocation with the Institute Of Contemporary Arts
   <http://www.yapc.org/Europe/>   <http://www.ica.org.uk>


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

Date: Thu, 17 Aug 2000 09:59:50 GMT
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: problems installing DBD::oracle for oracle-db-access
Message-Id: <qIOm5.168$NE3.14333@news.dircon.co.uk>

On Thu, 17 Aug 2000 06:39:23 GMT, rudi_runkel@my-deja.com Wrote:
> 
> I thought that there is no need to install any oracle-software when I
> want to connect to a oracle-db via perl on my suse-linux system. Am I
> wring or what do I make wrong?
> 

You are wrong - you need the Oracle client libraries.

/J\


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

Date: Thu, 17 Aug 2000 08:15:40 +0200
From: "Ellegiers, J. M. (Jens)" <jellegie@ford.com>
Subject: Re: redirect script just providing an HREF, not redirecting as I'd like
Message-Id: <399B830C.6204AA6A@ford.com>

dack@visi.com* wrote:
> 
> I have successfully determined if the user is visiting the site with a
> phone or a PC, but the redirect script doesn't take them there
> directly; it only provides them with an HREF they need to click on.
> What am I doing wrong? Here is the script:
> 
> #!/usr/local/bin/perl
> 
> print "Content-type: text/html\n\n";
> print "Location: http://www.liquid3.com/\n\n";
> 

This is simple: You mustn't print the Content-type when you want to
redirect the browser.

In short: The Content-type and the Location are so-called headers not
visible to a user. So you tell the browser that everything that follows
is text especially html text. By using a double newline character at the
end, you tell the browser that this is the last header and that the rest
is content. And voila, your location is displayed in the browser.

> You can see what happens at http://dev.dack.com/
> 
> Thanks in advance,
> 
> Dack

-- 
Viele Gruesse, regards, saludos
Jens Ellegiers
---------------------------------------------------------------
FORD-Werke AG, Spessartstrasse, 50725 Koeln
Jens Ellegiers                         Email: jellegie@ford.com  /"\
Engineer (I-Engine CAE)                Phone: +49-221-90-31467   \ /
Mail Sym: D-ME/PN-S                    Fax  : +49-221-90-33025    X
ASCII Ribbon campaign against HTML E-mail & Usenet News >------> / \


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

Date: Thu, 17 Aug 2000 10:38:14 +0100
From: "pete" <pete@alphanetcoms.co.uk>
Subject: Re: redirection problems
Message-Id: <399bb6a6.0@energise.enta.net>

Hi everyone,

Thanks for your help Rafael. Your suggestions were very helpful. I used the
full path to MySQL and the textfile and the script worked fine in a Unix
environment.

Regarding the security issues, I won't be interpolating input from web users
into the system call. I'll be doing a lookup from a database and then using
the system call which is appropriate.

As a follow-up to this I'm wondering if someone can help me with the
follow-up questions:

1. Do I need to 'close' the system call or cleanup after invoking the system
command?

2. I do most of my development using Win98, but have not been successful in
reproducing similar results as the Unix environment.  I am able to run
scripts using Perl and Apache.  I've tried the following:

    system('C:/mysql/bin/mysql.exe -uroot < go.txt');
    system('C:/mysql/bin/mysql.exe -u root < go.txt');

neither seems to work although go.txt is in the current dir. What am I doing
wrong? Can the system command work under Win98? (It might be a problem with
the way I am calling MySQL). Do I need to use the full path to go.txt,
something like:
    'C:/Program files/Apache Group....'
I tried this but it didn't work either.

3. Although the original script worked, It stopped working correctly when I
tried to import data via a text file. Is there a limitation on the length of
the string/data passed via the system command?

Thanks for your help.

Pete.




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

Date: Thu, 17 Aug 2000 11:47:37 +0200
From: Jonas Reinsch <Jonas.Reinsch@ppi.de>
Subject: Regex Alternation Question
Message-Id: <399BB4B9.B779C6F0@ppi.de>

I have an alternation $alt consisting of parenthesized parts 
$p1, $p2, $p3, ..., $pn (stored in an array @alt):

@alt = ($p1, $p2, $p3, ..., $pn);
$alt = "(" . join(")|(", ($p1, $p2, $p3, ... , $pn)) . ")";

Now let's say (for the sake of simplicity) that no part $pi 
contains any further parentheses apart from non-catching-ones
like "(?:...)".
I do a match like this:

@parens = $string =~ /$alt/;

It's easy to get the part of $string that was matched by $alt
with $&, but the opposite (which part $pi of $alt matched) 
seems to be far more tricky.
The best solution I could think of is something like:

for ($i = 0; $i<@parens; $i++) {
    if ($parens[$i]) {$part = $alt[$i];last}
}

But with alternations consisting of many parts it becomes
rather slow.
Is there a more direct way to do this? (Perhaps a missing
feature?) Sorry if I'm a bit naive, but I didn't implement
a regex engine yet :-)

Jonas.


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

Date: Thu, 17 Aug 2000 09:29:04 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: RegExp Puzzle
Message-Id: <ejbnpsop5tsnh2ebb67aofj8okt7ml3geh@4ax.com>

jamesk5674@my-deja.com wrote:

>My problem lies in the fact that I have a text file formatted as the
>following:
>
>"field1","field2","field3",
>"field1","field2","field3","",
>"field1","field2","field3",
>"field1","field2","field3","field4",
>
>The file will contain at least 3 fields and may or may not contain a
>4th field.

I wouldn't use regexes. I would split into fields, for example using the
Text::CSV module, make sure I have 4, and print them out again. Oh,
maybe try this.

	($\,$,) = ("\n", ",");
	while(<>) {
	    chomp;
	    my @data = /("[^"]*"|[^",]+),?/g;
	    push @data, '""' while @data < 4;
	    print @data;  
	}

Depending on the complexity of the fields, and the way quotes are
incorporated in the fields, the regex will have to be expanded.

-- 
	Bart.


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

Date: Thu, 17 Aug 2000 09:37:57 +0100 (BST)
From: csxsdm@comp.leeds.ac.uk (Smylers)
Subject: Re: Replacing lines in a file
Message-Id: <2000Aug17.083758.11855@leeds.ac.uk>

Abigail <abigail@foad.org> uttered something along the lines of:

> Now, perhaps you meant:
> 
>     perl -ni -we 'BEGIN{$key='THEKEY'} print if /^$key|\/' file
> 
> but that has some problems. First, "THEKEY" is interpretated by the
> shell, because of your use of '' inside ''.

You're almost certainly right that that use of quotation marks isn't
what was intended, but curiously (and pedanticially) it isn't actually a
problem (at least, not in Bash, C, or Korn shells).

Without any intervening white space, adjacent strings and words just get
concatenated, so (simplifying the code to ignore the other things wrong
with it):

   perl -we 'BEGIN{$key='THEKEY'} print $key'

is interpreted by the shell exactly the same as:

  perl -we 'BEGIN{$key=THEKEY} print $key'

or indeed:

  'p'e'r'l -we B"E"GI'N{$key=T'HEK'EY} pri'n't $'key

And because of the way Perl allows unquoted bare words, and because the
word in this example happens to be all in upper-case, the code does
actually function without complaint.

(For anybody lurking who doesn't follow this:  Please forget I've said
it, and pretend that Abigail is right.  For the general case she is
right; it's just a quirk that happens to allow sloppy quoting in this
particular case, and it certainly isn't something to be encouraged.)

Smylers
-- 
Random Rebuttal:  The story of Anne Robinson and a bush mistakenly
taming Billie Piper has been shown to be false.  Apologies to them.



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

Date: Thu, 17 Aug 2000 09:05:11 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Substituting newlines for HTML equivalent
Message-Id: <vcanps49fr7jbj4ll3c90d2815v6hu3nuq@4ax.com>

Keith Calvert Ivey wrote:

>    $field =~ s/\n\n/<P>/g;
>    $field =~ s/\n/<BR>/g;

Don't forget that this won't work on a line by line basis. You need the
whole text in one string.

Personally, I'd like some newlines in there: before the "<P>", and after
the "<BR>". So, maybe this "do everything at once" method is better?

	%replace = ( "\n" => "<BR>\n", "\n\n" => "\n<P>" );
	tr/\r//d;   # don't need those
	s/(\n\n?)\n*/$replace{$1}/g;

-- 
	Bart.


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

Date: Thu, 17 Aug 2000 07:20:14 GMT
From: yhvhboy1 <yhvhboy1@home.com>
Subject: Re: windows headache
Message-Id: <399B9344.E736337A@home.com>

yhvhboy1 wrote:

> i hit my head on a window.
>
> a copy schript (to test my problem with files getting mangled)
> infile is 93,080  mangles outfile to 85 bytes.
> here's my code:
> #!c:/perl/bin/perl
> use strict;
>
> open(IN, 'c:\\command.com');
> open(OUT, '>command.com');
> print OUT (<IN>);
>
> # no i don't use windows often.

it works now.
thanks for your bits and bytes.



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

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


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