[9327] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 2922 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Jun 20 18:07:13 1998

Date: Sat, 20 Jun 98 15:00:25 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Sat, 20 Jun 1998     Volume: 8 Number: 2922

Today's topics:
    Re: ?CGI scripts & Explorer (Michael Rubenstein)
    Re: Changing Computer Name/IP <sdh1@anchor.hotmail.com>
    Re: Ctrl+C disable in perl program abraham@mpi.com
    Re: database corruption problems <dean@mail.biol.sc.edu>
        Error log processing <agjemmes@virtualis.com>
    Re: Error log processing <sdh1@anchor.hotmail.com>
    Re: Find::File/Functional programing <scribble@pobox.com>
    Re: Flames.... <tchrist@mox.perl.com>
    Re: Flames.... <tchrist@mox.perl.com>
        Formmail 1.6 & "Print to TAB textfile" <gilray@pop.hip.cam.org>
    Re: How to use Socket.pm? abraham@mpi.com
    Re: kinda like tail -f...? <sdh1@anchor.hotmail.com>
        Newbie print << question (Brian McIntosh)
        Question about perl and sockets -- long abraham@mpi.com
    Re: REVIEW: Perl CGI Programming - No Experience Requir (Rahul Dhesi)
    Re: REVIEW: Perl CGI Programming - No Experience Requir (Rahul Dhesi)
    Re: Running perl scripts on NT as a Service abraham@mpi.com
        Sort problems <webmaster@dragonslist.com>
    Re: Sort problems <tchrist@mox.perl.com>
        Strip carriage return from cgi? (Delta Charley)
    Re: Unix installation <sdh1@anchor.hotmail.com>
        What "mini" database (text?) to use? <molkiheg@sp.zrz.tu-berlin.de>
        Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: Sat, 20 Jun 1998 19:41:49 GMT
From: miker3@ix.netcom.com (Michael Rubenstein)
Subject: Re: ?CGI scripts & Explorer
Message-Id: <358f0dbb.3583562@nntp.ix.netcom.com>

On Sat, 20 Jun 1998 08:23:26 -0700, lr@hpl.hp.com (Larry Rosler)
wrote:

><quote>
>I also papered over a bug in MSIE 3, because I couldn't insist they [the
>users of my code] upgrade to MSIE 4.  Essentially our CGI code has to be
>tested on a variety of clients (as well as, in my case, hosts -- HPUX and
>NT), which is a great pain.
></quote>
>
>But your hilarious swipe at those in this newsgroup who rely on Frequent 
>Answer "upgrade your perl" has relieved some of the pain.  ROTFLOL.

I'm sorry for any confusion.  In the article I replied to it was
reasonably clear that it was not you being quoted, but the automatic
quoting of my news reader muddied the waters a bit.

Actually, I did not intend that as a swipe at the "upgrade your perl"
responses we often see here.  Perhaps they do go a bit far in
expecting everyone to always keep up with minor upgrades (though I
have a "latest version" fetish and do so), but it is a completely
reasonable response to those who have problems with version 4.  There
has to be a limit on support for old versions.

My point was the opposite -- that it is reasonable for Microsoft (or
any other company) to refuse to fix bugs in an older version when a
newer one is available.  Microsoft has a lot to answer for, but not
everything they do is wrong.
--
Michael M Rubenstein


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

Date: Sat, 20 Jun 1998 17:07:10 -0400
From: "Scott" <sdh1@anchor.hotmail.com>
Subject: Re: Changing Computer Name/IP
Message-Id: <6mh8dg$no8$1@camel0.mindspring.com>


- wrote in message <358b0eb5.249824756@news2.cais.com>...
>"Murtuza Chhil" <nrd1mmc@nrd.ups.com> Said this:
>
>>Hi,
>>Is it possible to change the IP address and computer name on a NT machine
>>using perl....
>>
>>
>
>Why, to help you with your spamming???
>
>
Besides, doesn't windows require that you reboot the system to change the IP
address?  Kind
of makes it difficult to script...

I guess I could see this for a laptop, but Microsoft doesn't really support
NT on laptops.




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

Date: Sat, 20 Jun 1998 19:23:00 GMT
From: abraham@mpi.com
Subject: Re: Ctrl+C disable in perl program
Message-Id: <6mh26k$ft6$1@nnrp1.dejanews.com>

$SIG{INT} = sub{};

In article <3589A4E8.27E9A1F5@inet.net>,
  Li Xiaoning <lxn@inet.net> wrote:
>
> I am writing a system configuration program in perl, I want to disable
> control+C in program. appreciate for any idea on that.
>
>


-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/   Now offering spam-free web-based newsreading


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

Date: 20 Jun 1998 17:00:40 -0400
From: Dean Pentcheff <dean@mail.biol.sc.edu>
Subject: Re: database corruption problems
Message-Id: <m3d8c3wzyf.fsf@mail.biol.sc.edu>

rrichey@my-dejanews.com writes:
> I am having database corruption problems with a moderately large database
> file of 1290 records that I am accessing with a Perl hash.  My Perl is
> version 5.004_04, and my OS is BSDI 3.1 on a Pentium platform.	Since the
> script evolved from an old perl 4 script, I am still using dbmopen and
> dbmclose, though since I am on BSD, I am inherently using the Berkeley DB.

Uhmmmm... I doubt it (though I'm not entirely sure).  My guess is that
dbmopen & friends use the old crufty db stuff, even on a BSD system.
To use the Berkeley DB stuff, you'll need tie and and a "use
DB_File".  

> After going through a foreach loop to parse through my database and add stuff
 ...
> 1)  Is the new tie function more robust than dbmopen?

Actually, in modern perls dbmopen is just a wrapper around tie for
backwards compatibility.  With tie, though, you get much more
flexibility, and that warm 'n' fuzzy feeling of knowing exactly what
library you're using (since a "use Something-or-other" is required).  

> 2)  In order to conveniently manipulate my database, I am opening additional
> instances of the same database using different hashes while the initial hash
> is still open.	Is this a problem?  I've never had problems doing this in the
> past--and I've done it a lot, even on this same database.

I plead ignorance, but it sure gives me a creepy feeling...

> 3)  I have been using this same script on this same database for several
> months, but have only seen the problem manifest in the last few days.  The
> only thing I can correlate this with, is the continued growth of one
> particular database record to over 5k in size.	I've seen evidence that the
> corruption is indirectly related to occasions when I add additional stuff to
> this record.

Ding-ding-ding score!  Checking The Book (Programming Perl 2e) under
AnyDBM_File gives the following record length limitations: 

ODBM (ancient crufty db): 1k
NDBM (newer crufty db):   4k

Wanna bet your dbmopen is actually wired to the ndbm library?  Check
out GDBM or BSD-DB (the Berkeley DB stuff) for equivalents without
record length limits.  


Good luck!  Hope that helps.

-Dean
-- 
N. Dean Pentcheff                                          <pentcheff@acm.org>
Biological Sciences, Univ. of South Carolina, Columbia SC 29208 (803-777-7068)


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

Date: 20 Jun 1998 19:22:06 GMT
From: "Asbjorn Gjemmestad" <agjemmes@virtualis.com>
Subject: Error log processing
Message-Id: <01bd9c80$d10bcb80$d8ac4382@asbj-rng>

A while ago I saw a posting on this group about a script taking the last
ten lines of your error log and displaying them. Does anyone know where I
can get a hold of this script?

thnx

Asbjorn Gjemmestad (agjemmes@online.no.nospam)

Please mail as well as post answer.


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

Date: Sat, 20 Jun 1998 17:00:52 -0400
From: "Scott" <sdh1@anchor.hotmail.com>
Subject: Re: Error log processing
Message-Id: <6mh823$13m$1@camel0.mindspring.com>

Well, I guess something like this would work.

$max=10;

open (FILE,"log");

$counter = 0;
while($line=<FILE>)
{
  $report_line[$counter++] = $line;
  $counter = 0 if ($counter == $max);
}

for ($index=$counter; $index<$max; $index++)
{
  print $report_line[$index];
}

for ($index=0; $index<$counter; $index++)
{ 
  print $report_line[$index];
}

That will be $US200... :-)





Asbjorn Gjemmestad wrote in message <01bd9c80$d10bcb80$d8ac4382@asbj-rng>...
>A while ago I saw a posting on this group about a script taking the last
>ten lines of your error log and displaying them. Does anyone know where I
>can get a hold of this script?
>
>thnx
>
>Asbjorn Gjemmestad (agjemmes@online.no.nospam)
>
>Please mail as well as post answer.





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

Date: 20 Jun 1998 14:19:37 -0500
From: Tushar Samant <scribble@pobox.com>
Subject: Re: Find::File/Functional programing
Message-Id: <6mh209$1mm@tako.wwa.com>

xah@shell13.ba.best.com writes:
>use File::Find;
>find( myFunction($File::Find::name), 'some directory path');
>sub myFunction {
>    my $currentFile = $_[0];
>    {"do something"};
>    return "some thing";
>};
>
>It does not work because the first argument to "find" must be a
>reference.
>
>What can I do so that $File::Find::name is passed as an argument
>explicitly to myFunction?

Rewrite myFunction to return the appropriate code reference. See
perldoc -f sub.

>(not meant to be inflammable (^_^), but I desire all my codes to be
>strickly "functional")

I'll pass on that since I don't know what "strictly functional"
means. But please read up on anonymous subs and closures, because
if the questions you are going to have are similar to the above,
then the answers are in those man pages.



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

Date: 20 Jun 1998 19:09:04 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Flames....
Message-Id: <6mh1cg$asp$1@csnews.cs.colorado.edu>

 [courtesy cc of this posting sent to cited author via email]

In comp.lang.perl.misc, 
    gebis@albrecht.ecn.purdue.edu (Michael J Gebis) writes:
:The faq is big.  The docset for perl is big.  

grep.  man -k.  less.  find.  whatever.

If you haven't figured out how to search for things,
turn off your computer until you can buy yourself
a pet trainer.

--tom
-- 
A woman needs a little more weird today than normal.  --Andrew Hume


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

Date: 20 Jun 1998 19:11:02 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Flames....
Message-Id: <6mh1g6$asp$2@csnews.cs.colorado.edu>

 [courtesy cc of this posting sent to cited author via email]

In comp.lang.perl.misc, 
    "Michael D. Schleif" <mike.schleif@aquila.com> writes:
:the documentation can be both tedious
:and enlightening.  

grep and ye shall find.

--tom
-- 
"A momentary lapse of stupidity" -- Dean Roehrich


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

Date: Sat, 20 Jun 1998 16:47:52 -0500
From: "Gilles Raymond" <gilray@pop.hip.cam.org>
Subject: Formmail 1.6 & "Print to TAB textfile"
Message-Id: <6mh738$61n@tandem.CAM.ORG>

passme


A friend a mine suggested to insert and try the following between close
(MAIL);} and sub check_email { in formmail 1.6 to print/export the data
to a textfile since I wanted to keep using Formmail's functionalities.


sub print_export_to_database_textfile {

# The file name "database" can be what ever you would like to call it.
$dataprog = '/home/projects/public_html/data/database.txt';

Note: I have also tried: $dataprog =
'www.cam.org/home/projects/public_html/data/database.txt';

 #Write Data to Log file
 open (OUT, "$dataprog");
 
 # Sort alphabetically if
specified:                                      #
    if ($Config{'sort'} eq 'alphabetic') {
        foreach $field (sort keys %Form) {

            # If the field has a value or the print blank fields
option      #
            # is turned on, print out the form field and
value.              #
            if ($Config{'print_blank_fields'} || $Form{$field} ||
                $Form{$field} eq '0') {
                print OUT "$field: $Form{$field}\n\n";
            }
        }
    }

    # If a sort order is specified, sort the form fields based on
that.      #
    elsif ($Config{'sort'} =~ /^order:.*,.*/) {

        # Remove extraneous line breaks and spaces, remove the
order:        #
        # directive and split the sort fields into an
array.                 #
        $Config{'sort'} =~ s/(\s+|\n)?,(\s+|\n)?/,/g;
        $Config{'sort'} =~ s/(\s+)?\n+(\s+)?//g;
        $Config{'sort'} =~ s/order://;
        @sorted_fields = split(/,/, $Config{'sort'});

        # For each sorted field, if it has a value or the print
blank        #
        # fields option is turned on print the form field and
value.         #
        foreach $sorted_field (@sorted_fields) {
            if ($Config{'print_blank_fields'} || $Form{$sorted_field} ||
                $Form{$sorted_field} eq '0') {
                print OUT "$sorted_field: $Form{$sorted_field}\n\n";
            }
        }
    }

    # Otherwise, default to the order in which the fields were
sent.         #
    else {

        # For each form field, if it has a value or the print
blank          #
        # fields option is turned on print the form field and
value.         #
        foreach $field (@Field_Order) {
            if ($Config{'print_blank_fields'} || $Form{$field} ||
                $Form{$field} eq '0') {
                print OUT "$field: $Form{$field}\n\n";
            }
        }
    }
  
 close OUT;

 }


Which can be compared with <Carl Hagstrom, hagstrom@epix.net>'s script
codes suggestion to print the output of my html form into a COMMA
delimited text file.
(Carl, sorry for yesterday's mistake)

># This should be set to the dir where you house the file your going to 
>write to
># The file name "database" can be what ever you would like to call  it.
>$dataprog = '/home/webusr/rest_of_path_here/database.txt';
>
>
>#Write Data to Log file
>open (OUT, ">>$dataprog");
>print OUT "$FORM{'Company'},$FORM{'Name'},$FORM{'Address'}, , 
>,$FORM{'City'},$FORM{'State'},$FORM{'Zip'}, , , , , , , , , , 
>,$FORM{'Email'},$FORM{'occupation'},$FORM{'extra'},$FORM{'jtitle'},$FORM{'
>textra'}\n";
>close OUT;



In Carl's example's, is it possible to have a [TAB] rather than printing
a comma (,) between each field so that I may be able to easily import
everything into a database? 


I have also created a "blank" database.txt file and uploaded it in a
specific directory as described here >$dataprog =
'/home/webusr/rest_of_path_here/database.txt';

The permissions of this database.txt file have been set up as Read an
Write

drwxrwxr-x   2 projects  users        512 Jun 18 14:13 ./
drwxr-xr-x   3 projects  users        512 Jun 18 14:13 ../
-rw-rw-r--   1 projects  users         19 Jun 18 14:19 database.txt


I have done the same for the "Data" folder

drwxr-xr-x   3 projects  users        512 Jun 18 14:13 ./
drwx--x--x   3 projetcs  users        512 Jun 18 14:13 ../
drwxrwxr-x   2 projetcs  users        512 Jun 18 14:13 data/


Everything seems to work perfectly... in the sense that I do not get any
error message BUT nothing gets printed in the database.txt file. It's
always blank ! ! !


What is wrong ??? Your comments will be greatly appreciated.


I also only want to print/export the values, not the labels. I presume
that I just need to delete the following $field:    and  
$sorted_field:     on the following lines ? 

print OUT "$field: $Form{$field}\n\n";
print OUT "$sorted_field: $Form{$sorted_field}\n\n";
print OUT "$field: $Form{$field}\n\n";



And remove \n\n if I want to print/export everything on a single long,
long, line with each field separated by a [TAB].


Is life so simple ? ? ? ?


Sincerely . . . and my best wishes from Montreal



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

Date: Sat, 20 Jun 1998 19:08:24 GMT
From: abraham@mpi.com
Subject: Re: How to use Socket.pm?
Message-Id: <6mh1b8$etf$1@nnrp1.dejanews.com>

use LWP::Simple;
$doc = get 'http://www.domain.com/cgi-bin/pgm.cgi?parm1=value1&parm2=value2';

It doesn't get any easier than this.

Jim Abraham

In article <mbudash-1806980920550001@d152.pm4.sonic.net>,
  mbudash@sonic.net (Michael Budash) wrote:
>
> Hey all -
>
> Can someone tell me how to, in a perl script, execute this:
>
> http://www.domain.com/cgi-bin/pgm.cgi?parm1=value1&parm2=value2
>
> then collect the returned html into a variable?
>
> I have the feeling I'll need Socket (or possibly LWP), but I just can't
> seem to find the documentation or example that I need...
>
> TIA -
>
> --
> Michael Budash, Owner * Michael Budash Consulting
> mbudash@sonic.net * http://www.sonic.net/~mbudash
> 707-255-5371 * 707-258-7800 x7736
>


-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/   Now offering spam-free web-based newsreading


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

Date: Sat, 20 Jun 1998 17:12:17 -0400
From: "Scott" <sdh1@anchor.hotmail.com>
Subject: Re: kinda like tail -f...?
Message-Id: <6mh8n1$95m$1@camel0.mindspring.com>

Keep in mind that the log file may be stuck in buffers when you try to read
it.




Tom Phoenix wrote in message ...
>On 17 Jun 1998, John Chapin wrote:
>
>>   I suppose what I'm really asking for is how to get an open()
>> to ignore the EOF -- so it behaves like a "tail -f",
>
>See the FAQ, section five. Hope this helps!
>
>--
>Tom Phoenix       Perl Training and Hacking       Esperanto
>Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/
>




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

Date: Sat, 20 Jun 1998 19:36:16 GMT
From: brian_mcintosh@csi.com (Brian McIntosh)
Subject: Newbie print << question
Message-Id: <358d0de7.12577227@news.compuserve.com>

I am taking my first steps down the perl road, and have attempted to
load a perl CGI scrip on my server and execute it.

When I run then script, I get the following error:

Can't find string terminator "RESULTS-HEADER" anywhere before EOF at
query.pl line 60.

Line 60 shows this:

print <<"RESULTS-HEADER";   
<HTML>
<HEAD>
<TITLE>Contact-Information Search Results </TITLE>
</HEAD>
<BODY BGCOLOR="#FFFFFF">
<H1> Contact-Information Search Results</H1>
RESULTS-HEADER

I have tried a few different syntax changes at line 60 based on some
messages in this newsgroup, but have not been able to get this sorted
out.

Any suggestions where I should begin to look?

Thanks,

Brian McIntosh


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

Date: Sat, 20 Jun 1998 18:56:27 GMT
From: abraham@mpi.com
Subject: Question about perl and sockets -- long
Message-Id: <6mh0kr$e3k$1@nnrp1.dejanews.com>



I'm writing a client in Perl on Unix to talk to an NT service, using
sockets.  I've tried using IO::Socket, but given the implementation of
the server side, I've thought it best to use plain old Socket.pm.

All I really have to do with my program is port the C sample version,
provided by the maker of the service.  I've compiled and tested the
C sample; it works fine.  The problem I'm having with the perl version
is with the recv call, which simply hangs.  I feel that the service is
never sending data, so the recv is simply waiting to time out.  I'm
enclosing the C sample code (which works) and my perl "port":

/* C Sample  -- connect to server, send "open:" command; server will
return the child port number */

main(int argc, char **argv)
{
   char str[256];
   char *retStr;
   char *token;
   char *ipAddr;
   unsigned char len8;
   unsigned short success;
   unsigned short numStrings;
   int s;
   int port;
   int i=0;
   struct sockaddr_in addr;
   const int ssize = sizeof(unsigned short);


   ipAddr = "204.162.26.178";
   if (argc == 2)
      ipAddr = argv[1];


   /* Connect to server */
   s = socket(PF_INET, SOCK_STREAM, 0);
   if (s == -1)
      return 1;
   memset(&addr, 0, sizeof(addr));
   addr.sin_addr.s_addr = inet_addr(ipAddr);
   addr.sin_port = htons(700);
   addr.sin_family = AF_INET;
   if (connect(s, (sockaddr *)&addr, sizeof(addr)) == -1)
      return 2;

   /* Send command */
   strcpy(str, "open:");
   len8 = strlen(str);
   send(s, (const char *)&len8, sizeof(unsigned char), 0);
   send(s, str, len8, 0);
    /* server returns child port number.  Close this socket & open one
to the child to do the actual work */
   port = Get16(s);
   close(s);

   if (port == 0)
 return 3;
/* continues... */
}

unsigned short Get16(int s)
{
   unsigned short value16;
   unsigned short temp;
   const int ssize = sizeof(unsigned short);
   int actual;

   actual = recv(s, (char *)&temp, ssize, 0);
   ASSERT_EQUAL(actual , ssize);
   swab((const char *)&temp, (char *)&value16, ssize);

   return value16;
}

/* End of C sample */

# My perl sample follows:

#!/home/abraham/perl/bin/perl

use strict;
use sigtrap;
use Socket;

my $remoteHost = shift || '192.168.57.44';  # ip address of my PC, on
which the server is running
my $port = shift || 700;
my $proto = getprotobyname 'tcp';

my $ip = inet_aton $remoteHost or die "Unknown host: $remoteHost\n";
my $paddr = sockaddr_in($port, $ip);

socket GC, PF_INET, SOCK_STREAM, $proto or die "Can't create socket:
$!\n";
connect GC, $paddr or die "Can't connect: $!\n";

print "Connected to $remoteHost:$port\n";

my $cmd = "open:"; # this command causes the server to create a child
process; server will return the port
my $len = length $cmd;

# send the length of the message
my $bytesSent = send(GC, $len, 1, 0) or errSock("send", "$!");
print "send: $len; bytes sent: $bytesSent\n";

# now send the message
$bytesSent = send(GC, $cmd, $len, 0) or errSock("send", "$!");
print "send: $cmd; bytes sent: $bytesSent\n";

my $rec;

# THIS IS THE ERROR: the recv call ALWAYS times out
my $bytesRec = recv(GC, $rec, 2, 0) or errSock("recv", "$!");
print "recv: $rec; bytes recv: $bytesRec\n";  # this line and those
following never executed

close GC or die "Can't close socket: $!\n";

exit;
# end of perl sample

Hope this doesn't seem too newbie of me to ask -- I always hate those
"please help me" posts on comp.lang.perl.misc.  I've written other
socket clients in Perl, using Socket and IO::Socket, and I've never had
this trouble before.  I've RTFM, but I'm still stuck.  Thanks for any
help you can provide.

Jim Abraham


-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/   Now offering spam-free web-based newsreading


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

Date: 20 Jun 1998 20:04:24 GMT
From: c.c.eiftj@54.usenet.us.com (Rahul Dhesi)
Subject: Re: REVIEW: Perl CGI Programming - No Experience Required
Message-Id: <6mh4k8$rme$1@samba.rahul.net>

In <6ma5tg$d13@news1.panix.com> dha@panix.com (David Adler) writes:

>>My next question is:  If the only difference between the two is that one
>>is in a single variable, and the other is explicitly enumerated, why are
>>we making such a a big deal of this difference?  We don't make a big
>>deal of the fact that the interger held in $i is differnt from the
>>integer explicitly denoted by 15.  If the ONLY difference between two
>>things is that one is in a variable and the other is not, that's hardly
>>a difference worth arguing about.

>I think theres a shift in your argument, subtle though it may be, that
>you're missing.  That the integer held by $i is the same as the
>integer 15 (assuming, of course, $i=15) is not, I think in dispute.
>The problem comes when you say $i is the same as 15.  The distinction
>being that $i and the value *contained* in $i are not the same thing.
>The contents of $i can change, the integer value itself cannot.

If you will recall, the reviewer of the book in the subject was
chastised for saying that a perl list is an ordered sequence of elements
and is equivalent to arrays in other languages.  If you believe that the
significant difference between a perl list and a perl array is that the
perl array is in (or referenced by) a single variable while a perl list
is explicitly enumerated, then we can naturally ask:  Does every author
of every programming book go to great lengths to make a distinction
between something explicitly enumerated and an equivalent thing that's
in a variable?  

It seems to me that the among the first things that we learn when
learning to program is the difference between values and variables, and
once we have done so, there is no further need to remind us.  In Pascal,
for example:

     var a: set;

     (* RHS is the set of the first three odd integers *)
     a := [ 1, 3, 5 ];


     (* at this point a is the set of the first three odd integers *)

Are the comments above incorrect, in that they claim that both the
explicitly enumerated set and the variable a are the same thing?  Should
we chastize the programmer for not recognizing the difference between an
explicitly enumerated set and a variable that holds one?

>From C:

     /* N is my name */
     char *N = "Rahul Dhesi";

Is N really my name?  Isn't it really a pointer to an area of memory
that holds my name?  Nope not really, it's actually a pointer to an area
of memory that holds the ASCII VALUES of characters used to spell my
name.  Even that might not be right, because we don't know if the above
program is in memory yet -- we might not have yet compiled it!  N is
really a pointer that will, once the program is compiled and running,
point to an area of memory that holds my name -- provided the program
has not been swapped out, because if it has, it might have no physical
memory allocated to it, only some virtual memory mapped to blocks on a
disk.  

HOLD THE PRESSES!!!  N itself is not a pointer at all!  N is really the
name of a machine word that CONTAINS a pointer!
-- 
Rahul Dhesi <dhesi@spams.r.us.com>


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

Date: 20 Jun 1998 20:26:32 GMT
From: c.c.eiftj@54.usenet.us.com (Rahul Dhesi)
Subject: Re: REVIEW: Perl CGI Programming - No Experience Required
Message-Id: <6mh5to$rsu$1@samba.rahul.net>

In <x7sol3e2md.fsf@sysarch.com> Uri Guttman <uri@sysarch.com> writes:

>i have been following this thread and i am amazed that you aren't
>grasping the fundamental difference between lists and arrays.

Several people are amazed.  The problem is that I take your words at
face value.  If you try to read your own prose from first principles you
will see why it's so hard to understand.  The use of the term 'AV', not
defined anywhere in the many perl manuals and books I have read, was
just one of the problems.  The use of ad hominem attacks and idiotic
analogies is one more problem.  Read what you and others have written,
carefully, as if you are trying to learn from it, not merely argue, and
you will see why it's so unhelpful.

>there is a
>MAJOR difference between an explicitly named variable and a list of
>values. about the only thing they have in common is that an array in a
>list context, gives its values as a list. that is why both can be
>subscripted in similar ways. but lists can't be pushed onto, shifted,
>unshifted, popped, spliced, passed by reference (i don't mean as an anon
>list which is a copy), etc.

This amounts to saying that certain operations are defined for
variables, not for values not containd in a single variable.  So what?
I can do $i++ but not 15++, but I don't make a big deal of it, beause
it's understood that variables can be used in ways that their values
can't.

[ portions skipped ]
>assignment must do a copy of the assigned value to keep it around. a
>list lives on the stack always while variables live on the stack, and in
>allocated and static memory. you can't have a list in the last two types
>of storage.

This is not helpful at all, since we are talking about implementation
details.  You would be better off talking about the lifetime or scope of
things, not about the sort of memory they reside in.

>list _context_ is a different animal as randal showed earlier in this
>thread. there is no such thing as array context, as that phrase has no
>meaning. 

This is just a matter of terminology;  obviously at some point in time
Larry Wall was thinking of array context, when he used the identifier
'wantarray'.  He could have called it 'wantblurf' and defined a 'blurf
context'.  A name is just a name.

'Array' is a generic term used in many lanauges, as is 'list'.
Please be careful to distinguish between:

     Array, a generic term common to many lanauges.
     List, a generic term common to many lanauges.
     Perl array, a perl-specific term.
     Perl list, a perl-specific term.

The reviewer of the book in question was clearly using 'array' in
generic way, and trying to map that to the perl-specific term 'perl
list'.  The point of contention appears to be that the generic term
'array' might map better to the term 'perl array' rather than 'perl
list'.  But that would be inaccurate too, because in the generic sense,
'array' can refer to an explicitly enumerated ordered list of values,
not necessarily only to an array in a single variable.  Both
'perl array' and 'perl list' are analogous to the 'array' concept
in general.
-- 
Rahul Dhesi <dhesi@spams.r.us.com>


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

Date: Sat, 20 Jun 1998 19:30:02 GMT
From: abraham@mpi.com
Subject: Re: Running perl scripts on NT as a Service
Message-Id: <6mh2jq$gbi$1@nnrp1.dejanews.com>

Typically, services do some task in a short amount of time, and sleep, or
wait for a set condition to occur, etc.  In short, they spend much of their
time idle.  You are using sleep to put your service in an idle state, right? 
Because it sounds like it's in a loop...


In article <358A6181.2C510125@mail.matav.hu>,
  Jozsef Dojcsak <dojo@mail.matav.hu> wrote:
>
> There are perl modules and scripts like NNML which are worth using as a
> Service on NT. Does anyone have any experience with it? (And with
> Service tools like srvany from Microsoft or RunExecSvc from WinWinSoft)
>
> I went a step further and created a small NT service, which contained an
> embedded perl interpreter. I was able to start the service but failed
> using it because it consumed 98% CPU. What did I wrong?
>
> Thanks in advance,
> Jozsef
>
>


-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/   Now offering spam-free web-based newsreading


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

Date: Sat, 20 Jun 1998 20:49:00 GMT
From: Sifu Hall <webmaster@dragonslist.com>
Subject: Sort problems
Message-Id: <358C1EAD.12A8E491@dragonslist.com>

    First let me thank everyone who have responded to my previous
questions and everyone else who has attempted to get this old database
programmer on the road to perl.
    My problem is this:  I have read the FAQ and a book 'Teach Yourself
Perl in 21 Days', but so far I can solve this problem.  I am trying to
sort a multiple dimensioned array on one specific element.  For example,
I have an array of @Schools and I would like to sort based on the third
element, or $Schools[$i][3].  I have tried many variations to the code
that was recommended to me and none seem to work correctly.  I have
modified the code to the following.

sub arraysort {
   my(@MyArray) = @_;
   $NumItems = @MyArray;
   for ($i = 0; $i < $NumItems-1; $i +=1) {
      @sorted = sort {$Test[$i][3] cmp $Test[$i+1][3]}@MyArray;
   }
   return @sorted;
}

     Any help will be greatly appreciated!!!



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

Date: 20 Jun 1998 21:33:01 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Sort problems
Message-Id: <6mh9qd$l4s$1@csnews.cs.colorado.edu>

 [courtesy cc of this posting sent to cited author via email]

In comp.lang.perl.misc, 
    Sifu Hall <webmaster@dragonslist.com> writes:
:    My problem is this:  I have read the FAQ and a book 'Teach Yourself
:Perl in 21 Days', 

Did you read perldsc manpage on your system?  It talks about this.
You'll also find its semblance in chapter 4 of the Camel.

:sub arraysort {
:   my(@MyArray) = @_;
:   $NumItems = @MyArray;
:   for ($i = 0; $i < $NumItems-1; $i +=1) {
:      @sorted = sort {$Test[$i][3] cmp $Test[$i+1][3]}@MyArray;
:   }
:   return @sorted;
:}

I really can't tell what you're doing.  It's horrifically
complex.  I think you want

    @out = sort { $in[$a][3] cmp $in[$b][3] } @in;

You should read the fine perlfunc manpage's treatment of the
sort function for more details.  Or my FMTEYEWTK on this.

--tom
-- 
"Usenet is like a herd of performing elephants with diarrhea --
massive, difficult to redirect, awe-inspiring, entertaining, and a
source of mind-boggling amounts of excrement when you least expect
it." --gene spafford, 1992


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

Date: 20 Jun 1998 21:18:08 GMT
From: deltac@localhost.localdomain (Delta Charley)
Subject: Strip carriage return from cgi?
Message-Id: <slrn6oo69i.u6.deltac@localhost.localdomain>

Hi all,  I am having problems getting a perl cgi script 
that I got from a web site to run on my Linux/Apache box.

When I try and check it using perl -c I get this:

[seegeeeye@localhost or_for]$ perl -c order_form.pl
Illegal character \015 (carriage return) at order_form.pl line 11.
(Maybe you didn't strip carriage returns after a network transfer?)
[seegeeeye@localhost or_for]$

Can anybody advise as to the best way to strip the carriage returns?

I tried to use sed to strip them but I can't figure out how
get sed to work on non printing characters.

Thanks for any help,

--
Dale Coleman (alias Delta Charley)
e-mail: deltac@gate.net
My page: http://www.gate.net/~deltac/


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

Date: Sat, 20 Jun 1998 17:17:16 -0400
From: "Scott" <sdh1@anchor.hotmail.com>
Subject: Re: Unix installation
Message-Id: <6mh90e$lkk$1@camel0.mindspring.com>

You need to modify your kernel parameters.  Try upping maxuprcs?  Something
like that.  It's the maximum number of procedures per user.  I think the
default is 50.
Assuming you have root access, it's pretty easy to change under SAM.  Just
go
into the kernel area and configurable parameters.  You will need to re-boot
the system
when you are finished.

Either that or try to stop something else that's running under your user id.

I've gotten good at compiling perl on a B180.  You might try using gcc as
the compiler.


Dave J. Lowe wrote in message <3587089A.A99736D9@hotmail.com>...
>Hi,
>I've been trying to install Perl 5.004_04 onto my Unix workstation
>(HPUX) and I keep getting these kinds of messages when I run 'make
>depend':
>
>"sh: fork failed - too many processes
>*** Error code 1"
>and something like
>"too much defining- try the -H option"
>
>What can I do about the processes and how do I get it to try the -H
>option?
>
>Thanks,
>Dave
>




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

Date: Sat, 20 Jun 1998 22:50:05 +0200
From: Kay Molkenthin <molkiheg@sp.zrz.tu-berlin.de>
Subject: What "mini" database (text?) to use?
Message-Id: <358C207D.D02722C6@sp.zrz.tu-berlin.de>

Hi,

I just started with perl and wrote an adress book for my webserver.
Because I want to learn more about perl I like to store the datas in a
database, now I store them in a text file.

For this project I only need a small database application. I heared of a
text based perl database. What is the name and what do I need?

Kay.
-- 
Kay Molkenthin   -   Ruesternallee 45   -   14050 Berlin [GERMANY]
Email:  molkiheg@sp.zrz.tu-berlin.de  /  Kay_Molkenthin@Bigfoot.de
------------------------------------------------------------------
Key fingerprint = A6 1E 73 E7 E7 77 75 E1  7C E6 EF AF 78 A6 6C 38


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

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


Administrivia:

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

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.

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

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

The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.

The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.

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


------------------------------
End of Perl-Users Digest V8 Issue 2922
**************************************

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