[15877] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 3290 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Jun 8 14:05:43 2000

Date: Thu, 8 Jun 2000 11:05:25 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <960487524-v9-i3290@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Thu, 8 Jun 2000     Volume: 9 Number: 3290

Today's topics:
        [LWP] Simple telnet requests on port 80 <makau@multimania.com>
    Re: [LWP] Simple telnet requests on port 80 (Simon Cozens)
    Re: [repost] sizeof($), sizeof(@), sizeof(%) (Andreas Kahari)
        Capturing frames newbie@db-networks.com
    Re: CGI::Cookie or HTTP::Cookie (Peter J Scott)
    Re: change priority (Andreas Kahari)
        Checking for Variable's value <raphaelp@nr1webresource.com>
    Re: Checking for Variable's value <lauren_smith13@hotmail.com>
    Re: Content-type header to Set Cookie <norbert@NOSPAMcontrex-us.com>
        core dumps - my fault? (Steve Vertigan)
    Re: Database program <raphaelp@nr1webresource.com>
    Re: DB_Lib (Abigail)
        Difficult regex: Update algorithm <burton@REMOVETHIS.lucent.com>
    Re: Dumb question.. How to prompt the user and get the  <lauren_smith13@hotmail.com>
    Re: Encrypting / decrypting. (Simon Cozens)
    Re: Encrypting / decrypting. <godzilla@stomp.stomp.tokyo>
    Re: Encrypting / decrypting. (David Wall)
    Re: file access (locking) (David Wall)
        file access (Eric Mosley)
        Function Which Saves a Passed-in Help Desk HTML Form to teddy9542@my-deja.com
    Re: Function Which Saves a Passed-in Help Desk HTML For nobull@mail.com
        GCI using Java? <cwlau3@hkstar.com>
    Re: GCI using Java? <sariq@texas.net>
    Re: General failure reading device (Win32) <vwilding@digizen.net>
        How to turn off "Deep recursion" warnings? (Gwyn Judd)
        Java/Swing GUI for DBI/MySQL ka6wke@my-deja.com
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Thu, 08 Jun 2000 17:14:12 GMT
From: Makau Divangamene <makau@multimania.com>
Subject: [LWP] Simple telnet requests on port 80
Message-Id: <8hok8j$818$1@nnrp1.deja.com>

Is there a module out there that allows me to S.I.M.P.L.Y send COMPLEX
requests via Telnet on port 80?
LWP modules are great for basic HTTP requests (POST/GET), but as soon
as it comes to very complex requests, those modules become useless ...

Is there a module that would enable me to do the following :

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

use SimpleHttpModule;

my $output = SimpleHttpModule->new->send(
POST /cgi-bin/script.cgi HTTP/1.1
Accept: image/gif, */*
application/pdf, */*
Referer: http://www.url.com
Accept-Language: lg
Content-Type: application/x-www-form-urlencoded
Accept-Encoding: gzip, deflate
User-Agent: Browser
Host: www.host.com
Content-Length: 123
Connection: Keep-Alive
\n
a=1&b=2&c=3&d=5
\n
GET /cgi-bin/script.cgi HTTP/1.1
Accept: */*
Accept-Encoding: ...
Referer: ...
User-Agent: ...
Host: ...
\n
);

print $output;
---------------------

With the LWP modules it is mission impossible for me to do the above :(
It needs complex syntax and I never know where two newlines are put by
the modules, how to define a "keep-alive" connection etc... and even if
I did, I think LWP is to difficult to use.

Any help would be greatly appreciated guys!

--
Makau


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


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

Date: 8 Jun 2000 17:25:53 GMT
From: simon@brecon.co.uk (Simon Cozens)
Subject: Re: [LWP] Simple telnet requests on port 80
Message-Id: <slrn8jvlp1.bh3.simon@justanother.perlhacker.org>

Makau Divangamene (comp.lang.perl.misc):
>Is there a module out there that allows me to S.I.M.P.L.Y send COMPLEX
>requests via Telnet on port 80?

If you're doing all the talking HTTP yourself anyway, simply open a
IO::Socket::INET connection, spit your HTTP request at it and read
what comes back.

-- 
IBM Pollyanna Principle:
	Machines should work.  People should think.


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

Date: 8 Jun 2000 17:57:37 +0100
From: andkaha@hello.to.REMOVE (Andreas Kahari)
Subject: Re: [repost] sizeof($), sizeof(@), sizeof(%)
Message-Id: <393fc271@merganser.its.uu.se>

In article <slrn8jvagb.bh3.simon@justanother.perlhacker.org>,
Simon Cozens <simon@brecon.co.uk> graciously put forth:
>Andreas Kahari (comp.lang.perl.misc):
>>When I declare a scalar like so
>>        $i = 30;
>>how much space does it occupy?
[cut]


Wow. Thanks for all those pointers :-) I will certainly take a good
long look into perlguts at once and into the Perl source code during
the summer.


>If individual variables' sizes are so important that you don't trust
>Perl's way of laying things out, it's time to go to C.


I'm coming from C, C++ and Fortran, I think that's why I posed the
question to myself. I make my living from high performance computing,
so it was a natural question.

Thanks!

/A

-- 
# Andreas Kähäri, <URL:http://hello.to/andkaha/>
# -----------------------------------------------------------
# All junk e-mail is reported to the appropriate authorities. 
# Quidquid latine dictum sit, altum viditur.


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

Date: Thu, 08 Jun 2000 15:12:31 GMT
From: newbie@db-networks.com
Subject: Capturing frames
Message-Id: <sqdvjs4sm9gcn3u5hf153uilvlt3rh5434@4ax.com>

I am capturing webpages with:

use LWP::UserAgent;
$ua = new LWP::UserAgent;
$ua->timeout(45);
$request = new HTTP::Request('GET','http://www.website.com');
$response = $ua->request($request);
print INFO $response->{_content};

This work for non-framed web pages. But I cannot capture frames. Is
there a way of doing it?

Thanks in advance.


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

Date: Thu, 08 Jun 2000 15:55:14 GMT
From: peter@PSDT.com (Peter J Scott)
Subject: Re: CGI::Cookie or HTTP::Cookie
Message-Id: <ClP%4.10350$F9.331254@news1.gvcl1.bc.home.com>

In article <8hm59f$9l2$1@news.service.uci.edu>,
 "Gabe" <grichard@uci.edu> writes:
>These modules seem to do pretty much the same thing. Which is preferred?
>Why?

They're oriented towards different uses.  HTTP::Cookie makes it easy to ensure
that cookies that are set are preserved over the lifetime of a session without
having to explicitly address them; CGI::Cookie makes it easy to read and write
the guts of a cookie and decide when to read and send them.

-- 
Peter Scott


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

Date: 8 Jun 2000 18:04:20 +0100
From: andkaha@hello.to.REMOVE (Andreas Kahari)
Subject: Re: change priority
Message-Id: <393fc404@merganser.its.uu.se>

In article <8hlv9k$gvf$1@news.sovam.com>, Roman Chumakov <zfido88@zr.ru> wrote:
>I need to low priority for executing a perl script.
>
>How a perl script can do it itself?
>May a perlscript to low itself priority? If yes - How?
>
>Hlp pls.
>thx. Ruslan
>

See the manual on the Perl function 'setpriority'. You might want to
say e.g. "setpriority(0,0,19);" (will be fatal on a OS without
priorities).

/A

-- 
# Andreas Kähäri, <URL:http://hello.to/andkaha/>
# -----------------------------------------------------------
# All junk e-mail is reported to the appropriate authorities. 
# Quidquid latine dictum sit, altum viditur.


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

Date: Thu, 8 Jun 2000 19:07:23 +0200
From: "Raphael Pirker" <raphaelp@nr1webresource.com>
Subject: Checking for Variable's value
Message-Id: <8hojtu$bc8$1@news.online.de>

Hi,

I have the following problem: I'm gathering input from a Form and I need to
check inside the script whether a value was entered. The code which assigns
the value of the form looks as follows:

$results_cartoon      = $FORM{results_cartoon};

Now I need to see if $results_cartoon has a value, or if nothing was
entered. If it helps, $results_cartoon is supposed to have a number between
0 and 20 as value...

Any help is greatly appreciated!

Regards,

Raphael




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

Date: Thu, 8 Jun 2000 10:30:57 -0700
From: "Lauren Smith" <lauren_smith13@hotmail.com>
Subject: Re: Checking for Variable's value
Message-Id: <8hol7b$pft$1@brokaw.wa.com>


Raphael Pirker <raphaelp@nr1webresource.com> wrote in message
news:8hojtu$bc8$1@news.online.de...
>
> I have the following problem: I'm gathering input from a Form and I need
to
> check inside the script whether a value was entered. The code which
assigns
> the value of the form looks as follows:
>
> $results_cartoon      = $FORM{results_cartoon};
>
> Now I need to see if $results_cartoon has a value, or if nothing was
> entered. If it helps, $results_cartoon is supposed to have a number
between
> 0 and 20 as value...

perldoc -f defined

Lauren





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

Date: Thu, 8 Jun 2000 11:18:07 -0400
From: Norbert Wienholz <norbert@NOSPAMcontrex-us.com>
Subject: Re: Content-type header to Set Cookie
Message-Id: <MPG.13a9830bb6244203989685@news.sover.net>

THANK YOU!

Even though this wasn't what I had hoped to hear,
at least it's a real answer to the question asked.
I did finally end up rearranging my code to get it done.

But the side effect of not relying on Black Boxes for my
programming is that I now know more about Perl & CGI than
if I'd have just read the documentation of some modules
and used them without understanding what they do.
I know that Perl isn't CGI, but as far as Web-Programming
is concerned, there probably aren't very many Perl programs
out there that can manage without it. That means sooner or 
later I will run into problems with it, and if I totally rely 
on third-party routines I'll never be able to troubleshoot them.
(I recently came across a thread discussing the problems
CGI.pm had with multiple cookies. How am I going to diagnose
and fix potential problems like this, if all I know how to do
is call up other people's modules?)
I know this is not the most efficient way of working, but cranking
out code as fast as possible is not my priority. I've been 
programming for over 15 years, and if my only priority would've 
been productivity I would've been burnt out a long time ago...

Norbert


In article <8hn2q7$v51$1@slb7.atl.mindspring.net>, ebohlman@netcom.com 
says...
> Norbert Wienholz (norbert@NOSPAMcontrex-us.com) wrote:
> : Can I reset the Content-Type after outputting some HTML
> : (where it was set to text/html), to be able to set a cookie
> : afterwards?
> 
> Nope.  The CGI protocol has headers first and body second.  There's no CGI
> equivalent of Usenet Jeopardy quoting :)
> 
>  : Rearranging the code to set the cookie before would be
> : very inefficient in this case.
> 
> In that case, you'll have to squirrel your output away in buffers and 
> then output them in the correct order once everything's been built.
[...]


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

Date: Thu, 08 Jun 2000 15:14:02 GMT
From: vertigan@bigfoot.com (Steve Vertigan)
Subject: core dumps - my fault?
Message-Id: <393fb5d9.48779973@news.iinet.net.au>

I have some fairly big/complex scripts on an ISP which mainly deal with
manipulating large flat file databases.  I've tested each script
individually and they do all run without error AFAICT.  However on occasion
a 40 MB core dump is appearing in the data directory, playing havoc with the
disk quota.   Also in a seemingly unrelated event occasionally all the
scripts return "Internal server error" for about 5 minutes, then everything
starts functioning again.

My feeling is that it's a very sick machine and also a relatively ancient
one as this shows...

$ perl -v
This is perl, version 5.003 with EMBED
        built under linux at Jun 27 1996 21:52:16
        + suidperl security patch

So just a quick question, is it at all possible that a core dump could be
due to a problem in one of my scripts?  It seems to me that now matter what
I do wrong, the worst that should happen is perl should exit with an error,
not crash and dump core.

Regards,
Steve


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

Date: Thu, 8 Jun 2000 18:04:00 +0200
From: "Raphael Pirker" <raphaelp@nr1webresource.com>
Subject: Re: Database program
Message-Id: <8hog44$8rq$1@news.online.de>

www.webteacher.com

Jim Ray <jim.ray@west.boeing.com> wrote in message
news:FvuAn3.n2u@news.boeing.com...
> What is the easiest way to handle a simple database need?  Here is what I
> have. A list of names and address, by regions and email.
>
> I want to be able to build a list sorted by last name or company.  I also
> want to have control over what the output looks like. Also, I want to be
to
> place an mailto around the email address.
>
> Now,  my host will not support MySql, so that one is out.  I currently
have
> the information in a text file.  What would be my next best  thing to do?
>
> Any help and direction would be helpful.
>
> Thanks!
>
> Jim
> jaray214@yahoo.com
>
>




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

Date: 8 Jun 2000 18:03:11 GMT
From: abigail@arena-i.com (Abigail)
Subject: Re: DB_Lib
Message-Id: <8hon4v$hq4$1@news.panix.com>

On Thu, 08 Jun 2000 10:00:02 -0400,
Mihail Temelkov <mihail.temelkov@gs.com> wrote:
++ Does anyone know how to make a db call to a Sybase db using DB-Lib? I am
++ trying to store the results of a query that returns a single record to a
++ scalar..


use Sybase::DBlib;


Abigail


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

Date: Thu, 08 Jun 2000 12:05:05 -0500
From: Burton Kent <burton@REMOVETHIS.lucent.com>
Subject: Difficult regex: Update algorithm
Message-Id: <393FD241.EBDCB234@remove_this.lucent.com>


The simple version:
I'm creating automatically generated text.  Users can insert comments in the
text, and I would like to keep these comments across versions of the
automatically generated text, by comparing the original version to updates.  

Details:
I'm using an SGML DTD and a user guide to create a series of linked help files. 
The users also add their own comments (tips and tricks, when to use, etc.). When
either the user guide or the DTD are updated, I'd like to update the help files
without losing any user commentary.  For the most part, the boundary between
automatically generated text and the user additions are known, but not always.

Any idea for the logic?  The unix utility, 'diff' would do it, except it makes
assumptions about line numbers, which will almost certainly change between
versions.

This is perl.  Therefore, there should be an elegant way to do this.

Thanks.

B

(Please note my email address is mangled to prevent autospamming)


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

Date: Thu, 8 Jun 2000 09:45:32 -0700
From: "Lauren Smith" <lauren_smith13@hotmail.com>
Subject: Re: Dumb question.. How to prompt the user and get the input.
Message-Id: <8hoii9$e02$1@brokaw.wa.com>


Matt King <mattking@techie.com> wrote in message
news:8hns2c$feo$1@news1.transmedia.de...
> Just a followup. I can use the <stdin> just fine now (although it took
> forever to find it, Activestate doesn't include all the docs, atleast not
> with the version I got).
>
> So how can I make a prompt for a single key press? Something like 'press
any
> key to continue'.

Sometimes I think I have a question that there is no way anyone would have
ever asked it before, but then I check the FAQ.  It turns out that I am
always mistaken.

Behold:

perlfaq8: How do I read just one key without waiting for a return key?

Lauren





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

Date: 8 Jun 2000 15:05:36 GMT
From: simon@brecon.co.uk (Simon Cozens)
Subject: Re: Encrypting / decrypting.
Message-Id: <slrn8jvdi0.bh3.simon@justanother.perlhacker.org>

David Wall (comp.lang.perl.misc):
>>Hi. I need a way to encrypt and decrypt a small string (between 8 and 16
                              ^^^^^^^^^^^
>
>perldoc -f crypt

Nope.

I'd look at something in the Crypt:: heirarchy on CPAN. I've certainly
used something there in the past and it didn't need any additional
libraries or programs install, although IIRC it was XS-based. DES,
perhaps.

-- 
It is better to wear chains than to believe you are free, and weight
yourself down with invisible chains.


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

Date: Thu, 08 Jun 2000 09:53:51 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: Encrypting / decrypting.
Message-Id: <393FCF9F.6312ADFA@stomp.stomp.tokyo>

Matt King wrote:
 
> Hi. I need a way to encrypt and decrypt a small string 
> (between 8 and 16 chars). I have looked on CPAN, but all
> I find are add-in modules. I need something small...

> ...so that the file is a 'stand alone' file and can be 
> moved from PC to PC without installing anything...
 
> I would like some type of encryption that can't easly be 
> broken and doesn't make the encrypted string more then 
> double the orginal length...

> Can one of you please help me out with this?



Funny, encryption and modules, yet again...


I love these type of questions. Just takes a bit of old
fashion imagination Matt. Not doubling your original
string length using HEX as you suggest, clearly is
quite impossible. HEX doubles a string, inherently.
Would you mind double length plus one?

This test script and results below, affords encoding
and decoding based on four basic principles:

Encode based on a random ROT-13 variation.
Reverse a string.
HEX encode.
Append a decode key.


I have limited this to two ROT-13 variations
to keep it a simple example. You can develop
as many ROT-13 variations as you like and key
them to a random number generator.

Reversing your string adds a 'frustration' factor.

HEX, not all that secure but befuddles those who
are not familiar with HEX encoding; a bit more
frustration for those with idle hands.

Your Green Hornet Magic Key, a random number,
can be prepended or appended to your string
then extracted for decoding.

However, there is another slick trick you
may employ, one of dozens of variations.
You could include a random substring, slice
up your string, glue it together backwards,
sidewards, upside down, whatever and, the
reverse for decoding. Easy enough to do
by generating a random number for a substring
start position or a substring character count,
or both! A random substring number could also
be used to conceal your decode number or numbers
well within a string.

You might even consider adding a number to each
of your HEX numbers, or multiply, divide...
Lots and lots of 'stuff' you can do.

How complicated you make this is only limited
by your imagination and how much work you are
willing to give this methodology.

Naturally this method can be cracked but would
be rather frustrating. This method is not intended
for absolute high level security but may well 
meet your needs for casual encoding, as a stand
alone method with no need for any modules. Your
security with this method relies on frustration,
not on high level eighty-bagillion key encryption
requiring a ten gigabyte module taking forty-seven
hours to run and complete.

Otherwords, it's stand-alone and portable.

Have fun with this, should you decide to
use something similar to this. If you wish
to test this code of mine, it is quite
portable and will run under any Perl 4
or Perl 5 version, no problems. This code
is ready to run on your server.

Godzilla!


"Imagination is more important than knowledge."

  - Albert Einstein



SAMPLE PRINTED RESULTS
______________________

Input Sample Is: 
     Green Hornet Secret Decoder Ring

Encoded Sample Is:
     7a67624b206b787768767857206d786b76784c206d78676b6841206778786b5a1

Decoded Sample Is:
     Green Hornet Secret Decoder Ring


SAMPLE PRINTED RESULTS
______________________

Input Sample Is: 
     Green Hornet Secret Decoder Ring

Encoded Sample Is:
     6e75705920796c6b766a6c4b20616c796a6c5a20616c7579764f20756c6c794e0

Decoded Sample Is:
     Green Hornet Secret Decoder Ring



TEST SCRIPT
___________

#!/usr/local/bin/perl

print "Content-Type: text/plain\n\n";

$sample = "Green Hornet Secret Decoder Ring";

print "Input Sample Is: 
     $sample\n\n";


## Encode:

local ($random_key) = int(rand(2));

if (!($random_key))
 {
  srand;
  $random_key = int(rand(2));
 }

if ($random_key == 0)
 { $sample =~ tr/a-zA-Z/h-za-gH-ZA-G/; }

elsif ($random_key == 1)
 { $sample =~ tr/a-zA-Z/t-za-sT-ZA-S/; }

else
 { print "Random Key Generation Failed"; exit; }

$sample = reverse ($sample);

$sample =~ s/(.)/sprintf('%02x',ord($1))/ge;

$sample = join ("", $sample, $random_key);

print "Encoded Sample Is:
     $sample\n\n";


## Decode:

$random_key = chop ($sample);

$sample =~ s/([0-9A-Fa-f]{2})/sprintf("%c",hex($1))/ge;

$sample = reverse ($sample);

if ($random_key == 0)
 { $sample =~ tr/h-za-gH-ZA-G/a-zA-Z/; }

elsif ($random_key == 1)
 { $sample =~ tr/t-za-sT-ZA-S/a-zA-Z/; }

else
 { print "Random Key Generation Failed"; exit; }

print "Decoded Sample Is:
     $sample\n\n";

exit;


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

Date: 8 Jun 2000 13:17:10 -0400
From: darkon@one.net (David Wall)
Subject: Re: Encrypting / decrypting.
Message-Id: <8F4D8F586darkononenet@206.112.192.118>

simon@brecon.co.uk (Simon Cozens) wrote in 
<slrn8jvdi0.bh3.simon@justanother.perlhacker.org>:

>David Wall (comp.lang.perl.misc):
>>>Hi. I need a way to encrypt and decrypt a small string (between 8 and 16
>                              ^^^^^^^^^^^
>>
>>perldoc -f crypt
>
>Nope.
>
>I'd look at something in the Crypt:: heirarchy on CPAN. I've certainly
>used something there in the past and it didn't need any additional
>libraries or programs install, although IIRC it was XS-based. DES,
>perhaps.

Oops, I missed that.  Maybe I should read every word instead of skimming, 
eh? :-)  

-- 
David Wall
darkon@one.net


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

Date: 8 Jun 2000 13:29:59 -0400
From: darkon@one.net (David Wall)
Subject: Re: file access (locking)
Message-Id: <8F4D8D8E6darkononenet@206.112.192.118>

ericm@iol.ie (Eric Mosley) wrote in <12P%4.1492$QT5.24089@news.iol.ie>:
>I will have a cgi perl program that will take names and emails from a form
>on a web page and save them to a file.
>
>What happens if two people submit at the same time?
>
>Each instance of the cgi perl program will try and open the file and write
>to it at the same time? Is there any way of stopping that?

See perlfaq5, "How do I lock a file?".

perldoc perlfaq5

-- 
David Wall
darkon@one.net


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

Date: Thu, 08 Jun 2000 15:34:21 GMT
From: ericm@iol.ie (Eric Mosley)
Subject: file access
Message-Id: <12P%4.1492$QT5.24089@news.iol.ie>

Hi,

I will have a cgi perl program that will take names and emails from a form
on a web page and save them to a file.

What happens if two people submit at the same time?

Each instance of the cgi perl program will try and open the file and write
to it at the same time? Is there any way of stopping that?

Its on my ISP's servers so I can't use modperl or anything that they don't
have.

Thanks.

Eric


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

Date: Thu, 08 Jun 2000 15:58:30 GMT
From: teddy9542@my-deja.com
Subject: Function Which Saves a Passed-in Help Desk HTML Form to a file
Message-Id: <8hofqr$48r$1@nnrp1.deja.com>

Hi, I found a code in Perl/CGI book, which saves information passed
from a HTML form into a file (eg a text file). I am having trouble
getting it to work. I don't receive any error messages either. Any
suggestions would be greatly appreciated

# This function saves a passed-in help desk HTML form to a file
# ($gbdata is the name of the file e.g. comments.txt)
sub save {
     get_lock();
     open(GB, ">>$gbdata") || die "Cannot open $gbdata: $!";
     print GB "name: ", param('name'), "\n";
     print GB "type: ", param('probtype'), "\n";
     print GB "problem: ", param('problem'), "\n";
     close(GB);
     release_lock();
}


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


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

Date: 08 Jun 2000 17:42:29 +0100
From: nobull@mail.com
Subject: Re: Function Which Saves a Passed-in Help Desk HTML Form to a file
Message-Id: <u9k8g0ktu2.fsf@wcl-l.bham.ac.uk>

teddy9542@my-deja.com writes:

> Subject: Function Which Saves a Passed-in Help Desk HTML Form to a file

Please use the subject line to give us relvant information about your
Perl question.  It is not relevant to tell us what the real-world
problem you happened to be addressing when you encountered the Perl
problem.

> Hi, I found a code in Perl/CGI book, which saves information passed
> from a HTML form into a file (eg a text file). I am having trouble
> getting it to work. I don't receive any error messages either. Any
> suggestions would be greatly appreciated

I suggest that when trying to get programming help via an on-line forum
you cut your program down to the smallest possible form that actually
runs and actually manifests the problem you are experiencing.  The
person who doesn't understand why his program is not working is not
best qualified to work out where the problem is!

There's nothing wrong with the code you posted.  At least nothing that
would stop it working - the use of global variables looks so very
old-hat in C21. (Yes, I know C21 doesn't _really_ start until 2001).

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


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

Date: Thu, 08 Jun 2000 17:30:04 GMT
From: Lawrence <cwlau3@hkstar.com>
Subject: GCI using Java?
Message-Id: <sjvm0st4h5185@corp.supernews.com>

Dear all,

  I know that we can use many language for CGI program, such as C, Perl 
and so on.  Does Java is a good choice?  What is the pros and cons of 
using Java as the CGI program.  p.s. I have to decide what kind of 
language I have to learn.

Lawrence

--
Posted via CNET Help.com
http://www.help.com/


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

Date: Thu, 08 Jun 2000 12:54:58 -0500
From: Tom Briles <sariq@texas.net>
Subject: Re: GCI using Java?
Message-Id: <393FDDF2.858ED6E8@texas.net>

Lawrence wrote:
> 
> Dear all,
> 
>   I know that we can use many language for CGI program, such as C, Perl
> and so on.  Does Java is a good choice?  What is the pros and cons of
> using Java as the CGI program.  p.s. I have to decide what kind of
> language I have to learn.

Ummm, you know that this is comp.lang.*perl*.misc, right?  ANd you know
that 'Perl' ne 'CGI', right?

comp.lang.java is twenty-two doors that way, on the left.  I have no
idea where comp.infosystems.www.authoring.cgi is located.

- Tom


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

Date: Thu, 8 Jun 2000 14:59:01 GMT
From: Vince Wilding <vwilding@digizen.net>
To: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: General failure reading device (Win32)
Message-Id: <393FB4B5.583C8EB8@digizen.net>

AHA!  Thanks!  I disabled McAfee and the failures went away! 

I just got this brand spanking new machine, so I knew it wasn't a real
failure, and it was only happening to perl scripts.  It also has (office
mandated) Win98 & Mcafee, whereas my old NT box had NT 4.0 WS  & Norton.
I've asked for permission to go to NT and they've ordered it for me. 
I've re-booted 56 times (counter in autoexec!) in the few weekes since
I've gotten this Win98 box, I crashed <5 times in the three years I used
NT. 

Jonathan Stowe wrote:
> You havent got a Virus Checker installed have you ? 

-- 
Vince Wilding, Web Wrangler, MetaData Maven, Perl Hacker Wannabe
SilverSoft Micro, SOHO PC Consulting --- http://www.SilverSoftMicro.com
email:vwilding(at)digizen(dot)net 
http://www.digizen.net/members/vwilding
Cat fur expands to fill all available drives.


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

Date: Thu, 08 Jun 2000 17:16:36 GMT
From: tjla@guvfybir.qlaqaf.bet (Gwyn Judd)
Subject: How to turn off "Deep recursion" warnings?
Message-Id: <slrn8jvlc7.r67.tjla@thislove.dyndns.org>

#!/usr/bin/perl -w

use integer;

sub ack {
	my ($x, $y) = @_;

	return $y + 1 if ($x == 0);
	return ack($x - 1, 1) if ($y == 0);
	return ack($x - 1, ack($x, $y - 1));
}

($x, $y) = @ARGV;

$result = ack($x, $y);

print "ack($x, $y) = $result\n";

If you call this with (say) arguments 3,8 then you get hundreds and
hundreds of "Deep recursion..." warnings. Is there any way to turn these
off for a situation like this when you know the algorithm terminates?

And a kind of related question. I took one look at this and said to
myself that this was just screaming out to be Memoized in the interests
of greater efficiency. So I did...and it crashed!!!:

[gwyn@thislove:~]$ cat ack.pl
#!/usr/bin/perl -w

use integer;
use Memoize;

sub ack {
        my ($x, $y) = @_;

        return $y + 1 if ($x == 0);
        return ack($x - 1, 1) if ($y == 0);
        return ack($x - 1, ack($x, $y - 1));
}

memoize('ack');

($x, $y) = @ARGV;

my $result = ack($x, $y);

print "$result\n";
[gwyn@thislove:~]$ perl -w ack.pl 3 8              
Deep recursion on subroutine "Memoize::_memoizer" at (eval 1) line 1.
Deep recursion on subroutine "main::ack" at
/usr/local/lib/perl5/site_perl/5.6.0/Memoize.pm line 261.
Segmentation fault (core dumped

If I change the last line in the above file to 'print "ack($x, $y) =
$result\n"' it doesn't crashes but it does fail to compile:

[gwyn@thislove:~]$ perl -w ack.pl 3 8  
Deep recursion on subroutine "Memoize::_memoizer" at (eval 1) line 1.
Deep recursion on subroutine "main::ack" at
/usr/local/lib/perl5/site_perl/5.6.0/Memoize.pm line 261.
Use of uninitialized value in subroutine entry at
/usr/local/lib/perl5/site_perl/5.6.0/Memoize.pm line 261.
Can't use string ("") as a subroutine ref while "strict refs" in use at
/usr/local/lib/perl5/site_perl/5.6.0/Memoize.pm line 261.

I then hand-memoized the original version, this version did not crash
(it is also satisfyingly faster than the original :)).

[gwyn@thislove:~]$ cat ack.pl
#!/usr/bin/perl -w

use integer;

my @vals;

sub ack {
        my ($x, $y) = @_;
        
        return $vals->[$x][$y] if $vals->[$x][$y];
        
        return $vals->[$x][$y] = $y + 1 if ($x == 0);
        return $vals->[$x][$y] = ack($x - 1, 1) if ($y == 0);
        return $vals->[$x][$y] = ack($x - 1, ack($x, $y - 1));
}

my ($x, $y) = @ARGV;

$result = ack ($x, $y);

print "ack($x, $y) = $result\n";
[gwyn@thislove:~]$ perl -w ack.pl 3 8 2> /dev/null 
ack(3, 8) = 2045

-- 
Gwyn Judd (tjla@guvfybir.qlaqaf.bet)
My return address is rot13'ed
In order to live free and happily, you must sacrifice boredom.
It is not always an easy sacrifice.


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

Date: Thu, 08 Jun 2000 16:57:58 GMT
From: ka6wke@my-deja.com
Subject: Java/Swing GUI for DBI/MySQL
Message-Id: <8hojac$74u$1@nnrp1.deja.com>

Thanks for Reading!

I've developed several databases using DBI & CGI.pm and have run into
difficult problems developing the front end to the databases. My main
problem is simple screen layout and control. My users find standard
HTML to be clunky and I tend to agree. I'm in the process of learning
Java and was wondering if it's possible to have a Swing applet that can
use DBI/MySQL as the back end?? I know I could use a servlet and/or
JDBC, but I would rather not have to rewrite all my perl scripts. My
thoughts are to keep perl to handle the databases and Java/Swing on the
client. Has anyone tried this before?? I've searched the various Java &
Perl sites. Any pointers would be greatfully received!

Thanks again!

 .mark


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


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

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


Administrivia:

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

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

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

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

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

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


------------------------------
End of Perl-Users Digest V9 Issue 3290
**************************************


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