[8802] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 2419 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Apr 26 01:03:11 1998

Date: Sat, 25 Apr 98 22: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, 25 Apr 1998     Volume: 8 Number: 2419

Today's topics:
        == vs. eq <kelby@mplx.com>
    Re: == vs. eq <tchrist@mox.perl.com>
    Re: == vs. eq (Jonathan Stowe)
    Re: == vs. eq (John Moreno)
    Re: == vs. eq <gwynne@utkux.utk.edu>
    Re: Bye All :-) (Craig Simpson)
    Re: Bye All :-) (I R A Aggie)
    Re: Bye All :-) <gwynne@utkux.utk.edu>
    Re: can ne, not equal, ne? <uri@sysarch.com>
        can USE or REQUIRE use expressions for variable assignm <dtbaker_@flash.net>
    Re: can USE or REQUIRE use expressions for variable ass <jdf@pobox.com>
    Re: can USE or REQUIRE use expressions for variable ass <jdf@pobox.com>
    Re: commenting a whole block? (Michal Jaegermann)
        Help with cgi script <mhanson@wyoming.com>
    Re: Help with cgi script (Jonathan Stowe)
        help...can't rcp a file to another machines <dmwaff@erols.com>
        Implementing sh in perl <lamber45@EGR.msu.edu>
        Manipulating serial ports with Perl mhannam@gardner-webb.edu
        Minneapolis Perl Mongers Meeting <spimac@inetsource.com>
    Re: newbie question (Craig Simpson)
        perl 5.004 is better than 5.004004 ?! <captain@pirate.de.nospam-delete-this>
    Re: perl 5.004 is better than 5.004004 ?! (Jason Gloudon)
        Perl's non-blocking socket support sucks!  Please help! (Damon Hastings)
    Re: Perl-only distribution (was Re: How do I build Linu <shimpei+usenet+.mil+.gov@BOFH.patnet.caltech.edu>
        Reg Exp problem troxel@sammcgees.com
        RFI:  Counting repeated substrings within a string (Alfred Landrum)
        Shopping Cart in Perl tietzmann@yahoo.com
        Wanted: Your Perl Hacks gzoller@hotmail.com
    Re: Wanted: Your Perl Hacks <ajohnson@gpu.srv.ualberta.ca>
    Re: Why doesn't this work? (Jonathan Stowe)
        Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: Sat, 25 Apr 1998 16:35:06 -0400
From: "Kelby Valenti" <kelby@mplx.com>
Subject: == vs. eq
Message-Id: <6hthfs$g7r@aaron.hamilton.edu>

What exactly is the difference between == and eq in an if statement.  Also
is there a function that can tell me whether a string is numbers or chars.
Thanks, Kelby




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

Date: 25 Apr 1998 22:10:40 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: == vs. eq
Message-Id: <6htn10$pu3$1@csnews.cs.colorado.edu>


In comp.lang.perl.misc, "Kelby Valenti" <kelby@mplx.com> writes:
:What exactly is the difference between == and eq in an if statement.  Also
:is there a function that can tell me whether a string is numbers or chars.

The way of the post-docu-literate future.  Lovely.  Should have 
seen it coming:

    X-Newsreader: Microsoft Outlook Express 4.71.1712.3
    X-MimeOLE: Produced By Microsoft MimeOLE V4.71.1712.3

--tom
-- 
	Tom Christiansen	tchrist@jhereg.perl.com

    /* now make a new head in the exact same spot */
            --Larry Wall in cons.c from the perl source code


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

Date: Sat, 25 Apr 1998 06:59:35 GMT
From: Gellyfish@btinternet.com (Jonathan Stowe)
Subject: Re: == vs. eq
Message-Id: <3541829d.96730559@news.btinternet.com>

On 25 Apr 1998 22:10:40 GMT, Tom Christiansen wrote :

>
>In comp.lang.perl.misc, "Kelby Valenti" <kelby@mplx.com> writes:
>:What exactly is the difference between == and eq in an if statement.  Also
>:is there a function that can tell me whether a string is numbers or chars.
>
>The way of the post-docu-literate future.  Lovely.  Should have 
>seen it coming:
>
>    X-Newsreader: Microsoft Outlook Express 4.71.1712.3
>    X-MimeOLE: Produced By Microsoft MimeOLE V4.71.1712.3
>
Ho,hum

Thats the "aborted excuse for a newsreader" I seem to recall.

/J\


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

Date: Sun, 26 Apr 1998 01:12:44 GMT
From: phenix@interpath.com (John Moreno)
Subject: Re: == vs. eq
Message-Id: <1d82760.s7l4461fncqr9N@roxboro0-033.dyn.interpath.net>

Tom Christiansen <tchrist@mox.perl.com> wrote:

> In comp.lang.perl.misc, "Kelby Valenti" <kelby@mplx.com> writes:
> :What exactly is the difference between == and eq in an if statement.  Also
> :is there a function that can tell me whether a string is numbers or chars.
> 
> The way of the post-docu-literate future.  Lovely.  Should have 
> seen it coming:
> 
>     X-Newsreader: Microsoft Outlook Express 4.71.1712.3
>     X-MimeOLE: Produced By Microsoft MimeOLE V4.71.1712.3
> 

The idea that you can tell (negatively at least) how competent a person
is by what newsreader they use has a certain appeal.  But I think it's
not going to fly in the end.  As long as they can be configured not to
do things that are actively harmfully you're going to get people using
all of them.

-- 
John Moreno


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

Date: Sat, 25 Apr 1998 23:28:27 -0400
From: "Bob Gwynne" <gwynne@utkux.utk.edu>
Subject: Re: == vs. eq
Message-Id: <6hu9n1$ceb$1@gaia.ns.utk.edu>

Get a copy of Learning Perl by Randal Schwartz & Tom Christiansen.  The
answers are in there. If you want a more basic book, try Perl5 Interactive
Course by Jon Orwant.  I don't know about other operating systems; however,
if it's Unix, you can type perldoc perlop and perldoc perlfunc at the prompt
and get info about your questions. There is also a FAQ at
http://www.perl.com/CPAN-local/doc/FAQs/FAQ/PerlFAQ.html.  The FAQ also
comes with Perl when you download it.

In this group, you do not want to ask a question until you have consulted
the above sources.  You have to make an effort to learn the basics on your
own.  If you do, you'll get an answer like the one Mr. Christiansen gave.
Consider yourself lucky that Abigail did not answer.  Never mind, I'll
answer for her: "RTFM".

Bob Gwynne
University of Tennessee



Kelby Valenti wrote in message <6hthfs$g7r@aaron.hamilton.edu>...
>What exactly is the difference between == and eq in an if statement.  Also
>is there a function that can tell me whether a string is numbers or chars.
>Thanks, Kelby
>
>




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

Date: Sat, 25 Apr 1998 23:33:36 GMT
From: craigs@3rdstone.net (Craig Simpson)
Subject: Re: Bye All :-)
Message-Id: <354272b4.85280697@209.76.252.8>


Are you two day sfrom Death, How do you all of a sudden "give up"
perl?


On Sat, 25 Apr 1998 15:48:50 GMT, Bill 'Sneex' Jones
<bill@astro.fccj.cc.fl.us> wrote:

>I just wanted to say I have enjoyed hangin' out here
>and reading everyones queries and other's answers or flames :-)
>
>I will miss you! :-)
>
>C'Ya, and take care!
>Sneex
>____________________________________________________________________________
>Bill Jones | FCCJ Webmaster | Voice 904-632-3089 | Fax 904-632-3007
>Florida Community College at Jacksonville | 501 W. State St. | Jax, FL 32202
>mailto:webmaster@fccjmail.fccj.cc.fl.us | http://www.fccj.cc.fl.us



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

Date: Sat, 25 Apr 1998 22:25:01 -0500
From: fl_aggie@thepentagon.com (I R A Aggie)
Subject: Re: Bye All :-)
Message-Id: <fl_aggie-2504982225020001@aggie.coaps.fsu.edu>

In article <354134d5.84229300@news.btinternet.com>,
Gellyfish@btinternet.com wrote:

+ Whats going on:  you going to the chair,

Why, yes, we still use ol' Sparky...

+ they banned usenet in Florida,

Better not have...or I'll be pissed.

James

-- 
Consulting Minister for Consultants, DNRC
The Bill of Rights is paid in Responsibilities - Jean McGuire
To cure your perl CGI problems, please look at:
<url:http://www.perl.com/CPAN-local/doc/FAQs/cgi/idiots-guide.html>


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

Date: Sun, 26 Apr 1998 00:00:33 -0400
From: "Bob Gwynne" <gwynne@utkux.utk.edu>
Subject: Re: Bye All :-)
Message-Id: <6hubj4$df5$1@gaia.ns.utk.edu>

Maybe he's running off to New Zealand to marry Abigail.

Bob Gwynne

Craig Simpson wrote in message <354272b4.85280697@209.76.252.8>...
>
>Are you two day sfrom Death, How do you all of a sudden "give up"
>perl?
>
>
>On Sat, 25 Apr 1998 15:48:50 GMT, Bill 'Sneex' Jones
><bill@astro.fccj.cc.fl.us> wrote:
>
>>I just wanted to say I have enjoyed hangin' out here
>>and reading everyones queries and other's answers or flames :-)
>>
>>I will miss you! :-)
>>
>>C'Ya, and take care!
>>Sneex
>>__________________________________________________________________________
__
>>Bill Jones | FCCJ Webmaster | Voice 904-632-3089 | Fax 904-632-3007
>>Florida Community College at Jacksonville | 501 W. State St. | Jax, FL
32202
>>mailto:webmaster@fccjmail.fccj.cc.fl.us | http://www.fccj.cc.fl.us
>




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

Date: 26 Apr 1998 00:53:08 -0400
From: Uri Guttman <uri@sysarch.com>
To: scott@rappahannock-web.com
Subject: Re: can ne, not equal, ne?
Message-Id: <x7vhrxchfv.fsf@sysarch.com>

>>>>> "s" == scott  <scott@rappahannock-web.com> writes:

well you have one main bug and many minor bugs and weak code points. i
will try to comment on all of them

first are you using -w?

  s> $the_current_year = `date +"%Y"`;
  s>         chop($the_current_year);
  s> $datem = `date +"%m"`;
  s>         chop($datem);
  s> $dated = `date +"%d"`;
  s>         chop($dated);
        
  s> $plog_str = "$the_current_year$datem$dated";

ths whole section could be done several better ways. why not call date
once with the full format string? and use chomp and not chop as it is
better and more accurate as it remove only a trailing newline

	chomp( $plog_str = `date +%Y%m%d` ) ;

or even better use the strftime in the POSIX module so you don't have to
call a subprocess.

  s> &CheckPlog;

  s> #        check the log to see if database might need
  s> #        pruning

  s> sub CheckPlog
  s> {        
  s> open (PLOG, ">$prune_log");

you don't check open for an error. and the file is open for writing and
not reading so you will never read a line. use

	open(PLOG, "+>$prune_log") or die "can't open $prune_log $!" ;

  s> while (<PLOG>){$plog_date = "$_";}

you don't need "" to assign a var. why do you use while here? is the file
more than one line long? it would be cleaner to write:

	while (defined ($plog_date = <PLOG>)){}

and the main bug is that you don't chomp the newline off this line so it
will never match the generated date

	chomp( $plog_date ) ;

  s> if ($plog_date ne $plog_str){&Prune}
    
  s>     print  PLOG "$plog_str";

again you don't need "" for a simple var. but if you want lines of dates
you have to add a newline. the data format you write doesn't match the
data you expect. you write without newlines but you use a line input
reading loop. it is inconsistant.

	print PLOG "$plog_str\n";

  s>     close (PLOG);
  s>    }#      end CheckPlog


hth,

uri

-- 
Uri Guttman  -----------------  SYStems ARCHitecture and Software Engineering
Perl Hacker for Hire  ----  8 Years of Perl Experience, Available Immediately
uri@sysarch.com  ---------  Resume and Perl Example at http://www.sysarch.com
Use the Best Search Engine on the Net  --------  http://www.northernlight.com


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

Date: Sat, 25 Apr 1998 15:11:36 -0600
From: Dan Baker <dtbaker_@flash.net>
Subject: can USE or REQUIRE use expressions for variable assignments?
Message-Id: <35425188.52A8@flash.net>

I have looked thru several books and some source code, and have never
seen require statements inside logical blocks, or using defined
variables or expressions to define what module to use (or require). 

Is it possible to put require or use statements inside logic, or use
variables in the pathname to the file to require?

for example, could I do this?:

	# decide what menu data to load
	if ($something) { $TheParamFile="ParamFile1" }
	elsif ($something2) { $TheParamFile="ParamFile2" }
	elsif ($something3) { $TheParamFile="ParamFile3" }
	# load up the assignments
	require $TheParamFile
	# and proceed to build menus with the variables assigned
	#...

What I'm considering may be a strange(mis)use of the require
statement... what I'm trying to figure out is a way to have my main perl
program load up arrays and hashes for menu selections in a
context-sensitive fashion without having to open and read text files to
do it. I want to extract all the lists that will be used to build menu
choices and various other lists to routines that would have a minimum of
embedded logic to make it easy for non-programmers to maintain and
extend the menus without needing to learn much about perl.

Are there better ways to do this sort of thing?

thanx,

Dan



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

Date: 25 Apr 1998 23:14:47 -0500
From: Jonathan Feinberg <jdf@pobox.com>
To: dtbaker@flash.net
Subject: Re: can USE or REQUIRE use expressions for variable assignments?
Message-Id: <4szhqkw8.fsf@mailhost.panix.com>

Dan Baker <dtbaker_@flash.net> writes:

> Is it possible to put require or use statements inside logic, or use
> variables in the pathname to the file to require?

Go to DejaNews and search for the following thread; Tom Christiansen
posted a long and detailed answer.

    "How to load the mosule with calculated name?"

-- 
Jonathan Feinberg   jdf@pobox.com   Sunny Brooklyn, NY


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

Date: 25 Apr 1998 23:16:01 -0500
From: Jonathan Feinberg <jdf@pobox.com>
Subject: Re: can USE or REQUIRE use expressions for variable assignments?
Message-Id: <1zulqku6.fsf@mailhost.panix.com>

Jonathan Feinberg <jdf@pobox.com> writes:

>     "How to load the mosule with calculated name?"

    s/s/d/;

-- 
Jonathan Feinberg   jdf@pobox.com   Sunny Brooklyn, NY


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

Date: 25 Apr 1998 21:03:10 GMT
From: michal@gortel.phys.ualberta.ca (Michal Jaegermann)
Subject: Re: commenting a whole block?
Message-Id: <6htj2e$ktm$1@pulp.ucs.ualberta.ca>

Stefan Berglund (f94stbe@dd.chalmers.se) wrote:
: press s/^/# / and press return. Finished!

Oh, I would love to see that "s/^/# /" keypress (said typing that in
vim; but for a real work I use a real editor :-).

  --mj


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

Date: Sat, 25 Apr 1998 15:02:13 -0600
From: Michael Hanson <mhanson@wyoming.com>
Subject: Help with cgi script
Message-Id: <35424F36.4065@wyoming.com>

I'm attrmpting to write a script that submits a link to multiple copies
of Matt's freefor all Links script.  I've been trying to base it on a
"search engine spammer" that works great, using the perl5 socket library
like this:

$port = 80;
        $remote = "add-url.altavista.digital.com";
        $add="/cgi-bin/newurl?ad=1&q=$url";
        $submit = "GET $add HTTP/1.0\n\n";
        if ($port =~ /\D/) { $port = getservbyname($port, 'tcp') }
        die "No port specified." unless $port;
        $iaddr   = inet_aton($remote)               || die "Could not
find host: $remote";
        $paddr   = sockaddr_in($port, $iaddr);
        $proto   = getprotobyname('tcp');
        socket(SOCK, PF_INET, SOCK_STREAM, $proto)  || die "socket: $!";
        connect(SOCK, $paddr)    || die "connect: $!";
        send(SOCK,$submit,0);
        while(<SOCK>) {
                $success = 1 if ($_ =~ /will be indexed/)
        }
 
        if($success != 1) {
                print "Addition to Altavista failed for unknown reason.
(Perhaps it already exists)<BR>\n";
                return 1;
        }
        return 0;

Unfortunately, this technique seems to get no results when I substitute
other values for $remote, and $add.  Ive tried changing ports, and
changing the request method to POST.  Neither seems to help.
Deadlines are looming, and any help will be greatly appreciated.
Thanks,
Michael Hanson
Parnassus Information Assistance
http://www.wyoming.com/~hanson/PIA-home/


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

Date: Sat, 25 Apr 1998 06:59:37 GMT
From: Gellyfish@btinternet.com (Jonathan Stowe)
Subject: Re: Help with cgi script
Message-Id: <3541846f.97196378@news.btinternet.com>

On Sat, 25 Apr 1998 15:02:13 -0600, Michael Hanson wrote :

>I'm attrmpting to write a script that submits a link to multiple copies
>of Matt's freefor all Links script.  I've been trying to base it on a
>"search engine spammer" that works great, using the perl5 socket library
>like this:
>
<snip>

>Unfortunately, this technique seems to get no results when I substitute
>other values for $remote, and $add.  Ive tried changing ports, and
>changing the request method to POST.  Neither seems to help.
>Deadlines are looming, and any help will be greatly appreciated.

If things are as you describe then this is *not* a Perl problem.  You
will need to choose the correct method and query for each for each
server. 

You might however consider using the LWP modules available from CPAN
to achieve this task as this should simplify the task.

/J\
Jonathan Stowe
Some of your questions answered http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm


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

Date: Sat, 25 Apr 1998 17:53:01 -0400
From: "David Waffen" <dmwaff@erols.com>
Subject: help...can't rcp a file to another machines
Message-Id: <6htlsd$ntl$1@winter.news.erols.com>


I have written a Perl script to run on Unix.  It is a remove_user script.
The whole script depends on rcp'ing a LOG file to a remote site and placing
the LOG file in the users home directory, as well as rcp'ing the tar'ed up
home back to my server for achieving.  I has completed the entire thing.  I
only portion that does not work is rcp.  I have a "God" machine with root
mounts and my machine is in every machine's root .rhosts file.


Problem is:  rcp takes the LOG file and just "touches" an empty file in the
user's home.  It does not transfer any of the contents of the LOG.

Syntax used:  system ("rcp -p  /Admin/Boneyard/LOGS/$user/.rm_usr.log
SERVER: /Users/$user");


Please Help,
I have been working on this script for a month.

david.waffen@mci.com or dmwaff@erols.com






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

Date: Sat, 25 Apr 1998 19:17:00 -0400
From: David Lee Lambert <lamber45@EGR.msu.edu>
Subject: Implementing sh in perl
Message-Id: <Pine.GSO.3.96.980425190915.18328A-100000@area51>

I'm thinking of writing a replacement Bourne shell in perl.  Has anyone
else already done this,  or tried to?  What minimum of commands would I
have to implement to make most shell scripts continue to work,  or to
achieve POSIX compliance?  Is there some reason why this cannot be done in
perl?

(I want to do this so I can make a perl-based Linux distribution,  with
all system startup files written in perl,  and without the need to install
bash.  I use bash on my Linux box and a friend's Linux box, and I find
myself invoking it regularly on a Solaris network where the
administrators refuse to make anything but csh or tcsh the login shell.)

-- 
m/lamber45\100(egr|pilot)\.msu\.edu/ and print <<MHM16x20
David Lee Lambert -- Just another perl hacker
webstuph at http://web.egr.msu.edu/~lamber45
MHM16x20



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

Date: Sat, 25 Apr 1998 23:40:20 -0600
From: mhannam@gardner-webb.edu
Subject: Manipulating serial ports with Perl
Message-Id: <6huds0$mrv$1@nnrp1.dejanews.com>

For my final exam in a networking class, I'm trying to toggle an LED light on
the serial port of a remote computer via the internet.  The LED is on pins 10
and 15 of a RS-232 DB25 connector.  Can I use Perl to turn the LED on/off?
Could I accomplish a task like that with Perl by enabling/disabling the port?
Thanks for any wisdom.  Matt

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


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

Date: Sat, 25 Apr 1998 23:24:35 -0500
From: Patrick McNamee <spimac@inetsource.com>
Subject: Minneapolis Perl Mongers Meeting
Message-Id: <3542B703.55A7@inetsource.com>

The first meeting of Minneapolis Perl Mongers will be held as follows:

When: Tuesday, April 28, 1998, 7pm to 8pm (or later)

Where: Starbuck's in the Barnes and Noble at Har Mar Mall in Roseville

For more info, contact:

Patrick McNamee
spimac@inetsource.com


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

Date: Sat, 25 Apr 1998 23:38:10 GMT
From: craigs@3rdstone.net (Craig Simpson)
Subject: Re: newbie question
Message-Id: <35427356.85442840@209.76.252.8>


Yes. As a matter of fact it is a great way to learn how to run a whole
darn ISP. You can get into sendmail, apache, DNS, and every thing
else. You could host several domains. Alias a whole Class C on you
ethernet card. You could set up Sendmail to do Major Domo and have
multiple domains with sendmail knowing the difference between
me@this.com and me@that.com. 


On Sat, 25 Apr 1998 12:56:31 -0400, "Igor I. Tovstopyat-Nelip"
<itovsto@emory.edu> wrote:

>Hi everybody,
>
>Is it possible/reasonable to learn the CGI programming and to test scripts
>on a stand-alone machine (PC under the Linux OS) running an Apache server? 
>
>Thank you for your patience.
>
>  Igor.
>
>



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

Date: Sun, 26 Apr 1998 03:44:17 +0200
From: Mark Seuffert <captain@pirate.de.nospam-delete-this>
Subject: perl 5.004 is better than 5.004004 ?!
Message-Id: <35429171.41B5@pirate.de.nospam-delete-this>

Hi,
I just installed Perl latest Version 5.004004 (Linux i486), 
everything was okay: "make test" and some small CGI-Scripts. 
But then I started a bigger script which runs perfect under 
5.003... there where strange errors: syntax errors where none
are. When I uncomment the lines Perl complained about,
suddenly the strange syntax errors occurs at other lines.

Because I'm curiuos I installed now (the older) Perl 5.004,
runs perfect again.....

Strange don't U think? I will now try to install a higher 
version like 5.004003... anyway someone knows about the bug
I described and which is the "best" version?
-- 

/Mark (EMailadresse ab ".nospam" lvschen)
http://home.pages.de/~irc ~html ~unix


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

Date: Sun, 26 Apr 1998 03:12:07 GMT
From: jgloudon@hyssop.bbn.com.bbn.com (Jason Gloudon)
Subject: Re: perl 5.004 is better than 5.004004 ?!
Message-Id: <slrn6k59fb.gor.jgloudon@hyssop.bbn.com>

Mark Seuffert <captain@pirate.de.nospam-delete-this> wrote:
 .
 .
>5.003... there where strange errors: syntax errors where none
>are. When I uncomment the lines Perl complained about,
>suddenly the strange syntax errors occurs at other lines.

When that starts to happen to me it is usually because I have some
broken matching { }'s or ( ) somewhere.

Try inserting __END__; into the code starting near the end and moving up
and doing perl -c. When the errors go away you're trouble code is somewhere
after the __END__.

However you didn't say or show the syntax errors so none of the above may 
apply.

 .
>version like 5.004003... anyway someone knows about the bug
>I described and which is the "best" version?

The 'best' is supposed to be the latest.tar.gz, as it should have fewer
known bugs.

--
Jason Gloudon


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

Date: Sun, 26 Apr 1998 01:38:12 GMT
From: dhasting@nyx.net (Damon Hastings)
Subject: Perl's non-blocking socket support sucks!  Please help!
Message-Id: <35468746.242892159@news.cc.utexas.edu>

Okay, maybe it doesn't suck.  Maybe I'm just clueless -- I sincerely 
hope so.  I'm using the usual Socket.pm stuff to create, bind, and 
connect a socket.  I'm setting the O_NONBLOCKING flag with fcntl() to 
make it nonblocking.  But there are two things I can't figure out:

1.)  How do I detect when the remote host closes a nonblocking
     connection?  (I already tried the return value of read, recv, and

     eof.)

2.)  When I make a nonblocking connect attempt (i.e., I set 
     O_NONBLOCKING before calling connect), how do I detect when the 
     attempt has completed, and whether it failed or succeeded?

My ultimate goal is to be able to simultaneously open THOUSANDS of 
connections in parallel, with no costly child processes, and with no 
blocking, anywhere, any time, for any reason.  Not even once.  :-)

Does anyone know how to do this with Socket.pm or with any other 
module or package, or anything??!  A better language maybe???

I have already consulted the man pages.  I have read the FAQ.  I have
visited CPAN.  I have read the posts to this group.  I have 
experimented for hours.  I tried Net::TCP and TCP::Client, but they 
seem to just be wrappers for some underlying Socket.pm commands.  The 
Net::TCP documentation says:

"Support for non-blocking sockets is under-tested at best.  The
        select, fhvec, ioctl, and fcntl methods aren't necessarily all
        one would wish."

Truer words were never spoken.

Damon Hastings


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

Date: 26 Apr 1998 04:40:52 GMT
From: Shimpei Yamashita <shimpei+usenet+.mil+.gov@BOFH.patnet.caltech.edu>
Subject: Re: Perl-only distribution (was Re: How do I build Linux from stratch?? (w/o distribution of course!!))
Message-Id: <6hudsk$2qm@gap.cco.caltech.edu>

David Lee Lambert  <lamber45@EGR.msu.edu> writes:
>
>On 20 Apr 1998, Peter Samuelson wrote:
>
>> [J. K. Towery <kellyboy@arn.net>]
>> > *Where* can I get some info on *exactly* which
>> > files/package/tar-files does Linux needed to get running? I been
>> > spending all this week searching on Internet, going to bookstore
>> > (even book from O'Reilly doesnt cover that area), and looking thru
>> > FTP Archive on CD and find nothing what Im looking for.
>> 
>> Depends on what you want.  The kernel wants to be able to mount a root
>> directory and run init.  Beyond that, whatever init wants to do -- the
>> kernel doesn't particularly care.
>
>How hard would it be to put together a distro that used no shell but
>/bin/perl?  Would it do anything useful?

perl uses tcsh for globbing, so you will have to come up with a
stripped-down replacement that does csh-style globbing. More
importantly, libc also calls /bin/sh in several locations (most
notably in some of the exec() family of calls), so you will also need
to patch libc. (Does messing around with libc scare you? It should.)
It isn't as trivial as you might think.

-- 
Shimpei Yamashita               <http://www.patnet.caltech.edu/%7Eshimpei/>
perl -w -e '$_="not a perl hacker\n";$q=qq;(.);x9;$qq=qq;345123h896789,;;;$s=
pack(qq;H6;,q;6a7573;);$qq=qq;s,^$q,$s$qq;;$qq=~s;(\d);\$$1;g;eval$qq;print;'


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

Date: Sat, 25 Apr 1998 20:04:54 -0600
From: troxel@sammcgees.com
Subject: Reg Exp problem
Message-Id: <6hu17m$3gh$1@nnrp1.dejanews.com>

I am writing a site search engine that simple reads a directory and
returns a list of links to the html files that match an expression
along with the number of hits in each file.  If the user clicks on
one of the links the Perl script reads in the html file and attempts
to highlight the keyword where ever it occurs and spit it back out to
the client.  Perhaps a click is worth a thousand words:

http://www.sinuses.com/search_site.cgi?db=s

The problem I am having is skipping the text inside the tags <  >. For
example, if the user searched on "font" it would cause major distruption
to highlight "font".  So I attempted to use:

$lines_str=~s/(.*?>[^<]*?)\b($_)/$1 <font size=\+1 color=red> $2 <\/font>/ig ;

where $lines_str is the entire file on a line and $_ is the keyword.
While this indeed skips the text inside the < >, it only catchs one
occurance of the keyword after a > character.

Any pointers on an example or module that would help would be greatly
appreciated.





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


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

Date: 26 Apr 1998 00:07:35 GMT
From: agl3@cornell.edu (Alfred Landrum)
Subject: RFI:  Counting repeated substrings within a string
Message-Id: <6htts7$6nf@newsstand.cit.cornell.edu>

Hi,

 I'm working on a cryptology problem.  I would like to create
a perl script that will read in a cyphertext file, and find all
repeated substrings within that file.

 I have some experience with perl, but so far I have gotten very far.
If anyone could give me some hints about how to go about this,
I'd appreciate it.

Ex: An input of 'werasdwerasdwer' would return all of the times
that 'wer', 'era', 'ras', 'asd' occured.  (For the assignment, I'm just
going to be looking at repeated patterns with 4 or more characters, then
do some frequency study on the results to try and crack the cyphertext.)


Thanks for any help,
Alfred Landrum



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

Date: Sat, 25 Apr 1998 21:30:18 -0600
From: tietzmann@yahoo.com
Subject: Shopping Cart in Perl
Message-Id: <6hu67s$bkb$1@nnrp1.dejanews.com>

Hello,

I like to implement PerlShop on my web site, but I have some doubts:

1. Do I really need a main page containing a button like "Click Here to Start
   Shopping"?
   I've hundreds of product's pages on my web site, and I like to be able to
   make my users start shopping from any page.

2. I didn't understand the "Navigation Tag" very well. Do I need to have a
   preview and a next page for each of my page, or it's only an option?


Thanks for your help.
Juliano Tietzmann
mailto:tietzmann@yahoo.com

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


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

Date: Sat, 25 Apr 1998 18:04:22 -0600
From: gzoller@hotmail.com
Subject: Wanted: Your Perl Hacks
Message-Id: <6htq5m$juk$1@nnrp1.dejanews.com>

I need to collect as many perl CGI security hacks as possible.

NOTE:  I am *not* breaking into web sites with this information!

I am a consultant who's client is (I believe) not taking
enough security precautions with his perl code.  I'm trying
to demonstrate (in the presence of my client) that someone
can do unintended things unless he lets me install some
checking/validation code.

I'm looking for are things like the following:

*  Ways to create/set/examine the perl variables
   from a string entered at a form field.

*  Ways to execture simple commands (like 'ls') from
   a form text field.

*  Any way to "eval" perl code on an unsuspecting
   web site.

*  Any general perl/CGI security dangers.

Note:  Even harmless code is great if it will make
my client say "That's not supposed to be possible!".

If there are no substantive replies, I will assume
my concerns are unwarranted.

Greg

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


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

Date: Sat, 25 Apr 1998 22:33:24 -0500
From: Andrew Johnson <ajohnson@gpu.srv.ualberta.ca>
Subject: Re: Wanted: Your Perl Hacks
Message-Id: <3542AB04.61C6351A@gpu.srv.ualberta.ca>

gzoller@hotmail.com wrote:
!
! I need to collect as many perl CGI security hacks as possible.
! 
! NOTE:  I am *not* breaking into web sites with this information!
! 
! I am a consultant who's client is (I believe) not taking
! enough security precautions with his perl code.  I'm trying
! to demonstrate (in the presence of my client) that someone
! can do unintended things unless he lets me install some
! checking/validation code.

hmm, you yourself are unsure about your client's site-security
(you 'believe' it to be insecure), yet you are trying to sell
them your services as a consultant to make their site more
secure??? Am I reading this right?

I certainly hope your client reads this group and realizes
you may not be the right person to assess or ensure the
security of their site.

andrew


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

Date: Sat, 25 Apr 1998 08:24:51 GMT
From: Gellyfish@btinternet.com (Jonathan Stowe)
Subject: Re: Why doesn't this work?
Message-Id: <35416e9f.94452874@news.btinternet.com>

On 25 Apr 1998 19:59:18 GMT, Dave Neuer wrote :

>I have written a script to extract the meta tags from several html
>documents. Here's the code:
>
<snip>

I would suggest the use of HTML::Parser or HTML::HeadParser for this
job.  You know it makes sense.

I hacked around with your regex until I got:

$lines =~ s/^.*?(<meta\s+?[^<>]*?>).*?$/$1/imsg;

But it still doesnt work completely.  I couldnt figure out how to
control the greediness thing at the end.  

/J\
Jonathan Stowe
Some of your questions answered http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm


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

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

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