[18007] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 167 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Jan 29 11:05:44 2001

Date: Mon, 29 Jan 2001 08:05:09 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <980784309-v10-i167@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Mon, 29 Jan 2001     Volume: 10 Number: 167

Today's topics:
        [OT] What other languages do you know? <m_ario@my-deja.com>
    Re: [OT] What other languages do you know? <djberge@uswest.com>
    Re: [OT] What other languages do you know? jw_c@my-deja.com
    Re: CGI.pm <tore@extend.no>
    Re: Handling Errors nicely <djberge@uswest.com>
    Re: Handling Errors nicely <mjcarman@home.com>
    Re: Handling Errors nicely (Eric Bohlman)
    Re: How to make Perl wait <brentdax1_@_earthlink.net>
    Re: How to make Perl wait (=?iso-8859-1?Q?J=F6rg?= Ziefle)
        Looking for a reviews script with ratings. <spawn1112@slip.net>
    Re: Looking for a reviews script with ratings. <x@x.x>
        mod_perl with DSO fraikin@my-deja.com
    Re: New Perl Book. <bowman@montana.com>
    Re: Newbie Question:  Can I compile a Perl Script? <djberge@uswest.com>
    Re: Newbie Question:  Can I compile a Perl Script? <djberge@uswest.com>
    Re: Newbie Question:  Can I compile a Perl Script? <flavell@mail.cern.ch>
    Re: Newbie Question:  Can I compile a Perl Script? <djberge@uswest.com>
    Re: Newbie Question: Can I compile a Perl Script? qcoldiron@yahoo.com
    Re: passing parameter (Eric Bohlman)
    Re: Perl is bad at (very) simple math! philhibbs@my-deja.com
        perl newbie cyberwing79@my-deja.com
    Re: perl newbie <djberge@uswest.com>
        perlMagick under windows <dnp@ms-visucom.de>
        regex help in an html file... (Jamie)
    Re: Running a CGI as a USER <devnull@localhost.org>
    Re: String functions? <x@x.x>
    Re: uploading files <m_ario@my-deja.com>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Mon, 29 Jan 2001 14:03:09 GMT
From: Mario <m_ario@my-deja.com>
Subject: [OT] What other languages do you know?
Message-Id: <953t6p$o23$1@nnrp1.deja.com>

Just curious to know what other languages are popular in the Perl
community.

--
Mario
diab.litoATusa.net


Sent via Deja.com
http://www.deja.com/


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

Date: Mon, 29 Jan 2001 08:34:00 -0600
From: Daniel Berger <djberge@uswest.com>
Subject: Re: [OT] What other languages do you know?
Message-Id: <3A757F58.72519EB9@uswest.com>

I think you'll find C and C++ as the "other" language of choice among
Perl programmers (largely due to XS, SWIG and now Inline.pm),
although I'm sure Java is gaining more popularity.

I personally use C as my "other" language and have taught myself some
Python and Ruby.

Dan

Mario wrote:

> Just curious to know what other languages are popular in the Perl
> community.
>
> --
> Mario
> diab.litoATusa.net
>
> Sent via Deja.com
> http://www.deja.com/



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

Date: Mon, 29 Jan 2001 14:46:05 GMT
From: jw_c@my-deja.com
Subject: Re: [OT] What other languages do you know?
Message-Id: <953vna$qc9$1@nnrp1.deja.com>

In article <953t6p$o23$1@nnrp1.deja.com>,
  Mario <m_ario@my-deja.com> wrote:
> Just curious to know what other languages are popular in the Perl
> community.

Hmmm... not really sure how "The Perl Community" is defined, but I'll
play:

Languages I know (more or less) well[1]:

Perl
C
Java
sh[2]

Languages I've dabbled in[3]:

FORTRAN
COBOL
LISP
C++

Pascal fits in there somewhere; I've written Real Prgrams in it,
but  that was a long, long time ago.

[1] "Well" is defined as "I've actually written serious programs
that did something useful in this language".
[2] Programming in sh is understood to include grep/awk/sed/and pretty
much anything else in /bin. That might be why I like Perl so much!
[3] Defined as "I took a course or read a book or something,
but never did aything serious in it".


Sent via Deja.com
http://www.deja.com/


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

Date: Mon, 29 Jan 2001 16:57:26 +0100
From: Tore Aursand <tore@extend.no>
Subject: Re: CGI.pm
Message-Id: <MPG.14dfb14e4e7b596d98986e@news.online.no>

In article <3a748ad3.3673190@news.planet.nl>, mustbe@pdelahunta.cjb.com 
says...
> I have a form wich's method = POST and action= "../form.pl?number=714"
> I want to retrieve  both the POSTed parameters and the 'number'
> parameter using CGI.

It's mentioned in the CGI documentation ('man CGI'), but are you sure 
you really want to do this?  Isn't easier - and "more gentle" - to put 
this number inside the form as a hidden parameter?

Example;

<FORM ACTION="../form.pl" METHOD="post">
 .
 .
 .
<IMPUT TYPE="hidden" NAME="number" VALUE="714">
</FORM>

Makes more sense for me.


-- 
Tore Aursand - tore@extend.no - http://www.extend.no/~tore/


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

Date: Mon, 29 Jan 2001 08:37:52 -0600
From: Daniel Berger <djberge@uswest.com>
Subject: Re: Handling Errors nicely
Message-Id: <3A758040.2643D6EF@uswest.com>

If you can get ahold of a copy of "Advanced Perl Programming" by O'Reilly,
there's an entire
chapter devoted to the subject.  There is also a module (or two) on CPAN
that provide syntax
that's very similar to the C++/Java "try-catch-throw" if you prefer that.
See the "Error" module,
for example (on CPAN).

Dan

Matt Venn wrote:

> Hey all,
>
> I have just started using Perl to make my own modules. I was wondering if
> anyone could offer tips/links on good ways to flow error conditions back
> to the user - rather than just die-ing.
>
> Is there a nice way of emulating Java's try catch mechanism? Subroutines
> die, but are called from an eval block?
>
> Thanks,
>
> Matt
>
> --
> #!/usr/bin/perl
> open(S,$0);while(<S>){if(/l(.*?$l)/x){
> print chr($ Al+ $A+10*(length $1) +(length
> >39?86:77));$l= $ l?'\$':'\(';}}print"\n";



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

Date: Mon, 29 Jan 2001 08:10:55 -0600
From: Michael Carman <mjcarman@home.com>
Subject: Re: Handling Errors nicely
Message-Id: <3A7579EF.24C3D746@home.com>

Matt Venn wrote:
> 
> I have just started using Perl to make my own modules. I was wondering if
> anyone could offer tips/links on good ways to flow error conditions back
> to the user - rather than just die-ing.
>
> Is there a nice way of emulating Java's try catch mechanism? 
> Subroutines die, but are called from an eval block?

I don't know Java, but please *don't* eval() your subroutine calls.
eval() is done at runtime, which means that it slows your program down.
Plus, it could be a security risk. It's a useful tool, but it's a
sledgehammer. Don't use it for driving finishing nails.

Instead of calling die(), use warn(), or check out the Carp.pm module.
Trap the error, return [some value that means] failure, and let the user
deal with it. Just be sure to document the behavior.

-mjc


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

Date: 29 Jan 2001 15:20:52 GMT
From: ebohlman@omsdev.com (Eric Bohlman)
Subject: Re: Handling Errors nicely
Message-Id: <9541ok$msk$2@bob.news.rcn.net>

Michael Carman <mjcarman@home.com> wrote:

> I don't know Java, but please *don't* eval() your subroutine calls.
> eval() is done at runtime, which means that it slows your program down.
> Plus, it could be a security risk. It's a useful tool, but it's a
> sledgehammer. Don't use it for driving finishing nails.

Except that nobody here is talking about eval().  They're talking about 
eval {}.  The block form of eval is a completely different beast from the 
string form, and suffers none of the problems the string form has.



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

Date: Mon, 29 Jan 2001 14:58:27 GMT
From: "Brent Dax" <brentdax1_@_earthlink.net>
Subject: Re: How to make Perl wait
Message-Id: <nyfd6.25854$x_2.169935@newsread1.prod.itd.earthlink.net>


Hash: SHA1

"Jimtaylor5" <jimtaylor5@aol.com> wrote in message
news:20010128162737.16317.00001537@ng-cn1.aol.com...
> I've written a perl program which writes out a form with certain
> options, and I want to force everyone to answert the question
> within "say 60 seconds." Where, if not, my perl program would write
> to a file and go to another page. The part I am having problems
> with is having perl wait. Does anyone know of an effective way to
> do this? I tried sleep(60); at the end of the printout. That waited
> alright, but it didn't allow any html to be printed to screen until
> after the 60 seconds. Of course then the program writes to file and
> goes on to the next page. Can anytone help me with this PLEASE!

I seem to remember that there's a META tag that will do something
like this.

<META HTTP-EQUIV="Refresh" CONTENT="time-in-seconds;
URL=url-to-redirect-to">

(or something like that).  Outputting this to a browser tells it that
in time-in-seconds seconds, it should go to url-to-redirect-to.  Not
sure if this is what you're trying to do, but it might be.  For
example:

<META HTTP-EQUIV="Refresh" CONTENT="60; myscript.cgi?timeout=1">
 .
 .
 .
<INPUT TYPE="Hidden" NAME="timeout" VALUE="0"><!-- make sure your
script knows it didn't time out -->

FYI, your post was offtopic for this group.  Please consider
comp.infosystems.www.authoring.cgi next time you have a question
that's basically CGI, not basically Perl.

HTH,
- --Brent Dax
brentdax1@earthlink.net


Version: PGPfreeware 6.5.3 for non-commercial use <http://www.pgp.com>

iQA/AwUBOnWE2rJgQ5JqNEGyEQKwOwCeI2uMoetMZGQ0VdFuedOebVyidoAAnjEX
5woZ/RxBz8Q5EYXAQDZGOtiB
=2KiX
-----END PGP SIGNATURE-----





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

Date: 29 Jan 2001 15:16:31 GMT
From: gt4556a@acmez.gatech.edu (=?iso-8859-1?Q?J=F6rg?= Ziefle)
Subject: Re: How to make Perl wait
Message-Id: <slrn97b2ae.8fi.gt4556a@acmez.gatech.edu>

On Mon, 29 Jan 2001 14:58:27 GMT, Brent Dax <brentdax1_@_earthlink.net> wrote:

>> I've written a perl program which writes out a form with certain
>> options, and I want to force everyone to answert the question
>> within "say 60 seconds." Where, if not, my perl program would write
>> to a file and go to another page. The part I am having problems
>> with is having perl wait. Does anyone know of an effective way to
>> do this? I tried sleep(60); at the end of the printout. That waited
>> alright, but it didn't allow any html to be printed to screen until
>> after the 60 seconds. Of course then the program writes to file and
>> goes on to the next page. Can anytone help me with this PLEASE!

You could use a SIGALARM.  Read perlipc.
-- 
Jörg Ziefle


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

Date: Mon, 29 Jan 2001 07:30:18 -0800
From: Spawn <spawn1112@slip.net>
Subject: Looking for a reviews script with ratings.
Message-Id: <MPG.14df2c638e13b92f989687@news.slip.net>

I'm looking for a reviews script with rating system. If there a script 
available to download, where can I find it? Here is an example: 
http://www.scifi.com/anime/title.cgi








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

Date: Mon, 29 Jan 2001 17:48:29 +0200
From: "Dan" <x@x.x>
Subject: Re: Looking for a reviews script with ratings.
Message-Id: <95437i$72l$1@news.kolumbus.fi>

"Spawn" <spawn1112@slip.net> wrote in message
news:MPG.14df2c638e13b92f989687@news.slip.net...
> I'm looking for a reviews script with rating system. If there a script
> available to download, where can I find it? Here is an example:
> http://www.scifi.com/anime/title.cgi
>
>
>
>
>

Heya, try http://www.cgi-resources.com/




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

Date: Mon, 29 Jan 2001 15:05:30 GMT
From: fraikin@my-deja.com
Subject: mod_perl with DSO
Message-Id: <9540rl$rcd$1@nnrp1.deja.com>

I'm running Apache 1.3.12 on my unix server (RM400 Siemens) with Sinix
5.44.
Perl 5.00404 is installed
The DSO module for servlets is also installed and works fine.

I try to install the DSO mod_perl 1.24 with
 ./configure --with-apxs=/usr/...../apx follow by make and make install
in the subdirectory apaci of mod_perl.

when I try ./apachectl configtest I receive the error msg
 Syntax error in line 236 of /usr..../httpd.conf: Cannot
load /usr/....../libexec/libperl.so into server:
ld.so: /usr/...../httpd: relocation error: symbol not found: Perl_incgv

- the line 236 is : LoadModule perl_module libexec/libperl.so
- libperl.so is correct and in the right place
- apache works fine without the 236 line in httpd.conf

Francis


Sent via Deja.com
http://www.deja.com/


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

Date: Mon, 29 Jan 2001 07:37:50 -0700
From: "bowman" <bowman@montana.com>
Subject: Re: New Perl Book.
Message-Id: <7efd6.6060$Uo2.19732@newsfeed.slurp.net>


Abraham S. Lin <md5.bbs@bbs.ntu.edu.tw> wrote in message
news:a0ca7tceoc6git4rrko747634kmfaklrii@4ax.com...
>
> Has anyone read the new Programming Perl Version 3?
> How is it different from Version 2?

It covers the newer features of the language. It is not the complete rewrite
that 1 -> 2 was. If you already have 2, and are comfortable with the massive
electronic documentation available, it is an optional purchase. If you have
neither, go for 3, and not some bookseller's leftover 2. (unless it is
deeply discounted and you are trying to save money)





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

Date: Mon, 29 Jan 2001 08:24:44 -0600
From: Daniel Berger <djberge@uswest.com>
Subject: Re: Newbie Question:  Can I compile a Perl Script?
Message-Id: <3A757D2C.6999EE73@uswest.com>

Here's why:

1) Too often the FAQ is the *only* source of information when it *should* be in
the manual.  I generally only
use the FAQ when I don't understand the manual.  It shouldn't be a primary source.

2) Because it's not searchable (although I did find a searchable Perl/Tk archive -
if there's one for perl, someone please let me know).
I don't feel like reading through the TOC for every FAQ until I happen to come
across the topic I'm looking for.

3) Because it often isn't helpful.  This topic is a case in point.

perlfaq3 (in response to "How can I compile my Perl program into byte code or C?")
says, "Malcolm Beattie has written a multi-function backend compiler, available on
CPAN, that can do both these things".

Really?  Where?  I checked CPAN - I see 14 modules written by Malcolm but not one
of them catches my eye as having anything to do with this topic.
So now I have to look at the documentation for each of these modules to find the
one I want, assuming that any of them do.

The faq further goes on to state that his module is included in the Perl
distribution as of 5.005, but still doesn't bother to tell us which module it is
or even how to begin
this process.  It mainly warns that our Perl won't be any faster anyway, so don't
bother.  Gee, thanks for nothing.

So, the answer is,  "Yeah, yeah, yeah, I read the FFAQ and got JS out of it, so
just answer my FQ".

That answer your question?

Dan

Bernard El-Hagin wrote:

> On Mon, 29 Jan 2001 21:10:04 +0900, James And Tess Hawks
> <jhawks@yta.attmil.ne.jp> wrote:
> >Is it possible to compile a Perl script so I can use it on computers without
> >Perl installed?
>
> Why don't you RTFFAQ?
>
> Cheers,
> Bernard
> --
> #requires 5.6.0
> perl -le'* = =[[`JAPH`]=>[q[Just another Perl hacker,]]];print @ { @ = [$ ?] }'



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

Date: Mon, 29 Jan 2001 08:29:49 -0600
From: Daniel Berger <djberge@uswest.com>
Subject: Re: Newbie Question:  Can I compile a Perl Script?
Message-Id: <3A757E5D.B602AF8C@uswest.com>

Well, after my little rant, I finally found it.  See the "perlcompile" faq.

To generate C code:

perlcc myperlprogram.pl

To generate byte code:

perlcc -b myperlprogram.pl

The module that handles this is called "B".


James And Tess Hawks wrote:

> Is it possible to compile a Perl script so I can use it on computers without
> Perl installed?



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

Date: Mon, 29 Jan 2001 16:35:30 +0100
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: Newbie Question:  Can I compile a Perl Script?
Message-Id: <Pine.LNX.4.30.0101291631140.2051-100000@lxplus003.cern.ch>


On Mon, 29 Jan 2001, Daniel Berger hung usenet upside down and
blurted out some over-long lines which when subjected to intensive
scrutiny, said inter alia:

> Here's why:

> 1) Too often the FAQ is the *only* source of information when it
> *should* be in the manual.

and more, before finally quoting

> > Why don't you RTFFAQ?

And you offer than as an explanation for _not_ reading the FAQ?

It's only too true what they say about Jeopardists, then.



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

Date: Mon, 29 Jan 2001 09:51:25 -0600
From: Daniel Berger <djberge@uswest.com>
Subject: Re: Newbie Question:  Can I compile a Perl Script?
Message-Id: <3A75917D.1116FEF8@uswest.com>

Talk about a non-sensical response.  I notice you didn't bother to
respond to the
rest of my points.


"Alan J. Flavell" wrote:

> On Mon, 29 Jan 2001, Daniel Berger hung usenet upside down and
> blurted out some over-long lines which when subjected to intensive
> scrutiny, said inter alia:
>
> > Here's why:
>
> > 1) Too often the FAQ is the *only* source of information when it
> > *should* be in the manual.
>
> and more, before finally quoting
>
> > > Why don't you RTFFAQ?
>
> And you offer than as an explanation for _not_ reading the FAQ?
>
> It's only too true what they say about Jeopardists, then.



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

Date: Mon, 29 Jan 2001 14:31:04 GMT
From: qcoldiron@yahoo.com
Subject: Re: Newbie Question: Can I compile a Perl Script?
Message-Id: <953ur8$pga$1@nnrp1.deja.com>

In article <953mfj$95p$1@new.flood.tokyo.att.ne.jp>,
  "James And Tess Hawks" <jhawks@yta.attmil.ne.jp> wrote:
> Is it possible to compile a Perl script so I can use it on computers
without
> Perl installed?
>
>

Perl does have perlcc, but I have had problems with it on Linux.  I have
turned to the commercial Perl2EXE from http://www.perl2exe.com.  It has
be VERY good on Linux,Win32 and AIX for me.  I have compiled some very
complexe applications with many modules that even link to compiled
shared objects (like DBD::Mysql, DBD::Oracle, etc).

I am very impressed with it.  Well worth the money.

Quinn


Sent via Deja.com
http://www.deja.com/


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

Date: 29 Jan 2001 15:15:13 GMT
From: ebohlman@omsdev.com (Eric Bohlman)
Subject: Re: passing parameter
Message-Id: <9541e1$msk$1@bob.news.rcn.net>

Bin - Lu <b0l4549@cs.tamu.edu> wrote:
> I'm writing a 'server side image map'. The code is as follows:

> ...
> <form action="http://..../image.pl">
> <INPUT NAME="image" TYPE="IMAGE" SRC="banner.jpg">
> ...

> When calling the Perl cgi file, I have:
> http://..../image.pl?image.x=244&image.y=164

> In image.pl, I have

> #!/usr/bin/perl -w

> #print "content-type: text/html\n\n";

> $x=$ENV{QUERY_STRING};
> $y=$ENV{QUERY_STRING};            
> print "image x is: $x";
> print "image y is: $y";

> But the image.pl is not running correctly. Does anybody what's wrong with
> my code? Thanks a lot!

The problem is that your code is, according to the popular definition of 
the term, insane; it does the same thing over and over while expecting to 
get different results.  Why would you expect that two consecutive 
assigments from the same variable would have different values?  There's a 
little bit of magic behind the %ENV hash, but not *that* much.

As another poster suggested, you really need to be using CGI.pm rather 
than trying to decode parameters yourself.



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

Date: Mon, 29 Jan 2001 14:41:44 GMT
From: philhibbs@my-deja.com
Subject: Re: Perl is bad at (very) simple math!
Message-Id: <953vf7$q11$1@nnrp1.deja.com>

In article <t70pai1fh08r2b@corp.supernews.com>,
  Chris Stith <mischief@velma.motion.net> wrote:

> I might do the same if I was going to run _only_ on Intel
> x86 CPU-based machines. One of Perl's greatest strengths
> is its portability. I the core had a different math engine
> for every platform...

Perl, AFAIK, uses whatever FP maths that the C compiler that compiled
it does. It's tactic of standing on the shoulders of these particular
giants does give it a wide degree of cross-platform support. However, C
compilers have excellent FP maths support because a) most processors
support it in their instructions, and b) good emulation has been around
since well before Intel wrote the reference implementation for 80187
emulation. However, getting Perl to run on a platform that doesn't have
an FPU and doesn't have good FP maths routines easily available will be
a chore. The difficulty in implementing Base 10 floating point is
relatively small, as the field is well covered in academic exercises.
For a scripting language, dealing with numbers being converted to and
from text all the time, I would have thought that Base 10 would have
been a more sensible choice for a default number base than Base 2.


Sent via Deja.com
http://www.deja.com/


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

Date: Mon, 29 Jan 2001 14:51:21 GMT
From: cyberwing79@my-deja.com
Subject: perl newbie
Message-Id: <954016$qgu$1@nnrp1.deja.com>

Hello, I just downloaded perl, but I don´t know how to compile and what
to compile. I work with windows. Can someone please help me? I´m a
total newbie. Thank you


Sent via Deja.com
http://www.deja.com/


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

Date: Mon, 29 Jan 2001 09:07:20 -0600
From: Daniel Berger <djberge@uswest.com>
Subject: Re: perl newbie
Message-Id: <3A758728.3286AD85@uswest.com>

If that's the case, then I seriously recommend the ActiveState
distribution of Perl (at www.activestate.com).

It has an easy installation program for Windows, good HTML formatted
documentation, and generally makes life easier with "ppm".

Dan

cyberwing79@my-deja.com wrote:

> Hello, I just downloaded perl, but I don´t know how to compile and what
> to compile. I work with windows. Can someone please help me? I´m a
> total newbie. Thank you
>
> Sent via Deja.com
> http://www.deja.com/



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

Date: Mon, 29 Jan 2001 15:22:16 +0100
From: "Dimitri Papoutsis" <dnp@ms-visucom.de>
Subject: perlMagick under windows
Message-Id: <953ua6$2n17$1@news.uni-koblenz.de>

> --> sorry my last posting was in german
>
> hi
>
> can anyone send me the following file:
>
>     "ImageMagick5.2.7/VisualMagick/configure/configure.mak"
>
> I am trying to install PerlMagick under Windows...
> while compiling configure.dsw I get an errormessage because
> configure.mak doesn't exist....
>
> i have just loaded down 12 MB ImageMagick.zip...
> and don't wanna do it again...
>
> please help
>
> dimi
>





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

Date: Mon, 29 Jan 2001 14:18:40 GMT
From: jrdarkiii@rhtc.net (Jamie)
Subject: regex help in an html file...
Message-Id: <3a7578f4.806361@nntp.rhtc.net>

In trying to get this replacement program to work and  I'm ready to
jump off the top of the office...If I could get pointed in the right
direction it sure would be appreciated...(No not to the top of the
office)...

I only want to replace the name values in form boxes in an html file
with the text that preceeds the form element...for example:

<b><font face="Arial" size="2">Text that should go in the first name
value...</font></b></font></td>
    <td width="309" valign="bottom" colspan="2" height="25"><font
SIZE="2"><b><font face="Arial" size="2">
    <input type="text" name="Text that should go in the first name
value..." size="33">
    </font></b>

<b><font face="Arial" size="2">Text that should go in the second name
value...</font></b></font></td>
    <td width="309" valign="bottom" colspan="2" height="25"><font
SIZE="2"><b><font face="Arial" size="2">
    <input type="text" name="Text that should go in the second name
value..." size="33">
    </font></b>

Instead what I'm getting is:

<b><font face="Arial" size="2">Text that should go in the first name
value...</font></b></font></td>
    <td width="309" valign="bottom" colspan="2" height="25"><font
SIZE="2"><b><font face="Arial" size="2">
    <input type="text" name="Text that should go in the first name
value..." size="33">
    </font></b>

<b><font face="Arial" size="2">Text that should go in the second name
value...</font></b></font></td>
    <td width="309" valign="bottom" colspan="2" height="25"><font
SIZE="2"><b><font face="Arial" size="2">
    <input type="text" name="Text that should go in the first name
value..." size="33">
    </font></b>

etc....


Here's my ill attempt:


#!/usr/bin/perl -w

#so far, this only matches the first bit of text that I want to match
#and replaces 
#every name ="something here" part of the form globally but only with
#that first match in an html file...
#End goal is to have it loop through the file leaving off with the
#last match, etc.

open FILE, "../my_files/some.html" or die $!;

$/ = <FILE>;

while(<FILE>) {

#Treats substitution literally... Could not get to work...is there a
#fix here??  Could this be going in a better direction?? (Yes, I know
#there is a # in front of the REGEX..)

#s/name\=\"(\w+)\"/<.*>(\w+.*)(:|;)<.*>/g; 


/<.*>(\w+.*)(:|;)<.*>/g;

$name = $1;

s/name\=\"(\w+)\"/name="$name"/g;


print;
}

close (FILE);



Any help would be very appreciative...

Thanks,

JME


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

Date: Mon, 29 Jan 2001 15:10:34 GMT
From: "John L" <devnull@localhost.org>
Subject: Re: Running a CGI as a USER
Message-Id: <KJfd6.57858$pp2.4005589@news3.cableinet.net>


Brian E. Seppanen <seppanen@chartermi.net> wrote in message
news:3A664D23.16EB8C8B@chartermi.net...
> Hello:
>
> I've been given the task of setting up a user guestbook on a multi-user
> webserver running linux and apache 1.3.14.  The criteria I have been
> given is that I need to setuid the program and run the program as the
> user.  Now I'm very new to writing perl, and CGI's.  I'm trying to do
> this as securely as possible.  My initial thoughts were rw-rw-rw the
> damn guestbook and let the script run as nobody and I'm hesitant of
> setuiding a script.  So anyways the thinking is that the script is
> setuid, we match the username, test it for validity, once we've
> determined the username we somehow send the script off as user A giving
> it the effective rights of the user.  Now I'm not sure how I would do
> this.  Would I have to fork a new process?  Would it be as easy as
> defining $EFFECTIVE_USER_ID=(getpwnam($username)) [3];  Although I've
> tried that it doesn't seem to work.   Doing it this way would allow  the
> guestbook to be rw-r--r--.  Not just anyone could write to it.
>
> I really don't know whether this is more of an apache issue or a perl
> issue.
>
> Hope someone can shed a little light on this.
>
> Brian E. Seppanen
>

Not quite sure what you mean.
You don't want the guest book running as different users all the time do
you, why on earth would you want that? or just a particular user for a
particular website?
If running only one websitewhy not make the script and associated files
owned by the user that apache runs as and leave it at that?

In a virtual host container you can declare the 'User' and 'Group' that cgi
will run as for that virtual server.
The cgi when launched will then run as if that user had run it.
The code must be in the users home directory which must be under the normal
webserver document root.
If using Apache you'll need it compiled with suexec....
Look up suexec  at apache.org for more details

John
southportnews.com






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

Date: Mon, 29 Jan 2001 17:46:21 +0200
From: "Gerdo" <x@x.x>
Subject: Re: String functions?
Message-Id: <95433g$6vc$1@news.kolumbus.fi>

"Godzilla!" <godzilla@stomp.stomp.tokyo> wrote in message
news:3A745560.81802AA3@stomp.stomp.tokyo...
> Dan wrote:
>
> (snipped)
>
> > How do I store the first three characters of
> > a string into another string? And how can I get
> > the length of a string?
>
> Finding the length of a string is quite
> simple using length () function. Grabbing
> the first n (any number) characters of
> a string is equally easy with substring.
> You will find good documentation on these
> functions in your reference material or
> in online reference sites.
>
> Look over my simple test script below
> my signature.
>
> Godzilla!
> --
>
> TEST SCRIPT:
> ____________
>
>
> #!perl
>
> print "Content-type: text/plain\n\n";
>
> $string ="123456789";
>
> $length = length ($string);
>
> print "Length Of String:\n\n  $length";
>
> $new_string = substr ($string, 0, 3);
>
> print "\n\nNew String:\n\n  $new_string";
>
> exit;
>
>
> PRINTED RESULTS:
> ________________
>
>
> Length Of String:
>
>   9
>
> New String:
>
>   123

Actually yes I already got the help I needed for the post. I found it in the
documentation. I recieved some angry comments about posting thanks and
telling the group I've got the answer so I didn't mention it in the group.
But thanks anyways it's really nice to know that there are people out there
that can help/do help...





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

Date: Mon, 29 Jan 2001 14:13:54 GMT
From: Mario <m_ario@my-deja.com>
Subject: Re: uploading files
Message-Id: <953tqt$opl$1@nnrp1.deja.com>

In article <951qai$4t9$1@nnrp1.deja.com>,
  roof2211@my-deja.com wrote:
> hello,
>
> I am having trouble getting all the info from a form on an html page
to
> upload a file to actually upload. Two of the three input fields get
> sent fine, but 'user' does not. It always has a blank value.
>
> Here is the form:
> --------------------------------------------
> <form ENCTYPE="multipart/form-data" action="upload.pl" method="post">
> <input type="hidden" name="user" value="webmaster">
> File: <input type="file" name="filename" size="20">
> File Name:<input type="text" name="name" size="20">
> <input type="Submit" value="Upload">
> </form>
> --------------------------------------------
>
> Here is the first part of my .pl file:
>
> -------------------------------------------
> #!/usr/bin/perl
>
> use CGI qw/:standard/;
>
> #use CGI::Carp qw/fatalsToBrowser/;
> $| = 1;
>
> $limit= 100;
>
> @ext= qw(jpg gif bmp htm html doc xls asp jsp php zip pl pdf);
>
> $encoding='multipart/form-data';
> $match=0;
> $CGI::POST_MAX=1024 * $limit;
> $q = new CGI;
>
> #$user2 =~ /\w:[\\[\w- ]*\\]*([\w- ]*.\w{1,3})$/g;$use=$1;
>
> $user = $q->param('user');
> $filename = $q->param('filename');
> $name = $q->param('name');
> --------------------------------------
>
> After this part, the code is fine except the $user variable is equal
> to "" and not what the value is. I have tried it with using other
names
> for it and different types, and still no luck. I can't think of why
> this doesn't work.
>

You should output the $user variable right after reading it to see its
actual value.

$user=param('user');
print $user;

It is probable that the error is later in the script.The form looks
ok,the piece of code you posted too.

--
Mario
diab.litoATusa.net


Sent via Deja.com
http://www.deja.com/


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

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


Administrivia:

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

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.

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

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

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


------------------------------
End of Perl-Users Digest V10 Issue 167
**************************************


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