[8686] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 2303 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Apr 12 14:07:22 1998

Date: Sun, 12 Apr 98 11:00:40 -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           Sun, 12 Apr 1998     Volume: 8 Number: 2303

Today's topics:
        5004_02 /  DBI:: W32ODBC / SQL Anywhere <tsahi@netvision.net.il>
    Re: Bill Gates should be invited to O'Reilly's "Free So <elflord@pegasus.rutgers.edu>
    Re: Bill Gates should be invited to O'Reilly's "Free So (Chris Nandor)
    Re: Bill Gates should be invited to O'Reilly's "Free So <abraham@dina.kvl.dk>
        File::Find (mikep)
    Re: How do I cut off the first word of a string? (Martin Vorlaender)
    Re: Korn to Perl, Help! <quillan@doitnow.com>
    Re: MacPerl Book Online in HTML <gwynne@utkux.utk.edu>
    Re: MacPerl Book Online in HTML <merlyn@stonehenge.com>
        MLDBM - calling methods on retrieved object? otis@POPULUS.net
    Re: MLDBM - calling methods on retrieved object? (Gurusamy Sarathy)
    Re: Nonblocking pipe reads from perl? <greg@hassan.com>
    Re: Nonblocking pipe reads from perl? (Michael Fuhr)
    Re: Numeric validation <Russell_Schulz@locutus.ofB.ORG>
    Re: Relational Searching <greg@hassan.com>
        restricting perl paths on NT <danfs@wolfenet.com>
    Re: RMS should be invited to O'Reilly's "Free Software  <abraham@dina.kvl.dk>
    Re: Script URL (Amy Williams)
    Re: Script URL <eugene@vertical.net>
        Sockets, Multi-line input, and efficiency (IQueue Multimedia)
    Re: sort and uniq in Perl <gwynne@utkux.utk.edu>
    Re: Wanted: Amoo to stop my sysadmin from whining <quillan@doitnow.com>
    Re: Week of Month (Sullivan N. Beck)
        Weird problem with sending to a socket (Paul Wilson)
        Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: 12 Apr 1998 16:44:50 GMT
From: "Tsahi Savion" <tsahi@netvision.net.il>
Subject: 5004_02 /  DBI:: W32ODBC / SQL Anywhere
Message-Id: <01bd6630$8b629900$98035ac2@spring>

Hello !

I Tried to use DBI::W32ODBC module with two HTTP Servers but failed.
I  used Sybase SQL Anywhere

Omni Httpd 1.01.
When i do Connect  and then disconnect  It gives me CGI Error page , I
Increased the timeout interval,
tried debug tricks. but... it prints everything up to the last line (debug
file printout)  and then fail and give CGI Error.


Please Advise me whet to do


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

Date: Sun, 12 Apr 1998 09:33:03 +0000
From: Donovan Rebbechi <elflord@pegasus.rutgers.edu>
Subject: Re: Bill Gates should be invited to O'Reilly's "Free Software Summit" (was Re: RMS should be invited to O'Reilly's "Free Software Summit")
Message-Id: <35308A4F.A302F84D@pegasus.rutgers.edu>

Ben Bullock wrote:
> 
> I am not discussing whether or not O'Reilly make good books:
> I'm discussing whether or not they are a free
> software company.

Well that's very simple to answer. No, they're not a free software
company. Neither are Netscape or Caldera, but both have contributed to
free software. But this doesn't mean that they should be shunned as a
threat to free software. Providing first grade documentation on free
software ultimately serves to advance its cause. 

> I'm happy to discuss free software issues, but a lot of people
> in this discussion seem to think that `O'Reilly does make exceedingly
> good books about free software - therefore they are a pro-free software
> company'.

And I would say that this is more or less true. If there were no good
books about linux, for example, no-one would use it. It would be
thoroughly inaccessible to beginners. Without O'Reilly's books, I
couldn't use free software almost exclusively, as I do today. 

The fact that ORA don't exclusively sell GPL software or open-license
books does not make them "anti-free software" to me.

I think that our disagreement ultimately boils down to the question of
whether you believe that companies have a valid role to play in backing
free software, or if they should just go away. I'm still waiting for a
decent GPL word processor (and decent "free" documentation on sed for
that matter) , so for now, I guess the commercial people still have
something useful to do ... 

-- Donovan Rebbechi   


*************************************************
*	Lord of the Elves 			*
*	http://pegasus.rutgers.edu/~elflord/ 	*
*	elflord@pegasus.rutgers.edu		*
*************************************************


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

Date: Sun, 12 Apr 1998 11:44:30 GMT
From: pudge@pobox.com (Chris Nandor)
Subject: Re: Bill Gates should be invited to O'Reilly's "Free Software Summit" (was Re: RMS should be invited to O'Reilly's "Free Software Summit")
Message-Id: <pudge-1204980744190001@dynamic283.ply.adelphia.net>

In article <35302a80.6655982@newsreader.cais.net>,
perl.babe@mailexcite.com (Sandra Anderson) wrote:

# No to put too fine a point on it, information does not long to be
# free.  It longs to live and grow and be distributed widely, which
# means someone has go to come up with the cash to pay the printers,
# publishers, authors, the drivers of the trucks full of books, the
# clerks at the store, the people working for the computer companies,
# etc.

Not to put too fine a point on it (:-), but information does not long to
do anything, does not will to do anything.  We will it to be certain
things, and as we change, those wills change.

-- 
Chris Nandor          mailto:pudge@pobox.com         http://pudge.net/
%PGPKey=('B76E72AD',[1024,'0824 090B CE73 CA10  1FF7 7F13 8180 B6B6'])
#==               New Book:  MacPerl: Power and Ease               ==#
#==    Publishing Date: Early 1998. http://www.ptf.com/macperl/    ==#


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

Date: 12 Apr 1998 16:26:48 +0200
From: Per Abrahamsen <abraham@dina.kvl.dk>
Subject: Re: Bill Gates should be invited to O'Reilly's "Free Software Summit" (was Re: RMS should be invited to O'Reilly's "Free Software Summit")
Message-Id: <rj3efjcdzr.fsf@zuse.+dina.kvl.dk>

[ FUT: gnu.misc.discuss ]

Russ Allbery <rra@stanford.edu> writes:

> Sure they are.  I can use them freely, read them freely, and distribute
> them freely to my friends.  

Like MSIE.

> You're trying to apply licenses to documentation that were never
> really intended to work for documentation.

Ideas, not licenses.  Here is the copyright from the printed version
of the GNU Emacs Manual.  I believe this license is free in the FSF
and Debian sense.

>>>>> "GEM" == "The GNU Emacs Manual" writes:

GEM> Permission is granted to make and distribute verbatim copies of
GEM> this manual provided the copyright notice and this permission notice
GEM> are preserved on all copies.
GEM> 
GEM> Permission is granted to copy and distribute modified versions of this
GEM> manual under the conditions for verbatim copying, provided also that the
GEM> sections entitled ``The GNU Manifesto'', ``Distribution'' and ``GNU
GEM> General Public License'' are included exactly as in the original, and
GEM> provided that the entire resulting derived work is distributed under the
GEM> terms of a permission notice identical to this one.
GEM> 
GEM> Permission is granted to copy and distribute translations of this manual
GEM> into another language, under the above conditions for modified versions,
GEM> except that the sections entitled ``The GNU Manifesto'',
GEM> ``Distribution'' and ``GNU General Public License'' may be included in a
GEM> translation approved by the Free Software Foundation instead of in the
GEM> original English.

I also think we should encourage other authors of gratis documentation
to make their work free as well.  Politely, of course.


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

Date: 12 Apr 1998 15:43:04 GMT
From: mikep@rt66.com (mikep)
Subject: File::Find
Message-Id: <6gqne8$8gq$1@news.rt66.com>

I'm looking for the File::Find module. Moreover, if there is a complete
listing or source where I could download several File::* modules that'd
be wonderful as well. MTIA

===========================
Mike Powell
mikep@rt66.com
http://www.rt66.com/~mikep/


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

Date: Sun, 12 Apr 1998 13:53:48 +0200
From: martin@RADIOGAGA.HARZ.DE (Martin Vorlaender)
Subject: Re: How do I cut off the first word of a string?
Message-Id: <3530ab4c.524144494f47414741@radiogaga.harz.de>

[posted & mailed]

Bryan T Hoch (bth@acsu.buffalo.edu) wrote:
: 	I want to have the user pass in a string (assuming through <STDIN>
: to a varaiable $whatever). The problem now is analyzing the first word of
: the string, and then passing the remainder of the string on to another sub
: routine. Does anyone know how to do that?

$whatever =~ /^(\w*?)(.*)$/;
$first_word = $1;
$remainder  = $2;

will do what you want. This presumes you have the same notion of what a
"word character" (\w) is as perl has.
What perl's notion is, you ask? Read about it in perlre.pod.

cu,
  Martin
--
                          | Martin Vorlaender | VMS & WNT programmer
 Ceterum censeo           | work: mv@pdv-systeme.de
 Redmondem delendam esse. |       http://www.pdv-systeme.de/users/martinv/
                          | home: martin@radiogaga.harz.de


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

Date: Sun, 12 Apr 1998 10:10:25 -0700
From: "John C. Quillan" <quillan@doitnow.com>
To: Chakravarthy KM Nalamotu <kittu@Hawaii.Edu>
Subject: Re: Korn to Perl, Help!
Message-Id: <3530F581.78470E33@doitnow.com>

Chakravarthy KM Nalamotu wrote:
> 
> Hello Perl Users,
> I am a novice perl user.
> I have a piece of code in Korn Shell environment and
> am in the process of converting it to perl. Could
> some one help me in converting the following statements
> written in korn environment to perl.
> 
> The code down here has a << EOF which lets me connect
> to a database session and do a query on a table and
> output the information into $FILES. Is
> there something similar in perl that does this?
> 
> Thank you for your responses.
>   Kittu.
> 
> ###################################################
> 
> sqlplus userid/passwd >> $FILES << EOF
> 
> select file_name FNAME
> from sys.dba_data_files
> order by file_name;
> 
> exit

Try something like the following (This may not be exact but
will get you close


--- Start perl

open( SQL, "| sqlplus userid/passwd >> $FILES ");

print SQL <<EOF;
select file_name FNAME
from sys.dba_data_files
order by file_name;
SQL

close(SQL);

--- End perl.


Another thing you might want to consider later on, once
this is working, is use the Oracle module, and possibly
the DBI modules.  You can find these at any CPAN site.

Hope this helps you. 

John C. Quillan
> EOF


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

Date: Sun, 12 Apr 1998 08:53:34 -0400
From: "Bob Gwynne" <gwynne@utkux.utk.edu>
Subject: Re: MacPerl Book Online in HTML
Message-Id: <6gqdik$5r4$1@gaia.ns.utk.edu>

I think this one needs a thread.

Chris Nandor wrote in message ...
>The MacPerl: Power and Ease book, due out in May, is available online in
>HTML from PTF, publishers of the book.


On the book's Web page, Chris asks for comments on his book.  In a private
message, I mentioned that there is a paucity of exercises--mainly zilch.
Chris replied as follows:

>Some people learn by exercises, some do not; some learn better by examples,
>which we do give plenty of.  If you do learn that way, there are plenty of
>Perl books out there for that.  No book can be all things to all people.

My reply was as follows:
Chris:
   I agree that different people learn in different ways. This implies that
you should teach, in this case, to "both" of those ways so that you benefit
all, not just those who learn by example. Can you cite research that more
people learn by example than by exercises?  Can you cite research that
learning by examples is superior to learning by exercises?  There is a hell
of a lot of research out there on learning theory that addresses these
concerns.  Why not be scientific instead of intuitive?  Some researchers
suggest that there are up to seven ways that people learn. I know that some
of my students learn something from my lectures, some learn from reading the
text or the lectures, and that others learn from doing.  Would I be an
effective teacher if I used only one method?  No!  The same goes for your
book.
###############

Since there are so many books about Perl, Chris's should be the best.  Why
not take a look at it and post suggestions about how it might be improved?
I vote for inclusion of exercises.

Bob Gwynne
University of Tennessee






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

Date: Sun, 12 Apr 1998 15:32:27 GMT
From: Randal Schwartz <merlyn@stonehenge.com>
To: "Bob Gwynne" <gwynne@utkux.utk.edu>
Subject: Re: MacPerl Book Online in HTML
Message-Id: <8cd8ent5sp.fsf@gadget.cscaper.com>

>>>>> "Bob" == Bob Gwynne <gwynne@utkux.utk.edu> writes:

Bob> Since there are so many books about Perl, Chris's should be the
Bob> best.  Why not take a look at it and post suggestions about how
Bob> it might be improved?  I vote for inclusion of exercises.

Writing a book is not a matter of voting.

"Thank the maker!" -- C-3PO

:-)

In seriousness, there are many styles of learning.  I put exercises in
"Learning Perl", because I was intending for it to be the complete
textbook for the course I was designing in parallel with the book.
But, had I not been doing a course, I might have left the exercises
out.  (I waffled on that anyway... it really needs about twice the
exercises it has.)

We didn't put exercises into the Camel, and yet it still outsells the
Llama by a significant pace.  Using "market research" (your "voting")
that would lead me to believe that I should take the exercises *out*
of the next Llama.  See the fallacy here?

It all depends on the market, and what you need to say to effectively
communicate.  The object of writing is to shift the reader's ability
to perceive their world, by giving them a set of distinctions that
they didn't have before.  And there are many ways to do that,
depending on the reader and writer both.  Writing for in-class
presentation is very different from textbook writing, which is
different again from reference book writing, or writing for an
interactive CD-ROM course.

If Chris's book is intended for reference, rather than classroom,
there's no compelling reason for exercises.  Having a public vote on
this is silly.

And as someone who has been authoring technical books for over 20
years, and has his name on a half-million shelves out there, I think I
know at least a *little* of which I speak. :-)

print "Just another Perl hacker," # but not what the media calls "hacker!" :-)
## legal fund: $20,990.69 collected, $186,159.85 spent; just 142 more days
## before I go to *prison* for 90 days; email fund@stonehenge.com for details

-- 
Name: Randal L. Schwartz / Stonehenge Consulting Services (503)777-0095
Keywords: Perl training, UNIX[tm] consulting, video production, skiing, flying
Email: <merlyn@stonehenge.com> Snail: (Call) PGP-Key: (finger merlyn@teleport.com)
Web: <A HREF="http://www.stonehenge.com/merlyn/">My Home Page!</A>
Quote: "I'm telling you, if I could have five lines in my .sig, I would!" -- me


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

Date: Sun, 12 Apr 1998 04:26:52 -0600
From: otis@POPULUS.net
To: gsar@umich.edu
Subject: MLDBM - calling methods on retrieved object?
Message-Id: <6gq1cs$kq0$1@nnrp1.dejanews.com>

Hello,

I was trying to use MLDBM for persistent object storing.
Since the modele has the same interface (hash-like) as other DBM
implementations, adding stuff to MLDBM is not a problem.

However, when I do something like this:

    my ($docID, $webdoc) = each (%rep); # %rep is tied to MLDBM
    $webdoc->method();

I get error such as:

Can't call method "method" without a package or object reference at Script
line 123.

This is most probably because $webdoc is not quite the OBJECT any more, so I
cannot call methods on it.  But it should be an object, isn't that what MLDBM
is supposed to do? Preserve the object properly so that I can just get it like
a normal DBM value and call a method on it?

Am I doing something wrong? Mistaken?
Wait, is MLDBM for storing 'only' complex data structures, or objects?
If the former then the error I'm getting makes sense, if the latter then my
question still stands...

Thanks,

Otis
P.S.
I just discovered a module called ObjStore - how does it compare with MLDBM?

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


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

Date: 12 Apr 1998 17:44:55 GMT
From: gsar@engin.umich.edu (Gurusamy Sarathy)
Subject: Re: MLDBM - calling methods on retrieved object?
Message-Id: <6gquin$d83@srvr1.engin.umich.edu>

  [ mailed and posted ]

In article <6gq1cs$kq0$1@nnrp1.dejanews.com>,  <otis@POPULUS.net> wrote:
>However, when I do something like this:
>
>    my ($docID, $webdoc) = each (%rep); # %rep is tied to MLDBM
>    $webdoc->method();
>
>I get error such as:
>
>Can't call method "method" without a package or object reference at Script
>line 123.

You're not checking if each() had something to return.  Try something
like this instead:

    use MLDBM;
    use Fcntl;
    tie %h, 'MLDBM', 'm', O_CREAT|O_RDWR, 0666 or die $!;
    %h = ( 'akey' => Foo->new );
    while (my($k,$v) = each %h) {
    	print "$v [$k ", $v->show, "]\n";
    }
    package Foo;
    sub new { bless { k => 2 }, shift }
    sub show { $_[0]{k} }
    __END__
    Foo=HASH(0x90de38) [akey 2]

 - Sarathy.
   gsar@umich.edu




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

Date: Sun, 12 Apr 1998 08:48:09 -0400
From: "Greg Hassan" <greg@hassan.com>
Subject: Re: Nonblocking pipe reads from perl?
Message-Id: <3530c669.0@194.214.162.66>

How about just write a seperate output file for each
child.

If you need to process the output in some way, you can
have the parent continually snag the latest updates to
the files and process them.

-Greg
--
===============================================================
  Greg Hassan, The Independent Solution (CGI,Java,SQL,Perl...)
     http://www.hassan.com/, 1-607-225-4214, ICQ #: 8048297
===============================================================
Online Editable Database: http://www.hassan.com/super_dbedit/
Sell Stuff on the Web: http://www.hassan.com/shopcart/
Classifieds (FREE!): http://www.hassan.com/cl/
===============================================================





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

Date: 12 Apr 1998 08:50:12 -0600
From: mfuhr@dimensional.com (Michael Fuhr)
Subject: Re: Nonblocking pipe reads from perl?
Message-Id: <6gqkb4$oj6@flatland.dimensional.com>

Arrrgh...mail filters are your friend.

SpamYourselFtwest@agora.rdrop.kom (Todd West) writes:
^^^^^^^^^^^^^^^^^

> I'm working on implementing a parallel data search project in perl, and
> I can't figure out how to do a nonblocking read from a pipe.  Can you do
> this in perl 5.004?  If so, how?  I know it can be done from C (I've got
> code that does it), so I'm guessing it's doable from perl too.

Check out the select() function[1].  The IO::Pipe and IO::Select modules
can be handy for doing this.

[1] The multiple-argument form, which is the same as C's select().

-- 
Michael Fuhr
http://www.dimensional.com/~mfuhr/


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

Date: Sun, 12 Apr 1998 13:14:58 +0100
From: Russell Schulz <Russell_Schulz@locutus.ofB.ORG>
Subject: Re: Numeric validation
Message-Id: <19980412.131458.9p1.rnr.w164w@locutus.ofB.ORG>

ppp-support <ppp-support@canelle.telecom.uqam.ca> writes:

> Someone gave me the right answer by Email, he's answer is:
> if ($num =~ /^[0-9]+$/)

this is the second entry in the FAQ (`\d' is a digit, `[0-9]').

but this implies `-3' is not a number, and neither is `1.5'.  so I
think you need to state what you want more clearly.
-- 
Russell_Schulz@locutus.ofB.ORG  Shad 86c


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

Date: Sun, 12 Apr 1998 08:33:10 -0400
From: "Greg Hassan" <greg@hassan.com>
Subject: Re: Relational Searching
Message-Id: <3530c2e8.0@194.214.162.66>

Wouldn't you just search the first table.  Get the key/s
to the second table  and then search that one.

Or you can do a join on both tables and then do the search, although
this will be very inefficient.

-Greg
--
===============================================================
  Greg Hassan, The Independent Solution (CGI,Java,SQL,Perl...)
     http://www.hassan.com/, 1-607-225-4214, ICQ #: 8048297
===============================================================
Super Stats 1.3: http://www.hassan.com/super_stats/
The Best Shopping Cart Around: http://www.hassan.com/shopcart/
The Super Link Adder(FREE!): http://www.hassan.com/superlinkadder/
===============================================================

Henry Lifton wrote in message <6gl4or$3ms$1@usenet50.supernews.com>...
>I have done searching in flat file databases before, but now I have a
database
>with 2 tables with a one to many relationship.
>
>I need to search on 1 field in one and on 3 fields in the other, then the
>records that match those fields will be displayed.
>
>Can this be done, and if you would be so kind give me a small example.
>
>Thanks
>
>Henry Lifton




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

Date: Sun, 12 Apr 1998 07:12:05 -0700
From: Dan Schueler <danfs@wolfenet.com>
Subject: restricting perl paths on NT
Message-Id: <3530CBB5.30E16030@wolfenet.com>

How do you configure perl to restrict users to their own path?
I don't want users to be able to write to the root, which they
can do as perl comes out of the box, at least the version that
is delivered with o'reilly's website.



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

Date: 12 Apr 1998 15:37:52 +0200
From: Per Abrahamsen <abraham@dina.kvl.dk>
Subject: Re: RMS should be invited to O'Reilly's "Free Software Summit"
Message-Id: <rj7m4vcg9b.fsf@zuse.+dina.kvl.dk>

[ FUT: gnu.misc.discuss ]

tzs@halcyon.com (Tim Smith) writes:

> They should not automatically use GPL just because, say, they
> develop on Linux and most of the stuff on Linux is GPL'ed, nor
> should they choose BSD just because they happen to be using FreeBSD.

On the other hand, if you write a Perl module, you should have a
really good reason *not* to use the the AL.  If you write a tool that
would naturally belong to binutils, you should have a really good
reason *not* to use the GPL.  If you write a plugin for Netscape, you
should have a really good reason *not* to use the MPL.

In general, using the dominating freeware license in the environment
the code is being used is a good thing.  It means one less license for
the users and distributors to worry about.  So if you are developing a
Linux or FreeBSD specific application, using the GPL or the FreeBSD
license is usually the right thing to do.

However, if you are really writing a Unix application, as you should
be in most cases, and just happens to be using Linux or FreeBSD as
your development platform, then Tim Smith's advice is correct.  Think
about what you want to accomplish (are your goals technical,
political, economical, or personal?), and use the most appropriate
license.


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

Date: Sun, 12 Apr 1998 02:49:55 GMT
From: epic@arosREMOVE.net (Amy Williams)
Subject: Re: Script URL
Message-Id: <35302a9d.11015028@news.aros.net>

On Sat, 11 Apr 1998 17:52:54 -0700, "Ken" <watkins@mailexcite.com>
wrote:
>I am new to perl programming (3 days) so please excuse me if my question is
>a little simplistic. Is there a way to find out the URL that was used to
>access a CGI script? Let's say someone enters
>http://mysite.com/refer.cgi?4325 (fictional url)
>I then need just the 4325

There are environment variables that are automatically passed to a
script.  One of them is called the query string, this is the
evironment variable you want.  It is located in the hash %ENV.  To
access it use $ENV{QUERY_STRING}.


--
Amy Williams                    | Amy Williams Web Page Design
epic@aros.net                   | and CGI Scripting
http://www.aros.net/~epic/      | http://www.aros.net/~epic/html.html


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

Date: Sun, 12 Apr 1998 09:19:26 -0500
From: Eugene Sotirescu <eugene@vertical.net>
To: Ken <watkins@mailexcite.com>
Subject: Re: Script URL
Message-Id: <3530CD6D.3E6E5DED@vertical.net>

You're better off understanding what you're looking for than looking for a
quick fix (in the wrong place).
This, from the GellyFish, should help with both Perl and CGI: it's a
"list of links to all those bits of information that some people working in
the above areas find so hard to find"

http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm

Eugene

Ken wrote:

> I am new to perl programming (3 days) so please excuse me if my question is
> a little simplistic. Is there a way to find out the URL that was used to
> access a CGI script? Let's say someone enters
> http://mysite.com/refer.cgi?4325 (fictional url)
> I then need just the 4325
>
> I found a script that almost does what I want,
> (http://www.panix.com/~wizjd/cgi-bin/juggle.cgi) But it uses STDIN, and I
> don't think that will work if someone just enters the URL and not part of a
> form action, please correct me if I am wrong.
>
> Thanks
> Ken





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

Date: 12 Apr 1998 13:03:13 -0400
From: iqueue@panix.com (IQueue Multimedia)
Subject: Sockets, Multi-line input, and efficiency
Message-Id: <6gqs4h$qsu@panix2.panix.com>

Quick question for the sockets/files gurus in the crowd.  I'm having fun 
playing with sockets and am in the process of building a few nifty-keen net 
clients to be run through CGI.  No big deal.

My problem isn't that I can't get the suckers to run.  I connect fine, I
negotiate fine, I bind all warm and happy.  I talk to the server, it talks
back, and things are just great -- until I need a reply from the server
that spans more than one line.

Even then, I can get the reply I need by reading through the socket byte by
byte until I get the 'end transmission' clue I need from the server.  But
damned if it doesn't seem clunky, slow and inefficient.  

So, for reference, here's what I'm doing for a multi-line transaction:

sub get_multi {

	my($full_input, $byte_of_input);
        while ($full_input !~ /$end_of_input_clue/) {
                read S, $byte_of_input, 1;
                $full_input .= $byte_of_input;
        }
        return $full_input;
}

I can't read the socket with a @list; it hangs if I try, and I'm assuming
that's because it wants the entire contents of the socket, which it won't 
get because I'm still doing transactions with it.  If it makes a difference
to anyone, the $end_of_input_clue is the same <CR><LF>.<CR><LF> one gets
from a POP server ending a multiline send.

(Before it comes up, yes, I could use the Mail::POP3Client module to do
all this for me, but (A) the ISP I need to run this thing doesn't have it
installed and doesn't want to at the moment, and (B) I'm having fun
tinkering and learning right now anyway.)

I mean, it works, so don't waste long hours agonizing over it, but I get the
funny feeling I'm missing something almost rudely obvious - which is likely, 
since I've been learning PERL piecemeal since my =first= need-it-tomorrow
PERL project.  One of these days I'm going to get some time to experiment
without a deadline, I swear it...

Thanks for peeking.

Chris


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

Date: Sun, 12 Apr 1998 10:33:11 -0400
From: "Bob Gwynne" <gwynne@utkux.utk.edu>
Subject: Re: sort and uniq in Perl
Message-Id: <6gqjdb$92p$1@gaia.ns.utk.edu>

How about the system() function?

Bob Gwynne

Hui Tang wrote in message <352D3B77.1FA6@tus.ssi1.com>...
>Hi, all,
>
>Is there any simple way to get the functions of shell commands "sort"
>and "uniq" in Perl?
>
>Thanks.




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

Date: Sun, 12 Apr 1998 10:16:02 -0700
From: "John C. Quillan" <quillan@doitnow.com>
To: "Andrew F. Lee" <andrewf@cp.pathfinder.com>
Subject: Re: Wanted: Amoo to stop my sysadmin from whining
Message-Id: <3530F6D2.FEE9D649@doitnow.com>

Andrew F. Lee wrote:
> 
> Hello,
> 
> We have Perl 5.002 (which has been around about 2 years) and very limited
> set of modules.  I am groaning to my sysadmin to UPGRADE, but no one wants
> to do anything unless the building is on fire.
> 

What I have been forced to do in the past when I couldn't get something like
this done is,

   A. Write some code in perl that breaks under 5.002 and create your own fire.

   B. Install my own copy of perl for the task I am working on.

I have recently done B,  The other atvantage to option B is that now YOU have
control of the perl instalation, can add modules as you need them and don't
have to wait for a sysadmin to help you out.


Hope this helps

John C. Quillan


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

Date: 12 Apr 1998 12:28:03 -0400
From: sbeck@cise.ufl.edu (Sullivan N. Beck)
Subject: Re: Week of Month
Message-Id: <xz390pb57jg.fsf@rain.cise.ufl.edu>


> Having nothing better to do on a very wet and windy night I thought
> I'd take a crack at it. It's probably not portable as it uses
> Date::Manip (the UnixDate parts), does no error checking for things
> like (13/32/-0001) - but then neither does a pencil, is slow, not
> particularly clever, and so forth.

Date::Manip does lots of error checking.  The problem is that you are
manipulating values that UnixDate gave you and not doing the error checking
yourself.  If you're going to use Date::Manip, far better to let it do the
error checking for you.  :-)

First of all, the subject "week of month" is a very ambiguous term.  What
constitutes the first week of the month?  The 1st seven days of it?  But
that means that a week can start on Tuesday, Saturday, or any other day.
Not how most people think of weeks.  Any other definition runs into equally
strange examples of weeks.

A much better phrase is "Nth Sunday of the month".  If you've got a recent
version of Date::Manip (5.30 or 5.31), then you can write:

  # Get the year/month that you want
  $year=1998;
  $month=2;
  # Get a list of all Sunday's in this month:
  @date = &ParseRecur("*$y:$m:1-5:7:0:0:0");

This says to return a list of the 1st through 5th Sunday (day 7 of the
week) for the year and month given.  The list will be sorted by date, so
$date[$n-1] is the n'th Sunday of the month.

Incidentally, if you REALLY do mean "Nth week of the month", ParseRecur
will do that too based on several ways of definging the "1st week of the
month".  Read the man page about the ParseRecur command for more details.

> The one gotcha I found was that I'm used to GNU's 'data' which returns
> the day of the week as (0-6) and (Sunday...Saturday).  UnixDate (from
> DateParse's Date::Manip), uses (1-7) and (Monday...Sunday). I never 
> thought of Sunday as being part of the previous week, but it's 
> probably just because I tend to think of indexes as beginning with
> zero and Sunday, being a day of rest for me, needs no added value. :-)

The only reason Date::Manip refers to Sunday as day 7 is simply that that
is what ISO 8601 states it is.  I don't consider it to really be related to
what day of the week Sunday is.

------------------------------------------------------------------------------
Sullivan Beck                      http://www.cise.ufl.edu/~sbeck/
 sbeck@cise.ufl.edu  | This space reserved for some saying demonstrating great
 PH : (352) 392-1057 | wisdom, wit, or insight.  I'll fill it in just as soon
 Fax: (352) 392-1220 | as I have any of the above.
------------------------------------------------------------------------------


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

Date: Sun, 12 Apr 1998 16:27:52 GMT
From: prw@vanitydomain.net (Paul Wilson)
Subject: Weird problem with sending to a socket
Message-Id: <3530e8b7.174286482@news.bestweb.net>

Here's part of a script than when it's printed, just prints a number
instead of the actual string:

($uhost,$foo,$foo,@stuff) = split(/\s+/,$line);
send SOCK, "lwallops :Possible Spam: $uhost: @stuff\n", 0;

This results in a printout of "Possible Spam: 266421: whatever..."

$uhost would typically contain an IRC hostmask such as
someone@nas-nh12-32.ix.netcom.com. If I split $uhost on @, then put it
back in in the send SOCK, it works fine:

($uhost,$foo,$foo,@stuff) = split(/\s+/,$line);
($uid,$host) = split(/\@/,$uhost);
send SOCK, "lwallops :Possible Spam: $uid\@$host: @stuff\n", 0;

Is there any specific reason for this? If I have the script do a send
SOCK, "foo@foo", 0; it prints foo@foo, and doesn't translate it to
some weird number...

If there's any place I could RTFM too, please let me know. My socket
skills are still pretty pathetic...

Paul.


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

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

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