[16994] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4406 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Sep 22 18:05:38 2000

Date: Fri, 22 Sep 2000 15: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: <969660314-v9-i4406@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Fri, 22 Sep 2000     Volume: 9 Number: 4406

Today's topics:
        /me bangs head agains't brick wall <darryl@work-thicker.co.uk>
    Re: /me bangs head agains't brick wall <hartleh1@westat.com>
    Re: /me bangs head agains't brick wall (John J. Trammell)
    Re: /me bangs head agains't brick wall (Ben Coleman)
    Re: Auto-Execute Perl in HTML ??? <vf1@smarts.com>
    Re: Auto-Execute Perl in HTML ??? <mtaylorlrim@my-deja.com>
        Does Perl have C API? <x.liu@xsb.com>
        generating arrays on the fly <rocket@acme.com>
    Re: generating arrays on the fly (John J. Trammell)
    Re: generating arrays on the fly <noone@dontbother.com>
    Re: generating arrays on the fly <darryl@work-thicker.co.uk>
        Gunzip at Prohosting (BUCK NAKED1)
    Re: Gunzip at Prohosting (Clay Irving)
    Re: Help with complex regexp koppum@my-deja.com
        Help With Mac File <skpurcell@hotmail.com>
        Help With Macintosh Resource Forks <skpurcell@hotmail.com>
        Help With Macintosh Resource Forks <skpurcell@hotmail.com>
    Re: Here Document <tim@ipac.caltech.edu>
    Re: HTTP::Request lil prob <sushi38@my-deja.com>
        Identify this book! stdenton@my-deja.com
    Re: Newbie Perl/CGI Question <vf1@smarts.com>
    Re: null string (Craig Berry)
    Re: Pattern Matching Question <lr@hpl.hp.com>
    Re: Pattern Matching Question nobull@mail.com
    Re: PERL and GPS <bigiain@mightymedia.com.au>
    Re: Perl Threads on Win <rpolzer@web.de>
    Re: pushing an array of records <tim@ipac.caltech.edu>
    Re: Question about Overloading "=" alphazerozero@my-deja.com
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Fri, 22 Sep 2000 21:55:04 +0000
From: "CJ Llewellyn" <darryl@work-thicker.co.uk>
Subject: /me bangs head agains't brick wall
Message-Id: <ackgq8.jf1.ln@paulweller>

I'm having trouble with a script that recurses through directories. 

#!/usr/bin/perl -w

read_dir("/usr");

sub read_dir {
	my $dirname = $_[0];
	
	opendir(DIR , $dirname) or die "Unable to open directory : $dirname\n";
	while (defined($file = readdir(DIR))){
				# ignore . and .. directory pointers
		if(! ($file eq '.' || $file eq '..')){
			       if(-d "$dirname/$file") {
					$readdir = "$dirname/$file";
					read_dir($readdir);
				} else {				
			      		print "$dirname/$file\n";
				}
		}
	}
	closedir(DIR);
}


The problem is that when the script reaches the last file in the lowest
directory the script terminates, any suggestions ?

-- 
Regards,
CJ Llewellyn
http://www.cjll.uklinux.net/



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

Date: Fri, 22 Sep 2000 17:24:34 -0400
From: Henry Hartley <hartleh1@westat.com>
Subject: Re: /me bangs head agains't brick wall
Message-Id: <39CBCE12.134FA0D@westat.com>


CJ Llewellyn wrote:
> 
>         closedir(DIR);

What is the scope of DIR?  What happens when you reuse and close it?

Henry Hartley


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

Date: 22 Sep 2000 21:44:55 GMT
From: trammell@nitz.hep.umn.edu (John J. Trammell)
Subject: Re: /me bangs head agains't brick wall
Message-Id: <slrn8smqce.689.trammell@nitz.hep.umn.edu>

On Fri, 22 Sep 2000 21:55:04 +0000, CJ Llewellyn <darryl@work-thicker.co.uk>
wrote:
>I'm having trouble with a script that recurses through directories. 
>

perldoc DirHandle

-- 
John J. Trammell
johntrammell@yahoo.com


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

Date: Fri, 22 Sep 2000 21:46:46 GMT
From: oloryn@mindspring.com (Ben Coleman)
Subject: Re: /me bangs head agains't brick wall
Message-Id: <39cbd316.27150870@news.mindspring.com>

On 22 Sep 2000 21:44:55 GMT, trammell@nitz.hep.umn.edu (John J.
Trammell) wrote:

>On Fri, 22 Sep 2000 21:55:04 +0000, CJ Llewellyn <darryl@work-thicker.co.uk>
>wrote:
>>I'm having trouble with a script that recurses through directories. 
>>
>
>perldoc DirHandle

not to mention perldoc File::Find

Ben


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

Date: Fri, 22 Sep 2000 14:41:08 -0400
From: "Victor Felix" <vf1@smarts.com>
Subject: Re: Auto-Execute Perl in HTML ???
Message-Id: <8qg944$ld$1@versa.smarts.com>

Maureen,

I believe the "shtml" method would work, however, the web server has to be
configured to know what to do with files of that extension... Lookup how to
configure server side includes (SSI) and it should give you detailed
information on how to do this...

-Victor

"maureen" <maureen927@my-deja.com> wrote in message
news:8qe3ha$eh$1@nnrp1.deja.com...
> Hi:
>   I have a perl script that executes successfully when
> executed via a hyperlink from a webpage. The script
> generates another webpage.
>
>   I'd like to know how/if I can reference this script (which
> will be altered) in my html document so that as the html
> is rendering, the script executes and creates more html in
> the same html document and then the rest of the html is rendered.
>
>   I just can seem to find the correct syntax for this.
> It will be on a UNIX server.
>
>                              Thanks...!
>
>
>                                    Maureen
>
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.




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

Date: Fri, 22 Sep 2000 19:13:37 GMT
From: Mark <mtaylorlrim@my-deja.com>
Subject: Re: Auto-Execute Perl in HTML ???
Message-Id: <8qgb0e$jme$1@nnrp1.deja.com>

Maureen, try this...

For SSI to work you need a text file called .htaccess in the directory
you put your HTML file in. The file .htaccess must have the following
three lines in it:

Options Indexes FollowSymLinks Includes
AddType application/x-httpd-cgi .cgi
AddType text/x-server-parsed-html .html

Mark



In article <8qfv0b$41d$1@nnrp1.deja.com>,
  maureen <maureen927@my-deja.com> wrote:
>
>
> Hi:
>    Thanks for the input but this is not working either.
> I changed the html to shtml and when I tried to open
> it in a browser I get a prompt box asking if I want
> to save the file --- it won't open.
>
>    Can you suggest something else. .?
>
>                   Thanks.............Maureen
>
> In article <8qe6f9$3rv$1@nnrp1.deja.com>,
>   Mark <mtaylorlrim@my-deja.com> wrote:
> > let's see if I can remember the syntax...
> >
> > Change your html file to  filname.shtml
> >
> > then where you want the cgi to run add the line...
> >
> > <!--#exec cgi="path/to/sctipt" -->
> >
> > I think that is right...
> >
> > Mark
> >
> > In article <8qe3ha$eh$1@nnrp1.deja.com>,
> >   maureen <maureen927@my-deja.com> wrote:
> > > Hi:
> > >   I have a perl script that executes successfully when
> > > executed via a hyperlink from a webpage. The script
> > > generates another webpage.
> > >
> > >   I'd like to know how/if I can reference this script (which
> > > will be altered) in my html document so that as the html
> > > is rendering, the script executes and creates more html in
> > > the same html document and then the rest of the html is rendered.
> > >
> > >   I just can seem to find the correct syntax for this.
> > > It will be on a UNIX server.
> > >
> > >                              Thanks...!
> > >
> > >                                    Maureen
> > >
> > > Sent via Deja.com http://www.deja.com/
> > > Before you buy.
> > >
> >
> > --
> > Please reply to this newsgroup as my Deja mail
> > is used as a spam catcher only!
> >
> > Sent via Deja.com http://www.deja.com/
> > Before you buy.
> >
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
>

--
Please reply to this newsgroup as my Deja mail
is used as a spam catcher only!


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


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

Date: Fri, 22 Sep 2000 17:01:04 -0400
From: "Xiaoyan Liu" <x.liu@xsb.com>
Subject: Does Perl have C API?
Message-Id: <39cbc947_3@dilbert.ic.sunysb.edu>

Hi, all,

Does Perl have a C API for programmers to call from outside a perl engine?
My intention is to use Perl regular expression in Java through Java Native
Interface.

thanks.


Xiao
www.xsb.com






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

Date: Fri, 22 Sep 2000 11:59:46 -0700
From: JakeRocket <rocket@acme.com>
Subject: generating arrays on the fly
Message-Id: <3705191ABF160193.12EC5FA81805DFBF.417B52434F581EAA@lp.airnews.net>

after processing a text file I'm working with, I want to turn my
results into an array with numeric values for each new variable in the
array.  For each file I work with I do not know ahead of time how many
variables I want to produce (anywhere from 2 to 99).  

Can someone point me to some resources that will help me convert an
example such as the following: (This is what a sample text would look
like).

a01 1
a02 2
a03 2
a04 1
a05 2
a06 3
a07 2
 ....and so on.

I want to have the variables a01 = 1, a02 = 2, ao3 = 2, a04 = 1,etc.

Thanks in advance. 


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

Date: 22 Sep 2000 19:16:42 GMT
From: trammell@nitz.hep.umn.edu (John J. Trammell)
Subject: Re: generating arrays on the fly
Message-Id: <slrn8smhmh.65e.trammell@nitz.hep.umn.edu>

On Fri, 22 Sep 2000 11:59:46 -0700, JakeRocket <rocket@acme.com> wrote:
>after processing a text file I'm working with, I want to turn my
>results into an array with numeric values for each new variable in the
>array.  For each file I work with I do not know ahead of time how many
>variables I want to produce (anywhere from 2 to 99).  

You're really looking for the data structure known as a hash.
See 'perldoc perldata' for more details.

-- 
John J. Trammell
johntrammell@yahoo.com


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

Date: Fri, 22 Sep 2000 12:20:01 -0700
From: "Robert Lund" <noone@dontbother.com>
Subject: Re: generating arrays on the fly
Message-Id: <ssnc7b6l5ksl7f@corp.supernews.com>


"JakeRocket" <rocket@acme.com> wrote in message
news:3705191ABF160193.12EC5FA81805DFBF.417B52434F581EAA@lp.airnews.net...
> after processing a text file I'm working with, I want to turn my
> results into an array with numeric values for each new variable in the
> array.  For each file I work with I do not know ahead of time how many
> variables I want to produce (anywhere from 2 to 99).
>
> Can someone point me to some resources that will help me convert an
> example such as the following: (This is what a sample text would look
> like).
>
> a01 1
> a02 2
> a03 2
> a04 1
> a05 2
> a06 3
> a07 2
> ....and so on.
>
> I want to have the variables a01 = 1, a02 = 2, ao3 = 2, a04 = 1,etc.
>
> Thanks in advance.

I'm assuming that you dont want to have a separate sacalar variable for each
value you've read from the file.  Heres the code to store the values in a
list:


my @nums = ();
open INFILE, "$file" or die "Couldn't open $file";
while (<INFILE>) {
    /\w+ (\d+)/;
    push @nums, $1;
}

--Robert





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

Date: Fri, 22 Sep 2000 22:10:01 +0000
From: "CJ Llewellyn" <darryl@work-thicker.co.uk>
Subject: Re: generating arrays on the fly
Message-Id: <b8lgq8.9i1.ln@paulweller>

In article
<3705191ABF160193.12EC5FA81805DFBF.417B52434F581EAA@lp.airnews.net>,
JakeRocket <rocket@acme.com> burped:
> after processing a text file I'm working with, I want to turn my
> results into an array with numeric values for each new variable in the
> array.  For each file I work with I do not know ahead of time how many
> variables I want to produce (anywhere from 2 to 99).  
> 
> Can someone point me to some resources that will help me convert an
> example such as the following: (This is what a sample text would look
> like).
> 
> a01 1 a02 2 a03 2 a04 1 a05 2 a06 3 a07 2
> ....and so on.
> 
> I want to have the variables a01 = 1, a02 = 2, ao3 = 2, a04 = 1,etc.

Maybe you should use a hash 

$foo{'a01'} = 1;

etc

or 

$num=1;
$foo{"a$num"}=$num;

Alternatively you can use push to populate an array

push @foo, $num;

-- 
Regards,
CJ Llewellyn
http://www.cjll.uklinux.net/


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

Date: Fri, 22 Sep 2000 13:06:15 -0500 (CDT)
From: dennis100@webtv.net (BUCK NAKED1)
Subject: Gunzip at Prohosting
Message-Id: <1063-39CB9F97-23@storefull-245.iap.bryant.webtv.net>

[Still working on this 2 months later...sigh] 
Why doesn't this work at http://www.freeprohosting.com? I get a global
package error? How do I fix that?

Do I have the perl paths for prohosting correct? #!/usr/bin/perl works
there for all of my other scripts.

Here's my coding:

#!/usr/bin/perl
$file = usr/home1/discosco/html/lwp.tar.gz; 
@response = `/usr/contrib/bin/gzcat $file | tar -xvf - 2>&1`; 
print "<pre>\n"; 
foreach (@response) 
{ 
print; 
}
print "\n</pre>\n"; 


Also, do I have the path to my file at 

$file = usr/home1/discosco/html/lwp.tar.gz;

input correctly... or should I have input it like this: 

$file = http://lightning.prohosting.com/~discosco/lwp.tar.gz; 

I really need a perl script to unzip .tar.gz files so that I can extract
the files to a directory on my webserver so that I can grab modules and
other perl info... and learn. I cannot use a PC unzip program. 

PS  Thanks for all of your previous responses, but none of them worked.
Please help, this is driving me insane! 
 
Thanks,
--Dennis



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

Date: 22 Sep 2000 21:56:17 GMT
From: clay@panix.com (Clay Irving)
Subject: Re: Gunzip at Prohosting
Message-Id: <slrn8snlc1.7ua.clay@panix3.panix.com>

On Fri, 22 Sep 2000 13:06:15 -0500 (CDT), BUCK NAKED1 <dennis100@webtv.net> 
wrote:

>I really need a perl script to unzip .tar.gz files so that I can extract
>the files to a directory on my webserver so that I can grab modules and
>other perl info... and learn. I cannot use a PC unzip program. 

Try the dynamic duo -- Compress::Zlib and Achive::Tar

-- 
Clay Irving <clay@panix.com>
For people who like peace and quiet: a phoneless cord.


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

Date: Fri, 22 Sep 2000 19:05:51 GMT
From: koppum@my-deja.com
Subject: Re: Help with complex regexp
Message-Id: <8qgahv$j1f$1@nnrp1.deja.com>



Jeroen,

Will this work for you?

Say, $a contains your original string (like xxx;"xxx;xxx";xxx).
Now, do the following single substitution on $a.

$a =~ s{([^";]*)(;?)([^";]*)(("[^"]*")*)}
{my ($b1,$b2,$b3,$b4)=($1,$2,$3,$4);
$b2=~s/;/#/; $b1.$b2.$b3.$b4;}gex;

Now, $a would contain the resulting value as expected.

Thanks.
Murali.
koppum@hotmail.com


In article <8qb4ku$t8v$1@news.tudelft.nl>,
  "Jeroen Konijn" <news@jeroen.org> wrote:
> Hi,
>
> I want to replace the ; with a #, but only when it's not between two "
> quotes. For example:
>
> xxx;xxx;xxx;xxx   --> xxx#xxx#xxx#xxx
> xxx;"xxx;xxx";xxx --> xxx#"xxx;xxx"#xxx
>
> I cannot figure out the right regexp to do this. A solution would be
> _really_ appreciated.
>
> Jeroen Konijn
> The Netherlands
>
> ---
>   Operations & Developement - Remotion BV
>
>   Delftechpark 26, 2628 XH Delft, The Netherlands
>   (m) +31 6 20360158    (e) jeroen@remotion.nl
>   (t) +31 15 2600966    (w) http://www.remotion.nl
>   (f) +31 15 2600965
>
>


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


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

Date: Fri, 22 Sep 2000 11:32:55 -0500
From: "spurcell" <skpurcell@hotmail.com>
Subject: Help With Mac File
Message-Id: <39cbaa0a$1$11137@wodc7nh1.news.uu.net>

Hello, I have a problem and can't seem to resolve it on my own.
I am building a web site, and my configuration is a NT Web Server and I talk
to a SGI server where I host CMYK assets for Ad Agencies. I currently use
Samba for connectivity between the NT box and the SGI.

Anyway, it appears that a lot of my end users have Macintosh platforms, and
the service I am trying to code is giving them the ability to download these
files to their desktop.

What I have done up to today, has only been for PC users, and I basically
let a customer browse for an image, then if they want to download the asset,
I copy it to the web server (in the doc root) and run tar against it. And
all is good.

But now when I am trying to do the same for the Macintosh Users, I have two
issues. 1) Stuffit Expander (the macintosh tar equivalent) does not work on
tar files. And Gzip works, with Stuffit Expander, but I loose the "Resource
Fork" as soon as I copy the asset to the NT web server.

So does anyone have experience with this topic? I need somehow to run a hex
bin type application on the SGI that I can call from the NT web server, and
compress the file on the SGI, and then copy it down to the web server for
downloading.

Any suggestions?


Thanks
Scott






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

Date: Fri, 22 Sep 2000 11:31:58 -0500
From: "spurcell" <skpurcell@hotmail.com>
Subject: Help With Macintosh Resource Forks
Message-Id: <39cbaa0a$0$11137@wodc7nh1.news.uu.net>

Hello, I have a problem and can't seem to resolve it on my own.
I am building a web site, and my configuration is a NT Web Server and I talk
to a SGI server where I host CMYK assets for Ad Agencies. I currently use
Samba for connectivity between the NT box and the SGI.

Anyway, it appears that a lot of my end users have Macintosh platforms, and
the service I am trying to code is giving them the ability to download these
files to their desktop.

What I have done up to today, has only been for PC users, and I basically
let a customer browse for an image, then if they want to download the asset,
I copy it to the web server (in the doc root) and run tar against it. And
all is good.

But now when I am trying to do the same for the Macintosh Users, I have two
issues. 1) Stuffit Expander (the macintosh tar equivalent) does not work on
tar files. And Gzip works, with Stuffit Expander, but I loose the "Resource
Fork" as soon as I copy the asset to the NT web server.

So does anyone have experience with this topic? I need somehow to run a hex
bin type application on the SGI that I can call from the NT web server, and
compress the file on the SGI, and then copy it down to the web server for
downloading.

Any suggestions?


Thanks
Scott




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

Date: Fri, 22 Sep 2000 13:46:40 -0500
From: "spurcell" <skpurcell@hotmail.com>
Subject: Help With Macintosh Resource Forks
Message-Id: <39cbaa0a$2$11137@wodc7nh1.news.uu.net>

Hello, I have a problem and can't seem to resolve it on my own.
I am building a web site, and my configuration is a NT Web Server and I talk
to a SGI server where I host CMYK assets for Ad Agencies. I currently use
Samba for connectivity between the NT box and the SGI.

Anyway, it appears that a lot of my end users have Macintosh platforms, and
the service I am trying to code is giving them the ability to download these
files to their desktop.

What I have done up to today, has only been for PC users, and I basically
let a customer browse for an image, then if they want to download the asset,
I copy it to the web server (in the doc root) and run tar against it. And
all is good.

But now when I am trying to do the same for the Macintosh Users, I have two
issues. 1) Stuffit Expander (the macintosh tar equivalent) does not work on
tar files. And Gzip works, with Stuffit Expander, but I loose the "Resource
Fork" as soon as I copy the asset to the NT web server.

So does anyone have experience with this topic? I need somehow to run a hex
bin type application on the SGI that I can call from the NT web server, and
compress the file on the SGI, and then copy it down to the web server for
downloading.

Any suggestions?


Thanks
Scott






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

Date: Fri, 22 Sep 2000 14:05:29 -0700
From: Tim Conrow <tim@ipac.caltech.edu>
Subject: Re: Here Document
Message-Id: <39CBC999.5062A7C5@ipac.caltech.edu>

Brendon Caligari wrote:
> At time perl syntax is 'upWalling'...
> (note white space)
> 
>    print $fh <<'_EOT_';
> works

perl figured out that $fh is a filehandle, not a variable to be printed. Score 1
for DWIMery.

>    print $fh << '_EOT_';
> fails

As clearly documented. No unquoted space allowed after the '<<'. Score one for
documentation. (Though see below.)

>    print $fh<<'_EOT_';
> fails

Fails as a here-doc, yes. The compiler sees that as a left shift, having
determined that's what you must mean, probably because an indirect object is
followed by whitespace unless enclosed in '{}'.

print {$fh}<<'_EOT_';

works fine. Not at all obvious, I agree. Score -0.5 for DWIMery.

> on the other hand
>    print << '_EOT_';
> and
>    print( << '_EOT_');
> work!!!!!

Hmm. The docs are clear that there should be no unquoted space after the '<<'.
However, it appears to be legal if the tag is quoted, at least sometimes. Is
this new? Do the docs need to catch up? Score -1 for the docs.

Perl's up +0.5, but others may disagree with my scoring. :-)

The indirect object syntax can be a bear. I'm hoping something better can be
worked into [Pp]erl6.

For *real* indirect object and OO fun, see what comes out when you run 'perl
-MO=Deparse' on this:

print $fh<<'_EOT_';
aaa
bbb
ccc
_EOT_

print << '_EOT_';
xcv
bnm
,./
_EOT_


--

-- Tim Conrow         tim@ipac.caltech.edu                           |


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

Date: Fri, 22 Sep 2000 20:34:17 GMT
From: Igor Mack <sushi38@my-deja.com>
Subject: Re: HTTP::Request lil prob
Message-Id: <8qgfo8$pik$1@nnrp1.deja.com>

Thanks to all, I got it to work. I found a good example at
http://www.rrz.uni-hamburg.de/RRZ/software/LWP.pm/LWP.pm.html
and re did it from there.

Igor

In article <8q9k8n$cp2$1@orpheus.gellyfish.com>,
  Jonathan Stowe <gellyfish@gellyfish.com> wrote:
> On Tue, 19 Sep 2000 14:20:02 +0200 Alain BARBET wrote:
> > Hi,
> >
> >> Why do keep getting "Error: 400 URL is missing" but when I paste
it in
> >> the browser it works fine ?
> >>                 my $req = HTTP::Request->new
> >> (POST 'http://testserver/commerce/shop/shop/esdposttest.asp',
> >
> > When you test in browser, you use method "GET". May be error come
from
> > here ?
>
> There should be a comma between the POST and the URL :
>
> my $req = HTTP::Request->new (POST =>
>              'http://testserver/commerce/shop/shop/esdposttest.asp');
>
> /J\
> --
> yapc::Europe in assocation with the Institute Of Contemporary Arts
>    <http://www.yapc.org/Europe/>   <http://www.ica.org.uk>
>

--
Igor Mack.


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


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

Date: Fri, 22 Sep 2000 19:11:27 GMT
From: stdenton@my-deja.com
Subject: Identify this book!
Message-Id: <8qgasc$je1$1@nnrp1.deja.com>

Here's a question that is very truly "misc"!

From http://www.info.lk/techweb/perl/tutor/

"The sort function compares two variables, $a and $b. They must be
called $a and $b otherwise it won't work. One chap published a book
with stolen code, and he changed $a and $b to $x and $y. He obviously
didn't test the program because it would have failed and he would have
noticed. And this book was really published ! Don't believe everything
you read in books - but web tutorials are always 100% truthful :-)"

My question is, what book is this guy talking about?


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


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

Date: Fri, 22 Sep 2000 14:36:42 -0400
From: "Victor Felix" <vf1@smarts.com>
Subject: Re: Newbie Perl/CGI Question
Message-Id: <8qg8rq$ks$1@versa.smarts.com>

Bill,

Did you install ActivePerl ? This will allow windows machines to run perl...

-Victor

"Bill Sampler" <bsamp@my-deja.com> wrote in message
news:8qfkre$nat$1@nnrp1.deja.com...
> I have just started learning Perl/CGI but I have been an Informix 4GL
> programmer for 8 years. I have looked at a tutorial ( a not so complete
> one) on how to have a HTML form with a submit button on it that
> executes a script called simple-form.cgi which is written in Perl. I
> can get the form to display in the browser, but when I fill in the form
> (First name, last name, etc) and click the submit button, the text of
> the file simple-form.cgi appears in the browser instead of executing
> the script. I have a Pentium 200 PC / Windows 98. I have created a
> folder under C:\ called cgi-bin as the tutorial said that the scripts
> would have to reside there. There must be some steps I'm missing. Any
> help would be greatly appreciated.
>
> Thanx,
> Bill Sampler
>
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.




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

Date: Fri, 22 Sep 2000 20:59:56 -0000
From: cberry@cinenet.net (Craig Berry)
Subject: Re: null string
Message-Id: <ssni2c82238sb5@corp.supernews.com>

circuit_board@my-deja.com wrote:
: I have looked absolutely everywhere to try to find an answer to this.
: All I'm trying to do is to see if $somestring is null. I have tried /\s/
: but this matches a space not null. I have tried " ", ' ' but none of
: these work. How do I test if($somestring = null) ? Thanks for your help.

What's wrong with testing ($str eq '')?  Using (! length $str) also works.

-- 
   |   Craig Berry - http://www.cinenet.net/~cberry/
 --*--  "Quidquid latine dictum sit, altum viditur."
   |


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

Date: Fri, 22 Sep 2000 10:59:20 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: Pattern Matching Question
Message-Id: <MPG.14353dd0ef4fdb3498adb6@nntp.hpl.hp.com>

[Posted and a courtesy copy mailed.]

In article <8qg18f$4t0$1@rmsrv1.aexis.net> on Fri, 22 Sep 2000 12:27:38 
-0400, Scott Snella <bg229@scn.org> says...
> Hi, I am having a problem.  I have a string being passed to a CGI script
> with "/"'s in it.  I need to compare that string to another.  Although I
> print out both strings and they are the same, the PERL pattern matching
> doesn't evaluate correctly.  I am assuming that is because of the /'s in
> there.

No.  Even if you use '/' as a regex delimiter, any '/' interpolated into 
the regex isn't seen until the regex is executed, so cannot affect the 
parsing:

    my $foo = 'a string containing / more / than / once';
    s/$foo/bar/;

Why are you using pattern matching to determine string equality?  See 
below.

>      Is there any special way that I can tell PERL to just take the whole
> string and match it without having the /'s screw it up?

Use the 'eq' operator for string equality, the 'index' operator for 
substring matching.

>       If not, is there a
> way to iterate through each of the characters until I find a / and take it
> out?

Sure there is, but it is neither necessary nor desirable in this 
situation.  To remove all '/':

    tr%/%%d

>       It doesn't seem as though pattern matching works at all with this
> situation.  Can anyone help?

We could help more if you posted a small test program (not CGI!) that 
doesn't do what you think it should.

>                               Please email me... thanks.

Sure, why not?

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


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

Date: 22 Sep 2000 20:46:24 +0100
From: nobull@mail.com
Subject: Re: Pattern Matching Question
Message-Id: <u9ya0kdxbj.fsf@wcl-l.bham.ac.uk>

"Scott Snella" <bg229@scn.org> writes:

> Hi, I am having a problem.  I have a string being passed to a CGI script
> with "/"'s in it.  I need to compare that string to another.

The string equality operator is "eq".

  Although I
> print out both strings and they are the same, the PERL pattern matching
> doesn't evaluate correctly.  I am assuming that is because of the /'s in
> there.  Is there any special way that I can tell PERL to just take the whole
> string and match it without having the /'s screw it up?

\Q

-- 
     \\   ( )
  .  _\\__[oo
 .__/  \\ /\@
 .  l___\\
  # ll  l\\
 ###LL  LL\\


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

Date: Fri, 22 Sep 2000 13:26:48 -0700
From: Iain Chalmers <bigiain@mightymedia.com.au>
Subject: Re: PERL and GPS
Message-Id: <bigiain-C9DFD4.13264822092000@news.pacbell.net>

In article <RHJy5.6403$gi1.125305@news.magma.ca>, slipper@canada.com 
(Bob M) wrote:

> Are there any available PERL scripts or modules to facilitate uploading 
> and 
> downloading data from GPSs?  (I couldn’t find anything on CPAN).

It doesn't seem to be on cpan, but take a look at 

< http://www.iscsp.utl.pt/joaop/work_in_progress/GPS-Garmin-0.02.tar.gz>

cheers

big


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

Date: Fri, 22 Sep 2000 20:38:11 +0200
From: "Seiberdragan" <rpolzer@web.de>
Subject: Re: Perl Threads on Win
Message-Id: <8qgdcm$nh6$1@riker.addcom.de>


"iRQ9" <iloveyou@mailroom.com> schrieb im Newsbeitrag
news:8q8m8p$e9c1o$1@ID-51655.news.cis.dfn.de...
> Where can I find  Perl for win  with Threads support  ?
>
> I am trying to execute a simple program on ActiveState Perl
> _________________________
> use Thread;
>
> $thr = new Thread \&sub1;
>
> sub sub1
>
>
> print "In the thread\n";
>
> }
>
> _________________________
>
> and I am getiing the error:
>
> "No threads in this perl at script line 2."

Perhaps you can call it using fork()?

>
>
> In the Threads documentation I found some info that says I must recompile
> perl
> with threads support option. Anybody knows how I can do this in WinNT ?
> Is there any other way or place  I can obtain a  "Thread enabled"  Perl
for
> Win ?
>
>
> Thanks !
>
>
>
>
>




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

Date: Fri, 22 Sep 2000 14:24:42 -0700
From: Tim Conrow <tim@ipac.caltech.edu>
Subject: Re: pushing an array of records
Message-Id: <39CBCE1A.C2523BDC@ipac.caltech.edu>

phylobhetto@my-deja.com wrote:
> 
> I'm trying to create an array of records.  I get
> the contents of a directory and store them in an
> array.  From there, I split each array element
> into the different elements of my record.  Now I
> need to insert that entire record into a separate
> array... that's where the trouble is.  My code is
> similar to this:
> 
> #read in data
> @list = `/bin/ls -1`;
> 
> #insert data into records
> foreach $line (@list) {
>   ($var1,$var2,$var3) = split (/_/,$line);
>   $rec = {};

 ... creates a new hash reference.

>   $rec -> {TEMP1} = $var1;
>   $rec -> {TEMP2} = $var2;
>   $rec -> {TEMP3} = $var3;

 ... populates the hash refered to by $rec ...

>   push @arrayOfRecords, $rec;

 ... pushes each new reference onto the list.

> }
> 
> I don't know the purpose of the "$rec = {}" but
> when it's there, and I print the array, I get the
> first item in the @list array. 

All the elements of @arrayOfRecords are there, so either there's a difference
between your sample code and your real code, or it's how you're trying to
access/print its elements. Care to show us that?

> When it's not there and I print, I get the last item in the
> @list array. 

Because you're pushing the same array ref over and over again, and the hash ref
refered to only holds one record at a time.

Read perlref through. Read first, post later.

--

-- Tim Conrow         tim@ipac.caltech.edu                           |


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

Date: Fri, 22 Sep 2000 19:55:11 GMT
From: alphazerozero@my-deja.com
Subject: Re: Question about Overloading "="
Message-Id: <8qgdek$mn6$1@nnrp1.deja.com>

In article <Dnqx5.4941$o6.30089@news-west.usenetserver.com>,
  daniel@chetlin.com wrote:
<snip>
> It can be very confusing. I've been meaning to change the wording in
> overload.pm for a while, but have been caught up fixing other things.
<snip>
>   c) The documentation for overload is confusing and oddly ordered.
>      Hopefully I'll get that fixed before 5.6.1.
>
> -dlc

Thank you very much.
I think this email has cleared up my confusion.  Or at least my initial
confusion.  Im sure by the time ive finished what im writing I will
know every sentence inside out.

May I suggest that you include it in your new version of the overload
docs?  I figured out most of the the operators but the "mutators" and
im working on them right now so this will help greatly.

As an aside Id like to say that it is very reassuring for someone like
myself who is learning perl (and applying it on a daily basis actually)
to have people like yourself reply with such detail and thoroughness.





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


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

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


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