[8048] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1673 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Jan 19 14:17:53 1998

Date: Mon, 19 Jan 98 11:00:39 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Mon, 19 Jan 1998     Volume: 8 Number: 1673

Today's topics:
        Another Stupid Question (sort) <toddm@rahul.net>
    Re: Can unix Perl Modules be used under Win32 <corky@ultranet.com>
    Re: Changing Case (Mick Farmer)
    Re: Create file <rootbeer@teleport.com>
        date & Expiration? <kupid@ecom.net>
    Re: date & Expiration? (Matthew Cravit)
    Re: Deleting specific lines from text files. <jt@epix.net>
    Re: How on earth....?!?! <kupid@ecom.net>
        How to write fixed format data? <houde@fox.cisti.nrc.ca>
    Re: I am still a virgin <jmatocha@cs.ua.edu>
    Re: perl build error on Solaris w/ gcc <dkhosla@compaq.com>
    Re: PERL forking <phousto@cse.dnd.ca>
        please, help me, help me, help me..... <seong@cse.bridgeport.edu>
    Re: please, help me, help me, help me..... (brian d foy)
        Question about array <seong@cse.bridgeport.edu>
    Re: Question about array (Mike Stok)
        Redirect stdout on NT! Need some ideas <napes@ibm.net>
    Re: Redirect stdout on NT! Need some ideas (Michael Ng)
        Reload by perl - is it possible? <nborges@ccg.uc.pt>
    Re: Reload by perl - is it possible? (brian d foy)
        Sockets and Deadlock :-( <johnrs@dc.net>
    Re: source into binary code <tchrist@mox.perl.com>
    Re: source into binary code (Abigail)
    Re: source into binary code (Abigail)
    Re: source into binary code (John Stanley)
    Re: source into binary code (John Stanley)
        Switch statement in Perl-5??? <david.mohorn@sourcebbs.com>
    Re: Switch statement in Perl-5??? (brian d foy)
    Re: Symbolic Links <dhoover@textwise.com>
        Use of uninitialized value at fastbib.pl line 103. <dhoover@textwise.com>
    Re: Using Menus in Perl-5 (brian d foy)
        Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: 19 Jan 1998 18:22:53 GMT
From: Todd McLaughlin <toddm@rahul.net>
Subject: Another Stupid Question (sort)
Message-Id: <6a05lt$2kr$1@samba.rahul.net>


How do I sort a 2D array by the second field (numeric)?  Here's what I 
have so far.  Am I getting close?

@sorted = sort {$a[][1] <=> $b[][1]} @unsorted;

Todd
-- 


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

Date: Mon, 19 Jan 1998 12:52:17 -0500
From: Bob Trieger <corky@ultranet.com>
To: Bernard Arumainathan <dilana@vcn.bc.ca>
Subject: Re: Can unix Perl Modules be used under Win32
Message-Id: <34C392D1.37D0@ultranet.com>

Bernard Arumainathan wrote:
> 
> Is is possible to use perl modules from Perl distributions for Unix under
> Win32.
> Thanks in advance.

I asked the same question earlier this week and got the following reply
from Steffen Meyer:

Get the "Perl for Win32" port by Gurusamy Sarathy. It contains many
modules from CPAN in precompiled form, i.e., you don't need to install
them explicitly, just use them.

The port is available from http://www.perl.com/CPAN/authors/id/GSAR/.



Goodluck


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

Date: Mon, 19 Jan 1998 16:30:54 GMT
From: mick@picus.dcs.bbk.ac.uk (Mick Farmer)
Subject: Re: Changing Case
Message-Id: <En1HvI.A6@mail2.ccs.bbk.ac.uk>

Dear Brad,

Something like this should work.

	$text = ...;
	$nice = join ' ', map ucfirst lc, split / /, $text;

You split the text into a list of words, each word is then
translated into lower case, and then the first character
is capitalised.  Finally the list of words is joined into
a single string.  You can obviously modify this code to
suit your exact application.

Regards,

Mick


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

Date: Mon, 19 Jan 1998 09:43:16 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Chipmunk <rjk@coos.dartmouth.edu>
Subject: Re: Create file
Message-Id: <Pine.GSO.3.96.980119090843.9757N-100000@user2.teleport.com>

On Mon, 19 Jan 1998, I wrote:

> You should write a letter to the editor and complain. :-)

Upon reflection, I feel I should probably make this (poor) joke of mine
clearer.

The rule which I often give here is this:

    Even when your script is "just an example" (and perhaps 
    especially in that case!) you should _always_ check the 
    return value after opening a file. 

But (despite the "_always_") there is an exception. 

Whenever we learn rules in life, we learn any exceptions later. "Always
tell the truth... Unless a little white lie might spare somebody's
feelings." "Don't plug a 90-watt appliance into a 40-watt outlet... Unless
you're testing the circuit in a laboratory." "Never go in against a
Sicilian when death is on the line... Unless you have secretly built up an
immunity to iocaine powder."

The more general rule which can override all others is: 

    You may break any rule, including this one, only when
    you completely understand the reasons for it. 

In general, this rule is understood implicitly. No one need explicitly
state the exception clause of "Don't write in your books... Unless you're
taking notes." When you're ready to break a rule, you _know_ that you're
ready; you don't need anyone else to tell you. (If you're not that
certain, then you're _not_ ready! :-)

In this case, I'm sure that the underlying reasons for the rule I cited
were understood by Lincoln Stein and everyone who reviewed that code
before publication in The Perl Journal. 

And I hope that no one will object if I continue to omit the exceptions
when I cite that rule or others. Cheers! 

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/
              Ask me about Perl trainings!




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

Date: Mon, 19 Jan 1998 09:23:30 -0800
From: "Kupid" <kupid@ecom.net>
Subject: date & Expiration?
Message-Id: <6a02fk$b0o$1@usenet76.supernews.com>

What I'm trying to do is make a certain line in a file delete 15 days from
the creation date.  For example:

On my website.. when a person posts a message, it goes into my
text-based...database.  15 days after the initial post.. I want the line
deleted from the database.

Does anyone know of any date code, and the method in how to do this?

I've tried stamping the day, month, and year.. then saying this:

if ($day >= $databaseday + 15)  { &startdelete}

Obviously, this code is very limited.. and very inaccurate.  So.. if anyone
can help me, I'd really appreciate it.

Thanks!

David




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

Date: 19 Jan 1998 10:02:17 -0800
From: mcravit@best.com (Matthew Cravit)
Subject: Re: date & Expiration?
Message-Id: <6a04f9$4rr$1@shell3.ba.best.com>

In article <6a02fk$b0o$1@usenet76.supernews.com>, Kupid <kupid@ecom.net> wrote:
>What I'm trying to do is make a certain line in a file delete 15 days from
>the creation date.  For example:
>
>On my website.. when a person posts a message, it goes into my
>text-based...database.  15 days after the initial post.. I want the line
>deleted from the database.
>
>Does anyone know of any date code, and the method in how to do this?

The value of time() is an integer indicating seconds since January 1st,
1970 (on UNIX, anyway). So you could timestamp your records with that
value, and then in your code do something like this:

use constant SECS_IN_15_DAYS => 1296000;

[...]

if (time >= ($timestamp + SECS_IN_15_DAYS)) {
	# Delete the entry
}

Hope this helps.

/MC

-- 
Matthew Cravit, N9VWG               | Experience is what allows you to
E-mail: mcravit@best.com (home)     | recognize a mistake the second
        mcravit@taos.com (work)     | time you make it.


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

Date: Mon, 19 Jan 98 13:03:31 -0500
From: "Julian Thomas" <jt@epix.net>
Subject: Re: Deleting specific lines from text files.
Message-Id: <34c396cf$2$wg$mr2ice@news.epix.net>

In <pzCs3AAHx3w0Ew+v@cydaps.co.uk>, on 01/19/98 
   at 04:16 PM, James <James@cydaps.nospam.co.uk> said:

>I am wondering if anyone knows how I can allow the user to delete his/her
>information from this file without deleting anything else. They would
>enter their usename and password and click a button that would delete
>them from the server. 

>An example of the file would be:

>me@here.com|David Raymond|sK134/deshe83Z|draymond|Windows|MacOS
>134.55@dislike.co.uk|Jeremy Jones|eig34653se|jjones|Eggs|Jaguar cars
>dj@djsilver.au|Derek James|nsl234lkj9|djames|Basingstoke|Dockenfield

You might want to consider not rewriting the entire file each time, but
overwriting just the initial character of the entry with an illegal
character (for a userid; @ is just one that comes to mind).

I'm a perl novice myself, but you would need to:
 1.  open file for read and write
 2.  locate the offending record
 3.  back up the write pointer and overlay the first character
 4. close

and periodically copy the file, removing entirely the marked records.
 
-- 
 Julian & Mary Jane Thomas
 jt@epix.net  http://www.epix.net/~jt
 In the beautiful Finger Lakes Wine Country of New York State!
 --------------------------------------------------
 Murphy's Anachronism: disk failures occur immediately before backing up.




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

Date: Mon, 19 Jan 1998 09:42:16 -0800
From: "Kupid" <kupid@ecom.net>
Subject: Re: How on earth....?!?!
Message-Id: <6a03io$bt8$1@usenet76.supernews.com>

This is the project we have planned on our site.  Actually, this is very
simple:

Say that this is the database that you have.. which uses a comma delimiter.

(job title, job function, hours per day, hours per week)

When a person subscribes to "Cool Notify", print his info in the same format
as your main database.

Schedule your "Cool Notify" database to be checked against your main
database once or twice  per day.

You would split the delimters on both databases. Loop through the databases.

For each delimiter value/s in the "Cool Notify" database that matches the
delimter value/s in the main database.... send the person an e-mail message,
letting them know whatever you want to let them know.

Hope this helps.

David




James wrote in message ...
>
>Hi
>
>I have been asked by my boss to create a web site that has a Cool Notfiy
>system like the Classified adverts section on www.hotmail.com. We use
>Access 97 to create our database of jobs, and this is exported as a pipe
>delemited text file and ftp'd to the web server (SunOS Unix with Perl 5
>and Sendmail). We had a basis search script that seemed to work okay,
>but now my boss wants to be able to let clients register on our site
>stating their skills, the title of the job they are looking for, the
>area they are looking in and the type of job (ie contract etc) and then
>if there are any matches an email is sent out listing the jobs that
>match the users information.
>
>Does anyone know how www.classified2000.com setup their Cool Notify and
>how we could do something similar. Often their are around 20,000 jobs
>per month so it needs to be robust. Can anyone help?
>
>Thank you very much indeed for your help
>
>
>James
>Please remove .nospam if replying by email!




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

Date: Mon, 19 Jan 1998 12:48:15 -0500
From: Pascal Houde <houde@fox.cisti.nrc.ca>
Subject: How to write fixed format data?
Message-Id: <34C391DF.D2DA7562@fox.cisti.nrc.ca>

I'm currently using the format function to set a fixed record.
So it looks like:
format my_record =
@<<<<<<@<<@<<<< etc...
$field1,$field2,$field3,  etc...

The problem is that my fixed record is over 1000 chars long!
Some fields are 200 long. So you imagine the number of <<< I have!
Is there any other way to set a fixed record in a simpler way?

Thanks
Please send the reply directly to me.

Pascal





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

Date: Mon, 19 Jan 1998 11:04:36 -0600
From: Jeff Matocha <jmatocha@cs.ua.edu>
Subject: Re: I am still a virgin
Message-Id: <34C387A4.535E@cs.ua.edu>

Kati wrote:
> 
> Hello,
> 
> Could someone help me get started.
> 
> I made a simple test and placed
> it in my cgi bin:
> 
> #!/usr/bin/perl
> 
> print "Content-Type: text/html\n\n";
> print "This is my first test\n";
> 
> exit;
> 
> Naturally - this should return the
> words "This is my first Test".
> 
> I do the chmod a+x test.pl, then
> type test.pl and the shell returns
> correctly "This is my first test".
> 
> But when I access the same file
> via Netscape browser, the phrase
> is not printed, the above file
> is shown in full as ASCII characters.
> 
> How can I could make this work,
> please kindly help me out.
> 
> Kati

You are expecting your browser to act like a shell (and execute the
program); really, it is really more like a text viewer.  That's why you
just get the text.  If you want to run it, you *might* be able to use
the <!--#exec cmd="test.pl"--> inside another document.  If your server
is set up to do "server side includes", the output of test.pl will
replace the exec cmd line.  Otherwise, I guess you could set up a HTML
form which kicks off your program, but that assumes you have access to a
cgi-bin directory.

I know it is all kind of confusing, so let me know if you need some
help.

Jeff


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

Date: Mon, 19 Jan 1998 14:14:08 GMT
From: "Deepak Khosla" <dkhosla@compaq.com>
Subject: Re: perl build error on Solaris w/ gcc
Message-Id: <01bd24e5$1c774090$b90e12ac@print-tst01>



> If I'm correct, fixincludes should have been automatically run when
> you were building gcc.  Did you build gcc with cc or did you compile
> gcc against a pre-compiled binary?
I built gcc on the machine from the source (no problems)
same version with the p/c version.
> 
> : getting binaries and installing them. I am at a loss - is there a
Solaris
> : specific FAQ or has someone experienced the same? If not, any place I
can
> : get binaries?
> 
> There is a Solaris FAQ.  I believe that you can find it at
> rtfm.mit.edu.
Thanks
 


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

Date: Mon, 19 Jan 1998 16:56:15 GMT
From: Phil Houstoun <phousto@cse.dnd.ca>
Subject: Re: PERL forking
Message-Id: <34C384E9.18558104@cse.dnd.ca>

Anders Nilsson wrote:
> 
> Hello!
> 
> I am working with a perl program to administrate a large number of
> calculations. When a subprocess terminates from a fork it becomes a
> zombie. I haven't checked everything all through but judging from
> the simple csh program I wrote, the problem seems to be that perl
> refuses to release the control until the mother process dies. It is
> a real problem since the the actual loop will not be formed as below
> in the future. It will probably include a couple of thousand runnings
> and I don't think that a thousand zombies is particularly healthy for
> a linux machine. It's not a linux problem since it works the same on
> a HP-UX machine.
> 
> The active part of my test program is included below. Let me also tell
> that I have tried with: system("cmd"); and: `cmd`; for the row exec cmd;
> with the same result. The command cmd is a simple csh program for
> testing
> purposes including a find and an echo terminated by exit(0).
> The subroutine get_load extracts the load using csh uptime.
> 
> My question is: is this a bug in perl or is there another way to do it?
> I would prefer not to kill the main program and restart it.
> 
> for ( $z=0; $z< 100 ; $z++ ) {
>     print "Lap $z\n";
>     ( $load_01_min, $load_05_min, $load_15_min) = get_load();
>     if ( $load_01_min < 0.6 ) {
>         if ( $pid = fork ) {
>             print "Main Process\n";
>         } else {
>             print "Starting child process $pid\n";
>             exec cmd;
>             exit 0;
>         }
>     } else {
>         print "Not starting any process\n";
>     }
>     sleep 5;
> }
> 
> Thankful for help,
> 
> Anders Nilsson,   an@oso.chalmers.se

Are you being a thoughtful and patient 'parent' and 'wait'ing for your
children to die?

-- 

Phil Houstoun            Voice: (613) 991-7173 
Email: remove the 'j' in pjhousto@cse.dnd.ca
-----------------------------------------------------------------------


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

Date: Mon, 19 Jan 1998 01:01:30 -0500
From: "Seong Y. Kim" <seong@cse.bridgeport.edu>
Subject: please, help me, help me, help me.....
Message-Id: <34C2EC3A.5011@cse.bridgeport.edu>

Hi, there.

I am trying to write a program that searchs all the files and dirs in
specific directory.  

    $locfile[3000];	
    @locfile = <*>;
    foreach $eone (@locfile){

       if (-d $eone) {
           print "\n$eone \n";
       }
       else {
           print "$eone is not dir\t";
       }

    }
    print "\n";

This is part of my humble source code.
Problem is that whenever i run this code, it gave me message 'arguments
too long'.  
This directory has more than 1500 dirs in one dir. 
So, please help me. 


bye.....


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

Date: Mon, 19 Jan 1998 13:48:33 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: please, help me, help me, help me.....
Message-Id: <comdog-ya02408000R1901981348330001@news.panix.com>
Keywords: from just another new york perl hacker

In article <34C2EC3A.5011@cse.bridgeport.edu>, seong@cse.bridgeport.edu posted:

Please read this information on how to choose a good subject for a post:
       <URL:http://www.perl.com/CPAN/authors/Dean_Roehrich/subjects.post>

>I am trying to write a program that searchs all the files and dirs in
>specific directory.  
>
>    $locfile[3000];     
>    @locfile = <*>;
>    foreach $eone (@locfile){

>This is part of my humble source code.
>Problem is that whenever i run this code, it gave me message 'arguments
>too long'.  
>This directory has more than 1500 dirs in one dir. 

Perl helps those that help themselves.  see the FAQ

   Why do I sometimes get an "Argument list too long" when I use <*>?

in perlfaq5.

-- 
brian d foy                                  <comdog@computerdog.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
Comprehensive Perl Archive Network (CPAN) <URL:http://www.perl.com>


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

Date: Mon, 19 Jan 1998 00:12:30 -0500
From: "Seong Y. Kim" <seong@cse.bridgeport.edu>
Subject: Question about array
Message-Id: <34C2E0BE.15DF@cse.bridgeport.edu>

Hi, there.

I have a question about array. if anyone can answer for my question, I
will be more than happy.

I am writing a CGI programm in Perl and trying to read all the directory
name in specific directory and to put them in the array. However, when i
run the program, it says 'argument too long'.  Actually this dir has
more than 1000 dir in one folder.

Can any one tell me the answer???????


thanks.


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

Date: 19 Jan 1998 13:32:51 -0500
From: mike@stok.co.uk (Mike Stok)
Subject: Re: Question about array
Message-Id: <6a068j$1do$1@stok.co.uk>

In article <34C2E0BE.15DF@cse.bridgeport.edu>,
Seong Y. Kim <seong@cse.bridgeport.edu> wrote:

>I have a question about array. if anyone can answer for my question, I
>will be more than happy.
>
>I am writing a CGI programm in Perl and trying to read all the directory
>name in specific directory and to put them in the array. However, when i
>run the program, it says 'argument too long'.  Actually this dir has
>more than 1000 dir in one folder.
>
>Can any one tell me the answer???????

You can explicitly use opendir and readdir to open and read a directory
(untested code warning here!) e.g.

  $dir = '/etc';
  opendir (DIR, $dir) || die "$0: can't opendir $dir ($!)\n";
  @entries = readdir (DIR);
  closedir (DIR) || warn "$0: odd close of $dir ($!)\n";

this should leave @entries containing the names of all the entries in
$dir, with no path component.

Hope this helps,

Mike


-- 
mike@stok.co.uk                    |           The "`Stok' disclaimers" apply.
http://www.stok.co.uk/~mike/       |   PGP fingerprint FE 56 4D 7D 42 1A 4A 9C
http://www.tiac.net/users/stok/    |                   65 F3 3F 1D 27 22 B7 41
stok@colltech.com                  |            Collective Technologies (work)


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

Date: 19 Jan 98 17:25:56 GMT
From: "Ed Napier" <napes@ibm.net>
Subject: Redirect stdout on NT! Need some ideas
Message-Id: <01bd24ff$7d455c80$91786420@ednport.clm150.oh.ameritech.com>
Keywords: Redirect stdout on NT

Hi,

I used this old piece of code in the UNIX world, and I need some ideas on
what to change it to in the NT world.

if (! system("ping $host 1.5 > /dev/null 2>&1 "))

Is there an equivalent to /dev/null in the NT world.  If not, do you have
any good ideas. 

Thanks in advance,

Ed Napier


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

Date: 19 Jan 1998 18:27:20 GMT
From: syng@garlic.engr.ucdavis.edu (Michael Ng)
Subject: Re: Redirect stdout on NT! Need some ideas
Message-Id: <6a05u8$j46$1@mark.ucdavis.edu>

I forgot about NT and can't load NT to verify right now
/dev/null  is called NUL, if my memory is correct.

About the "2>&1" part.  I am not sure about this.  But I beleive I saw some 
threads in this newsgroup talking about this.

Ed Napier (napes@ibm.net) wrote:
::> Hi,

::> I used this old piece of code in the UNIX world, and I need some ideas on
::> what to change it to in the NT world.

::> if (! system("ping $host 1.5 > /dev/null 2>&1 "))

::> Is there an equivalent to /dev/null in the NT world.  If not, do you have
::> any good ideas. 

::> Thanks in advance,

::> Ed Napier

--
Michael 
+------------------------------------------------+
| mikeng@geocities.com                           |
| http://www.geocities.com/ResearchTriangle/8116 |
+------------------------------------------------+


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

Date: Mon, 19 Jan 1998 17:19:46 +0000
From: Nuno Borges <nborges@ccg.uc.pt>
Subject: Reload by perl - is it possible?
Message-Id: <34C38B32.F7ED42FA@ccg.uc.pt>

I don't know if my question is stupid or not, but i'd like to get an
answer...
Is it possible to make a reload by a command of perl? Is there any
language that permit to do so?

Thanks.



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

Date: Mon, 19 Jan 1998 13:51:42 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: Reload by perl - is it possible?
Message-Id: <comdog-ya02408000R1901981351420001@news.panix.com>
Keywords: from just another new york perl hacker

In article <34C38B32.F7ED42FA@ccg.uc.pt>, Nuno Borges <nborges@ccg.uc.pt> posted:

>I don't know if my question is stupid or not, but i'd like to get an
>answer...
>Is it possible to make a reload by a command of perl? Is there any
>language that permit to do so?

probably.  what's "to make a reload"?

-- 
brian d foy                                  <comdog@computerdog.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
Comprehensive Perl Archive Network (CPAN) <URL:http://www.perl.com>


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

Date: Mon, 19 Jan 1998 11:50:20 -0500
From: john -r s <johnrs@dc.net>
Subject: Sockets and Deadlock :-(
Message-Id: <34C3844A.721E1FAB@dc.net>

I have tried a number of suggestions from folks on getting a simple
client and server to exchange directory information. I used examples
from the archives. I am enclosing them here. To save space I have
removed the original comments and tags from the HTML examples.  Please
HELP. I have tried so many combos of the code, I am programming by trial
and error :-(
I just cant seem to flush the buffers each time I need to switch data
send/recieve directions.

Thanks.  - A humbled programmer. (more like brought to his knees).

SERVER -------
#!/usr/local/bin/perl

use Socket;

($port) = @ARGV;
$port = 2345 unless $port;

($name, $aliases, $protocol) = getprotobyname('tcp');
if ($port !~ /^\d+$/) {
     ($name, $aliases, $port) = getservbyport($port, 'tcp');
}

print "Listening on port $port...\n";

# Temporarily set default output to the handle NS so...
select(NS);
$| = 1;
select(STDOUT);

socket(S,AF_INET,SOCK_STREAM,$proto) || die "socket : $!";
$sockaddr = 'S n a4 x8';
$this = pack($sockaddr, AF_INET, $port, "\0\0\0\0");
bind(S, $this) || die "bind : $!";
listen(S,10) || die "listen: $!";

# Create connections as clients "arrive".  $con maintains the connection

# number of the last client

for ($con = 1; ; $con++) {

     # Let the user know we're waiting for a connection...

     printf("Waiting for connection %d....\n", $con);

     ($addr = accept(NS,S)) || die $!;

     if (($child = fork()) == 0) {

 while(<NS>){
  $list .= $_;
 }
 print "recieved $list from client\n";

 select(NS);
 $| = 1;
 select(STDOUT);

 $listing = `ls $list`;
        print "sending $listing\n";
 print NS "$listing\n";

 select(NS);
 $| = 1;
 select(STDOUT);

        close(NS);
        print "Client went away.  Forked server $con exiting...\n";
        exit;
     }
     close(NS);
}

CLIENT -------
#!/usr/local/bin/perl
#
use Socket;

($them,$port) = @ARGV;

$port = 2345 unless $port;
$them = 'localhost' unless $them;
chop($hostname = `hostname`);

($name, $aliases, $proto) = getprotobyname('tcp');
($name, $aliases, $port) = getservbyname($port,'tcp') unless $port =~
/^\d+$/;
print "Using port $port to connect to server on host $them...\n";

($name,$aliases,$type,$len,$thisaddr) = gethostbyname($hostname);
($name, $aliases,$type,$len,$thataddr) = gethostbyname($them);

if (socket(S,AF_INET, SOCK_STREAM, $proto)) {
    print "Socket creation succeeded.\n";
}
else {
    die $!;
}

$sockaddr = 'S n a4 x8';
$this = pack($sockaddr, AF_INET, 0, $thisaddr);
$that = pack($sockaddr, AF_INET, $port, $thataddr);

if (bind(S, $this)) {
    print "Bind succeeded.\n";
}
else  {
    die $!;
}
if (connect(S, $that)) {
    print "Connect succeeded.\n";
}
else {
    die $!;
}
####################### After connection things to do
###################
select(S);
$| = 1;
select(STDOUT);

print S "/tmp\n";
print "data sent - waiting for response\n";

select(S);
$| = 1;
select(STDOUT);

while(<S>){
 $contents .= $_;
 print ".";
}
print "Directory contents are: $contents\n";

--
john -r s (unix spelling)
johnr~s (Windows 3.1 spelling)
JOHNRS (DOS spelling)
John R S (Win95 spelling)




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

Date: 19 Jan 1998 17:03:27 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: source into binary code
Message-Id: <6a010v$74g$1@csnews.cs.colorado.edu>

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

In comp.lang.perl.misc, 
    stanley@skyking.OCE.ORST.EDU (John Stanley) writes:
:I have yet to see anyone refuse to buy Excel or Word because it wasn't
:available in source. 

Me.

--tom
-- 
	Tom Christiansen	tchrist@jhereg.perl.com
    ": fighting for peace is like fucking for virginity (ado@bigcomm.gun.de)
    Yes, but I did manage to increase the amount of virginity in the world
    by that method." --Larry Wall


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

Date: 19 Jan 1998 17:13:09 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: source into binary code
Message-Id: <6a01j5$emr$1@client2.news.psi.net>

John Stanley (stanley@skyking.OCE.ORST.EDU) wrote on 1602 September 1993
in <URL: news:69urj2$d01$1@news.orst.edu>:
++ >Abigail wrote:
++ >> 
++ >> Certainly Dan has succeeded in "protected" his code, by making it
++ >> harder to read the source than Betty's. So, why should people use
++ >> Dan's code at all?
++ 
++ Because Dan's code runs reliably. Because Dan will support it if it
++ doesn't. Because it runs on the platform it is needed on. Because it
++ does bar and bletch as well as foo. Because the report it creates
++ when it finishes doing foo is compatible with the corporate database.
++ Because they are part of a corporate culture that doesn't like free
++ software because there is no support and nobody to sue if it breaks.

Then Dan's and Betty's code aren't equivalent and Betty's code can't
be regarded as an 'easy alternative' for Dan's.



Abigail
-- 
perl -weprint\<\<EOT\; -eJust -eanother -ePerl -eHacker -eEOT


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

Date: 19 Jan 1998 17:13:59 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: source into binary code
Message-Id: <6a01kn$emr$2@client2.news.psi.net>

Chipmunk (rjk@coos.dartmouth.edu) wrote on 1602 September 1993 in
<URL: news:34C2E36D.1C02218D@coos.dartmouth.edu>:
++ Abigail wrote:
++ > 
++ > Dan makes a program to do foo. Dan obscures his code.
++ > Betty makes a program to do foo. Betty doesn't obscure her code.
++ > 
++ > Johnny wants to have a program that does foo, and possible "steal"
++ > the code, without willing to do much effort. Now, whose code is Johnny
++ > going to buy/use? Dan's, or Betty's?
++ 
++ Betty's.
++ 
++ And whose code is Johnny going to steal?  Betty's.
++ 
++ Which is just what Dan would want.  So, as Dan and I have already
++ pointed out, obscuring the code was successful.
++ 
++ Perhaps you should find an argument that actually proves your point.
++ 
++ > Certainly Dan has succeeded in "protected" his code, by making it
++ > harder to read the source than Betty's. So, why should people use
++ > Dan's code at all?
++ 
++ Now we're talking.
++ 
++ While you don't need to read the source to use the code, given the choice
++ I think most people would prefer to do so.  So, let's suppose a fourth
++ person, named Bob, who wants to use Dan's code, but does not want to steal
++ it.  Then he hears about Betty's code, and he realizes he wants to know what
++ the code is really doing before he runs it.  So he chooses Betty's code
++ instead.
++ 
++ The problem is that, while obscuring the code keeps out the bad guys, it
++ also turns away the good guys.


Which is exactly my point.


Abigail
-- 
perl -weprint\<\<EOT\; -eJust -eanother -ePerl -eHacker -eEOT


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

Date: 19 Jan 1998 17:51:41 GMT
From: stanley@skyking.OCE.ORST.EDU (John Stanley)
Subject: Re: source into binary code
Message-Id: <6a03rd$ako$1@news.orst.edu>

In article <6a010v$74g$1@csnews.cs.colorado.edu>,
Tom Christiansen  <tchrist@mox.perl.com> wrote:
>In comp.lang.perl.misc, 
>    stanley@skyking.OCE.ORST.EDU (John Stanley) writes:
>:I have yet to see anyone refuse to buy Excel or Word because it wasn't
>:available in source. 
>
>Me.

Somehow I doubt that Microsoft will go bankrupt because of it. I doubt
that they even noticed.



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

Date: 19 Jan 1998 17:55:52 GMT
From: stanley@skyking.OCE.ORST.EDU (John Stanley)
Subject: Re: source into binary code
Message-Id: <6a0438$c7e$1@news.orst.edu>

In article <6a01j5$emr$1@client2.news.psi.net>,
Abigail <abigail@fnx.com> wrote:
>John Stanley (stanley@skyking.OCE.ORST.EDU) wrote on 1602 September 1993
>in <URL: news:69urj2$d01$1@news.orst.edu>:
>++ >Abigail wrote:
>++ >> 
>++ >> Certainly Dan has succeeded in "protected" his code, by making it
>++ >> harder to read the source than Betty's. So, why should people use
>++ >> Dan's code at all?
>++ 
>++ Because Dan's code runs reliably. Because Dan will support it if it
>++ doesn't. Because it runs on the platform it is needed on. Because it

>Then Dan's and Betty's code aren't equivalent and Betty's code can't
>be regarded as an 'easy alternative' for Dan's.

Of course it is an equivalent to Betty's, if all you want to do is foo
and don't care about support or quality. If all you want to do is foo,
then Betty's code is just fine. The criterion you presented was "does
foo". I just made your example fit real life a little more by adding in
other factors that sometimes mean more to the user than just "does
foo".



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

Date: Mon, 19 Jan 1998 12:29:30 -0500
From: "David Mohorn" <david.mohorn@sourcebbs.com>
Subject: Switch statement in Perl-5???
Message-Id: <01bd2500$72bda1e0$315c5499@user.ncr.com>

What?  Perl-5 doesn't have a switch statement like C?  How can I do a menu?


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

Date: Mon, 19 Jan 1998 13:49:54 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: Switch statement in Perl-5???
Message-Id: <comdog-ya02408000R1901981349540001@news.panix.com>
Keywords: from just another new york perl hacker

In article <01bd2500$72bda1e0$315c5499@user.ncr.com>, "David Mohorn" <david.mohorn@sourcebbs.com> posted:

>What?  Perl-5 doesn't have a switch statement like C?  How can I do a menu?

see the FAQ

   How do I create a switch or case statement? 

in perlfaq7.

-- 
brian d foy                                  <comdog@computerdog.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
Comprehensive Perl Archive Network (CPAN) <URL:http://www.perl.com>


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

Date: Mon, 19 Jan 1998 11:47:17 -0500
From: Dean Hoover <dhoover@textwise.com>
Subject: Re: Symbolic Links
Message-Id: <34C38395.A45@textwise.com>

Chris Hamilton wrote:
> 
> Is there a function or combination of functions that will tell you what
> file a symbolic link is pointing to?
> 
> --
> Chris Hamilton
> chrish@squonk.net
> http://www.squonk.net/users/chrish

readlink


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

Date: Mon, 19 Jan 1998 11:46:17 -0500
From: Dean Hoover <dhoover@textwise.com>
Subject: Use of uninitialized value at fastbib.pl line 103.
Message-Id: <34C38359.4C3B@textwise.com>

Why is this message emitted? The statement that it is warning on
looks like this:

	if (defined $oldhandler)

Obviously, I am attempting to do the right thing... So why
is it warning me?

Thanks in advance.

Dean Hoover


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

Date: Mon, 19 Jan 1998 13:53:46 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: Using Menus in Perl-5
Message-Id: <comdog-ya02408000R1901981353460001@news.panix.com>
Keywords: from just another new york perl hacker

In article <01bd22be$40309be0$315c5499@user.ncr.com>, "David Mohorn" <david.mohorn@sourcebbs.com> posted:

>I in the processing of reading Teach Yourself Perl-5 for Windows NT in 21
>Days.  I'm over half way done reading the book.  Perl seems to be very
>similar in syntax to C (which I'm already familiar with.)  The only thing I
>find lacking in Perl is a switch/case statement.

see the FAQ

   How do I create a switch or case statement? 

in perlfaq7.

-- 
brian d foy                                  <comdog@computerdog.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
Comprehensive Perl Archive Network (CPAN) <URL:http://www.perl.com>


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

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

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