[17144] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4556 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Oct 9 00:05:35 2000

Date: Sun, 8 Oct 2000 21:05:13 -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: <971064312-v9-i4556@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Sun, 8 Oct 2000     Volume: 9 Number: 4556

Today's topics:
    Re: [UPDATE] mod_perl and ActiveState perl (v5.6.0 618) <jbaker6953@yahoo.com>
    Re: attaching a gif : Content-Transfer-Encoding <peter.sundstrom@eds.com>
    Re: Best definition of Perl so far in 19100 <elaine@chaos.wustl.edu>
        Can perl replace my VBA? <hamannj@ucs.orst.edu>
    Re: Can't pipe from Perl to C (Colin Watson)
        CGI: How to save upload file by perl? i0519@my-deja.com
        CGI: How to save upload file by perl? i0519@my-deja.com
    Re: CGI: How to save upload file by perl? <taboo@comcen.com.au>
    Re: CGI: How to save upload file by perl? <anmcguire@ce.mediaone.net>
    Re: CGI: How to save upload file by perl? <anmcguire@ce.mediaone.net>
    Re: Checking for existence of file <bmb@ginger.libs.uga.edu>
    Re: Code example in Cookbook <wyzelli@yahoo.com>
    Re: Comparing Perl and Java <bmb@ginger.libs.uga.edu>
    Re: Comparing Perl and Java <bmb@ginger.libs.uga.edu>
    Re: Comparing Perl and Java <wyzelli@yahoo.com>
    Re: Comparing Perl and Java <jschauma@netmeister.org>
        DBI arrayref (at)
    Re: Downloadable reference manual? (Jon Bell)
    Re: extract a segment of strings in a text <bwalton@rochester.rr.com>
        Is there Perl script to support CGI and Database? i0519@my-deja.com
    Re: Is there Perl script to support CGI and Database? <bwalton@rochester.rr.com>
    Re: Is there Perl script to support CGI and Database? <anmcguire@ce.mediaone.net>
        new daemon(): comments/critiques <jdb@wcoil.com>
    Re: Not Entirely On Topic:  Programming and math <iltzu@sci.invalid>
    Re: Not Entirely On Topic:  Programming and math (Logan Shaw)
        Number of matches <collin@crosslink.net>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Mon, 09 Oct 2000 03:55:19 GMT
From: Jerry Baker <jbaker6953@yahoo.com>
Subject: Re: [UPDATE] mod_perl and ActiveState perl (v5.6.0 618)
Message-Id: <39E141A4.51CFDDA3@weirdness.com>

Randy Kobes wrote:
> 
> Were you using the binary mod_perl.ppd package? This
> was compiled against apache_1.3.12. To test if this version
> difference contributes to the problem, you might try compiling
> mod_perl against the apache_1.3.13-dev sources, if that's
> possible - to do this, you need the current cvs mod_perl,
> which is available from
> http://perl.apache.org/from-cvs/modperl/
> This version should pass all the mod_perl tests.
> 
> best regards,
> randy kobes

I was very careful to follow all the directions in mod_perl's
INSTALL.win32. Build went OK (other than mod_perl's pre-definition of
perl.lib and apachecore.lib to non-existant places). Also, there is no
"perl.lib" anywhere in my Perl install. There is perl56.lib though, so
that is what I used. Apache still crashes when the services is stopped.

-- 
Jerry Baker

PGP Key:
http://pgpkeys.mit.edu:11371/pks/lookup?op=get&search=0x8B9F6300


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

Date: Mon, 9 Oct 2000 12:00:44 +1300
From: "Peter Sundstrom" <peter.sundstrom@eds.com>
Subject: Re: attaching a gif : Content-Transfer-Encoding
Message-Id: <8rqui5$p8a$1@hermes.nz.eds.com>


jtjohnston <jtjohnston@courrier.usherb.ca> wrote in message
news:39DF9481.6F02@courrier.usherb.ca...
> > and look for "MIME".  Specifically, MIME::Lite sounds
> > perfectly suited to your task.
> That would be great if I could install it. I was lucky enough to
> convince my sysop to install what he did. Real paranoid crowd.

You don't need your sysop to install it.  You can do it.  It only requires
one file.






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

Date: Mon, 09 Oct 2000 02:10:00 GMT
From: Elaine Ashton <elaine@chaos.wustl.edu>
Subject: Re: Best definition of Perl so far in 19100
Message-Id: <B606A139.7A8B%elaine@chaos.wustl.edu>

in article brian-ya02408000R0810000207130001@news.panix.com, brian d foy at
brian@smithrenaud.com quoth:

>> C'mon brian, remove that pesky broomstick from it's rather unpleasant
>> lodging. No amount of 'perl for idiots' books will rectify the fact that
>> some get it and some don't or won't ever.
> 
> try being the one that has to teach them ;)

:) I simply delete them....or, if they happen to be my mother, send them an
iMac. After spending a few years in web hosting admin, even the most highly
paid web weenies aren't pedants and couldn't care less if CGI is a not a
language or a new species of monkey as long as it works. If they come to
clpm for clues then they must get their stock tips from drunks in a pub as
well. 

Think of it as an investment in future classes. "Hey, if you didn't think
every line on this page was complete rubbish, sign up now for my class on
Perl and CGI." ;) 

e.



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

Date: Sun, 8 Oct 2000 20:12:33 -0700
From: "Jeff D. Hamann" <hamannj@ucs.orst.edu>
Subject: Can perl replace my VBA?
Message-Id: <8rrd2v$sg$1@news.NERO.NET>

I have an application that runs in MSAccess and uses VBA to access data
stored in MySQL. I really like the "features" of VBA but don't like not
having the features I'm used to having in C (profiling, good debugging, and
speed). I like using an IDE for my work and have no need for GUI's or the
like. I would like to make these apps more platform independent and think
perl would be a great choice if it fits the bill. Here's what I need to be
able to do:

1) use/make arrays of user defined data types.
2) pass these arrays to DLLs or loadable library modules
3) interface with databases
4) be able to detect performace bottlenecks to improve process
5) multithreading would be nice
6) start process and KNOW it will finish without hanging on some messgage
box.
7) be able to run it on both Win32 and *nix
8) be able to generate web pages to indicate progress (newbie question)

I would like to hear some suggestions regarding how other people generate
tons of data from simulations and handle the output as well. Most of what
I'm doing is generating data for combinatorial analysis problems and would
like to have something flexible enough to ease the pain of maintainence just
short of completely coding the stuff in C (even the DLLs are in Fortran 90).

Thanks,
Jeff.


-----------------------------------------------------------
Jeff D. Hamann
280 Peavy Hall
Department of Forest Resources
Oregon State University
Corvallis, Oregon 97331-8566 USA
541-740-5988
541-737-2375
hamannj@ucs.orst.edu

This is the song that never ends
It goes on and on my friends
Somebody started singing it
Not knowing what it was
Now everybodys singing it
And it goes on and on because
This is the song that never ends...





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

Date: 8 Oct 2000 22:20:51 GMT
From: cjw44@flatline.org.uk (Colin Watson)
Subject: Re: Can't pipe from Perl to C
Message-Id: <8rqs03$5ot$1@riva.ucam.org>

Michael <michaelr_41@hotmail.com> wrote:
>This prints Hello, world! (so I could see it get in the script, but then
>hangs on the read...
>
>Here's some code...
>
>Here's the .pl script...

Nothing much wrong with your Perl, but:

>main() {
>        int fifo[2];
>        char *message = "This comes from the called program";
>        char line[8];
>
>        if (pipe(fifo) == -1) {

That just connects fifo[0] and fifo[1] together, and they're both
internal to your C program. That is, anything you write to the fd in
fifo[1] will come straight back out of the fd in fifo[0].

Why not just write to stdout with printf()? By opening with open('...|')
in Perl, you've already created a pipe for your C program to use.

-- 
Colin Watson                                     [cjw44@flatline.org.uk]
"When Irish eyes are smiling, watch your step."


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

Date: Mon, 09 Oct 2000 01:45:04 GMT
From: i0519@my-deja.com
Subject: CGI: How to save upload file by perl?
Message-Id: <8rr7v0$vc9$1@nnrp1.deja.com>

The upload file maybe binary or text.


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


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

Date: Mon, 09 Oct 2000 01:46:20 GMT
From: i0519@my-deja.com
Subject: CGI: How to save upload file by perl?
Message-Id: <8rr81b$vcn$1@nnrp1.deja.com>

The file may be binary or ASCII text form.


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


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

Date: 9 Oct 2000 01:38:55 +1100
From: "Kiel Stirling" <taboo@comcen.com.au>
Subject: Re: CGI: How to save upload file by perl?
Message-Id: <39e086ff$1@nexus.comcen.com.au>


i0519@my-deja.com wrote:
>The upload file maybe binary or text.>
>
>Sent via Deja.com http://www.deja.com/
>Before you buy.

Read perldoc CGI


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

Date: Sun, 8 Oct 2000 22:33:44 -0500
From: "Andrew N. McGuire " <anmcguire@ce.mediaone.net>
Subject: Re: CGI: How to save upload file by perl?
Message-Id: <Pine.LNX.4.21.0010082232140.16008-100000@hawk.ce.mediaone.net>

On Mon, 9 Oct 2000, i0519@my-deja.com quoth:

> The upload file maybe binary or text.

use ftp?

anm
-- 
perl -wMstrict -e '
$a=[[qw[J u s t]],[qw[A n o t h e r]],[qw[P e r l]],[qw[H a c k e r]]];$.++
;$@=$#$a;$$=[reverse sort map$#$_=>@$a]->[$|];for$](--$...$$){for$}($|..$@)
{$$[$]][$}]=$a->[$}][$]]}}$,=$";$\=$/;print map defined()?$_:$,,@$_ for @$;
'



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

Date: Sun, 8 Oct 2000 22:34:16 -0500
From: "Andrew N. McGuire " <anmcguire@ce.mediaone.net>
Subject: Re: CGI: How to save upload file by perl?
Message-Id: <Pine.LNX.4.21.0010082233530.16008-100000@hawk.ce.mediaone.net>

On Mon, 9 Oct 2000, i0519@my-deja.com quoth:

> The file may be binary or ASCII text form.

use ftp? again.

anm
-- 
perl -wMstrict -e '
$a=[[qw[J u s t]],[qw[A n o t h e r]],[qw[P e r l]],[qw[H a c k e r]]];$.++
;$@=$#$a;$$=[reverse sort map$#$_=>@$a]->[$|];for$](--$...$$){for$}($|..$@)
{$$[$]][$}]=$a->[$}][$]]}}$,=$";$\=$/;print map defined()?$_:$,,@$_ for @$;
'



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

Date: Sun, 8 Oct 2000 20:37:45 -0400
From: Brad Baxter <bmb@ginger.libs.uga.edu>
Subject: Re: Checking for existence of file
Message-Id: <Pine.A41.4.21.0010082026010.13236-100000@ginger.libs.uga.edu>

On Sun, 8 Oct 2000, Geoff Soper wrote:
> >     16  use Fcntl;
> >     17  use POSIX qw(:errno_h);
> 
> OK, what does this provide me with that is used below?

See perldoc Fcntl.  This provides the correct values for the O_* stuff.
See perldoc POSIX.  ditto EEXIST.  Actually, I see I can use POSIX
qw(:errno_h :fcntl_h); and do away with use Fcntl.

> >     ...
> >     71    ### backup file can't already exist, so skip existing ones
> >     72    for( my $serial = 0;; ) {
> >     73      last if sysopen( BAK, $fmt . ++$serial,
> >                 O_WRONLY|O_EXCL|O_CREAT );
> >     74      die $! unless $! == EEXIST;              ### if other error
> 
> I don't understand this line, I assume EEXIST is the error returned when
> the file exists? Why must it die otherwise, shouldn't there be a condition
> for it to die?

If the open gets an error besides the fact that it exists, I want to die
because I probably won't be able to write to it.

Brad



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

Date: Mon, 9 Oct 2000 09:44:04 +0930
From: "Wyzelli" <wyzelli@yahoo.com>
Subject: Re: Code example in Cookbook
Message-Id: <m28E5.4$ue4.3093@vic.nntp.telstra.net>

<aramis1250@my-deja.com> wrote in message
news:8rl8vt$njt$1@nnrp1.deja.com...

<snip>

> No, the log file opens fine. Code in the "my code" section (not
> printed because it works) prints $_ for each line, and I can see the
> logfile's contents in the console window. The problem seems to
> be that the regexp in the assignment isn't actually matching
> anything, and so each variable doesn't get assigned.
>
> This is the entire listing.
>

<snip>

Since I don't know what an Apache common log looks like, I can't help
without seeing a sample of the data.

Wyzelli
--
($a,$b,$w,$t)=(' bottle',' of beer',' on the wall','Take one down, pass
it around');
for(reverse(1..100)){$s=($_!=1)?'s':'';$c.="$_$a$s$b$w\n$_$a$s$b\n$t\n";
$_--;$s=($_!=1)?'s':'';$c.="$_$a$s$b$w\n\n";}print"$c*hic*";





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

Date: Sun, 8 Oct 2000 20:46:41 -0400
From: Brad Baxter <bmb@ginger.libs.uga.edu>
Subject: Re: Comparing Perl and Java
Message-Id: <Pine.A41.4.21.0010082042150.13236-100000@ginger.libs.uga.edu>

On Sun, 8 Oct 2000, James Taylor wrote:

> In article <m3itr3grmi.fsf@solo.david-steuber.com>, David Steuber wrote:
> >
> > For now, it is pure Perl for me.  I've got CPAN (so long as I know
> > what to look for).  I've got this group.  I've got mounds of docs.
> > And Perl is just as RAD as any 4GL out there.
> 
> Sorry to seem ignorant, actually I should say sorry to BE ignorant,
> but what does RAD mean please?

Hey, man, like, you know, RAD means, like, radical to the max.  Yeah,
that's what it means.

Totally tubular,

Brad



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

Date: Sun, 8 Oct 2000 20:50:08 -0400
From: Brad Baxter <bmb@ginger.libs.uga.edu>
Subject: Re: Comparing Perl and Java
Message-Id: <Pine.A41.4.21.0010082047310.13236-100000@ginger.libs.uga.edu>

On Sun, 8 Oct 2000, Jan Schaumann wrote:

> Java is an Object-Oriented Full-Featured Programming Language, while Perl
> is a Practical Extraction and Report Language.

No, that'd be OOFFPL.  Rhymes with 'awful'.

Brad



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

Date: Mon, 9 Oct 2000 10:32:20 +0930
From: "Wyzelli" <wyzelli@yahoo.com>
Subject: Re: Comparing Perl and Java
Message-Id: <DL8E5.5$ue4.3296@vic.nntp.telstra.net>

"James Taylor" <james@NOSPAM.demon.co.uk> wrote in message
news:ant082001313fNdQ@oakseed.demon.co.uk...
> In article <m3itr3grmi.fsf@solo.david-steuber.com>, David Steuber
wrote:

> Sorry to seem ignorant, actually I should say sorry to BE ignorant,
> but what does RAD mean please?

Rapid Application Development (at least in this context)

Wyzelli
--
push@x,$_ for(a..z);push@x,' ';
@z='092018192600131419070417261504171126070002100417'=~/(..)/g;
foreach $y(@z){$_.=$x[$y]}y/jp/JP/;print;





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

Date: Sun, 08 Oct 2000 21:56:05 +0400
From: "Jan Schaumann" <jschauma@netmeister.org>
Subject: Re: Comparing Perl and Java
Message-Id: <0C9E5.49246$sB2.918932@news-east.usenetserver.com>

"Brad Baxter" <bmb@ginger.libs.uga.edu> wrote:

> On Sun, 8 Oct 2000, Jan Schaumann wrote:
> 
>> Java is an Object-Oriented Full-Featured Programming Language, while
>> Perl is a Practical Extraction and Report Language.
> 
> No, that'd be OOFFPL.  Rhymes with 'awful'.
> 

I reckon you're the funny guy in this NG?

-Jan

-- 
Jan Schaumann <http://www.netmeister.org>

We will have solar energy as soon as the utility companies solve one technical
problem -- how to run a sunbeam through a meter.


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

Date: Mon, 09 Oct 2000 03:06:58 GMT
From: longbrain(at)yahoo.com
Subject: DBI arrayref
Message-Id: <39e13387.27142704@news.wt.net>

I am using the following piece of CGI script to place elements from a
MySQL database into a scrolling listbox.  I keep getting values like
ARRAY (0x822609c).  I am assuming that this is the reference to the
array element instead of the element itself.  I have tried some
suggestions found in some books about dereferencing, but to no avail.
This appears to be the combination that works the best, as it returns
the proper number of values, instead of a single value.  I can use a
straight print function in the while loop and get the data properly,
so the connection is working fine.  Thanks for anyone who can help.

while ( $array_ref = $sth->fetchrow_arrayref )
{
     push @ary, [ @$array_ref ];
}

print scrolling_list    (-name     => 	"category",
                         -value    => 	[@ary],
                         -size	=>	8,
                         -multiple =>   1,
                         -override =>	1);




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

Date: Sun, 8 Oct 2000 21:50:29 GMT
From: jtbell@presby.edu (Jon Bell)
Subject: Re: Downloadable reference manual?
Message-Id: <G24so5.Mxv@presby.edu>

In article <ih0E5.20986$uq5.430134@news6-win.server.ntlworld.com>,
Siobhan <soneill@hotmail.com> wrote:
>
>I have the some of the FAQ documents for Perl, but is the a complete
>reference manual that I can download?

There sure is.  It comes with the Perl distribution, so if you download
Perl and install it, you not only get the documentation, you get Perl
itself!  :-)

-- 
Jon Bell <jtbell@presby.edu>                        Presbyterian College
Dept. of Physics and Computer Science        Clinton, South Carolina USA
[ Questions about newsgroups?  Visit http://www.geocities.com/nnqweb/  ]
[                or ask in news:news.newusers.questions                ]


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

Date: Mon, 09 Oct 2000 01:24:15 GMT
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: extract a segment of strings in a text
Message-Id: <39E11E3E.D703D699@rochester.rr.com>

DT wrote:
> 
> Hi,
> Can someone tell me how to extact, segment of a string that enclosed by
> tags. Like:
> 
> whatever, whatever, whatever, <tag>I want this<tag> whatever, whatever,
> whatever,whatever, whatever, whatever,whatever, whatever, whatever,<tag>I
> want this 111<tag> ,whatever, whatever <tag>I want this 222<tag>
> whatever, whatever
> 
> the end result I want is: I want this, I want this 111, I want this 222
Try:

   @string=<DATA>;
   chomp @string;
   $string=join '',@string;
   while($string=~s/<tag>(.*?)<tag>//i){
      push @result,$1;
   }
   print join ', ',@result;
__END__
whatever, whatever, whatever, <tag>I want this<tag> whatever, whatever, 
whatever,whatever, whatever, whatever,whatever, whatever,
whatever,<tag>I 
want this 111<tag> ,whatever, whatever <tag>I want this 222<tag> 
whatever, whatever

If you real data doesn't have trailing space characters on each line
like the data in your note did, you might want the first join to use 

   ' ' 

rather than 

   ''
 .
-- 
Bob Walton


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

Date: Mon, 09 Oct 2000 01:47:18 GMT
From: i0519@my-deja.com
Subject: Is there Perl script to support CGI and Database?
Message-Id: <8rr835$vjs$1@nnrp1.deja.com>

If yes, please tell me .


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


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

Date: Mon, 09 Oct 2000 02:03:49 GMT
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: Is there Perl script to support CGI and Database?
Message-Id: <39E12781.BB7D292E@rochester.rr.com>

i0519@my-deja.com wrote:
> 
> If yes, please tell me .
 ...
   use CGI; #for CGI
   use DBI; #for databases

For more info:

   perldoc CGI
   perldoc DBI
-- 
Bob Walton


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

Date: Sun, 8 Oct 2000 22:34:44 -0500
From: "Andrew N. McGuire " <anmcguire@ce.mediaone.net>
Subject: Re: Is there Perl script to support CGI and Database?
Message-Id: <Pine.LNX.4.21.0010082234240.16008-100000@hawk.ce.mediaone.net>

On Mon, 9 Oct 2000, i0519@my-deja.com quoth:

> If yes, please tell me .

yes.

anm
-- 
perl -wMstrict -e '
$a=[[qw[J u s t]],[qw[A n o t h e r]],[qw[P e r l]],[qw[H a c k e r]]];$.++
;$@=$#$a;$$=[reverse sort map$#$_=>@$a]->[$|];for$](--$...$$){for$}($|..$@)
{$$[$]][$}]=$a->[$}][$]]}}$,=$";$\=$/;print map defined()?$_:$,,@$_ for @$;
'



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

Date: 9 Oct 2000 03:16:02 GMT
From: "Josiah" <jdb@wcoil.com>
Subject: new daemon(): comments/critiques
Message-Id: <8rrd9i$a07$0@206.230.71.39>

gretts perlfolk,
thanks to uri for the immensly helpful comments on the daemon() functions. I
have re-written much of it after a few hours reading perldocs and after
reading uris post. if i could trouble you all one last time with this code,
i would be greatful for comments. it is multiforked, and uses ::INET as per
uri's suggestion. (yes, i'm sure you'll recognize reaper and spawn from
perlipc - i'm not brave enough to write my own, ...yet!) Thanks all !

$cheers = <$josiah>;


__CODE__

    use Data::Dumper;
    use IO::Socket;
    use IO::Select;
    use strict;

    sub spawn;
    sub EOL    { "\015\012" }
    sub flush  { my $a = shift; autoflush $a, 1 };
    sub logmsg { print "$0 $$: @_ at ", scalar localtime, "\n" }
    sub daemon {
        my $port  = shift || 23; #7778;
        my $file  = shift || 'words.xml';
        my $inad  = shift || INADDR_ANY;
        my $dict  = {}; #Lingua::EN::Dict->new(file=>$file,warn=>1);

        my $server = IO::Socket::INET->new(Listen    => 15,
                                           LocalAddr => $inad,
                                           LocalPort => $port,
                                           Proto     => 'tcp');

        logmsg "server started on port $port";

        my $waitedpid = 0;
        sub REAPER {
            $waitedpid = wait;
            $SIG{CHLD} = \&REAPER;
            logmsg "reaped $waitedpid" . ($? ? " with exit $?" : '');
        }
        $SIG{CHLD} = \&REAPER;

        while(my ($client,$paddr) = $server->accept) {
            next if $waitedpid and not $paddr;

            my($port,$iaddr) = sockaddr_in($paddr);
            my $name = gethostbyaddr($iaddr,AF_INET);

            logmsg "connection\n\t\tfrom ".inet_ntoa($iaddr).":$port
[$name]";

            spawn sub {
                $|=1;
                my $s = IO::Select->new($client);
                while(1)

                    my ($a,$b,$c) =
IO::Select::select(undef,undef,undef,0.001);
                    my @ready = $#{$a};     # simple hack
                         # just using $ready = $#{$a}, then
                         # testing for $ready!=-1 doesn't work on
                         # my system for some reason. Any ideas?
                    if ($#ready!=-1) {
                        $_=<$client>;
                        tr/\r\n//d;

                        logmsg "received command $_\n\t\tfrom
".inet_ntoa($iaddr).":$port [$name]";

                        if (/^DICT-PING/)            {
                            print $client "DICT-PING: Ping? Pong! : You are:
$name [",inet_ntoa($iaddr),"] at port $port", EOL;
                            next;
                        }
                        if (/^DICT-QUERY:(\w+)/)     {
                            my $dump=Dumper($dict->{$2}); $dump=~s/\$VAR1 =
//g;
                            print $client $dump,EOL;
                            next;
                        }
                        if (/^DICT-KEYS/)            {
                            my @keys = keys %{$dict};
                            print $client '[',
join(',',map{"'$_'"}@keys),']', EOL;
                            next;
                        }
                        if (/^DICT-TENSE:(\w+)/)     {
                            print $client $dict->tense($1), EOL;
                            next;
                        }
                        if (/^DICT-TYPES/)           {
                            my $type = $1;
                            $type =~ tr/\r\n//d;
                            print $client '[',
join(',',map{"'$_'"}@{$dict->types($type)}),']', EOL;
                            next;
                        }
                        if (s/^DICT-SET:(\w+)//)     {
                            my $word = $1;
                            if(inet_ntoa($iaddr) eq '127.0.0.1') {
                                $dict->{$word} = eval;
#                                $dict->{$word}->{modified_by} = { name =>
$name, ip => inet_ntoa($iaddr) };
                                next;
                            } else {
                                print $client "DICT-ERROR: Possible attempt
at security breach in command DICT-SET. Disconnecting.",EOL;
                                last;
                            }
                        }
                        if (/^DICT-WRITEOUT/)        {
                            $dict->save;
                            next;
                        }
                        if (/^DICT-CLOSE/)           {
                            last
                        }

                        print $client "DICT-ERROR: Erroneous command:
$_",EOL;
                        last
                    }
                }

                logmsg "disconnected\n\t\tfrom ".inet_ntoa($iaddr).":$port
[$name]";
            };
        }
    }

    sub spawn {
        my $coderef = shift;
        unless (@_ == 0 && $coderef && ref($coderef) eq 'CODE') {
            print "usage: spawn CODEREF";
        }
        my $pid;
        if (!defined($pid = fork)) {
            logmsg "cannot fork: $!" and return;
        } elsif ($pid) {
            logmsg "begat $pid" and return;
        }
        exit &$coderef;
    }


    daemon;


__END__




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

Date: 9 Oct 2000 00:23:12 GMT
From: Ilmari Karonen <iltzu@sci.invalid>
Subject: Re: Not Entirely On Topic:  Programming and math
Message-Id: <971050034.12763@itz.pp.sci.fi>

In article <35eptscl81drjr8gn9teh5ol2a2p00gcql@4ax.com>, Lou Moran wrote:
>
>--Could a creative (musician/writer/painter/whatever) person become a
>"real" (read useful/good/paid) programmer without having mathematical
>prowess?
>
>PS -- My brain stopped accepting math around quadratic equations

Most likely yes, probably even more so if you happen to be skilled in
more than one of the mentioned areas.  Writing, in particular, can be
very similar to programming in various ways, although quite obviously
the overlap will not be complete.

I would also predict that if you do take up programming, your ability
to grasp mathematical concepts intuitively may improve in the process
even if you don't actually learn any new mathematics.  That's another
case of overlapping skillsets -- the intuitive part of mathematics is
much the same as the non-verbal part of programming, specifically the
ability to "visualize" abstract concept totally unrelated to reality.

-- 
Ilmari Karonen - http://www.sci.fi/~iltzu/
Please ignore Godzilla  | "By promoting postconditions to
and its pseudonyms -    |  preconditions, algorithms become
do not feed the troll.  |  remarkably simple."  -- Abigail



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

Date: 8 Oct 2000 21:02:40 -0500
From: logan@cs.utexas.edu (Logan Shaw)
Subject: Re: Not Entirely On Topic:  Programming and math
Message-Id: <8rr900$8le$1@provolone.cs.utexas.edu>

In article <971050034.12763@itz.pp.sci.fi>,
Ilmari Karonen  <usenet11239@itz.pp.sci.fi> wrote:
>I would also predict that if you do take up programming, your ability
>to grasp mathematical concepts intuitively may improve in the process
>even if you don't actually learn any new mathematics.

This reminds me of the time that I dropped out of school and got (as
far as I knew) the only job I could: data entry.  I survived nine
months of nothing more intellectual than typing in people's names
and addresses as fast as I possibly could in order to avoid the
boredom that would surely then lead to insanity.  And when I was
done, I had two things to show for it:  (a) I knew that I could
stomach any job[1], because nothing could be as boring and useless as
data entry, and (b) my arithmetic skills had improved dramatically.

Somehow, thanks to data entry, I can now calculate Texas's
8.25% sales tax to the penny in my head when I go out to eat.

Don't ask me to explain it.  I can't, and besides that I'd
rather not think of that horrible job any more than I already
have.  The point is that one can indeed can get better at mental
tasks by just doing things that are sort of related to them.

  - Logan

[1]  I later became a system administrator.  Actually, the data entry
     job had another benefit:  I don't dread typing in ridiculously
     long alphanumeric license strings.


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

Date: Sun, 8 Oct 2000 23:47:03 -0400
From: "Collin Borrlewyn" <collin@crosslink.net>
Subject: Number of matches
Message-Id: <971063245.847539@pizza.crosslink.net>

What I'm trying to do is determine how many times a particlar pattern was
matched in a scalar. Specifically, I'm scanning the ICANNs list of proposed
TLDs and trying to return what the most suggested TLDs are, and how many
times each was suggested. For my own amusement, like. So... how can I get a
regexp to tell me how many matches were found? I've looked at every bit of
documentation I can think of, but nothing seems to mention it. This was
going to be something I did in a few minutes for fun, but it didn't work, I
grew curious, and now I really want to know.


#Collin E Borrlewyn
##More enlightening than Buddist Jeopardy.
###collin@crosslink.net




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

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


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