[10556] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4149 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Nov 4 14:08:03 1998

Date: Wed, 4 Nov 98 11:01:37 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Wed, 4 Nov 1998     Volume: 8 Number: 4149

Today's topics:
    Re: perl newbie desperate question <rootbeer@teleport.com>
    Re: que regarding perl&C interface <rootbeer@teleport.com>
    Re: Quiz type form.... <rootbeer@teleport.com>
        Reg exp question <dat96gln@student3.lu.se>
    Re: Reg exp question (Sean McAfee)
        replacing inbetween 2 keywords <mikej@1185design.com>
        Setting defaults in @INC? <grace@laurel.humboldt.edu>
        system(". $file"); #odd result! <prl2@lehigh.edu>
        using die to prevent blank forms <Pap22@erols.com>
    Re: using die to prevent blank forms <Tony.Curtis+usenet@vcpc.univie.ac.at>
    Re: using die to prevent blank forms (brian d foy)
    Re: using die to prevent blank forms <Pap22@erols.com>
        Using Perl to do an HTTP "GET /" <paul.fischer@cwusa.com>
    Re: Using Perl to do an HTTP "GET /" <Tony.Curtis+usenet@vcpc.univie.ac.at>
    Re: Web_store question <rootbeer@teleport.com>
        Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)

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

Date: Wed, 04 Nov 1998 18:41:46 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: perl newbie desperate question
Message-Id: <Pine.GSO.4.02A.9811041039120.7431-100000@user2.teleport.com>

On Wed, 4 Nov 1998, Casema wrote:

> Subject: perl newbie desperate question

Please check out this helpful information on choosing good subject
lines. It will be a big help to you in making it more likely that your
requests will be answered.

    http://www.perl.com/CPAN/authors/Dean_Roehrich/subjects.post

> I downloaded perl from www.perl.com and installed it on my windows98
> pc for testing.

That's a good start.

> what is the code to point to this directory.

It sounds as if you're having troubles with your system. Perhaps the docs,
FAQs, and newsgroups about your system would be useful to you. Good luck!

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



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

Date: Wed, 04 Nov 1998 18:38:02 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: que regarding perl&C interface
Message-Id: <Pine.GSO.4.02A.9811041036550.7431-100000@user2.teleport.com>

On Wed, 4 Nov 1998, Dharti Dhami wrote:

>         I am a student at purdue university and i am trying to develop
> a web based application in which i need to do the following things
> 
> 1. Get some information from the web - using Forms on the web page 2.
> Use this information .
>         A c program is written to process this information.
> 
> I would like to know if it is possible to pass this information to C
> program and cause the C program to run and then get the results from
> this C program and then display on the web page again.

Yes, it is possible. I recommend you use some of the suggestions in the
perlipc manpage. Hope this helps!

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



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

Date: Wed, 04 Nov 1998 18:23:35 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: Quiz type form....
Message-Id: <Pine.GSO.4.02A.9811041022560.7431-100000@user2.teleport.com>

On Wed, 4 Nov 1998, James Bartlett wrote:

> I've got a questionnaire form with 9 set's of 3 radio buttons. I want
> a page to appear on pressing the submit button that tells the users
> whether they've answered Mostly A's, Mostly B's or Mostly C's.
> 
> How can this be done??

Perhaps you want a CGI program that will do this. The docs, FAQs, and
newsgroups about CGI programming may be helpful here. Good luck!

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



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

Date: Wed, 04 Nov 1998 20:43:26 +0100
From: Gunnar Lindholm <dat96gln@student3.lu.se>
Subject: Reg exp question
Message-Id: <3640AE5E.247A@student3.lu.se>

Hello.

I have a line that I have read in from a file and it contains some 
mathematical expressions  like + * / and sin()
for example: x+y*sin(a+b)
And I want to extract the operands from the expression.
the above example would give: x,y,a,b

The problem is now that I find the Reg exp in perl is very  useful in
combination with split. But how do I do this with the sin() operator?
I wish to use split since it is so convenient.

I have just started with Perl. It's fantastic!!

Kind regards
Gunnar

"Don't use TitaniC++"


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

Date: Wed, 04 Nov 1998 18:53:45 GMT
From: mcafee@waits.facilities.med.umich.edu (Sean McAfee)
Subject: Re: Reg exp question
Message-Id: <Zo102.5090$fS.16574397@news.itd.umich.edu>

In article <3640AE5E.247A@student3.lu.se>,
Gunnar Lindholm  <dat96gln@student3.lu.se> wrote:
>I have a line that I have read in from a file and it contains some 
>mathematical expressions  like + * / and sin()
>for example: x+y*sin(a+b)
>And I want to extract the operands from the expression.
>the above example would give: x,y,a,b

>The problem is now that I find the Reg exp in perl is very  useful in
>combination with split. But how do I do this with the sin() operator?
>I wish to use split since it is so convenient.

Here's one (possibly too simple-minded) possibility:

@operands = split /\W+|\w*\(/, $string;

The \W+ eliminates non-word characters, and the \w*\( eliminates function
names.

-- 
Sean McAfee | GS d->-- s+++: a26 C++ US+++$ P+++ L++ E- W+ N++ |
            | K w--- O? M V-- PS+ PE Y+ PGP?>++ t+() 5++ X+ R+ | mcafee@
            | tv+ b++ DI++ D+ G e++>++++ h- r y+>++**          | umich.edu


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

Date: Wed, 04 Nov 1998 09:24:29 +0000
From: mikej <mikej@1185design.com>
Subject: replacing inbetween 2 keywords
Message-Id: <36401D4B.266EABFD@1185design.com>

Thanks for your help on finding and replacing.

Now is there a way to open an html file, then find a piece of text
between 2 keywords and replace or delete it? If I wanted to replace or
delete everything in my html file inbetween where it says <!--START-->
and <!STOP-->, is that possible with perl? Normally I could just do a
substitute command and tell it exactly which text to replace, but the
problem is that since the content of the html file is now generated
dynamically, I dont know exactly what the content is, so I cant specify
what to replace. Any ideas?
 

-Mike
 



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

Date: 4 Nov 1998 18:30:09 GMT
From: "Ryan Grace" <grace@laurel.humboldt.edu>
Subject: Setting defaults in @INC?
Message-Id: <01be0821$bee25700$13d89689@grace>

Hi All.  Our University Telecomm people just upgraded to Perl 5.005 on our
web server and it went less than smoothly.  Many modules are not found in
the paths in @INC anymore.  My understanding is that @INC includes the
site_perl directory, but after our upgrade it does not.  I've tried
push(@INC, '/usr/local/lib/perl5/site_perl'); to no avail in my scripts. 
I'd like to be able to tell them how to permanently add the site_perl path
to the @INC array.  They don't know how it's done.  Anyone know where these
values are stored?  Is there a config file I can modify somewhere or is
that too easy?

Ryan Grace
Office for Enrollment Management
Humboldt State University


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

Date: Wed, 4 Nov 1998 11:12:55 -0500
From: "Phil R Lawrence" <prl2@lehigh.edu>
Subject: system(". $file"); #odd result!
Message-Id: <71pugo$j9u@fidoii.cc.Lehigh.EDU>

Hi,
When I run . /path/set_env_vars from the shell prompt there is no problem.  If
I run the following perl, however...

test.pl:
===========================
#!/usr/local/bin/perl -w
use diagnostics;
use strict;

# Set environmental variables
my $file = '/path/set_env_vars';
my $x = system(". $file");
print "\$x = $x\n";
===========================

I get:
prompt >test.pl
sh: ADMIN_SYS_LIST=joe@machine1,dink!@lehigh.edu,prl2@lehigh.edu: 0402-026 The
specified data is not a valid identifier.
$x = 256

(I think that $x = 256 translates into an exit code of 1.)

set_env_vars:
===========================
#!/bin/ksh
export ADMIN_SYS_LIST=joe@machine1,dink!@lehigh.edu,prl2@lehigh.edu
export ADMIN1_MAIL_LIST=fine@admin1,bink@admin1
<snip>
===========================

If I comment out the first line of set_env_vars I get the same error as above
about the second line.  Any idea what I'm doing wrong?

Thanks,
Phil R Lawrence






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

Date: Wed, 4 Nov 1998 01:49:22 -0500
From: "Pap" <Pap22@erols.com>
Subject: using die to prevent blank forms
Message-Id: <71q46v$gmr$1@autumn.news.rcn.net>

To prevent someone from submitting a blank form, I use the die command to
halt the rest of the script and display a message, like this:

if ($FORM{'email'} eq "") {
die "<h2>Error!</h2><p>Please fill out the field for your E-mail address.";
}

But when I test it out on my server, I just get this error message instead
of the <hr>Error!</h2>... I get:

Internal Server Error
The server encountered an internal error or misconfiguration and was unable
to complete your request....(blah blah blah)...Premature end of script
headers ../postdata.cgi

It DOES halt the rest of the script, which is good, but I would like the
user to see what mistake he made.  What am I doing wrong?

Thank you.
-Pap




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

Date: 04 Nov 1998 18:56:47 +0100
From: Tony Curtis <Tony.Curtis+usenet@vcpc.univie.ac.at>
Subject: Re: using die to prevent blank forms
Message-Id: <83n267bau8.fsf@vcpc.univie.ac.at>

Re: using die to prevent blank forms, Pap <Pap22@erols.com>
said:

Pap> To prevent someone from submitting a blank form, I use
Pap> the die command to halt the rest of the script and
Pap> display a message, like this:

Pap> if ($FORM{'email'} eq "") { die
Pap> "<h2>Error!</h2><p>Please fill out the field for your
Pap> E-mail address."; }

Pap> But when I test it out on my server, I just get this
Pap> error message instead of the <hr>Error!</h2>... I get:

die goes to stderr, not stdout.  stuff to go back to the
browser is on stdout.

CGI.pm has "error back to browser" setup:

qx(perldoc CGI);

    use CGI::Carp 'fatalsToBrowser';

perldoc CGI::Carp

hth
tony
-- 
Tony Curtis, Systems Manager, VCPC,    | Tel +43 1 310 93 96 - 12; Fax - 13
Liechtensteinstrasse 22, A-1090 Wien,  | <URI:http://www.vcpc.univie.ac.at/>
"You see? You see? Your stupid minds!  | private email:
    Stupid! Stupid!" ~ Eros, Plan9 fOS.| <URI:mailto:tony_curtis32@hotmail.com>


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

Date: Wed, 04 Nov 1998 13:09:13 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: using die to prevent blank forms
Message-Id: <comdog-ya02408000R0411981309130001@news.panix.com>

In article <71q46v$gmr$1@autumn.news.rcn.net>, "Pap" <Pap22@erols.com> posted:

> To prevent someone from submitting a blank form, I use the die command to
> halt the rest of the script and display a message, like this:
> 
> if ($FORM{'email'} eq "") {
> die "<h2>Error!</h2><p>Please fill out the field for your E-mail address.";
> }

perhaps you'd like to read my article on this problem in The Perl Journal
issue #9 :)

in short:  you have to supply a valid HTTP message.  you forgot the
HTTP header.  D'oh!

-- 
brian d foy                                  <comdog@computerdog.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>


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

Date: Wed, 4 Nov 1998 13:27:27 -0500
From: "Pap" <Pap22@erols.com>
Subject: Re: using die to prevent blank forms
Message-Id: <71q6d6$q18$1@autumn.news.rcn.net>

Thanks guys!  The tutorial I was using didn't include the HTML header for
some reason but worked.  Thanks a bundle!




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

Date: Wed, 04 Nov 1998 16:45:14 GMT
From: Paul Fischer <paul.fischer@cwusa.com>
Subject: Using Perl to do an HTTP "GET /"
Message-Id: <36408989.F9F8D85C@cwusa.com>

I know I've seen scripts to open a socket and do an HTTP GET. I don't know
where to find them and I am not good enough to write one myself. I am
trying to create a tiny application that checks to see if the web server
returns a certain error on "GET /". Normally I would use "expect" to do the
GET, but expect is not on all the machines this app will run on. 

If someone could point me to a script that does a GET I would really
appreciate it.
-- 
Paul Fischer - Sr. Network Eng. - Cable and Wireless Web Hosting
Author "Configuring Cisco Routers for ISDN" - Publisher McGraw-Hill
See my web site for more details and purchasing information.
http://paul.tibex.com - paul.fischer@cwusa.com - (703) 341-6116 (v)


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

Date: 04 Nov 1998 18:10:37 +0100
From: Tony Curtis <Tony.Curtis+usenet@vcpc.univie.ac.at>
Subject: Re: Using Perl to do an HTTP "GET /"
Message-Id: <83hfwf8jua.fsf@vcpc.univie.ac.at>

Re: Using Perl to do an HTTP "GET /", Paul
<paul.fischer@cwusa.com> said:

Paul> I know I've seen scripts to open a socket and do an
Paul> HTTP GET. I don't know where to find them and I am not

see:

  perldoc LWP

Paul> If someone could point me to a script that does a GET
Paul> I would really appreciate it.

example in:

  perldoc LWP::Simple

hth
tony
-- 
Tony Curtis, Systems Manager, VCPC,    | Tel +43 1 310 93 96 - 12; Fax - 13
Liechtensteinstrasse 22, A-1090 Wien,  | <URI:http://www.vcpc.univie.ac.at/>
"You see? You see? Your stupid minds!  | private email:
    Stupid! Stupid!" ~ Eros, Plan9 fOS.| <URI:mailto:tony_curtis32@hotmail.com>


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

Date: Wed, 04 Nov 1998 17:34:40 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: Web_store question
Message-Id: <Pine.GSO.4.02A.9811040929370.7431-100000@user2.teleport.com>

On Tue, 3 Nov 1998, Kerry J. Cox wrote:

> When I changed all the permissions to 777, i.e. chmod 777 * in the

Don't do that. Regard as very dangerous whatever source of information
told you to do that.

Even if that mode is not dangerous on your system, it's not helpful.

If you're still having troubles with web_store, perhaps you can get
support via a mailing list, from the author, or from a support service.
Good luck!

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



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

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


Administrivia:

Special notice: in a few days, the new group comp.lang.perl.moderated
should be formed. I would rather not support two different groups, and I
know of no other plans to create a digested moderated group. This leaves
me with two options: 1) keep on with this group 2) change to the
moderated one.

If you have opinions on this, send them to
perl-users-request@ruby.oce.orst.edu. 


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

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