[11550] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 5150 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Mar 16 17:07:24 1999

Date: Tue, 16 Mar 99 14:00:22 -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           Tue, 16 Mar 1999     Volume: 8 Number: 5150

Today's topics:
        Can you use xxx.pm inside aaa.pm <dennis.kowalsk@daytonoh.ncr.com>
        compilation problems - make test fails differently base <rdschramm@earthlink.net>
    Re: Doc in HtmlHelp Format <jglascoe@giss.nasa.gov>
        DUMB Newbie question (VisualJP)
        Elegant substitution regex question <burton.not.spam@lucent.com>
    Re: Filehandle question (Earl Hood)
    Re: Finding end of line <jglascoe@giss.nasa.gov>
        flock() on NT? (Michael Budash)
    Re: flock() on NT? (Ethan H. Poole)
    Re: help with pattern matching <paul.cameron@sun.com>
    Re: How do you create an mSQL database... bthak@bascom.com
    Re: HTML, RTF, XML and CGI <flanker@sonnet.ru>
    Re: IDE for Perl (Earl Hood)
    Re: Inheriting question, please help :) <jglascoe@giss.nasa.gov>
    Re: Inheriting question, please help :) <please_reply@newsgroup.com>
    Re: Interrupting "print FH" <aqumsieh@matrox.com>
    Re: Multiple Users Corrupting File <flanker@sonnet.ru>
    Re: Navigation Bar? (newbie question) <flanker@sonnet.ru>
        Net::FTP get file and append? (Bryce Pursley)
    Re: Newby Question <horizon@internetexpress.com.au>
        Random for Hash <flanker@sonnet.ru>
    Re: Random for Hash <jglascoe@giss.nasa.gov>
    Re: Random for Hash <Allan@due.net>
    Re: Real Funny Browser/CGI Behavior (Abigail)
    Re: Regex limits for regex/function calls within subsit <aqumsieh@matrox.com>
    Re: Regex limits for regex/function calls within subsit <burton.not.spam@lucent.com>
    Re: Regex limits for regex/function calls within subsit (Ilya Zakharevich)
    Re: Sendmail and Cc: field <flanker@sonnet.ru>
    Re: Sorting Problem (Abigail)
    Re: symbolic method references? (Sean McAfee)
    Re: symbolic method references? (Andrew M. Langmead)
    Re: UNIQUE variable... <wells@cedarnet.org>
    Re: viewing contents of *.html files (Earl Hood)
        Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)

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

Date: Tue, 16 Mar 1999 15:43:11 -0500
From: "Dennis Kowalski" <dennis.kowalsk@daytonoh.ncr.com>
Subject: Can you use xxx.pm inside aaa.pm
Message-Id: <epiYyz#b#GA.101@rpc1285.daytonoh.ncr.com>

I have a lot of scripts that use Win32::NetResource to map network drives.

I wrote a .pm module that has map and unmap routines in it.
They take parameters for the drive and sharename

I put a use Win32::NetResource in my .pm module.

I wrote a test script that has a use statement for my .pm file and I called
the map and unmap routine in it.

My map routine calls the Win32::NetRseource::CancelConnection routine and
gets an error message of an undefined routine.

It is as if the use Win32::NetResource in my .pm is being ignored.

Can a .pm use another .pm ???

If not, any suggestions on how I can have a general library routine to map
and unmap drives without each script writer useing the raw Win32 module ??

Thanks in advance to the guru who responds






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

Date: Tue, 16 Mar 1999 13:39:18 -0500
From: "Rich Schramm" <rdschramm@earthlink.net>
Subject: compilation problems - make test fails differently based on compiler used - dec unix 4.0e
Message-Id: <7cmann$q1h$1@ash.prod.itd.earthlink.net>

Background:

For Y2K remediation, we recently destroyed and rebuilt our DEC Unix
development box, loaded DEC Unix 4.0E and DEC compiler, and then went about
installing the latest version of the GNU tools/apps. As such, I downloaded
and built the latest version of gnu make, then I loaded gcc 2.8.1 with c++
stdlib, building the two together as that package recommends (and making it
with the gnu make).

--------------------------------
Problem:

Perl compiles successfully with either cc or gcc, but make test fails as
follows:

cc: op/pack.t fails on test 9 packing/unpacking with hex
gcc: lib/sdbm.t fails by dumping core.

Pack tests successfully with gcc, and sdbm test OK with cc!

--------------------------------
Misc:

I have tried this many times, using both cc/make and gcc/gnu make and other
permutations and get the same results.

I have also tried making 5.004_04 and get the same results.  I build
5.004_04 on this box with dec unix 4.0b and gcc 2.7.

Has anyone else run into a problem like this?  Any thoughts are appreciated.
The INSTALL doc did not cover these problems.

If possible, please reply to both addresses listed below.

TIA,

Rich Schramm
rdschramm@earthlink.net
rdschramm@scripps.com








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

Date: Tue, 16 Mar 1999 15:59:20 -0500
From: Jay Glascoe <jglascoe@giss.nasa.gov>
To: schlueter@dialogs.de
Subject: Re: Doc in HtmlHelp Format
Message-Id: <36EEC628.3EB0EE9@giss.nasa.gov>

[courtesy copy of post sent to cited author]

Ralf Schlueter wrote:
> 
> Hi,
> 
> I'm looking for perl documentation in HtmlHelp format.
> Does anybody know where I can download it?

hi,

I have no idea what an "HtmlHelp" is.  But, I know the
docs are available as PlainOldHtml files:

print << 'Narf!';
You can access these individually or you can fetch a giant
tarfile of all the HTML pages.
    http://language.perl.com/info/documentation.html
Narf!

	Jay Glascoe
-- 
	"Don't be too proud of this technological
	 terror you've constructed."
        --Darth Vader (speaking to Bjarne S. ???)


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

Date: 16 Mar 1999 21:45:41 GMT
From: visualjp@aol.com (VisualJP)
Subject: DUMB Newbie question
Message-Id: <19990316164541.28798.00000152@ng104.aol.com>

I am trying to start a perl script on a SGI (irix).  It contains a loop that
executes a program.  The problem is that the perl script doesn't seem to wait
until the program finishes, it just keeps going.  The result is the same
program opened several times at once.  

Is there a line that I can type in that will tell the computer to wait until
the program is finished to go on to the next line?  I thought of putting a for
loop in there to make it pause, but that seems rather barbaric.

Any help is greatly appreciated!
Thanks
John Pollard
Visual Sciences, Inc.


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

Date: Tue, 16 Mar 1999 15:17:31 -0600
From: Burton Kent <burton.not.spam@lucent.com>
Subject: Elegant substitution regex question
Message-Id: <36EECA6B.EC821381@lucent.com>

I'm looking for an elegant way to do the following two
related substitutions. Everything I've thought up 
requires a hack of some sort.  

But this is Perl.  There must be a better way to do it.


<synopsis>text1</synopsis>

becomes:

<indexterm>text1<indexterm>
<synopsis>text1></synopsis>

but the following must also work:

<refsynopsisdiv>
<synopsis>text1</synopsis>
<synopsis>text2</synopsis>
</refsynopsisdiv>

becomes:

<indexterm>text1<indexterm>
<indexterm>text2<indexterm>
<refsynopsisdiv>
<synopsis>text1</synopsis>
<synopsis>text2</synopsis>
</refsynopsisdiv>

Thanks for any help.

Burton


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

Date: 16 Mar 1999 20:30:25 GMT
From: ehood@medusa.acs.uci.edu (Earl Hood)
Subject: Re: Filehandle question
Message-Id: <7cmf11$fuf@news.service.uci.edu>

	[mailed & posted]
In article <36EE2ED6.AD1F64AE@gredos.cnb.uam.es>,
	 <jmfernandez@gredos.cnb.uam.es> wrote:

>	Do you know how to change the predefined STDIN, STDOUT & STDERR filehandles, in
>the same style as the "dup2" system call?

Read the documentation about open() within the perlfunc manpage.

	--ewh
-- 
             Earl Hood              | University of California: Irvine
      ehood@medusa.acs.uci.edu      |      Electronic Loiterer
http://www.oac.uci.edu/indiv/ehood/ | Dabbler of SGML/WWW/Perl/MIME


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

Date: Tue, 16 Mar 1999 16:18:26 -0500
From: Jay Glascoe <jglascoe@giss.nasa.gov>
Subject: Re: Finding end of line
Message-Id: <36EECAA2.B09CFD82@giss.nasa.gov>

"J=FCrgen Exner" wrote:
> =

> However there is a
> - line-feed character (LF)

ascii value 12 <=3D> "\f" <=3D> "\014" <=3D> aka <ctrl-M>

> - and a carriage return character (CR)

ascii value 13 <=3D> "\r" <=3D> "\015"

- and a newline character

ascii value 10 <=3D> "\n" <=3D> "\012"

	Jay Glascoe
-- =

"'C' is for 'Cookie'.  That's good enough for me."
  --Cookie Monster


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

Date: Tue, 16 Mar 1999 12:20:52 -0800
From: mbudash@trantracks.com (Michael Budash)
Subject: flock() on NT?
Message-Id: <mbudash-1603991220530001@d58.nas1.napa.sonic.net>

i'm pretty sure flock() won't work on nt systems... am i correct?

so what do youz guys use in such dire (read that: micro$oft) predicaments?

tia-
-- 
@-----------------------------@--------------------@
| Michael Budash Consulting   | 707-255-5371       |
| Perl, Javascript, Html      | 707-258-7800 x7736 |
| Official Extropia Developer | mbudash@sonic.net  |
@-----------------------------@--------------------@


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

Date: Tue, 16 Mar 1999 16:36:31 -0500
From: ehpoole@ingress.com (Ethan H. Poole)
Subject: Re: flock() on NT?
Message-Id: <l9zmOU$b#GA.171@rejz.ij.net>

[Posted and Emailed]  In article 
<mbudash-1603991220530001@d58.nas1.napa.sonic.net>, mbudash@trantracks.com 
says...
>
>i'm pretty sure flock() won't work on nt systems... am i correct?
>
>so what do youz guys use in such dire (read that: micro$oft) predicaments?

I haven't found the flock() function to be very reliable under NT (NT 
certainly has the native capability to lock files *very* effectively, but the 
Perl implementation does not seem to take advantage of this), particularly on 
multi-processor machines.  I should point out that I have not tested flock() 
under the latest Perl release.

You can always fall back on the old trick of using *.lok files to advise 
other scripts that a file is currently considered locked.  You will need to 
be consistent in that all scripts accessing the file must obey the same rules 
and check for the file's non-existence before proceeding. Further, even after 
establishing a tentative lock, the process must ensure that the lock file was 
created only by itself and not another process that opened the file 
simultaneously.  You will also want to provide some means of recovering from 
orphaned *.lok files after some reasonable time period has expired.

-- 
Ethan H. Poole              | Website Design and Hosting,
                            | CGI Programming (Perl & C)..
========Personal=========== | ============================
* ehpoole @ ingress . com * | --Interact2Day, Inc.--
                            | http://www.interact2day.com/



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

Date: Tue, 16 Mar 1999 19:49:15 +0000
From: Paul Cameron <paul.cameron@sun.com>
Subject: Re: help with pattern matching
Message-Id: <36EEB5BB.E5336844@sun.com>

Kevin Howe wrote:

> Hi, the code below works great. Now what I would like do is do it for more
> that one pattern, but still in the same expression, which I'm pretty sure
> can be done.

You know how it should work. The quick hack would be just to do the
regular expression twice!

You've been given solutions that work. Use your grey matter and
extrapolate a solution yourself, most of the hard work has been done
for you!

> Here's the idea of what I want to do:
> $var = "<on>   this  <off>...<n>...<me> t ha  t  <n>  <you>";
>
> I want to eliminate:
> 1. All spaces and <n> codes between the <on> and <off> tags as before
> 2. All spaces and <n> codes  between the <me> and <you> tags
>

<SNIP>

> The desired result would be:
> $var = "<on>this<off>...<n>...<me>that <you>";

There's a space between <me> and <you>! How do you expect
people to help you when you contradict yourself in the output you
expect ??


> ** Note: The periods are meaningless, just there to take up space.

You should have stated this in your previous email. I can't figure
out why I should donate my time to helping you, when you can't
help yourself.

My two cents,

Paul.

--
Paul Cameron
  Intern Extraordinaire    @_=qw(Jnrk Aecther Past Huoler);print+map{substr
  thrase@slip.net             ($_[($_>>2)-($_&3)],$_%4,1).($_&3^3?"":substr
  Will Perl for Food!                 ($_[$_>>2],4).($_^15?" ":"\n"))}0..15





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

Date: Tue, 16 Mar 1999 20:22:17 GMT
From: bthak@bascom.com
Subject: Re: How do you create an mSQL database...
Message-Id: <7cmehc$ps1$1@nnrp1.dejanews.com>

In article <comdog-ya02408000R1503992024060001@news.panix.com>,
  comdog@computerdog.com (brian d foy) wrote:

>
> there's always http://www.hughes.com, the main site for msql.

don't forget the trailing .au :)

http://www.hughes.com.au

Baiju Thakkar

www.perlmonth.com
Just user Perl;

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: Tue, 16 Mar 1999 21:16:07 +0300
From: "Michael Yevdokimov" <flanker@sonnet.ru>
Subject: Re: HTML, RTF, XML and CGI
Message-Id: <7cmer7$skr$2@bison.rosnet.ru>

Have you received an answer?
I'd like to get a Perl script for parsing RTF file (to convert it into
HTML)... My scripts works under FreeBSD system and I don't need in C
programes!

If you have or anyone else have, please let me know as soon as possible. ;-)


--
Best wishes,

Michael Yevdokimov

Email: flanker@sonnet.ru
ICQ: 30874618
-------------------------------------------------
>> Developers Support Site <<
Web: http://developer.tsx.org
http://www.basicnet.sonnet.ru
-------------------------------------------------

rouchyg@gatwick.geco-prakla.slb.com PI[ET W SOOB]ENII
<7c8elp$sdr$1@nnrp1.dejanews.com> ...
>I would like to build a kind of "on-line writing tool" for specific
documents.
>The idea is the following:
> - Information is gathered via HTML form
> - A cgi script build the the HTML and RTF documents by filling some
template
>files (respectively HTML and RTF)with the information coming from the form.
>
>The idea would be to build only one XML instance that would allow then the
>generation of the HTML, the RTF or whatever.
>
>My question is what language is the most apropriate to implement my cgi
script
>knowing that I must deal with:
> - Lexical analysor and important string manipulation
> - CGI functionnalities to access data
> - XML manipulation tool to manage XML doc
>
>C++ ? Java ? perl ?
>
>Thanks for your help.
>
>-----------== Posted via Deja News, The Discussion Network ==----------
>http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own




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

Date: 16 Mar 1999 20:22:04 GMT
From: ehood@medusa.acs.uci.edu (Earl Hood)
Subject: Re: IDE for Perl
Message-Id: <7cmehc$fnv@news.service.uci.edu>

	[mailed & posted]
In article <7cjmev$b5a$1@nnrp1.dejanews.com>,
 <swamichandra@my-dejanews.com> wrote:
>Thanks for the detailed reply Mr. Jim. I'm developiing applications in
>Solaris environment. So I was looking out for solaris based IDE's. I'll keep
>hunting !!

Look at DDD, <URL:http://linux.cis.nctu.edu.tw/docs/ddd/>.  It is a
free graphical debugging tool, and it supports Perl (along with several
other languages).

	--ewh
-- 
             Earl Hood              | University of California: Irvine
      ehood@medusa.acs.uci.edu      |      Electronic Loiterer
http://www.oac.uci.edu/indiv/ehood/ | Dabbler of SGML/WWW/Perl/MIME


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

Date: Tue, 16 Mar 1999 15:35:17 -0500
From: Jay Glascoe <jglascoe@giss.nasa.gov>
To: Don Pritchard <please_reply@newsgroup.com>
Subject: Re: Inheriting question, please help :)
Message-Id: <36EEC085.CF026778@giss.nasa.gov>

[courtesy copy of post sent to cited author]

Don Pritchard wrote:
> 
> If I have a ksh script, which calls a perl script, which calls a ksh script
> (via the "`" method).  Will the final ksh script have available to it any
> Unix environment variables set in the first script?

I'm not much of a shell programmer, but here goes:

foo=bar /bin/ksh -e '
    echo $foo;
    perl -e '\''
        print "$ENV{foo}\n";
        print `/bin/ksh -e "echo \$foo"`;
    '\''
'

	Jay Glascoe
-- 
"Just say 'Narf!'."
  --Pinky


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

Date: Tue, 16 Mar 1999 14:47:46 -0600
From: "Don Pritchard" <please_reply@newsgroup.com>
Subject: Re: Inheriting question, please help :)
Message-Id: <7cmg9v$7ff@sjx-ixn10.ix.netcom.com>

That answers that! Thanks.


Jay Glascoe <jglascoe@giss.nasa.gov> wrote in message
news:36EEC085.CF026778@giss.nasa.gov...
>[courtesy copy of post sent to cited author]
>
>Don Pritchard wrote:
>>
>> If I have a ksh script, which calls a perl script, which calls a ksh
script
>> (via the "`" method).  Will the final ksh script have available to it any
>> Unix environment variables set in the first script?
>
>I'm not much of a shell programmer, but here goes:
>
>foo=bar /bin/ksh -e '
>    echo $foo;
>    perl -e '\''
>        print "$ENV{foo}\n";
>        print `/bin/ksh -e "echo \$foo"`;
>    '\''
>'
>
> Jay Glascoe
>--
>"Just say 'Narf!'."
>  --Pinky




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

Date: Tue, 16 Mar 1999 13:03:05 -0500
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: Interrupting "print FH"
Message-Id: <x3yg1758g89.fsf@tigre.matrox.com>


prl2@lehigh.edu writes:

> In the following test, if I strike ENTER everything goes fine.
> However, if I
> ctrl-C when it's waiting for input, the test.log has nothing in it when I
> check it.
> 
> open FH, ">test.log" or die "!";
> print FH "test";
> my $z = <STDIN>;

The reason is due to output buffering. You must disable it (or flush
the buffer after every print). That is done via the $| special
variable (check out perlvar for more info on $|).

open FH, "test.log" or die "$!";   # it's $! .. not !
select((select(FH), $| = 1)[0]);
###
# The above can be more clearly written as:
# { my $dum select FH; $| = 1; select $dum }
###
print FH "test";
my $z = <STDIN>;

You can also use the autoflush() method if you're using the IO
modules. Or, you can write a "\n" into your file which flushes the
buffer.

> Questions: - Why? - What can I do to protect the log from ctrl-C's?

That's another issue. If you would like to trap the ctrl-C's, have a
look at the 'sigtrap' pragma. Also, check out the %SIG special hash in
perlvar.

HTH,
Ala



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

Date: Tue, 16 Mar 1999 20:59:39 +0300
From: "Michael Yevdokimov" <flanker@sonnet.ru>
Subject: Re: Multiple Users Corrupting File
Message-Id: <7cmer5$skr$1@bison.rosnet.ru>

Could you send me an example of using flock in this situation? ;)

--
Best wishes,

Michael Yevdokimov

Email: flanker@sonnet.ru
ICQ: 30874618
-------------------------------------------------
>> Developers Support Site <<
Web: http://developer.tsx.org
http://www.basicnet.sonnet.ru
-------------------------------------------------

ICG PI[ET W SOOB]ENII <7ch67s$r7q@world6.bellatlantic.net> ...
>In article <36E9BD14.515946AF@his.com>, Steve Palincsar <palincss@his.com>
wrote:
>>Eric Patterson wrote:
>>>
>>> I've run into a problem that I can't figure out.  I hope someone here
>>> has an answer.  I'm running a Perl bulletin board script that is
accessible
>>> from the internet.  Anytime two internet users execute the script within
>>> a small period of time files get corrupted.  Specifically a file
>>> is opened and written too by the first user.  The same file is opened
>>> by the second user before the first has finshed writing to the file.
This
>>> is causing loss of data.
>>>
>>> Is there a way to combat this problem?  Is there some way of restricting
>>> access to file that is currently open?  Or perhaps another way
alltogether.
>>>
>>
>>flock
>
>Definately.  flock.  If you can't flock due to your environment, you may
have
>to flock yourself.  (build your own).  When the fill you are trying to
protect
>gets opened, build another small file.  Before the routine accesses the
main
>file, test for the presence of the small file (the lock file), if it
exists,
>wait untill it goes away.  After the main file access is over, kill the
small
>file, that clears the lock.  Unix does something similar (but better, since
>it's already there and Perl makes use of it) that uses the PID of the
routine.
>
>Have fun flocking around....




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

Date: Tue, 16 Mar 1999 21:21:09 +0300
From: "Michael Yevdokimov" <flanker@sonnet.ru>
Subject: Re: Navigation Bar? (newbie question)
Message-Id: <7cmer9$skr$3@bison.rosnet.ru>

Hi!

It seems to me you must have several files..
1. script
2. text file with menu items
3. image (background)

Now, u have simply generate new html file reading data from 2) and 3)... Did
you mean this? ;-)


--
Best wishes,

Michael Yevdokimov

Email: flanker@sonnet.ru
ICQ: 30874618
-------------------------------------------------
>> Developers Support Site <<
Web: http://developer.tsx.org
http://www.basicnet.sonnet.ru
-------------------------------------------------

Vice Admiral Acker PI[ET W SOOB]ENII <7cf0ui$gec$1@nnrp1.dejanews.com> ...
>Is there a way to use CGI to generate a left-hand navigation  bar, and then
a
>way to include the text from another source, by having ONE cgi and then
just
>linking it up?
>
>
>.---------------------------.-----------------------------------.
>| Vice Admiral Acker        | mailto:ViceAdmiralAcker@rotfl.com |
>| "Life's short, have fun!" |                                   |
>'---------------------------'-----------------------------------'
>
>-----------== Posted via Deja News, The Discussion Network ==----------
>http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own




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

Date: Tue, 16 Mar 1999 20:44:05 GMT
From: hbpursle@duke-energy.com (Bryce Pursley)
Subject: Net::FTP get file and append?
Message-Id: <36eebedb.1035708570@news.infoave.net>

I get a list of files from a remote server (VMS) and change the name
before I save them.  That part I did with the following lines:

use Net::FTP;
chdir ("\\\\xxxxxx\\yyyyyyyy\\zzzzzzz") or die "Can't change to
directory on remote server $!";
$ftp = Net::FTP->new("remote.server.com");
$ftp->login("username","password");
$ftp->cwd("directoryname");
@filelist = $ftp->ls;
foreach $file (@filelist) {
  if ($file =~ (/UNPROCESSED/)) {
  $ftp->get($file, "OPC002.$file");
  }
}
$ftp->quit;

My question involves "appending" these files to existing files if they
already exist.  I see the "append" command in Net::FTP that allows you
to append to a file on the remote server but I don't see any command
to append to a file on the local machine.  I didn't really want to
"open" each file.  What I'd like is to "copy with append if exist."
Any ideas or suggestions?
Bryce


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

Date: Wed, 17 Mar 1999 07:52:51 +1100
From: Mick <horizon@internetexpress.com.au>
To: mojo@trianglenet.net
Subject: Re: Newby Question
Message-Id: <36EEC4A3.3814A653@internetexpress.com.au>

Hi...have a real close look at the first line of code -

#!/cgi-bin/nameage.cgi

Are you trying to execute you nameage.cgi script with nameage.cgi?

Try -

#!/your_path_to_perl/perl

eg....

#!/local/bin/perl

Hope this helps,
Mick

Ramona wrote:

> Hello,
> I have been trying
> to learn perl/cgi
> here in the last
> month.  I have been
> attempting to create
> and run simple
> programs from the
> "CGI Developer's
> Guide" by Eugene
> Eric Kim.
>
> My web host is a NT
> server. Here is an
> example of the
> program that I am
> working with.
> ******************************************************************
> #!/cgi-bin/nameage.cgi
> #nameage.cgi
> 
> require 'cgi-lib.pl'
> 
> &ReadParse(*input);
> print
> "<Content-Type:  text/html\r\n\r\n";
> print "<html>\n";
> print "<head>\n";
> print "<title>Name
> and Age</title>\n";
> print "</head>\n";
> print "<body>\n";
> print "Hello, " .
> $input{'name'} . ".
> You are\n";
> print $input{'age'}
> . " years old.<p>\n";
> print "</body> \n";
> print "</html>\n";
> ********************************************************************
> After submiting my
> name and age from
> the form I receive
> the following error message:
>
> The specified CGI
> application
> misbehaved by not
> returning a complete
> set of HTTP headers.
> The headers it did
> return are:
>
> Can't exec
> /cgi-bin/nameage.cgi
> at
> D:\inetpub\wwwroot\219067\s8e8hnjl\cgi-bin\nameage.cgi
> line 1.
>
> I know that this is
> not a difficult
> problem, but for
> some reason I am
> having difficulty
> understanding why I
> am getting this error.
>
> Any suggestions or
> comments would be
> greatly appreciated.
> Ramona



--
----------------------------------------------------------------
HORIZON Software Solutions

Visit Site - http:www.deakin.edu.au/~bellears/horizon/index.html
e-mail     - mailto:horizon@internetexpress.com.au

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




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

Date: Tue, 16 Mar 1999 22:45:13 +0300
From: "Michael Yevdokimov" <flanker@sonnet.ru>
Subject: Random for Hash
Message-Id: <7cmerf$skr$5@bison.rosnet.ru>

I have a hash:

%Datas = ('0' => 'aaa'
          '3' => 'bbb'
          '4' => 'ccc'
          '6' => 'ddd'
         '10' => 'eee');

How to generate a random number which will be one of the listed keys in
hash? I.e. I need to choose a string value from hash by random method but
the generated key must be equal to one of the listed hash keys!

Please reply as soon as possible!

Thank you.

--
Best wishes,

Michael Yevdokimov

Email: flanker@sonnet.ru
ICQ: 30874618
-------------------------------------------------
>> Developers Support Site <<
Web: http://developer.tsx.org
http://www.basicnet.sonnet.ru
-------------------------------------------------





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

Date: Tue, 16 Mar 1999 15:45:38 -0500
From: Jay Glascoe <jglascoe@giss.nasa.gov>
To: Michael Yevdokimov <flanker@sonnet.ru>
Subject: Re: Random for Hash
Message-Id: <36EEC2F2.D67D933A@giss.nasa.gov>

[courtesy copy of post sent to cited author]

Michael Yevdokimov wrote:
> 
> I have a hash:

I have a rolling paper and matches  ;^)

> How to generate a random number which will be one of the listed keys in
> hash? I.e. I need to choose a string value from hash by random method but
> the generated key must be equal to one of the listed hash keys!

my @keys = keys %hash;
my $rand_key = $keys[int rand @keys];  # may need to call "srand()" first
my $rand_val = $hash{$rand_key};

	Jay Glascoe
-- 
"They'll get my perl when they pry it
 from my cold, dead /usr/local/bin."
    --Randy Futor in 
      <news:1992Sep13.175035.5623@tc.fluke.COM>


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

Date: Tue, 16 Mar 1999 16:00:57 -0500
From: "Allan M. Due" <Allan@due.net>
Subject: Re: Random for Hash
Message-Id: <7cmgqj$thm$1@camel21.mindspring.com>


Michael Yevdokimov wrote in message <7cmerf$skr$5@bison.rosnet.ru>...
:I have a hash:
:
:%Datas = ('0' => 'aaa'
:          '3' => 'bbb'
:          '4' => 'ccc'
:          '6' => 'ddd'
:         '10' => 'eee');


You forgot some commas there.
:
:How to generate a random number which will be one of the listed keys in
:hash? I.e. I need to choose a string value from hash by random method but
:the generated key must be equal to one of the listed hash keys!
:

Well you are in a hurray and so am I so I am probably missing something
obvious but one way:

my $ran_value = $Datas{(keys %Datas)[rand keys %Datas]};

--
$email{'Allan M. Due'} = ' All@n.Due.net ';
--random quote --
Numbers are symbols for things; the number and the thing are not the same.
 - Ashley-Perry Statistical Axioms[1]





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

Date: 16 Mar 1999 21:29:11 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Real Funny Browser/CGI Behavior
Message-Id: <7cmif7$he6$1@client2.news.psi.net>

tatabu@my-dejanews.com (tatabu@my-dejanews.com) wrote on MMXXIII
September MCMXCIII in <URL:news:7clt5n$8uh$1@nnrp1.dejanews.com>:
"" I am trying to use the line of code
"" 
"" $sizes=imgsize("friend.jpg");
"" 
"" in a CGI script file. When I call that cgi file with any one of the
"" three browsers (Netscape, MSIE, Opera), I get an error.

I highly, highly doubt that's the case.

Browsers don't call CGI programs; servers do.




Abigail
-- 
perl -wle 'print "Prime" if (0 x shift) !~ m 0^\0?$|^(\0\0+?)\1+$0'


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

Date: Tue, 16 Mar 1999 13:16:58 -0500
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: Regex limits for regex/function calls within subsitutions?
Message-Id: <x3yemmp8fl2.fsf@tigre.matrox.com>


Burton Kent <burton.not.spam@lucent.com> writes:

> What kind of limits does Perl have on substitutions?  

what do you mean? You can substitute whatever you want, as many times
as you want.

> Is there anything I should watch out for in substitutions?
> (e.g. $text =~ s/this/that/g;)

Hmmm.. did you read perlre?

> I get a segmentation fault at a consistent place in a 
> substitution operation -- at the end of the replace.  I'm
> able to print the value right before returning from the 
> replace, but get the segmentation fault as the replace 
> returns.

Can you show us some code that suffers from the behaviour you
describe?
I have *NEVER* seen Perl give a "segmentation fault". Do you get any
error messages? Does Perl dump core?

> My workaround is to put the subsitution in a subroutine. 
> I return the replacement from within the regex, instead of 
> letting the replacement part of the expression finish.

I have no idea what you're talking about. You mean something like:

s/this/&that/eg;  

??

> The program involves recursively applying regular expression 
> substitutions.  It seems to fail at about the 4th recursion 
> of two nested (with subroutine calls) substitution operations.  
> I'm also calling subroutines within the replacement part of 
> the regex.  
> 
> Has anyone else had similar problems?  

Posting some code would tremendously help. The problem might simply be
a typo, or a misuse of some function. Show us the code, along with the
exact description of what Perl does (hangs? error messages?)
I'm sure someone will be able to help you further.

Ala



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

Date: Tue, 16 Mar 1999 14:15:01 -0600
From: Burton Kent <burton.not.spam@lucent.com>
To: Tad McClellan <tadmc@metronet.com>
Subject: Re: Regex limits for regex/function calls within subsitutions?
Message-Id: <36EEBBC5.AD01E1F@lucent.com>

The code is far too complex to post here.  I just sent mail
to perlbug asking if they want a tarred version of the program
and related files.  

I have the exact keystrokes needed to fill each prompt and 
recreate the bug/segmentation fault.  I also know exactly
where the bug occurs, and have a work around to bypass it.

Burton

> 
>    Where is the code that can reproduce the problem for us to look at?
> 
> --
>     Tad McClellan                          SGML Consulting
>     tadmc@metronet.com                     Perl programming
>     Fort Worth, Texas


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

Date: 16 Mar 1999 21:33:11 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: Regex limits for regex/function calls within subsitutions?
Message-Id: <7cmimn$o4t$1@mathserv.mps.ohio-state.edu>

[A complimentary Cc of this posting was sent to Ala Qumsieh 
<aqumsieh@matrox.com>],
who wrote in article <x3yemmp8fl2.fsf@tigre.matrox.com>:
> 
> Burton Kent <burton.not.spam@lucent.com> writes:
> 
> > What kind of limits does Perl have on substitutions?  
> 
> what do you mean? You can substitute whatever you want, as many times
> as you want.

> I have *NEVER* seen Perl give a "segmentation fault". Do you get any
> error messages? Does Perl dump core?

Then you did not try hard enough.  Perl has a limit for "hard" sub-REx
repetitions.  Unfortunately, this limit is dictated by the available
stack size.

At compile time Perl tries to determine a reasonable limit:

  > perl -ce '/(a|bb){123456}/'
  /(a|bb){123456}/: Quantifier in {,} bigger than 32766

but this is only a heuristic, and it is always possible to create a
REx which would blow things away:

  > perl -we '$_ = "a" x 1e6; /(a?a?a?){12345}/'
  Segmentation fault (core dumped)

Ilya


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

Date: Tue, 16 Mar 1999 21:37:58 +0300
From: "Michael Yevdokimov" <flanker@sonnet.ru>
Subject: Re: Sendmail and Cc: field
Message-Id: <7cmere$skr$4@bison.rosnet.ru>

Some time ago I made a similar script. Instead of using Cc: I was including
each person into To: field using foreach{} construction. You may save all of
your user emails into database (User_Name|Email) and then read data from
each record:
open (F, "database.txt) || die "Error during opening database $!";
 while ($line=<F>) {
   ($User,$Email)=split(/|/,$line);

   #.... write a subroutine to paste $Email into To:
   #.... and $User into "Hello $User!", i.e. message body
  }
close(F);

I hope it'll help you.

--
Best wishes,

Michael Yevdokimov

Email: flanker@sonnet.ru
ICQ: 30874618
-------------------------------------------------
>> Developers Support Site <<
Web: http://developer.tsx.org
http://www.basicnet.sonnet.ru
-------------------------------------------------

Steve Miles ohxer b qnnayemhh <36EBF7B8.AC690A1C@bellsouth.net> ...
>Hi all, I'm trying to send email through a perl script using sendmail to
>multiple people. I'm trying to use the "Cc:" field but I only get the
>email sent to the first person on the list. Is there a sendmail resource
>on the web I don't know about? Thanks.
>
>open (MAIL, "|$mailprog $email") || die "Can't open $mailprog!\n";
> print MAIL "Subject: $subject\n";
> print MAIL "From:$admin_email\n";
> print MAIL "Cc:myemai1\@mysite.com\n";
> print MAIL "Cc:myemail2\@mysite.com\n";
> print MAIL "$message\n";
> close (MAIL);
>
>Thanks,
>Steve Miles
>




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

Date: 16 Mar 1999 21:39:46 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Sorting Problem
Message-Id: <7cmj32$he6$2@client2.news.psi.net>

Frank de Bot (debot@xs4all.nl) wrote on MMXXII September MCMXCIII in
<URL:news:36ED68D0.8D14D81D@xs4all.nl>:
!! I have an array:
!! 
!! $ar[0] = "14 || Some Text here";
!! $ar[1] = "4 || Lalalala";
!! $ar[2] = "7 || Hello World";
!! 
!! How can I sort that the array is this:
!! 
!! $ar[0] = "4 || Lalalala";
!! $ar[1] = "7 || Hello World";
!! $ar[2] = "14 || Some Text here";


@ar = @a [1, 2, 0];


HTH. HAND.


Abigail
-- 
perl -MTime::JulianDay -lwe'@r=reverse(M=>(0)x99=>CM=>(0)x399=>D=>(0)x99=>CD=>(
0)x299=>C=>(0)x9=>XC=>(0)x39=>L=>(0)x9=>XL=>(0)x29=>X=>IX=>0=>0=>0=>V=>IV=>0=>0
=>I=>$r=-2449231+gm_julian_day+time);do{until($r<$#r){$_.=$r[$#r];$r-=$#r}for(;
!$r[--$#r];){}}while$r;$,="\x20";print+$_=>September=>MCMXCIII=>()'


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

Date: Tue, 16 Mar 1999 20:23:36 GMT
From: mcafee@waits.facilities.med.umich.edu (Sean McAfee)
Subject: Re: symbolic method references?
Message-Id: <c5zH2.11847$Ge3.46620143@news.itd.umich.edu>

In article <uRxH2.10100$TD3.106056@typhoon-sf.pbi.net>,
Ekkis <ekkis@arix.com> wrote:
>In a package I wrote I had used the following:
>    $f = shift; &$f() if defined &$f;

>I'm now converting the package to a class so the function's become a method.
>I can call it but can't figure out how to test for it's presence:
>    $f = shift;
>    $o = TST->new();
>    $o->$f();    # works fine
>    $o->$f() if defined &$o->$f;    # dn't work

The UNIVERSAL package, from which all objects inherit, has a method called
"can", which indicates whether a given object supports a given method.

$f = shift;
$o = TST->new();
$o->$f() if $o->can($f);

This is described on the perlobj man page.

-- 
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: Tue, 16 Mar 1999 20:44:05 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: symbolic method references?
Message-Id: <F8pG9H.7KK@world.std.com>

"Ekkis" <ekkis@arix.com> writes:

>I'm now converting the package to a class so the function's become a method.
>I can call it but can't figure out how to test for it's presence:

There is a special class called UNIVERSAL, which is an implicit base
class of every class. By default, it defines the methods isa(),
VERSION(), and can() (see the UNIVERSAL man page for details.) What
you want is the can() method to see if your class, or any of its
base classes has the specified method.

   $o->$f() if $o->can($f);
-- 
Andrew Langmead


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

Date: Tue, 16 Mar 1999 21:19:15 +0000
From: Steve Wells <wells@cedarnet.org>
Subject: Re: UNIQUE variable...
Message-Id: <36EECAD2.7CE1F84D@cedarnet.org>

Bart Lateur wrote:
> 
> Steve Wells wrote:
> 
> >Good points Bart, by making sure that the process takes at least
> >a second to run it will make sure that time is unique compared to
> >the PID.
> 
> At least, I hope the system is smart enough not to reuse a PID that is
> still in use when it wraps to that point.
> 
> >Rather than sleep though would you recommend simply
> >using the benchmark routines to manage the time?  This way you
> >don't 'waste' a second trying to get a unique number.
> 
> From the sleep() docs:
> 
>             On some older systems, it may sleep up to a full second
>             less than what you requested, depending on how it counts
>             seconds. Most modern systems always sleep the full
>             amount.
> 
> It looks like the "old" behaviour would be what is desired here: sleep
> until time() has reached the next second value.
> 
> But, anyway: why not postpone the sleep() to the very end of what this
> script is supposed to do? If this is a CGI script, you could the
> standard handles (STDIN, STDOUT, STDERR) to notify the server that the
> useful stuff is finished, if necessary. I think I saw this trick first
> in Randal's WebTechniques columns. See his website
> (http://www.stonehenge.com/merlyn/WebTechniques/) for these; in
> particular, columns 23 through 25 seem to be using this trick.
> 
> >The cookies part comes in when trying to save state, build counters or
> >track users going through the site.  Though I don't know who they are
> >(nor do I care) I can build statistics such as the fact that most people
> >click on a certain link or go to a certain page.  It helps with site
> >design or so they say...
> 
> Ah. Not everybody has cookies enabled.
> 
> You can generate a unique ID, and redirect people from the home page to
> a new URL with this unique ID appended (using a "Location:" line). Like:
> 
> http://www.somewhere.com/contents/cgi-bin/script.cgi/ABCDEFGHIJKL
> 
> Everything up to the "script.cgi" is the URL of the script itself. This
> script will be called, and "ABCDEFGHIJKL" is the "unique" ID, which will
> be available in the script through the $ENV{EXTRA_PATH} environment
> variable. Details depend on the server, so experiment.
> 
> Keep track of the age of these unique ID's. If you see one that is too
> old (could be a bookmark), create a new unique ID , and redirect.

This would give you information concerning the homepage but not the most
frequented links within the homepage.  I have had several clients ask
for information concurring how people traverse through their site not 
necessarily the unique people arriving at the homepage.  They want to 
put two links to the same page on the homepage and see which one is 
chosen more often.

Personally, I hate the fact that people could be tracing you through 
their site.  I realize they don't know that it's you per say but they
have that potential with anything you may enter as part of their site.

Nevertheless do this correctly you would need to parse each page as it
comes through the server.  Extract each link and append the ID number 
to the end of it.  Read them back in from the webserver and record it.
Each link should probably be numbered so as to refer it to later and 
you could find out what area of the page is most popular.

This sounds exactly like Amazon.com.  Every page on their site is dynamic
and the Unique ID is appended to every url as it is passed back from the
server.  It also sounds like a lot of work unless you use the 
Apache::Registry and the HTML::Parser routines ;-)  

Just to clarify the environment variable is called PATH_INFO as opposed 
to EXTRA_PATH (at least that's what it in apache).

STEVE
-- 
-----------
Stephen D. Wells
http://www.iren.net/wellss/


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

Date: 16 Mar 1999 20:03:26 GMT
From: ehood@medusa.acs.uci.edu (Earl Hood)
Subject: Re: viewing contents of *.html files
Message-Id: <7cmdee$f7e@news.service.uci.edu>

In article <1doqheo.4ltgb3rn62rN@bay3-145.quincy.ziplink.net>,
Ronald J Kimball <rjk@linguist.dartmouth.edu> wrote:
>Zenin <zenin@bawdycaste.org> wrote:
>
 ...
>>   print "Content-type: text/html\n\n";
 ...

>Is there anything else we're forgetting?

Yes.  Using text/plain as the content-type to avoid unneccessary
work.

	--ewh
-- 
             Earl Hood              | University of California: Irvine
      ehood@medusa.acs.uci.edu      |      Electronic Loiterer
http://www.oac.uci.edu/indiv/ehood/ | Dabbler of SGML/WWW/Perl/MIME


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

Date: 12 Dec 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 Dec 98)
Message-Id: <null>


Administrivia:

Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing. 

]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body.  Majordomo will then send you instructions on how to confirm your
]subscription.  This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.

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

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