[13902] in Perl-Users-Digest

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

No subject found in mail header

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Nov 10 17:44:59 1999

Date: Tue, 9 Nov 1999 18:05:16 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <942199516-v9-i1332@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Tue, 9 Nov 1999     Volume: 9 Number: 1332

Today's topics:
        "Cross-device link" *error* <elton_taupinNOelSPAM@altavista.net.invalid>
    Re: "Cross-device link" *error* (Kragen Sitaker)
        'dup'ing filehandles <rasmusin@erwin.wpi.edu>
    Re: -bv switch for sendmail <aqumsieh@matrox.com>
    Re: call an other script <cassell@mail.cor.epa.gov>
    Re: Calling an external routine. (Kragen Sitaker)
    Re: can per read an excel file (Kragen Sitaker)
    Re: can per read an excel file (brian d foy)
        exporting perl variable into and environment variable <ross.potter@nzl.xerox.com>
    Re: exporting perl variable into and environment variab (Matthew Bafford)
    Re: FAQ 4.67: How can I use a reference as a hash key? <cassell@mail.cor.epa.gov>
    Re: garbage collection (Ilya Zakharevich)
    Re: garbage collection <aqumsieh@matrox.com>
    Re: HELP: Insecure dependancy with mkdir () <jjames@atlantic.net>
    Re: How do I turn on NUM-LOCK on NT system? <cassell@mail.cor.epa.gov>
    Re: how to parse dir recursively for files? (Kragen Sitaker)
    Re: Language specifications (Alan Barclay)
    Re: Language specifications <lr@hpl.hp.com>
    Re: Language specifications <flavell@mail.cern.ch>
    Re: Language specifications <cassell@mail.cor.epa.gov>
    Re: list (array) programming question <skilchen@swissonline.ch>
    Re: list (array) programming question (Craig Berry)
        matching <dperrin@octane.bioc.uvic.ca>
        Multiplexing Server <curtisj@BannerFusion.com>
        MYSQL question sxbktm@my-deja.com
    Re: Newbie Help:  Splitting Large file into smaller fil (Kragen Sitaker)
    Re: Newbie: Need help parsing html file for links (Kragen Sitaker)
        No Fork in NT Perl and Print to socket hdesa@bellsouth.net
    Re: No Fork in NT Perl and Print to socket <cassell@mail.cor.epa.gov>
        parsing structured text (e.g., lisp or tcl output) <sds@goems.com>
    Re: parsing structured text (e.g., lisp or tcl output) (Ken Bandes)
    Re: parsing structured text (e.g., lisp or tcl output) <cassell@mail.cor.epa.gov>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Tue, 09 Nov 1999 15:12:32 -0800
From: Elton <elton_taupinNOelSPAM@altavista.net.invalid>
Subject: "Cross-device link" *error*
Message-Id: <054f0654.8297b8f7@usw-ex0108-062.remarq.com>

I have writen a script to move files from a directory
/home/cpoole/uploads to /home2/cpoole/html

The script fails when it trys to move fails to the home2
partition.

rename("$uploads/$cn/$word", "$customers2/$word") || die
("mv: $!");

The die message indicated Cross-device link. What does this
error mean and how do I fix it. When I do this at the prompt
using the mv command I don't get this error.

Thanks for any help!

elton


* Sent from AltaVista http://www.altavista.com Where you can also find related Web Pages, Images, Audios, Videos, News, and Shopping.  Smart is Beautiful


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

Date: Wed, 10 Nov 1999 00:11:40 GMT
From: kragen@dnaco.net (Kragen Sitaker)
Subject: Re: "Cross-device link" *error*
Message-Id: <0L2W3.61968$23.2394596@typ11.nn.bcandid.com>

In article <054f0654.8297b8f7@usw-ex0108-062.remarq.com>,
Elton  <elton_taupinNOelSPAM@altavista.net.invalid> wrote:
>I have writen a script to move files from a directory
>/home/cpoole/uploads to /home2/cpoole/html
>
>The script fails when it trys to move fails to the home2
>partition.
>
>rename("$uploads/$cn/$word", "$customers2/$word") || die
>("mv: $!");
>
>The die message indicated Cross-device link. What does this
>error mean and how do I fix it. When I do this at the prompt
>using the mv command I don't get this error.

'Cross-device' means from one disk to another.  You need to copy the
file, then delete the old one.  rename() is atomic, and cross-device
renames can't be atomic on simple filesystems like Unix's.

Bravo bravo for the die.
-- 
<kragen@pobox.com>       Kragen Sitaker     <http://www.pobox.com/~kragen/>
The Internet stock bubble didn't burst on 1999-11-08.  Hurrah!
<URL:http://www.pobox.com/~kragen/bubble.html>


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

Date: 09 Nov 1999 20:03:49 -0500
From: Frank Sweetser <rasmusin@erwin.wpi.edu>
Subject: 'dup'ing filehandles
Message-Id: <m3so2f40p6.fsf@erwin.wpi.edu>


help!

what i'm trying to do, is something along the lines of an inetd-style
server - fork, dup the socket -> stdin/stdout/stderr, and exec.  i'm trying
something like

use IO::Socket;

$sock = new IO::Socket::INET (...);
fork();
$fh = $sock->accept;

the dup stuff should go in here

exec(...)

now, i've already verified that the socket io is working fine - i can read
and write to it no problem... however, i just can't seem to redirect
STDIN/STDOUT/STDERR to go through the socket, so that the child process
inherits them.  any pointers?

-- 
Frank Sweetser rasmusin at wpi.edu fsweetser at blee.net  | PGP key available
paramount.ind.wpi.edu RedHat 5.2 kernel 2.2.5        i586 | at public servers
No, I'm not going to explain it.  If you can't figure it out, you didn't
want to know anyway...  :-)
             -- Larry Wall in <1991Aug7.180856.2854@netlabs.com>


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

Date: Tue, 9 Nov 1999 18:11:45 -0500 
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: -bv switch for sendmail
Message-Id: <x3yk8nrz2dq.fsf@tigre.matrox.com>


"John" <mjh@me.com> writes:

> How do use the -bv switch to test whether an e-mail address is valid or not.
> For example,
> 
> open (MAIL, "| /usr/sbin/sendmail -bv");

You do a 'man sendmail'. You don NOT post to a Perl newsgroup.

> Can I perform an if statement on the returned message?  Also, how would I
> specify the e-mail address.

Did you try anything?

--Ala



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

Date: Tue, 09 Nov 1999 16:37:40 -0800
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: call an other script
Message-Id: <3828BE54.5EBCFCDC@mail.cor.epa.gov>

Michiel Lankamp wrote:
> 
> How do I call a perl-script from an other perlscript and put the output of
> the script in a string?

Are you sure this is a good way to do what you want?  You
might want to re-think your requirements to figure out why
you feel that you need to do this.  There are better ways.
Use the perldoc program to find out more about some of the
Perl options, just by typing the following lines at a command
prompt:

perldoc -f system
perldoc perlop [look for 'qx']
perldoc -f require 
perldoc -f do

David
-- 
David Cassell, OAO                     cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician


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

Date: Tue, 09 Nov 1999 23:05:52 GMT
From: kragen@dnaco.net (Kragen Sitaker)
Subject: Re: Calling an external routine.
Message-Id: <kN1W3.61848$23.2390490@typ11.nn.bcandid.com>

In article <s2gtd4t86i738@corp.supernews.com>,
Mike Bowie - Go For Gold <mike@goforgold.com> wrote:
>I want to have a sparate file for each 'page' that my script calls.
>
>What do I need to put in 'master.pl' and 'slave'pl' to enable my to call a
>routine in slave from within master?

Put the routine in another file and require it.  Or, better yet, create
a Perl module (perldoc perlmod) and use it.
-- 
<kragen@pobox.com>       Kragen Sitaker     <http://www.pobox.com/~kragen/>
The Internet stock bubble didn't burst on 1999-11-08.  Hurrah!
<URL:http://www.pobox.com/~kragen/bubble.html>


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

Date: Tue, 09 Nov 1999 23:09:52 GMT
From: kragen@dnaco.net (Kragen Sitaker)
Subject: Re: can per read an excel file
Message-Id: <4R1W3.61856$23.2387198@typ11.nn.bcandid.com>

In article <3828875D.73BB86CB@yahoo.com>,
n.thiyagarajan <jazz108@yahoo.com> wrote:
>i need to write a script that can read an excel file...
>anybody know what format excel files are in.

Excel format, which is an OLE stream, IIRC.  Read it with Excel
(controlled via ODBC or OLE/ActiveX) if you can; otherwise look at
laola and MSWordView for a starting point.
-- 
<kragen@pobox.com>       Kragen Sitaker     <http://www.pobox.com/~kragen/>
The Internet stock bubble didn't burst on 1999-11-08.  Hurrah!
<URL:http://www.pobox.com/~kragen/bubble.html>


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

Date: Tue, 09 Nov 1999 19:05:58 -0500
From: brian@smithrenaud.com (brian d foy)
Subject: Re: can per read an excel file
Message-Id: <brian-ya02408000R0911991905580001@news.panix.com>

In article <8E79AE301dkhenderson@207.14.236.133>, dalekh@hotmail.com (d.k. henderson) posted:

> You can use an ODBC module to read the spreadsheet values. Search on ODBC at 
> www.cpan.org

There's even a Perl Journal article about it, by Jan Dubois.

-- 
brian d foy                    
CGI Meta FAQ <URL:http://www.smithrenaud.com/public/CGI_MetaFAQ.html>
Perl Monger Hats! <URL:http://www.pm.org/clothing.shtml>


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

Date: Wed, 10 Nov 1999 13:19:26 +1300
From: "Ross Potter" <ross.potter@nzl.xerox.com>
Subject: exporting perl variable into and environment variable
Message-Id: <80ae30$q70$1@news.wrc.xerox.com>

How do you export a perl variable into and environment variable so that it
can be used by other programs??

Thanks





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

Date: Wed, 10 Nov 1999 02:00:04 GMT
From: *@dragons.duesouth.net (Matthew Bafford)
Subject: Re: exporting perl variable into and environment variable
Message-Id: <slrn82hj5v.ecs.*@dragons.duesouth.net>

On Wed, 10 Nov 1999 13:19:26 +1300, "Ross Potter"
<ross.potter@nzl.xerox.com> enriched us with: 
: How do you export a perl variable into and environment variable so that it
: can be used by other programs??

This depends on how the other programs are going to be called.

If you wish for programs that your program runs (via exec, et al), all
you have to do is set the environment variable.  The variable will then
be passed down to the other programs.

    $ENV{'FOO_BAR'} = 42;

If, however, you want to run your program in a shell and have it
available after the program is run, you're going to have problems.

There are some ways for it to be done, read the perlfaq for more
information.

man perlfaq8
 ...
I {changed directory, modified my environment} in a perl script.  How
come the change disappeared when I exited the script?  How do I get my
changes to be visible?
 ...
 
: Thanks

HTH,

--Matthew


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

Date: Tue, 09 Nov 1999 16:50:53 -0800
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: FAQ 4.67: How can I use a reference as a hash key?
Message-Id: <3828C16D.B72903E1@mail.cor.epa.gov>

Kragen Sitaker wrote:
> 
> In article <38287BE4.3891B0BE@mail.cor.epa.gov>,
> David Cassell  <cassell@mail.cor.epa.gov> wrote:
> >Right.  So the problem is that the FAQ is not sufficiently clear
> >on the point.  As Kragen indicated.  Who's going to submit
> >a patch to the FAQ?
> 
> Is .pod the source format for the FAQ, or is it translated to .pod from
> some other format?

I've just sent plain text, but Tom will happily take a diff.
POD should be okay too.

David
-- 
David Cassell, OAO                     cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician


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

Date: 9 Nov 1999 23:15:37 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: garbage collection
Message-Id: <80a9up$6ov$1@charm.magnus.acs.ohio-state.edu>

[A complimentary Cc of this posting was sent to Jean-Louis Leroy 
<jll@skynet.be>],
who wrote in article <m3ogd3z3k0.fsf@enterprise.newedgeconcept>:
> Regarding persistence: yes persistence layers can't help being dragged
> into memory management issues. Perl is *almost* an ideal platform for
> implementing orthogonal persistence properly. What's missing are weak
> references :-(

Hmm, I though we have it already in the development branch, do not we?

> For passing mentions of persistence vs MM see the Tangram website
> (www.tangram-persistence.org) and browse the p5p archives.

Can you elaborate in several lines?
    * the complete [1]documentation (approx 2,700 lines)
is kinda scary...

Ilya


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

Date: Tue, 9 Nov 1999 18:12:45 -0500 
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: garbage collection
Message-Id: <x3yiu3bz2c2.fsf@tigre.matrox.com>


"Jean-Patrick Madelon" <balance08@bow.intnet.mu> writes:

> What kind of garbage collection and automatic resource does it have if any?

What is 'it'?

> How does that interfere with features of real-time response, persistence,
> transactions and finalizations?

ha?

--Ala



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

Date: Tue, 9 Nov 1999 20:45:33 -0500
From: Jeremy James <jjames@atlantic.net>
Subject: Re: HELP: Insecure dependancy with mkdir ()
Message-Id: <Pine.GSO.4.10.9911092028140.7914-100000@sparky.atlantic.net>

On Mon, 8 Nov 1999, John Feeney wrote:

> Hi all.
> 
> I decided to turn on tainting in a script (-T) and I'm getting an error
> message about an insecure dependancy with mkdir. The piece of code in
> question is as follows:
> 
> unless (-d $outdir) {
>  mkdir ($outdir, 0755) || croak "cannot mkdir($outdir) : $!";
>     }
>

from perlsec:

    You may not use data derived from outside your program to affect
    something else outside your program--at least, not by accident.

This should explain why it's complaining.  Though a work around might be
something like, 
    
    my $taintdir = <TAINTEDLOVE>;

    my ($outdir) = $taintdir =~ /^(.*)$/;
    unless (-d $outdir) {
        mkdir($outdir, 0755) || die "couldn't mkdir($outdir) : $!";
    }
 
> However, when I log in as root and run the script, there's no problem. I've
> read the perlsec page countless times but there's no reference to mkdir.
> Does anybody know what's going on here? Any help in solving this problem or
> advice on what to read up on will be greatly appreciated.

I tried this and absolutely nothing changed after doing an 'su -', though
I didn't log in directly as root (lazy) I don't see why there would be a
distiction with taint checking.

--
Jeremy James
Atlantic.Net Engineering




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

Date: Tue, 09 Nov 1999 16:35:18 -0800
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: How do I turn on NUM-LOCK on NT system?
Message-Id: <3828BDC6.7C87230F@mail.cor.epa.gov>

Eric Farr wrote:
> 
> Can someone show me how I would force the number-lock on in Perl code on an
> NT system?

There are lots of DOS programs which will do this.  Just call
one of them using the system() function.  To find out more,
type this at a command prompt:

perldoc -f system
perldoc perl

David
-- 
David Cassell, OAO                     cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician


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

Date: Tue, 09 Nov 1999 23:17:35 GMT
From: kragen@dnaco.net (Kragen Sitaker)
Subject: Re: how to parse dir recursively for files?
Message-Id: <jY1W3.61863$23.2392351@typ11.nn.bcandid.com>

In article <80a5on$jfe$1@nnrp1.deja.com>,  <mirranda@my-deja.com> wrote:
>guys,
>I need to get every file in every directory uner "my directory" that has
>".abc" extension and store it into an array.
>
>This is how far i got.  But I just get the directory names and not the
>files.
>
>@ARGV = qw(.) unless @ARGV;
>use File::Find ();
>sub find(&@) {&File::Find::find}
>*name = *File::Find::name;
>find { print $name if -d } @ARGV;

You want { push @files, $_ if /\.abc$/ } instead.
-- 
<kragen@pobox.com>       Kragen Sitaker     <http://www.pobox.com/~kragen/>
The Internet stock bubble didn't burst on 1999-11-08.  Hurrah!
<URL:http://www.pobox.com/~kragen/bubble.html>


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

Date: Tue, 09 Nov 1999 23:30:06 GMT
From: gorilla@elaine.drink.com (Alan Barclay)
Subject: Re: Language specifications
Message-Id: <942190526.779848@elaine.drink.com>

In article <01bf2a15$7dbbc240$330eead4@pat>,
Jean-Patrick Madelon <balance08@bow.intnet.mu> wrote:
>What kind of language specifications are available?
>Are they formal?
>Are there some standard?

Am I the only one reading these as homework questions?



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

Date: Tue, 9 Nov 1999 16:33:30 -0800
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: Language specifications
Message-Id: <MPG.12925d364c3c284c98a1c9@nntp.hpl.hp.com>

In article <942190526.779848@elaine.drink.com> on Tue, 09 Nov 1999 
23:30:06 GMT, Alan Barclay <gorilla@elaine.drink.com> says...
> In article <01bf2a15$7dbbc240$330eead4@pat>,
> Jean-Patrick Madelon <balance08@bow.intnet.mu> wrote:
> >What kind of language specifications are available?
> >Are they formal?
> >Are there some standard?
> 
> Am I the only one reading these as homework questions?

Of course they are.  But I couldn't figure out what university a 
Mauritius domain implied (I've never seen one before).  Is Mauritius now 
in the same business as Nuie (.nu) and Tonga (.to) -- selling domains to 
make money?

-- 
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: Wed, 10 Nov 1999 01:40:08 +0100
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: Language specifications
Message-Id: <Pine.HPP.3.95a.991110013928.14997A-100000@hpplus01.cern.ch>

On Tue, 9 Nov 1999, Alan Barclay wrote:

> Am I the only one reading these as homework questions?

Am I the only one interpreting some of the answers as troll-feed?




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

Date: Tue, 09 Nov 1999 17:14:06 -0800
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: Language specifications
Message-Id: <3828C6DE.E3454D80@mail.cor.epa.gov>

Alan Barclay wrote:
> 
> In article <01bf2a15$7dbbc240$330eead4@pat>,
> Jean-Patrick Madelon <balance08@bow.intnet.mu> wrote:
> >What kind of language specifications are available?
> >Are they formal?
> >Are there some standard?
> 
> Am I the only one reading these as homework questions?

Actually, Matthew Bafford's replies had "I believe this
is your homework and I am not happy about that" written
all over them.  Or so I thought.

David
-- 
David Cassell, OAO                     cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician


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

Date: Wed, 10 Nov 1999 01:59:23 +0100
From: "Samuel Kilchenmann" <skilchen@swissonline.ch>
Subject: Re: list (array) programming question
Message-Id: <80ag43$oci5$1@fu-berlin.de>

Larry Rosler <lr@hpl.hp.com> wrote in message
news:MPG.12921052385cf45198a1c7@nntp.hpl.hp.com...
>
[...]
> To quote from
> "Mastering Algorithms with Perl":  ....
>
[...]
> the question asked, which is how to
> generate the 'power set' of a set ...
>
> The book I referred to above doesn't have an algorithm to generate
> the power set, just to count the number of permutations and
> combinations. But someone else posted an algorithm here today.
>
The book covers powersets on pages 235-239, but the algorithms
presented (an iterative and a recursive one) are a little bit strange
compared to the extremely elegant examples shown here by Kevin
Campbell and Abigail.






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

Date: Wed, 10 Nov 1999 01:17:21 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: list (array) programming question
Message-Id: <s2hht1r66i759@corp.supernews.com>

Paul Heinrich (heinrich@bucknell.edu) wrote:
: like the program to return the following:
: 
: one
: one two
: one three
: one two three
: two
: two three
: three

That specific ordering isn't provided, but this code generates the
combinations in a reasonably direct way:

#!/usr/bin/perl -w
# combine - display all nonempty combinations of the arguments
# Craig Berry (19991109)

use strict;

my @combos = combine(@ARGV);

foreach my $ar (@combos) {
  print join(' : ', @$ar), "\n" if @$ar;
}


sub combine {
  return ([]) unless @_;

  my $elem   = shift;
  my @combos = combine(@_);
  my @expand = @combos;

  # The new list of combinations consists of the recursively
  # generated combinations from rightward elements in the
  # original list, plus another complete set of these combos
  # with the current element prepended.  In other words,
  # each element can be either present or absent, and we
  # include a recursive subtree for each option.

  foreach my $ar (@combos) {
    my @copy = @$ar;
    unshift @copy, $elem;
    unshift @expand, [@copy];
  }

  return @expand;
}

__END__

Demo:

/usr2/people/cberry > combine one two three
one
one : three
one : two : three
one : two
two
two : three
three

-- 
   |   Craig Berry - cberry@cinenet.net
 --*--  http://www.cinenet.net/users/cberry/home.html
   |   "They do not preach that their God will rouse them
      a little before the nuts work loose." - Kipling


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

Date: Tue, 09 Nov 1999 17:38:20 -0800
From: David Perrin <dperrin@octane.bioc.uvic.ca>
To: cgarwood@gulf.uvic.ca
Subject: matching
Message-Id: <3828CC8C.3BECA448@octane.bioc.uvic.ca>

Hi.

I'm a co-op student working on a Perl project.  I have two arrays and
I'm comparing each element in one to each element in the other.  If
there is NOT a match of the element in the first array to any in the
second array then that element is sent to a third array.  Once this
comparison is done then for each element in the third array the program
goes through a file to grab out lines containing this element.  

The problem I'm having is that it's grabbing the wrong lines and I can't
figure out why.  Here's the snippet that relates to what I'm talking
about.  I've print the value and it does match what I want but somehow
in the conditional statement it doesn't seem to catch it.  Any help
would be most appreciated.  Thanks.  e-mail:  cgarwood@gulf.uvic.ca

         open(NEWFILEB, "<$filename");
        open(NEWDELTA, ">>$deltaname");

        for($cnt = 0; $cnt <=  $index_max_delta_id; $cnt++) {
           $temporary = 0;
           print "value is:  $thatarray[$cnt]\n";
           # open(NEWFILEB, "<$filename");
           # open(NEWDELTA, ">>$deltaname");
           SONOFZORK: while(<NEWFILEB>) {
              if ($_ =~ "<PRE>") {
                 $temporary = 1;
              }
              if (($_ =~ /$thatarray[$cnt]/) && ($_ =~ "<a name =") &&
($temporary == 1)) {
                 print NEWDELTA "<PRE>\n";
                 last SONOFZORK;
              }
              if (eof(NEWFILEB)) {
                 last SONOFZORK;
              }
           }
           until (($_ =~ "<PRE>") || ($_ =~ "Database: Non-redundant
GenBank CDS")) {
              print NEWDELTA $_;
              $_ = <NEWFILEB>;
           }
           # close(NEWDELTA);
           # close(NEWFILEB);
        }
        close(NEWDELTA);
        close(NEWFILEB);


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

Date: Wed, 10 Nov 1999 00:10:51 GMT
From: Curtis Jones <curtisj@BannerFusion.com>
Subject: Multiplexing Server
Message-Id: <80ad68$p27$1@nnrp1.deja.com>

I had a piece of server software written in Perl, which used forks to
allow for multiple simultaneous connections, but after a while, I
realized I really needed a multiplexing server. It now uses IO::Select to
check for an incoming connection, and process it without blocking other
processes. Anyway - I need to be able to get the IP address of the client
who is connecting to the server, and I can't seem to figure it out.

Below is the little bit of code which does the actual socket stuff.

-Curtis
curtisj@BannerFusion.com

-------------------------
   my $rh = new IO::Select();
   $rh->add( $s );
   &misc_print( "-> Waiting for connection." );
   while ( 1 ) {
      my ( $nr ) = IO::Select->select( $rh, undef, undef, 0 );
      foreach $sock ( @$nr ) {
         if ( $sock == $s ) {
            my $ns = $sock->accept();
            $rh->add( $ns );
         } else {
            my $buf = <$sock>;
            if ( $buf ) {
               $stats{'connect_count'}++;
               print "buf: $buf\n";
               $rh->remove( $sock );
               close( $sock );
            } else {
               $rh->remove( $sock );
               close( $sock );
            }
         }
      }
      sleep 0.5;
   }
------------------------


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


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

Date: Tue, 09 Nov 1999 23:21:14 GMT
From: sxbktm@my-deja.com
Subject: MYSQL question
Message-Id: <80aa96$mtf$1@nnrp1.deja.com>

Hi all,

Can Mysql do select(distinct(count))?
How about nested selects.

I'd appreciate an answer, since I think MySQL is really good for what I
am doing.  I just hope the answers to the above questions is 'yes'.

BTW, is there a dedicated MYSQL forum.

Thanks in advance.


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


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

Date: Tue, 09 Nov 1999 23:19:10 GMT
From: kragen@dnaco.net (Kragen Sitaker)
Subject: Re: Newbie Help:  Splitting Large file into smaller files
Message-Id: <OZ1W3.61865$23.2392445@typ11.nn.bcandid.com>

In article <38289BE8.A0B8EB5E@ucop.edu>,
S. Isaacs <Susan.Isaacs@ucop.edu> wrote:
>Your help would be most appreciated,

For each input line,
  switch output files if it looks like a separator line.
  write it to the current output file, whether it does or not.

Let us know if you have trouble translating some part of this into Perl.
-- 
<kragen@pobox.com>       Kragen Sitaker     <http://www.pobox.com/~kragen/>
The Internet stock bubble didn't burst on 1999-11-08.  Hurrah!
<URL:http://www.pobox.com/~kragen/bubble.html>


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

Date: Tue, 09 Nov 1999 23:11:59 GMT
From: kragen@dnaco.net (Kragen Sitaker)
Subject: Re: Newbie: Need help parsing html file for links
Message-Id: <3T1W3.61859$23.2391528@typ11.nn.bcandid.com>

In article <80a4bv$l9f$1@sherman.pixar.com>,
Dan Lyke <danlyke@news.pixar.com> wrote:
>You might also consider subclassing the HTML::Parser to do this, as
>it'll save you work in parsing out $2 as this expression gives it to
>you.

Indeed, someone has already done this; it's on CPAN as
HTML::LinkExtor.  I used it to write a web robot Monday morning.  It's
a little harder to use than one might like, but it's not too bad.

>On the other hand I've worked with enough "almost HTML" files to
>know that sometimes "RE"s are the winning technology.

Yes.  But you should probably try HTML::LinkExtor first. :)
-- 
<kragen@pobox.com>       Kragen Sitaker     <http://www.pobox.com/~kragen/>
The Internet stock bubble didn't burst on 1999-11-08.  Hurrah!
<URL:http://www.pobox.com/~kragen/bubble.html>


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

Date: Tue, 09 Nov 1999 23:07:25 GMT
From: hdesa@bellsouth.net
Subject: No Fork in NT Perl and Print to socket
Message-Id: <80a9fa$maj$1@nnrp1.deja.com>

1. Fork is not supported in the Perl verison that comes with the NT
Resource Kit. Is there another perl, that runs on NT, that has Fork.

2. I have written two "plain jane" routines (Client/Server) that uses
TCP sockets to send typed input from a client to a server. Socket, Bind
and Connect work like a charm. But when I "print" to the socket, the
app freezes AFTER the data reached and is displayed at the server. The
server also freezes up.

Can someone help.... The above ap. is taken from Programming Perl
(O'Reily).

Thanks


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


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

Date: Tue, 09 Nov 1999 17:12:04 -0800
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: No Fork in NT Perl and Print to socket
Message-Id: <3828C664.4C60E58C@mail.cor.epa.gov>

hdesa@bellsouth.net wrote:
> 
> 1. Fork is not supported in the Perl verison that comes with the NT
> Resource Kit. Is there another perl, that runs on NT, that has Fork.

Good news: yes;
Bad news:  get ready to install Perl by yourself.

You can install Perl using cygwin32 and egcs.  This was covered 
in an article in the Spring 1999 issue of The Perl Journal.
You'll get fork(), but everything will be noticeably slower.
after all, you're running on top of middleware now.

Otherwise, wait until next year, when ActiveState's Perl will
come out with a functional emulation of fork() .

Or you could install linux or FreeBSD on that box and have
fork() to play with...

David
-- 
David Cassell, OAO                     cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician


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

Date: 09 Nov 1999 18:39:34 -0500
From: Sam Steingold <sds@goems.com>
Subject: parsing structured text (e.g., lisp or tcl output)
Message-Id: <uhfivi6a1.fsf@ksp.com>

I looked at the FAQs, but could not find any references:

Suppose I need to parse some structured text, like this

(first (1 2 3 4) (5 (6 (7) 8) 9) 10)

the spaces could be any /\s+/; instead of "()" I might have "{}" or "[]"
or whatever.

I want to get an array with 4 elements - (1) "first", (2) reference to
an array (1, 2, 3, 4), (3) reference to another array of 3 elements and
(4) "10".

Another thing: a text file with data like this:

-----
name= "first" type=
        "character" values= {"a", "1", "x"}
name= "second" format= "%s" 
-----

You get the idea - basically, I want the full power of the lisp's READ.

Thanks.

-- 
Sam Steingold (http://www.podval.org/~sds/)
Micros**t is not the answer.  Micros**t is a question, and the answer is Linux,
(http://www.linux.org) the choice of the GNU (http://www.gnu.org) generation.
If I had known that it was harmless, I would have killed it myself.


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

Date: Wed, 10 Nov 1999 00:43:54 GMT
From: kbandes@home.com (Ken Bandes)
Subject: Re: parsing structured text (e.g., lisp or tcl output)
Message-Id: <8E79CF61Akbandeshomecom@192.168.123.1>

sds@goems.com (Sam Steingold) wrote in <uhfivi6a1.fsf@ksp.com>:
>Suppose I need to parse some structured text, like this
>
>(first (1 2 3 4) (5 (6 (7) 8) 9) 10)
>
>the spaces could be any /\s+/; instead of "()" I might have "{}" or 
"[]"
>or whatever.
 ...
>You get the idea - basically, I want the full power of the lisp's 
READ.

You need a parser.  (Not a regular expression - if you're not sure
why, read "How do I find matching/nesting anything?" in
perlfaq4).  Look into Parse::RecDescent, which is available
on CPAN.

Ken Bandes


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

Date: Tue, 09 Nov 1999 17:16:00 -0800
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: parsing structured text (e.g., lisp or tcl output)
Message-Id: <3828C750.BFF73959@mail.cor.epa.gov>

Sam Steingold wrote:
> 
> I looked at the FAQs, but could not find any references:
> 
> Suppose I need to parse some structured text, like this
> 
> (first (1 2 3 4) (5 (6 (7) 8) 9) 10)
> 
> the spaces could be any /\s+/; instead of "()" I might have "{}" or "[]"
> or whatever.

You may find the Parse::RecDescent module to be what you're
looking for.  It's available at CPAN [www.cpan.org].

David
-- 
David Cassell, OAO                     cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician


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

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


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