[12825] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 235 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Jul 23 12:07:26 1999

Date: Fri, 23 Jul 1999 09:05:12 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Fri, 23 Jul 1999     Volume: 9 Number: 235

Today's topics:
    Re: CGI:calling subroutine from a form <dparrott@ford.com>
    Re: checking if address is active <toby@venice.cas.utk.edu>
    Re: checking if address is active (Tad McClellan)
    Re: doing an ls in PERL (globbing) <sariq@texas.net>
    Re: doing an ls in PERL (globbing) (I R A Darth Aggie)
        duplicating double quotes in text breslow_marty@tandem.com
    Re: FAQ 9.6: How do I make a pop-up menu in HTML? (Tramm Hudson)
        fetching zip files velo1@earthlink.net
    Re: getting the decimal portion of a floating point num <bivey@teamdev.com>
        Has anyone seen this error before <jim.ray@west.boeing.com>
    Re: Has anyone seen this error before (Mike Bristow)
    Re: Has anyone seen this error before (I R A Darth Aggie)
    Re: How to give Passwords on STDIN (Tad McClellan)
    Re: How to give Passwords on STDIN <osman@focomedia.de>
    Re: How to give Passwords on STDIN (I R A Darth Aggie)
    Re: long explanations wearying (was Re: Top 10 response (Tad McClellan)
    Re: null byte in open's filename? (Tad McClellan)
        oracle <florian.petter@braintrust.at>
    Re: perl cgi <dparrott@ford.com>
    Re: Perl Math Calculation vs. FORTRAN Calculations <haverlan@agric.gov.ab.ca>
        Perl with MSQL (Layout/Design)
    Re: Perl with MSQL <mlopresti@bigfoot.com>
    Re: PGP and Mail <upsetter@ziplink.net>
        reading a textarea <jean.zoch@utoronto.ca>
        Regex-ing  <ben@NOSPAMcognitech.co.uk>
    Re: Regex-ing (Garth Sainio)
        Running register 1.2 adougall@netscape.net
        Special characters <dan@multicorpora.ca>
        Testing a file to see if it's already open jjanssen3894@my-deja.com
    Re: TextArea fields <chris@inta.net.uk>
    Re: What does this statement mean? <chris@inta.net.uk>
        Digest Administrivia (Last modified: 1 Jul 99) (Perl-Users-Digest Admin)

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

Date: Fri, 23 Jul 1999 09:19:28 -0400
From: "Dennis M. Parrott" <dparrott@ford.com>
To: matt <mlopresti@bigfoot.com>
Subject: Re: CGI:calling subroutine from a form
Message-Id: <37986BE0.48DCEE43@ford.com>

I would suggest that you are confusing your Perl and your
Javascript. You can do some things (sort of) like what you
have here in Javascript which would run on the client, but
definitely not in your Perl CGI program.

matt wrote:
> 
> Is there a way to call a subroutine from a form, like:
> <form action= &delete_record>
> Is this possible?
> 
> Thanks in advance,
> -Matt

-- 

-----------------------------------------------------------------------
Dennis M. Parrott        |            Unix:  dparrott@ford.com
PCSE Webmaster           |           PROFS:  DPARROTT
Ford Motor Company       |             VAX:  EEE1::PARROTT
Dearborn, Michigan USA   | public Internet:  dparrott@ford.com
-----------------------------------------------------------------------
Voice: 313-322-4933  Fax: 313-248-1234  Pager: 313-851-2958


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

Date: Fri, 23 Jul 1999 10:23:00 -0400
From: toby <toby@venice.cas.utk.edu>
Subject: Re: checking if address is active
Message-Id: <37987AC4.99C6AB24@venice.cas.utk.edu>

You could write a script that tests your server's status. It could then
return to a log or e-mail an administrator or even call a pager. I don't
think this is a Perl question but an Apache or whatever newsgroup type of
problem. Why does the site go down so much? A lot of traffic? Seems like a
Webserver problem.

"Steve ." wrote:

> We have a problem with a web site going down often.  I need to write a
> program that will basically hit the web site and return a value to a
> log, whether it successfully is running or not.  I can't use ping for
> the box is running, just the web interface is dead.  Thought of using
> a call to lynx, but wasn't sure how to determine success or failure
> with it.  Any ideas?  Thanks.
>
> Steve
>
> Newsgroup replies preferred.  Remove nospam from address when
> responding thru email.



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

Date: Fri, 23 Jul 1999 04:22:02 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: checking if address is active
Message-Id: <an89n7.fgb.ln@magna.metronet.com>


[ I have reordered the quoting into sane order ]


: On 22 Jul 1999 21:26:26 -0000, Jonathan Stowe
: <gellyfish@gellyfish.com> wrote:

: >Use the module LWP::UserAgent


Steve . (syarbrou@nospam.enteract.com) wrote:
: Thanks,  any idea where the lastest versions are kept?  I can't find
: it on perl.com or searching on yahoo.  Thanks.


   Perl FAQ, part 2:

--------------------------
=head2 What modules and extensions are available for Perl?  What is CPAN?  What does CPAN/src/... mean?

CPAN stands for Comprehensive Perl Archive Network, a huge archive
replicated on dozens of machines all over the world.  CPAN contains
source code, non-native ports, documentation, scripts, and many
third-party modules and extensions, designed for everything from
commercial database interfaces to keyboard/screen control to web
walking and CGI scripts.  The master machine for CPAN is
ftp://ftp.funet.fi/pub/languages/perl/CPAN/, but you can use the
address http://www.perl.com/CPAN/CPAN.html to fetch a copy from a
"site near you".  See http://www.perl.com/CPAN (without a slash at the
end) for how this process works.

   [ ... snip more helpful info, you know where to get it ...]
--------------------------


--
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


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

Date: Fri, 23 Jul 1999 09:32:41 -0500
From: Tom Briles <sariq@texas.net>
Subject: Re: doing an ls in PERL (globbing)
Message-Id: <37987D09.5BB02CA8@texas.net>

David Cassell wrote:
> 
> Tom Briles wrote:
> >
> > Bruno Pagis wrote:
> > >
> > > If you don't mind using existing code
> >
> > Personally, I only use code that doesn't exist.  My programs don't do
> > much, but (knock on wood) I've *never* had a bug.
> 
> You only use code that doesn't exist?  And you've never had a
> bug?  Are you really Edward Dijkstra?  :-)
> 
> David

I call my methods 'Ethereal Algorithmic Processing'.  Many of the tenets
are based upon ideas of L. Ron Hubbard (which, now that I think of it,
may be borrowed from Djikstra).

Basically, the premise is to create an algorithm, without any real
coding (the coding, after all, is quite trivial).  Why code a solution
when I *know* that my algorithm is ultimately perfect.

Hence, bug-free, non-existent code.

Unfortunately, I have yet to find an employer that is able to fully
comprehend my vision; however, I find that flipping burgers gives me
ample time to create.

- Tom (with a capital T)


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

Date: 23 Jul 1999 15:32:36 GMT
From: fl_aggie@thepentagon.com (I R A Darth Aggie)
Subject: Re: doing an ls in PERL (globbing)
Message-Id: <slrn7ph2sr.2gm.fl_aggie@thepentagon.com>

The original poster is encouraged to look at this page:

<url:http://language.perl.com/ppt/src/ls/>

I would have posted sooner, but the search engine on
<url:http://www.perl.com/> didn't know anything about 'ppt' or 'Perl
Power Tools'. Someone in another post in another thread referenced
PPT's URL, tho...

James



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

Date: Fri, 23 Jul 1999 15:37:05 GMT
From: breslow_marty@tandem.com
Subject: duplicating double quotes in text
Message-Id: <7na270$oo4$1@nnrp1.deja.com>

What is the easiest way to double quotes in strings.
For example, change:
Photo is 5" x 7"

to:

Photo is 5"" x 7""

Eventually, I want to put quotes and a comma around the whole thing to
get:

"Photo is 5"" x 7""",

       Thanks


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.


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

Date: 23 Jul 1999 07:55:47 -0600
From: hudson@swcp.com (Tramm Hudson)
Subject: Re: FAQ 9.6: How do I make a pop-up menu in HTML?
Message-Id: <7n9s93$3dc@llama.swcp.com>

[posted and cc'd to the faq-suggestion address]

Tom Christiansen  <perlfaq-suggestions@perl.com> wrote:
>   How do I make a pop-up menu in HTML?
>     Use the <SELECT> and <OPTION> tags.

And your Perl question is?

>                                           The CGI.pm module (available
>     from CPAN) supports this widget, as well as many others, including
>     some that it cleverly synthesizes on its own.

Ok, there is Perl content here, but I feel that the link is somewhat
tenuous, as with many of the entries in perlfaq9.  This question could
be phrased "How do I make a pop-up menu in HTML with CGI.pm?" to reinforce
the idea that this is directly a question about a well known Perl module
and not just an HTML question.

Otherwise the gentle readers of clp.misc may see questions from none
other than the famous author Tom Christiansen asking about HTML and think
that this may be the correct news group in which to inquire about how to
make text blink, how to configure their MS PWS, and how to make HTML
executable.

Tramm
-- 
  o   hudson@swcp.com                 tbhudso@cs.sandia.gov   O___|   
 /|\  http://www.swcp.com/~hudson/          H 505.323.38.81   /\  \_  
 <<   KC5RNF @ N5YYF.NM.AMPR.ORG            W 505.284.24.32   \ \/\_\  
  0                                                            U \_  | 


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

Date: Fri, 23 Jul 1999 14:14:51 GMT
From: velo1@earthlink.net
Subject: fetching zip files
Message-Id: <37987437.137148092@news.giganews.com>

Hello all,

I need to be able to retrieve a zip file from a .htaccess protected
directory and serve it to the browser. I have tried to config
htaccess to allow from only one HTTP_REFERER but no-one 
seems to be able to figure that out.  So I have tried to pull the file

out of the directory, but that isn't working either.

Here's what I have. Thanks for the help !
Please reply to     velo1@earthlink.net
#!/usr/bin/perl

$referrer = $ENV{'HTTP_REFERER'} ; 
$message = "" ;
$found_err = "" ;
$software = $ENV{'QUERY_STRING'} ;
$errmsg = "<p>Bad Referrer</p>\n" ;

%files = ( "001",  "file1.zip",
              "002",  "file2.zip",
              "003",  "file3.zip",
              "004",  "file4.zip",
              "005",  "file5.zip" );
           
$filename = ($files{$software});

if ($referrer ne "http://www.mysite.com/cgi-bin/referrer.pl") {
	$message = $message.$errmsg ;
	$found_err = 1 ; }

if ($found_err) {
	&PrintError; }

# this is an option that always named the file "registered.zip"
# it seemed to get around .htaccess but the file name was wrong
#$file = $ARGV[0]; 
#print "Content-length: ",(stat("registered/$file"))[7],"\n";
#print "Content-type: application/x-zip-compressed\n\n";
#print `cat registered/$file`;

# this option names the file properly but is denied access "Error 403"
print "Location: registered/$filename\nURI: registered/$filename\n\n"
;

sub PrintError { 
print "Content-type: text/html\n\n";
print $message ;

exit 0 ;
return 1 ; 
}







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

Date: 23 Jul 1999 14:38:46 GMT
From: "William" <bivey@teamdev.com>
Subject: Re: getting the decimal portion of a floating point number
Message-Id: <01bed519$2ae1eaa0$583c08cf@bill.jump.net>

Steven Smolinski <stevens@frisco.gulch.com> wrote in article
<slrn7pfah5.g0.stevens@frisco.gulch.com>...
> On Thu, 22 Jul 1999 11:05:41 -0700, Larry Rosler <lr@hpl.hp.com> wrote:
> 
> =perl -e 'print 12345.6789; printf " %.14f\n", 12345.6789'
> =
> =12345.6789 12345.67890000000100
> 
> As an amateur, I would love for someone to explain why a floating-point
> representation of 12345.6789 would *add* data that wasn't explicitly 
> assigned to it.  It certainly isn't what I would have expected.
> 
> Any references to texts which may cover this are welcome as well.
> 
> Steve

As the others have pointed out, it's because you can't get there
from purely binary representations. (You can't represent 1/3 in
decimal accurately, either, so it's not binary's fault.) There are
binary coding schemes which can represent decimal numbers accurately,
but they take more space. (BCD - Binary Coded Decimal - for example
uses at least 4-bits per digit. That means that 15 requires 8 bits
in BCD versus 4-bits in pure binary.)

For most purposes the accuracy of pure binary floating point is fine,
but there are problems and knowing how to get around them is
important. For example, you should never test two floating point
values for equality because, while in priniciple they may seem as
though they should be equal, depending on the operations that got
you there they could differ by small amounts. Either test against
a range (you can use subtraction: if ( abs($F1-$F2) < .001 )) or
chop off in some way digits that are to low in value to worry
about. (Perl makes this fairly simple.) -Wm

P.S. If you want more gritty details about binary floating
point, try a web search. "IEEE floating point" should get
you something about one of the most common schemes.


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

Date: Fri, 23 Jul 1999 14:35:10 GMT
From: "Jim Ray" <jim.ray@west.boeing.com>
Subject: Has anyone seen this error before
Message-Id: <FFBv5u.DKL@news.boeing.com>

I am getting the following error:
Use of uninitialized value at z:\Inetpub\wwwroot\division\cgi-bin\myfile.pl
line 242, chunk 8

Here is line 242:

$Save[$count] = "$level;$arg1;$FileTitle;white;;$date;$FileType";

I have access this array serveral times before this happens.  Does anyone
know what this error is tryng to say?  I have tried to research this, but
have no found a reference of it.

Thank you.

Jim Ray




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

Date: Fri, 23 Jul 1999 15:36:47 GMT
From: mike@fat.dotat.at (Mike Bristow)
Subject: Re: Has anyone seen this error before
Message-Id: <slrn7ph30f.5ot.mike@lindt.fat.dotat.at>

On Fri, 23 Jul 1999 14:35:10 GMT, Jim Ray <jim.ray@west.boeing.com> wrote:
>I am getting the following error:
>Use of uninitialized value at z:\Inetpub\wwwroot\division\cgi-bin\myfile.pl
>line 242, chunk 8
>
>Here is line 242:
>
>$Save[$count] = "$level;$arg1;$FileTitle;white;;$date;$FileType";
>
>I have access this array serveral times before this happens.  Does anyone
>know what this error is tryng to say?  I have tried to research this, but
>have no found a reference of it.

One of $level;$arg1;$FileTitle;white;;$date;$FileType is undefined.

man perldiag for more.

-- 
Mike Bristow, Geek-At-Large.                GK/RM0501
one tequila - two tequila - three tequila - FLOOR !!!



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

Date: 23 Jul 1999 15:36:05 GMT
From: fl_aggie@thepentagon.com (I R A Darth Aggie)
Subject: Re: Has anyone seen this error before
Message-Id: <slrn7ph33c.2gm.fl_aggie@thepentagon.com>

On Fri, 23 Jul 1999 14:35:10 GMT, Jim Ray <jim.ray@west.boeing.com>, in
<FFBv5u.DKL@news.boeing.com> wrote:
+ I am getting the following error:
+ Use of uninitialized value
         ^^^^^^^^^^^^^^^^^^^
This means exactly what it says.

+ at z:\Inetpub\wwwroot\division\cgi-bin\myfile.pl
+ line 242, chunk 8
+ Here is line 242:

+ $Save[$count] = "$level;$arg1;$FileTitle;white;;$date;$FileType";

One of the $variables doesn't have a value. Where is $count getting
set? that would be my suspect, followed by the stuff on the RHS of
the equation (tho that aught not matter).

James



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

Date: Fri, 23 Jul 1999 04:12:28 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: How to give Passwords on STDIN
Message-Id: <c589n7.fgb.ln@magna.metronet.com>

osman durrani (osman@focomedia.de) wrote:

:  Does anyone know how to get passwords from a user from the STDIN without
: using the ReadKey.pm.


   Why will ReadKey.pm not work for you?

   That is the "Standard Way of Doing It".

   If the usual way doesn't work for you, then you should
   mention what it is about the usual way that makes you
   need something else.


--
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


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

Date: Fri, 23 Jul 1999 17:40:58 +0200
From: "osman durrani" <osman@focomedia.de>
Subject: Re: How to give Passwords on STDIN
Message-Id: <379889ba.0@news.arcor-ip.de>


Tad McClellan schrieb in Nachricht ...
>osman durrani (osman@focomedia.de) wrote:
>
>: Tom Christiansen schrieb in Nachricht <3795dbe9@cs.colorado.edu>...
>: >
>: >:: $passwd = <STDIN>;
>
>
>: actually i wanted to know how can i get a password but not have the
>: passwaord visible on the STDIN.
>
>
>   Then you should have asked for that.
>
>
>: This way you see the actuall password ,so it is not very good if you want
to
>: keep your password secrete from prying eyes.
>
>
>   A crappy specification yields a crappy solution.
>
>   No surprise there, so it makes sense to decrapify your
>   specification *before* the design and implementation phases.
>
>
>--
>    Tad McClellan                          SGML Consulting
>    tadmc@metronet.com                     Perl programming
>    Fort Worth, Texas
I thought it was obvious as this is the norm. Who would want to have his
password printed on the monitor?

osman




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

Date: 23 Jul 1999 15:38:36 GMT
From: fl_aggie@thepentagon.com (I R A Darth Aggie)
Subject: Re: How to give Passwords on STDIN
Message-Id: <slrn7ph382.2gm.fl_aggie@thepentagon.com>

On Fri, 23 Jul 1999 17:40:58 +0200, osman durrani <osman@focomedia.de>, in
<379889ba.0@news.arcor-ip.de> wrote:

+ Who would want to have his password printed on the monitor?

perlfaq8: How do I ask the user for a password?

James


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

Date: Fri, 23 Jul 1999 04:08:33 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: long explanations wearying (was Re: Top 10 responses)
Message-Id: <1u79n7.fgb.ln@magna.metronet.com>

John Callender (jbc@shell2.la.best.com) wrote:
: Eric The Read <emschwar@rmi.net> wrote:

: >> > To answer your question Mats, it's because many newbies will never use
: >> > .newbie, because they want the real answers from the folks in
: >> > .professional.
: >> 
: >> Is this a proven fact?

: > Yep.  See the demise of comp.unix.wizards, just to name one.

: I'm not convinced on this particular point. I think it might be worth
: trying comp.lang.perl.newbie.


   Let us know when you have the RFD ready.

   I'm likely to support the creation of such a newsgroup,
   if it has a prohibition against crossposting to clpmisc
   (else the newbies will just post to both and nothing will
    be gained).


--
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


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

Date: Fri, 23 Jul 1999 04:29:00 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: null byte in open's filename?
Message-Id: <c499n7.fgb.ln@magna.metronet.com>

John Callender (jbc@shell2.la.best.com) wrote:

: What is a null byte, anyway? 


   The ASCII "character" with a numerical code of zero.

   But ASCII calls it "NUL".


--
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


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

Date: Fri, 23 Jul 1999 17:33:09 +0200
From: Florian Petter <florian.petter@braintrust.at>
Subject: oracle
Message-Id: <37988B35.24B8C4D4@braintrust.at>

hi,

how can I connect with perl to a oracle database? (with windows nt!)

thanks,
florian


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

Date: Fri, 23 Jul 1999 09:17:18 -0400
From: "Dennis M. Parrott" <dparrott@ford.com>
To: msdb159@my-deja.com
Subject: Re: perl cgi
Message-Id: <37986B5E.CE1C3EC3@ford.com>

msdb159@my-deja.com wrote:
> 
> Why doesn't straight Perl CGI scale?
> 

one simple problem: process creation overhead - each CGI
is a new process (unless you do other more complicated
magic). 

This is why I have *banned* stupid crap like counter
scripts from the intranet site I administer -- who
wants CPU bandwidth eaten up running crappy, stupid
scripts that don't do as good a job as grepping the
log files.
-- 

-----------------------------------------------------------------------
Dennis M. Parrott        |            Unix:  dparrott@ford.com
PCSE Webmaster           |           PROFS:  DPARROTT
Ford Motor Company       |             VAX:  EEE1::PARROTT
Dearborn, Michigan USA   | public Internet:  dparrott@ford.com
-----------------------------------------------------------------------
Voice: 313-322-4933  Fax: 313-248-1234  Pager: 313-851-2958


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

Date: Fri, 23 Jul 1999 09:22:57 -0600
From: Gordon Haverland <haverlan@agric.gov.ab.ca>
Subject: Re: Perl Math Calculation vs. FORTRAN Calculations
Message-Id: <379888D1.873C06BB@agric.gov.ab.ca>

Scott Dummer wrote:
> 
> I have wrote a series of equations to calculate something (like the
> distance on an oblate spheroid "earth") in FORTRAN and perl.

There are several ways of calculating distances between points
on a "sphere", all with different accuracy problems.

>                                                             Does
> anybody know why their answers differ slightly?

Different math libraries is most likely.  But in general,
neither is using infinite precision, so it is expected that
the answers should be close to each other if the algorithm
used doesn't suffer from excessive error propagation.

>                                           I would tend to believe
> the FORTRAN calculation since one of it's strengths is intensive
> accurate mathematical number crunching.

FORTRAN (FORmula TRANslation) was designed to be easy to
write numerical programs in.  Accuracy is something else.
You can write inaccurate programs in any language.

Gordon Haverland
#include <disclaimer.h>


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

Date: Fri, 23 Jul 1999 16:28:19 +0100
From: "Paul Foran (Layout/Design)" <Paul.Foran@analog.com>
Subject: Perl with MSQL
Message-Id: <37988A13.A19AEDAE@analog.com>

I need some support on interfacing perl with MSQL. What I need to do is
the following:

I need to generate a Perl script that does the following:
1. Connect to SQL Vacancies Table on Database.
2. Read in the form Category=engineering value from HTML form.
3. Get perl create a dynaset (temporary table) with MSQL containing only
the
engineering category colume in the vacancy table.
4. output a html document that will display each record from the dynaset
in
it's own line.


I also need to know how to upload my Access Vacancy table so that MSQL
will
accept.



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

Date: Fri, 23 Jul 1999 11:58:44 -0400
From: Matt <mlopresti@bigfoot.com>
Subject: Re: Perl with MSQL
Message-Id: <37989134.E53F4842@bigfoot.com>

Do you have examples that you tried? Or are you looking how to get started?
What kind of support do you need. If you could narrow down your support
request that would be more helpful.

"Paul Foran (Layout/Design)" wrote:

> I need some support on interfacing perl with MSQL. What I need to do is
> the following:
>
> I need to generate a Perl script that does the following:
> 1. Connect to SQL Vacancies Table on Database.
> 2. Read in the form Category=engineering value from HTML form.
> 3. Get perl create a dynaset (temporary table) with MSQL containing only
> the
> engineering category colume in the vacancy table.
> 4. output a html document that will display each record from the dynaset
> in
> it's own line.
>
> I also need to know how to upload my Access Vacancy table so that MSQL
> will
> accept.




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

Date: Fri, 23 Jul 1999 15:02:40 GMT
From: Scratchie <upsetter@ziplink.net>
Subject: Re: PGP and Mail
Message-Id: <ku%l3.1015$ui4.316408@news.shore.net>

brian d foy <brian@pm.org> wrote:
: if you want to read and write to another
: process, you can't use open().   

Thanks. That was the simple answer I was looking for (I may have been a
little dense when I read Anno's response yesterday).

: would you rather Tom wrote you a
: FMTYEWTK on the subject?

That shouldn't be necessary. :)

--Art

-- 
--------------------------------------------------------------------------
                    National Ska & Reggae Calendar
                  http://www.agitators.com/calendar/
--------------------------------------------------------------------------


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

Date: Fri, 23 Jul 1999 14:24:50 GMT
From: "Jean" <jean.zoch@utoronto.ca>
Subject: reading a textarea
Message-Id: <FFBurK.F6H@campus-news-reading.utoronto.ca>

Hello,

I'm having trouble processing a textarea field in a form.

I would like all the information of a form to be stored in a text file like:

entry1::entry2::entry3::entry4

The trouble I have is with textareas where a user has entered a "newline".
For examlple, instead of entering:
"hello there. how are you?"

they enter:

"hello there.
how are you?"

and then in the text file i get:

entry1::entry2::entry3::hello there.
how are you?

intstead of what  i want. which is:
entry1::entry2::entry3::hello there. how are you?

Every attempt i've made at removing these line breaks (for instance i've
tried $entry4 =~ s/\n/' '/g ), leaves thse weird ^M things in the text file
(on a UNIX machine).

Any Help... please!

Jean




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

Date: Fri, 23 Jul 1999 15:33:52 +0100
From: Ben Meghreblian <ben@NOSPAMcognitech.co.uk>
Subject: Regex-ing 
Message-Id: <37987D50.2939D6A9@NOSPAMcognitech.co.uk>

I am using cgi.pm to get the values from a form, including a multi-line
text-box.

I want to replace all carriage-returns with my own delimiter.

i have tried the following:-

$news = s/\n/delimiter/g;

but this doesn't work

for testing purposes, I changed the methos of the form to GET, and
observed that the carriage returns were encoded as follows:-

?news=This+is+the+first+line%0D%0AThis+is+the+second+line

Hope you can help

Cheers

Ben



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

Date: Fri, 23 Jul 1999 11:44:04 -0400
From: modred@shore.net (Garth Sainio)
Subject: Re: Regex-ing
Message-Id: <modred-2307991144040001@gniqncy-s08-120.port.shore.net>

In article <37987D50.2939D6A9@NOSPAMcognitech.co.uk>, Ben Meghreblian
<ben@NOSPAMcognitech.co.uk> wrote:

!!  I am using cgi.pm to get the values from a form, including a multi-line
!!  text-box.
!!  
!!  I want to replace all carriage-returns with my own delimiter.
!!  
!!  i have tried the following:-
!!  
!!  $news = s/\n/delimiter/g;
!!  
!!  but this doesn't work
!!  
<snip>

Depending on the browser and platform the carriage returns may be encoded
in the text as \r, \n, \r\n, \n\r. So, try something like

 $news =~ s/[\r\n]/delimiter/g;

Garth

-- 
Garth Sainio               "Finishing second just means you were the 
modred@shore.net            first to lose" - anonymous


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

Date: Fri, 23 Jul 1999 15:07:52 GMT
From: adougall@netscape.net
Subject: Running register 1.2
Message-Id: <7na0g0$o5n$1@nnrp1.deja.com>

Hi there,

Being new to perl, I am having no end of fun trying to get register 1.2
to run.  I can get simple scripts to run, but not this one:


-------------------- START --------------------

#!/usr/bin/perl

# register.pl 1.2
#
# Written by Robert Niles, ITM Services
# rniles@wolfenet.com
#
# 506 W. Orchard
# Selah, Wa 98942
# USA
#
# Modified by Alasdair Dougall, Sums (UK) Limited to include extra
fields
# required at bare ingredents site. (1999-07-22)
#***********************************************************************
*
# This program requires the htpasswd.pl script written by
# Nem W. Schlecht and Mark Soloman as NCSA htpasswd does not
# like to be piped (doesn't work well with STDIN/OUT)
#
# This script will take the information from a user and add
# the user and the password information to the passwdfile
# indicated.

# User definable parts -
# passfile is the file where the username and password will be kept
# htpasswd will be the full path to htpasswd.pl
# referer is the main registration page
# private_area is the initial page in which the user needs to enter
#   the username and password
##################################################################
#
$passfile
="/zeus2/standard_unix/www.bareingredients.com/recipes/password"; #must
be read/writable
$htpasswd
="/zeus2/standard_unix/www.bareingredients.com/cgi-local/htpasswd.pl";
$referer
="/zeus2/standard_unix/www.bareingredients.com/register/registration.htm
l";
$private_area
="/zeus2/standard_unix/www.bareingredients.com/recipes/recipe.html";
$reglog
="/zeus2/standard_unix/www.bareingredients.com/register/register.csv";
#must be read/writable
#
##################################################################

if ($ENV{'REQUEST_METHOD'} eq 'POST')
{
	read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
	@pairs = split(/\&/, $buffer);
	foreach $pair (@pairs)
	{
		($name, $value) = split(/=/, $pair);
		$value =~ tr/+/ /;
		$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C",
hex($1))/eg;
		$contents{$name} = $value;

	}
}

chop($date = `date`);

# Now with the program
###########################################################
# Has to output a Content-type
print "Content-type: text/html\n\n ";

# Check to see if all required information was entered
&no_name unless $contents{'username'};
&no_name unless $contents{'password'};
&no_name unless $contents{'email'};
&no_name unless $contents{'forename'};
&no_name unless $contents{'surname'};
&no_name unless $contents{'city'};
&no_name unless $contents{'postcode'};

sub no_name
{
print <<"HTML";
<HTML><HEAD><TITLE>Form Incomplete</TITLE></HEAD>
<BODY>
<H1>Form Incomplete</H1>
I'm sorry, the form was not filled completely.<br>
Please Return to the form and fill it out completely.<p>
Thank you.
<HR>
<a href=\"$referer\">Return to the registration page</a>
</BODY></HTML>
HTML
exit;
}

# Check to see if the username already exists ..if so, kick them out

open (HTFILE, "$passfile");
  until (eof (HTFILE))
  {
	$line =<HTFILE>;
  	chop ($line);
  	if ($line =~ /$contents{'username'}/)
	{

	close (HTFILE);

	print <<"HTML";
	<HTML><HEAD><TITLE>Sorry, user exists</TITLE></HEAD>
	<BODY>
	<H1>Username: \"$contents{'username'}\" already exists!</H1>
	<p>
	Please select a different username to use.
	<p><HR>
	<a href=\"$referer\">Return to the registration page</a>
	</BODY></HTML>
HTML
die;

	}
  }



# Call htpasswd.pl and encrypt the password then enter username and
# password into passfile

open(HTPASSWD, "|$htpasswd $passfile $contents{'username'} >/dev/null
2>&1");
print HTPASSWD "$contents{'password'}\n";
close(HTPASSWD);

# Hooray!! We made it! Now give them a pat on the back and send them
# off to view the protected pages.

print <<"HTML";
<HTML><HEAD><TITLE>Entry successful</TITLE></HEAD>
<BODY>
<H1>Entry successful!</H1>
<p>
<hr>
<p>
<B>$contents{'forename'}, you may now enter the Recipes page!</B>
Simply click the link below to return to the Home Page and then select
the
Recipe option from the sidebar.  When prompted, enter your user name and
private password when asked.
<p>
Thank you for registering with us!<p>
Enjoy!!
<p>
<HR>
<A HREF=\"$private_area\">Click here to return to the Home Page</A>.
</BODY>
</HTML>
HTML
#print "Content-type: text/plain\n\n ";
open(REGLOG, ">>$reglog");
print REGLOG "\"Date: $date\",";
print REGLOG "\"$contents{'title'}\",";
print REGLOG "\"$contents{'forename'}\",";
print REGLOG "\"$contents{'surname'}\",";
print REGLOG "\"$contents{'street1'}\",";
print REGLOG "\"$contents{'street2'}\",";
print REGLOG "\"$contents{'city'}\",";
print REGLOG "\"$contents{'county'}\",";
print REGLOG "\"$contents{'country'}\",";
print REGLOG "\"$contents{'postcode'}\",";
print REGLOG "\"$contents{'sex'}\",";
print REGLOG "\"$contents{'age'}\",";
print REGLOG "\"$contents{'marital'}\",";
print REGLOG "\"$contents{'username'}\",";
print REGLOG "\"$contents{'email'}\",";
if ($contents{'nfp'}) {
	print REGLOG "\"$contents{'nfp'}\"\n";
} else {
	print REGLOG "\"\"\n";
close (REGLOG);
exit;

--------------------- END ---------------------

While it seems correct to me, and I have set the attributes to 755, when
I run it from my web page (http:www.bareingredients.com), I get "This
document contains no data".

The FORM tag is:
<FORM ACTION="http://www.bareingredients.com/cgi-local/register.cgi"
METHOD="POST" NAME="regform">

It is submitted by javascript's submit() function.

Any help would be greatly appreciated.

Alasdair


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.


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

Date: Fri, 23 Jul 1999 10:32:47 -0400
From: "Dan Gervais" <dan@multicorpora.ca>
Subject: Special characters
Message-Id: <N1%l3.347$Lg6.47429@weber.videotron.net>

HI,
    I'm trying to print java into a print command of a cgi perl script.  The
java script works fine on the HTML page. I want to print the HTML page with
a Perl script.

Example that doesn't work:

if (document.regForm.bill_first_name.value == "") {
         alert('Please enter your first name.');
         return false;
      }

How can I put " and ' within the Print "   xxxxxxxxx"; ???

Thanks,


--


Dan Gervais
Product Manager
MultiCorpora Inc
dan@multicorpora.ca
www.multicorpora.ca

Tel:  819-595-5884
Fax: 819-595-5859




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

Date: Fri, 23 Jul 1999 14:43:40 GMT
From: jjanssen3894@my-deja.com
Subject: Testing a file to see if it's already open
Message-Id: <7n9v2p$nm6$1@nnrp1.deja.com>

This is not really a locking problem, but let me explain it properly.

I have a server which various people will FTP files into a certain
directory.  On that server I have a process which wakes up once in a
while and will process any thing that is put into that directory and
then clear out the directory for the next batch of stuff.

My concern is if my process wakes up while the files are still being
FTP'd in ( and hence not complete files) it will get confused since
it's trying to process a file that isn't complete yet.

Is it possible, somehow, in Unix to see if someone else has a
particular file open?  I would like to make it simple so that the FTP
user doesn't have to do anything fancy, just my process will be smart
enough to wait for them to be done downloading.


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.


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

Date: Fri, 23 Jul 1999 15:21:55 +0100
From: "Chris Denman" <chris@inta.net.uk>
Subject: Re: TextArea fields
Message-Id: <7n9tvg$8ak$1@news2.vas-net.net>

I have found that browsers send newlines in different ways.

The browsers could send any of the following:

/n/r
/r/n
/r
/n

so if just do this (if you are eventually outputting into a browser)

$br='<br>';
$line=~s/\n\r/$br/g;
$line=~s/\r\n/$br/g;
$line=~s/\r/$br/g;
$line=~s/\n/$br/g;

(there is probably a much more efficient way to do this, but it works for me
and is fast enough)

HTH

Chris Denman

(macs seem to send funny combinations)

lefkogt.xp@usafa.af.mil wrote in message <7n84fh$702$1@nnrp1.deja.com>...
>How can we use textarea fields in forms so that people can put hard
>carriage returns to separate paragraphs in a textarea field? Everytime
>we do it now it adds extra record(s) per physical carriage return.  We
>are on Unix-flavor server.  Try it at  www.home-bytes.com/stratplan/ .
>Click on Mission Analysis link, notice record count, click Add, enter
>info , enter hard carriage returns (enter key) in first textarea ONLY
>for now.  If you enter say three of them you will see four records were
>generated when you return to the main database screen (look at new
>count).  The program is an iteration of a database (ASCII) program
>built by Brent Michalski from www.webreview.com.  If you need to see
>code let me know and I will email it to you.
>Gary
>gary.lefko@usafa.af.mil
>
>
>Sent via Deja.com http://www.deja.com/
>Share what you know. Learn what you don't.




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

Date: Fri, 23 Jul 1999 15:27:50 +0100
From: "Chris Denman" <chris@inta.net.uk>
Subject: Re: What does this statement mean?
Message-Id: <7n9uaj$8av$1@news2.vas-net.net>


>  @result=`mv $filename $archivedirectory`;
>
>  Is it storing the result of the execution of the move statement in the
>  array ?
>
>Clarification is highly appreciated.

If you are using win32, then this is of no use to you (unless you have a
batch file to run mv as move).

Chris Denman




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

Date: 1 Jul 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 1 Jul 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.  

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 V9 Issue 235
*************************************


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