[19111] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1306 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Jul 14 18:05:51 2001

Date: Sat, 14 Jul 2001 15:05:09 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <995148309-v10-i1306@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Sat, 14 Jul 2001     Volume: 10 Number: 1306

Today's topics:
    Re: Accessing Outlook PST file info with perl <simon.hughes@bluewin.ch>
        Can I <!--include files ??? <dcs@ntlworld.com>
    Re: Can I <!--include files ??? <tony_curtis32@yahoo.com>
    Re: Can I <!--include files ??? <dcs@ntlworld.com>
    Re: Can I <!--include files ??? (Eric Bohlman)
    Re: Can I <!--include files ??? <dcs@ntlworld.com>
    Re: clean up array from "holes"... <andras@mortgagestats.com>
        CVS like script <mail@enricong.com>
    Re: Executing NT exe from Perl (Cosmic Cruizer)
        FAQ: How can I use Perl interactively? <faq@denver.pm.org>
        Hard DBI question <berube@odyssee.net>
        HELP! - Input text field problems! <firma@steinhaug.com>
        how do I flush a file buffer? <kitfox@kitfox.com>
    Re: how do I flush a file buffer? <uri@sysarch.com>
    Re: how do I flush a file buffer? (Tad McClellan)
        how many bytes to read from socket? <kitfox@kitfox.com>
    Re: how many bytes to read from socket? <uri@sysarch.com>
    Re: how many bytes to read from socket? <kitfox@kitfox.com>
    Re: how many bytes to read from socket? <gnarinn@hotmail.com>
    Re: how many bytes to read from socket? <uri@sysarch.com>
    Re: how to read multipart/form-data <spamhater@keepyourfilthyspamtoyourself.co.uk>
    Re: inline average <goldbb2@earthlink.net>
        Installing DBD on AIX 4.3.3 (Y)
    Re: perl debugger (Chad)
    Re: Recommendation for a book covering MySQL and Perl <bowman@montana.com>
    Re: Recommendation for a book covering MySQL and Perl <bart.lateur@skynet.be>
    Re: Replacing a word in a file <buddy@barefoot.net>
    Re: Sockets: What am I doing wrong? <gnarinn@hotmail.com>
    Re: warn() does not use a localized STDERR filehandle,  (Mark Jason Dominus)
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Sat, 14 Jul 2001 22:44:49 +0200
From: "Simon Hughes" <simon.hughes@bluewin.ch>
Subject: Re: Accessing Outlook PST file info with perl
Message-Id: <3b50af3f$1_3@news.bluewin.ch>

The Outlook object model is fully documented in the Outlook online help -
look under the "Advanced Customization" section.

"Richard A. Evans" <EvR@compuserve.com> wrote in message
news:9in678$jsu$1@suaar1ac.prod.compuserve.com...
> By reading the few pages of Perl documentation I could find referring to
> Outlook, I know that I can use something like this:
>
>   use strict;
>   use Win32::OLE;
>   use Win32::OLE::Const 'Microsoft Outlook';
>
>   my $Outlook = Win32::OLE->new('Outlook.Application', 'Quit');
>   my $ol = Win32::OLE::Const->Load($Outlook);
>
>   my $namespace = $Outlook->GetNamespace("MAPI");
>   my $Folder = $namespace->GetDefaultFolder(olFolderInbox);
>
> I don't fully understand the last few statements, but this code seems to
> start the process of accessing Outlook data.  (Printing the values
obtained
> didn't help me much either.)
>
> Where can I find specific function references, etc. to actually get at the
> information -- calendar, contacts, emails (including those in subfolders),
> etc.  Basically I want to be able to read (and hopefully write) any
> information in Outlook.
>
> Note:  I am not trying to send or receive email.  I am trying to read from
> (and hopefully write to) an Outlook PST file.
>
> Any help will be appreciated.
>
> Regards,
>
> Rick Evans
>
>




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

Date: Sat, 14 Jul 2001 18:35:07 +0100
From: "Terry" <dcs@ntlworld.com>
Subject: Can I <!--include files ???
Message-Id: <Lo%37.39930$B56.8361138@news2-win.server.ntlworld.com>

Hi,

All of my 'standard' webpages are *.shtml using SSI. This is great in that I
can have a standard template file for header, navigation menu and footer of
my pages by using the

<!--include file="template.html"-->
directive.
I wanted to use the same templates for my cgi pages. Is there any way of
doing this?

TIA

Terry





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

Date: 14 Jul 2001 12:45:57 -0500
From: Tony Curtis <tony_curtis32@yahoo.com>
Subject: Re: Can I <!--include files ???
Message-Id: <87vgkve756.fsf@limey.hpcc.uh.edu>

>> On Sat, 14 Jul 2001 18:35:07 +0100,
>> "Terry" <dcs@ntlworld.com> said:

> Hi, All of my 'standard' webpages are *.shtml using
> SSI. This is great in that I can have a standard
> template file for header, navigation menu and footer of
> my pages by using the

> <!--include file="template.html"--> directive.  I wanted
> to use the same templates for my cgi pages. Is there any
> way of doing this?

And you're posting this to comp.lang.perl.misc because...?

I'd try comp.infosystems.www.authoring.cgi instead IIWY.

-- 
Beep beep!  Out of my way, I'm a motorist!


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

Date: Sat, 14 Jul 2001 18:59:23 +0100
From: "Terry" <dcs@ntlworld.com>
Subject: Re: Can I <!--include files ???
Message-Id: <zM%37.40040$B56.8383851@news2-win.server.ntlworld.com>

Hi tony :)
--

Terry Moriarty  ( founder - DownlineConstructionSite )
http://www.downlineconstructionsite.com    Let US build YOUR downline,
FREE!!!

"Tony Curtis" <tony_curtis32@yahoo.com> wrote in message
news:87vgkve756.fsf@limey.hpcc.uh.edu...
> >> On Sat, 14 Jul 2001 18:35:07 +0100,
> >> "Terry" <dcs@ntlworld.com> said:
>
> > Hi, All of my 'standard' webpages are *.shtml using
> > SSI. This is great in that I can have a standard
> > template file for header, navigation menu and footer of
> > my pages by using the
>
> > <!--include file="template.html"--> directive.  I wanted
> > to use the same templates for my cgi pages. Is there any
> > way of doing this?
>
> And you're posting this to comp.lang.perl.misc because...?
>

because my cgi scripts are written with perl żżż

> I'd try comp.infosystems.www.authoring.cgi instead IIWY.
>

OK

Terry

> --
> Beep beep!  Out of my way, I'm a motorist!




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

Date: 14 Jul 2001 19:10:39 GMT
From: ebohlman@omsdev.com (Eric Bohlman)
Subject: Re: Can I <!--include files ???
Message-Id: <9iq5ff$lrn$1@bob.news.rcn.net>

Tony Curtis <tony_curtis32@yahoo.com> wrote:
>>> On Sat, 14 Jul 2001 18:35:07 +0100,
>>> "Terry" <dcs@ntlworld.com> said:

>> Hi, All of my 'standard' webpages are *.shtml using
>> SSI. This is great in that I can have a standard
>> template file for header, navigation menu and footer of
>> my pages by using the

>> <!--include file="template.html"--> directive.  I wanted
>> to use the same templates for my cgi pages. Is there any
>> way of doing this?

> And you're posting this to comp.lang.perl.misc because...?

> I'd try comp.infosystems.www.authoring.cgi instead IIWY.

Slight bit of Perl relevance: I remember someone releasing a Perl module 
specifically for performing SSI-like processing in CGI scripts.  A trip to 
search.cpan.org is probably in order for the OP.



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

Date: Sat, 14 Jul 2001 20:15:59 +0100
From: "Terry" <dcs@ntlworld.com>
Subject: Re: Can I <!--include files ???
Message-Id: <mT047.40353$B56.8474603@news2-win.server.ntlworld.com>

"Eric Bohlman" <ebohlman@omsdev.com> wrote in message
news:9iq5ff$lrn$1@bob.news.rcn.net...
> Tony Curtis <tony_curtis32@yahoo.com> wrote:
> >>> On Sat, 14 Jul 2001 18:35:07 +0100,
> >>> "Terry" <dcs@ntlworld.com> said:
>
> >> Hi, All of my 'standard' webpages are *.shtml using
> >> SSI. This is great in that I can have a standard
> >> template file for header, navigation menu and footer of
> >> my pages by using the
>
> >> <!--include file="template.html"--> directive.  I wanted
> >> to use the same templates for my cgi pages. Is there any
> >> way of doing this?
>
> > And you're posting this to comp.lang.perl.misc because...?
>
> > I'd try comp.infosystems.www.authoring.cgi instead IIWY.
>
> Slight bit of Perl relevance: I remember someone releasing a Perl module
> specifically for performing SSI-like processing in CGI scripts.  A trip to
> search.cpan.org is probably in order for the OP.

Thanks Eric, I'll take a look :)

All the best

Terry
>




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

Date: Sat, 14 Jul 2001 13:41:44 -0400
From: Andras Malatinszky <andras@mortgagestats.com>
Subject: Re: clean up array from "holes"...
Message-Id: <3B508458.D99697F1@mortgagestats.com>

Good grief, Godzilla, how can you, a well respected thinker and master -- or shall I
say mistress? -- of the the English language allow her name to be associated with a
sloppy piece of writing like this?

"Godzilla!" wrote:

> Godzilla! wrote:
>
> > Alexvalara wrote:
>
> (dietary snippage)
>
> > > Is it possible to get rid off "holes" in an array....
>
> > Those "holes" are referred to as null elements
> > and a host of other geeky terms of endearment.
>
>
> > Piece of cake. This method I exemplify works very nice

You should have used "nicely" here. You see, "nice" is an adjective, and as such,
it applies to noun phrases. If you want to qualify a verb, such as "works," what you
need is
an adverb, such as "nicely."

>
> > for small to small-medium size arrays. I would suggest
> > a different method for large arrays....
>
>
> > For large arrays, it would be more logical to simply
> > push non-null elements into a new array. However,
> > would not you then have two large arrays for a period

It should really be "would you not, " isn't it?

>
> > of time?  I would say,
>
> > "Half a dozen of one, a Baker's Dozen of the other."
>

Six of one, thirteen of the other? What is that supposed to mean? And why are you
capitalizing a phrase that is not a proper noun in the middle of a sentence?

>
> > Imaginative use of shift will turn these large fattening
> > half dozens into a small delicious cream puff;
> > push it in, shift it out.
>
>
> I hear a Sissified Geek whimpering "Aunt" over and over...
>
> These Sissified Geeks know to cry "Aunt" rather than "Uncle"
> simply because I cannot be an uncle, nor an aunt, actually,
> although some Sissified Geeks claim me to be a pissant.

This is a run-on sentence. You should break it up into several meaningful pieces. You
might also want to consider leaving meaningless parts out. Also, you should watch the
way you use the word "because" in your sentences. Normally, the part after the word
"because" should justify the part before it. For example: "The pavement is wet because
it is raining."

>
> You boys just don't know how to turn your fat beer bloated
> arrays into tasty little champagne cream puffs, like mine.

This is a good example of a mixed metaphore. You should avoid mixed metaphors. You are
also blatantly sexist in your writing. That is going to alienate not only most of your
male audience, but also a large number of women.

>
>
> This method might be of interest to those whom have such

This is a misuse of "whom." Whom is never used in the nominative case. The correct form
here is "who." In fact, I suspect this is an example of hypercorrection,  a mistaken
correction made through a desire to avoid nonstandard grammar. Some people are so
afraid of being accused of "violating the rules of grammar" by using "who" in the
accusative case (as in "she didn't know who she was talking to") that they use "whom"
even in the accusative, just to be safe.

>
> difficulty dealing with disproportionately large arrays;
> an intellectual dietary method.
>
> Godzilla!  Queen Of The Shifty.
> --

The next time you post -- if you choose to ever post again at all -- you should
carefully read -- and diligently correct -- what you have written instead of inflicting
your sloppy grammar and questionable style on your fellow Usenet readers. You might
consider submitting your posts for peer review in alt.usage.english before posting them
here.




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

Date: Sat, 14 Jul 2001 12:14:06 -0500
From: "Enrico Ng" <mail@enricong.com>
Subject: CVS like script
Message-Id: <9ipul9$h1s$1@info1.fnal.gov>

I have a website that I would like several people to beable to work on.
I can make them ftp accounts, but I cant make it so they can have a
shared access area.
I can make one account and put the files there, but I want separate
users so I know who does what.
I was thinking of making a cvs repository, but my host doesnt have a cvs
server installed.
so I figured I could make or find and install a cvs like script.
something that will allow users to download specific files and upload
files. (after asking for a username and password.)

--
Enrico Ng <mail@enricong.com>




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

Date: Sat, 14 Jul 2001 16:48:14 GMT
From: spam.killer@home.com_nospam (Cosmic Cruizer)
Subject: Re: Executing NT exe from Perl
Message-Id: <Xns90DE6337AD9F0ccruizermydejacom@24.0.0.25>

"John W. Krahn" <krahnj@acm.org> wrote in <3B4FB460.8F8006CD@acm.org>:

<- snip ->

>> $text = VAR1 . " " . VAR2 . " " . VAR3;
>> 
>> `E:\scripts\event.exe -s W -c 100 $text`;
>
>`E:\scripts\event.exe -s W -c 100 "$text"`;
>
>
>> and
>> 
>> system("E:\scripts\event.exe -s W -c 100 $text);
>
>system qq(E:\scripts\event.exe -s W -c 100 "$text");
>
<- snip ->
>> 
>> I'm using Perl 5.001m build 107 on an NT 4.0 sytem. Any suggestions?
>                 ^^^^^
>Time to upgrade!
>
>
>John
>

Thanks John, and yes... it is definitely time to upgrade. Just one more of 
long list of items I need to do with the system I just took over.


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

Date: Sat, 14 Jul 2001 18:17:01 GMT
From: PerlFAQ Server <faq@denver.pm.org>
Subject: FAQ: How can I use Perl interactively?
Message-Id: <x0047.139$T3.191782400@news.frii.net>

This message is one of several periodic postings to comp.lang.perl.misc
intended to make it easier for perl programmers to find answers to
common questions. The core of this message represents an excerpt
from the documentation provided with every Standard Distribution of
Perl.

+
  How can I use Perl interactively?

    The typical approach uses the Perl debugger, described in the
    perldebug(1) man page, on an ``empty'' program, like this:

        perl -de 42

    Now just type in any legal Perl code, and it will be immediately
    evaluated. You can also examine the symbol table, get stack backtraces,
    check variable values, set breakpoints, and other operations typically
    found in symbolic debuggers.

- 

Documents such as this have been called "Answers to Frequently
Asked Questions" or FAQ for short.  They represent an important
part of the Usenet tradition.  They serve to reduce the volume of
redundant traffic on a news group by providing quality answers to
questions that keep coming up.

If you are some how irritated by seeing these postings you are free
to ignore them or add the sender to your killfile.  If you find
errors or other problems with these postings please send corrections
or comments to the posting email address or to the maintainers as
directed in the perlfaq manual page.

Answers to questions about LOTS of stuff, mostly not related to
Perl, can be found by pointing your news client to

    news:news.answers

or to the many thousands of other useful Usenet news groups.

Note that the FAQ text posted by this server may have been modified
from that distributed in the stable Perl release.  It may have been
edited to reflect the additions, changes and corrections provided
by respondents, reviewers, and critics to previous postings of
these FAQ. Complete text of these FAQ are available on request.

The perlfaq manual page contains the following copyright notice.

  AUTHOR AND COPYRIGHT

    Copyright (c) 1997-1999 Tom Christiansen and Nathan
    Torkington.  All rights reserved.

This posting is provided in the hope that it will be useful but
does not represent a commitment or contract of any kind on the part
of the contributers, authors or their agents.

                                                           03.02
-- 
    This space intentionally left blank


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

Date: Sat, 14 Jul 2001 13:53:49 -0400
From: "Neb" <berube@odyssee.net>
Subject: Hard DBI question
Message-Id: <9iq0id$2cuj$1@cti15.citenet.net>

Hi,

I'm currently working with the DBI and DBD::ODBC modules to query a MS SQL
Server database.  I've been able to execute stored proc and play with the
resultset.  My problem is when my SP actually use the RETURN function to
return a value (for example, an error code).

Problem is that I can't find a way to retrieve that value.  The
$sth->bind_param_inout doesn't work with MS SQL, so I can't get the value
with an OUTPUT parameter.

I've search through all the "Perl DBI" book, but no explanation about that
(neither about SP).  Anyone knows an anwser ?

Thanks for the help,

Neb







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

Date: Sat, 14 Jul 2001 21:44:48 GMT
From: "Steinhaugs Webdesign" <firma@steinhaug.com>
Subject: HELP! - Input text field problems!
Message-Id: <k3347.8916$qR5.1007103@news01.chello.no>

Hello,

I have a <textarea cols="50" rows="10" name="message"></textarea> field
which brings the contents of the email to my mailscript.

The info is passed to the script like this :

$message = param('message');

Since I have a lot of messages, Ive created a batch system, so the $message
is written down to a file, "temp.log".
The batch.cgi the opens and reads the contents of "temp.log" and stores the
info into @temp, thereafter
$message = "@temp";

PROBLEM!
When I now send out all the mails, the ending email is corrupt, its supposed
to be a HTML mail, but after opening the text from
the file it gets corrupted in some strange way I cant figure.

I added the <textarea cols="50" rows="10" name="message"></textarea> to the
batch.cgi file, to see if that worked, and
when passing the same infor through the form, it works like a charm.

Are there any special things I have to do when storing the $message variable
to keep it correct.
Why does this happen?

An excerpt from the $message is :
----------------------------------
MIME-Version: 1.0
Content-Type: multipart/alternative;
 boundary="----=_NextPart_000_0274_01C10420.163BB1C0"
Thread-Index: AcEEQZ0b7cHNEU5bTIS5/0fnX2/02Q==
Content-Class: urn:content-classes:message
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200

This is a multi-part message in MIME format.

------=_NextPart_000_0274_01C10420.163BB1C0
Content-Type: text/plain;
 charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
----------------------------------

The email is sendt like this for reference,
-------------------------------------------
  print MAIL "From: \"$fromname\" <$fromnamemail>\n";
  print MAIL "To: \"$toname\" <$tonamemail>\n";
  print MAIL "Subject: $subject\n";
  print MAIL "Date: $DateAndTime -0700\n";
  print MAIL "$message\n";
-------------------------------------------

HELP IS NEEDED; PLEASE!

Kim Steinhaug
kim@steinhaug.com





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

Date: Sat, 14 Jul 2001 13:49:12 -0400
From: Mark McKay <kitfox@kitfox.com>
Subject: how do I flush a file buffer?
Message-Id: <3B508618.5009EB5C@kitfox.com>

I'm keeping a log file for a server program.  At startup, I open the
file for appending.  However, it only seems to write to the log when the
program shuts down.  Is there a way to flush the buffer on demand?

Please reply to mark@kitfox.com

Mark


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

Date: Sat, 14 Jul 2001 21:08:14 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: how do I flush a file buffer?
Message-Id: <x7k81bw75s.fsf@home.sysarch.com>

>>>>> "MM" == Mark McKay <kitfox@kitfox.com> writes:

  MM> I'm keeping a log file for a server program.  At startup, I open the
  MM> file for appending.  However, it only seems to write to the log when the
  MM> program shuts down.  Is there a way to flush the buffer on demand?

POSIX::fflush

or use syswrite instead of print.

  MM> Please reply to mark@kitfox.com

oh, the chat server kid.

uri

-- 
Uri Guttman  ---------  uri@sysarch.com  ----------  http://www.sysarch.com
SYStems ARCHitecture and Stem Development ------ http://www.stemsystems.com
Learn Advanced Object Oriented Perl from Damian Conway - Boston, July 10-11
Class and Registration info:     http://www.sysarch.com/perl/OOP_class.html


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

Date: Sat, 14 Jul 2001 13:38:29 -0400
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: how do I flush a file buffer?
Message-Id: <slrn9l10sl.rcg.tadmc@tadmc26.august.net>

Mark McKay <kitfox@kitfox.com> wrote:

>Is there a way to flush the buffer on demand?


What happened when you tried

   perldoc -q flush

*before* you posted to the Perl newsgroup?


>Please reply to mark@kitfox.com


Nope.

Ask it here. Get the answer here (maybe).


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


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

Date: Sat, 14 Jul 2001 11:58:31 -0400
From: Mark McKay <kitfox@kitfox.com>
Subject: how many bytes to read from socket?
Message-Id: <3B506C27.1FC622B1@kitfox.com>

I'm trying to create a simple chat server application.  I have it mostly
running, and am using sysread() and syswrite() calls on my sockets to
keep everything nonblocking.  However, sysread() requires an integer
input specifing how many characters to read.  How would I tell this?  Is
there some function that says how many characters in a socket are
waiting to be read (if any)?

I'm using the IO::Socket and IO::Select to create and manage several
connections.

Please email any responses to mark@kitfox.com

Mark


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

Date: Sat, 14 Jul 2001 16:18:51 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: how many bytes to read from socket?
Message-Id: <x7r8vjwkk4.fsf@home.sysarch.com>

>>>>> "MM" == Mark McKay <kitfox@kitfox.com> writes:

  MM> I'm trying to create a simple chat server application.  I have it mostly
  MM> running, and am using sysread() and syswrite() calls on my sockets to
  MM> keep everything nonblocking.  However, sysread() requires an integer
  MM> input specifing how many characters to read.  How would I tell this?  Is
  MM> there some function that says how many characters in a socket are
  MM> waiting to be read (if any)?

try playing with Stem's chat server demo. it will save you all the work.

download it and follow the docs on how to setup a simple chat server.

	http://www.stemsystems.com

uri

-- 
Uri Guttman  ---------  uri@sysarch.com  ----------  http://www.sysarch.com
SYStems ARCHitecture and Stem Development ------ http://www.stemsystems.com
Learn Advanced Object Oriented Perl from Damian Conway - Boston, July 10-11
Class and Registration info:     http://www.sysarch.com/perl/OOP_class.html


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

Date: Sat, 14 Jul 2001 14:00:59 -0400
From: Mark McKay <kitfox@kitfox.com>
Subject: Re: how many bytes to read from socket?
Message-Id: <3B5088DB.3DC53E19@kitfox.com>

Thanks for your replay, but this chat server is simply going to be the
first stage in what is going to be a more involved project.  The first
attempt to just get something up and running, if you will.  

So, would you know how to determine the number of bytes a socket has
available for reading?

Mark

Uri Guttman wrote:
> 
> >>>>> "MM" == Mark McKay <kitfox@kitfox.com> writes:
> 
>   MM> I'm trying to create a simple chat server application.  I have it mostly
>   MM> running, and am using sysread() and syswrite() calls on my sockets to
>   MM> keep everything nonblocking.  However, sysread() requires an integer
>   MM> input specifing how many characters to read.  How would I tell this?  Is
>   MM> there some function that says how many characters in a socket are
>   MM> waiting to be read (if any)?
> 
> try playing with Stem's chat server demo. it will save you all the work.
> 
> download it and follow the docs on how to setup a simple chat server.
> 
>         http://www.stemsystems.com
> 
> uri
> 
> --
> Uri Guttman  ---------  uri@sysarch.com  ----------  http://www.sysarch.com
> SYStems ARCHitecture and Stem Development ------ http://www.stemsystems.com
> Learn Advanced Object Oriented Perl from Damian Conway - Boston, July 10-11
> Class and Registration info:     http://www.sysarch.com/perl/OOP_class.html

-- 
We, in all humidity, are the people of currant times. This
concept grinds our critical, seething minds to a halt.
  - Anders Henriksson, "A History of the Past, Part II"
    (A collection of excerpts from student papers)


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

Date: Sat, 14 Jul 2001 20:24:45 +0000
From: gnari <gnarinn@hotmail.com>
Subject: Re: how many bytes to read from socket?
Message-Id: <995142285.332804532721639.gnarinn@hotmail.com>

In article <3B506C27.1FC622B1@kitfox.com>,
Mark McKay  <kitfox@kitfox.com> wrote:
>I'm trying to create a simple chat server application.  I have it mostly
>running, and am using sysread() and syswrite() calls on my sockets to
>keep everything nonblocking.  However, sysread() requires an integer
>input specifing how many characters to read.  How would I tell this?  Is
>there some function that says how many characters in a socket are
>waiting to be read (if any)?
>

how about reading the maximum you can handle, and reading the returned
number of bytes read?

gnari


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

Date: Sat, 14 Jul 2001 21:05:31 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: how many bytes to read from socket?
Message-Id: <x7ofqnw7ab.fsf@home.sysarch.com>

>>>>> "MM" == Mark McKay <kitfox@kitfox.com> writes:

first off, you stealth cc'ed me. don't do that. enable your newsreader
to mark cc's

secondly don't jeopardy post. put your comments AFTER the edited and
quoted letters.

  MM> Thanks for your replay, but this chat server is simply going to be the
  MM> first stage in what is going to be a more involved project.  The first
  MM> attempt to just get something up and running, if you will.  

third, you know not of what you speak. stem is much more 'involved' than
your (probably school project) chat server will ever be. stem has a
WORKING chat server demo that requires no coding. 

  MM> So, would you know how to determine the number of bytes a socket has
  MM> available for reading?

that is a useless piece of information you are requesting. when you read
from socket, you must handle buffering and parsing on your own. in
general you read as much as you can handle each time. the read call will
tell you how much you have read (if any).

and before you go off into socket land with no training wheels, read
perlipc and the IPC sections in the perl cookbook.

uri

-- 
Uri Guttman  ---------  uri@sysarch.com  ----------  http://www.sysarch.com
SYStems ARCHitecture and Stem Development ------ http://www.stemsystems.com
Learn Advanced Object Oriented Perl from Damian Conway - Boston, July 10-11
Class and Registration info:     http://www.sysarch.com/perl/OOP_class.html


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

Date: Sat, 14 Jul 2001 17:38:43 GMT
From: "Alan Wrigley" <spamhater@keepyourfilthyspamtoyourself.co.uk>
Subject: Re: how to read multipart/form-data
Message-Id: <Ds%37.3314$JS2.386507@newsread1.prod.itd.earthlink.net>

"Stuart Moore" <stumo@bigfoot.com> wrote in message
news:9_H37.26970$WS4.4095613@news6-win.server.ntlworld.com...
> Alan Wrigley <spamhater@keepyourfilthyspamtoyourself.co.uk> wrote in
message
> news:OmH37.1133$23.140503@newsread2.prod.itd.earthlink.net...
> >
> > File upload doesn't work for me if the source file has spaces in the
> > filename (which is becoming increasingly common with the proliferation
of
> > 'My Documents' and 'My Pictures' folders). Is there a way for the Perl
> > script that processes the upload to overcome this?
> >
>
> I've used the CGI module with source files with spaces, with no problems.
Are
> you coding this yourself? If so, could it be a regex needs to be changed
to
> allow spaces?

Yes, you're right. I've just knocked up a test page with what seemed to be
identical code to the page that didn't work, and spaces in filenames work
fine. I'm using the CGI module but there's obviously a typo somewhere in my
code. Many thanks, sorry if I wasted your time.

Alan





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

Date: Sat, 14 Jul 2001 16:10:25 -0400
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: inline average
Message-Id: <3B50A731.1AE46030@earthlink.net>

Rich wrote:
> 
> "Benjamin Goldberg" <goldbb2@earthlink.net> wrote in message news:3B4CBAB6.D05F2E6D@earthlink.net...
> <snip>
> > Or possibly:
> > tie $values{average}, "Average", \%values;
> >
> > This gives all the benefits of a tied scalar, without having to
> > create another variable for it... and it's only one value that's
> > tied, not the whole hash.
> 
> You mean like in the example I gave on 7/1/01?

Yup, just like that... except I don't see it on my newsserver.

> 
> ####################
> "Rich" <bigrich318@yahoo.com> wrote in message
> news:tju1btnbp33b17@corp.supernews.com...
> >
> > "David Frauzel" <nogard@gnosrehtaew.ten> wrote in message
> > news:9hm1cs$2h15$1@news.aros.net...
> > > This is perhaps esoteric, but I'm curious.
> > <snip, see previous posts>
> >
> > You could tie the scalar variable $values{average}.
> >
> > #!/usr/bin/perl -w
> >
> > package Average;
> >
> > sub TIESCALAR {
> >  my ($class, $hashref) = @_;
> >  return bless $hashref, $class;
> > }

Umm, what happens if you want to get the average of the values in a
class [something already blessed]?  Doesn't this mess that up?

I would do:
	sub TIESCALAR {
		my ($self, $hashref) = @_;
		bless \$hashref, $self;
	}

This results in the tied object being a blessed *scalar* ref, which was
made from a lexical -- and has no relation to to the hash except that it
happens to contain a reference to it.

> > sub STORE {
> >  #called when value assigned to tied variable
> >  #not sure what you'd do here in this case
> >  return;
> > }

How about you scale all the values up or down so that the passed value
is the new average?

> > sub FETCH {
> >  my $self = shift;
> >  my $total = 0;
> >  my $colors = 0; #number of valid color values to average
> >  foreach my $color (keys %$self) {
> >  if ($color ne "average"
> >           &&
> >           # Don't use value of  $values{$color} unless it's a number
> >           $$self{$color} =~ /^-?(?:(?:\d+\.?\d*)|(?:\d*\.\d+))$/) {
> >             $total += $$self{$color};
> >             $colors++;
> >     }
> >   }
> >   return sprintf("%.2f", $total /= $colors);
> > }

Why round it?  Surely that would be something to be done outside of the
class?  Also, there are lots more things which are valid perl numbers --
the only real way to tell is try it and see if perl complains.  Also,
how do you *know* that this class is tied to "average"?  What if I tied
it to "aVeRaGe" or "sum/count" or "scooby-doo"? (ok, maybe not scooby
doo).

sub FETCH {
	my ($self) = @_;
	my ($sum, $count);
	my $notanumber = 0;
	use warnings "numeric";
	local $SIG{__WARN__} = sub { $notanumber = 1 };
	for my $key ( keys %$$self ) {
		next if tied($$self->{$key}) == $self;
		my $val = $$self->{$key} + 0;
		$notanumber = 0, next if $notanumber;
		$sum += $val; ++$count;
	}
	$count && $sum / $count;
}

sub STORE {
	my ($self, $newaverage) = @_;
	my $oldaverage = &FETCH;
	return if $oldaverage == 0;
	my $scale = $newaverage / $oldaverage;
	my ($sum, $count);
	my $notanumber = 0;
	use warnings "numeric";
	local $SIG{__WARN__} = sub { $notanumber = 1 };
	for my $key ( keys %$$self ) {
		next if tied($$self->{$key}) == $self;
		my $val = $$self->{$key} + 0;
		$notanumber = 0, next if $notanumber;
		$sum += ($$self{$key} = $val * $scale);
		++$count;
	}
	$count && $sum / $count;
}

> >
> > package main;
> >
> >
> > my %values = (
> >   red => 5.0,
> >   orange => 4.0,
> >   yellow => 5.5,
> > );
> >
> > tie ($values{average}, "Average", \%values);
> <snip>
> #############################################
> 
> Just curious.
> 
> Rich

-- 
The longer a man is wrong, the surer he is that he's right.


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

Date: 14 Jul 2001 11:14:59 -0700
From: q_mac@hotmail.com (Y)
Subject: Installing DBD on AIX 4.3.3
Message-Id: <e7bb86d8.0107141014.30515bb@posting.google.com>

After I installed DBI 1.15, I get this message when I try to make
DBD-DB2-0.75..

ld: 0711-851 SEVERE ERROR: Output file: blib/arch/auto/DBD/DB2/DB2.so
        The file is in use and cannot be overwritten.
make: The error code from the last command is 12.


I have been running a script using the DBI functions but have it has
long been stopped. I have closed and re opened my session and it still
give this error.
HELP.


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

Date: Sat, 14 Jul 2001 17:08:06 GMT
From: m_010@yahoo.com (Chad)
Subject: Re: perl debugger
Message-Id: <3b557c20.1018214@enews.newsguy.com>

I think it's ok not to use a debugger, but it will take a much longer
time to find out what's wrong when things is not working.

Any easy-install perl debugger out there?   windows / unix?

Thanks

On Sat, 14 Jul 2001 11:36:28 +0100, James Taylor
<SEE_MY_SIG@nospam.demon.co.uk> wrote:

>In article <3b549a35.23305062@enews.newsguy.com>,
>Chad Yoshikawa <m_010@yahoo.com> wrote:
>> 
>> I found programming in perl is hard since It don't have a nice
>> debugger.  What do you guys think?
>
>I think you must have the wrong approach to programming.
>
>I produce working Perl code, and I don't use a debugger.
>Those two things are not unrelated: I don't use a debugger
>and *therefore* I produce working Perl code.



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

Date: Sat, 14 Jul 2001 09:37:47 -0600
From: "bowman" <bowman@montana.com>
Subject: Re: Recommendation for a book covering MySQL and Perl
Message-Id: <iFZ37.6756$752.2900@newsfeed.slurp.net>


"Geoff Soper" <g.soper@soundhouse.co.uk> wrote in message
news:9ipkj1$man$1@uranium.btinternet.com...
>
> I know nothing of MySQL and very little of databases so I wonder if anyone
> can recommend a book that would give me a grounding in MySQL from a Perl
> angle.

_Programming the Perl DBI_  handles the Perl end, MSql and MySQL  or the
docs that come with MySQL detail MySQL. The DBI is uniform across most
popular database implementations, and
most databases handle most of the SQL, with some exceptions like outer
joins, or other fairly specialized commands, so a good database design book
might help if you are anticipating a commercial quality app.





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

Date: Sat, 14 Jul 2001 21:41:19 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Recommendation for a book covering MySQL and Perl
Message-Id: <dje1lt0tv66tkc6aiihcbft9mlq4riklo7@4ax.com>

Geoff Soper wrote:

>In the past I've written a simple database for a web site from scratch using
>Perl, now I need to add more features to the database and a lot more records
>so I'd like something faster and more robust. MySQL has been recommended and
>we have a MySQL database provided on our server. I am very happy using Perl
>so would like to continue doing so.
>
>I know nothing of MySQL and very little of databases so I wonder if anyone
>can recommend a book that would give me a grounding in MySQL from a Perl
>angle. I was looking at the MySQL & mSQL book from O'reilly but it was badly
>reviewed on Amazon. 

Perhaps you shouldn't focus that hard onto MySQL. Perhaps your focus
should be on SQL, and the Perl interface, thus: DBI. The book
"Programming the Perl DBI", also O'Reilly, is pretty good. And although
it doesn't give you much info that you can't find anywhere else,
including the DBI docs, the slope is pretty shallow, and you'll get to a
level where you can stand on your own two feet pretty quickly.

For MySQL specifically, the New Riders book is considered not half bad,
although I know at least one person who was a little disappointed. It's
better than the book you mentioned, anyway. Er... here's a book review:
<http://slashdot.org/books/00/04/04/133213.shtml>.

-- 
	Bart.


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

Date: Sat, 14 Jul 2001 16:14:12 -0400
From: Buddy Burden <buddy@barefoot.net>
Subject: Re: Replacing a word in a file
Message-Id: <4291lt037brt4ru1bh4su0851vphk81ihg@4ax.com>

Dennis,

>  Otherwise, it appears that you have to open a file twice or make 2
>  copies just to replace a word; but maybe I misunderstand the docs in
>  that regard??? 

It's a common beginner misconception that you can just replace lines
in files by (conceptually) writing on top of the existing text.  Try
thinking of your file as a collection of bytes, kind of like ... oh,
say, my CD collection here.  Since I'm an anal sort of person, all my
CD's are alphabetical by artist.  Which means if I go out and buy a
new Tori Amos, or Alice in Chains, or whatever, then I've got to
painstakingly move every other CD in the case down one, starting at
the end.  An alternate method would be to take another (empty) CD case
and transfer all the CD's into _it_, inserting the new one at the
appropriate place.  Then I'd move the new CD case where my old one is,
and mark the old one ".bak".  This is pretty much exactly what you're
doing with searching/replacing in files.  Since you (usually) can't
guarantee that your replacement text is exactly the same number of
bytes as what you're searching for, you have to use the two file
method.

HTH.


        -- Buddy Burden, Barefoot Software


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

Date: Sat, 14 Jul 2001 20:12:36 +0000
From: gnari <gnarinn@hotmail.com>
Subject: Re: Sockets: What am I doing wrong?
Message-Id: <995141556.964704476296902.gnarinn@hotmail.com>

In article <Pine.SGI.4.21.0107111850080.21489135-100000@aisa.fi.muni.cz>,
Vit Hotarek  <xhotarek@fi.muni.cz> wrote:
>
>Hello,
>
>when I run the script below, it produces
>desired output: response from the
>$remote_host on port $port.
>
>But the problem is, that it doesn't
>end. I really have no idea how to
>solve it, i tried everything.
>
(snipped socket prog that opens connection to FTP server and
does an endless read loop)

your problem is that you have initiated an conversation with
a FTP server, but seem to have no idea what the protocol is about

your program seems to hang because the server is waiting for
a command

you should readup on specifications of the FTP protocol,
and then you might want to look at the module Net::FTP

gnari


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

Date: Sat, 14 Jul 2001 16:07:51 GMT
From: mjd@plover.com (Mark Jason Dominus)
Subject: Re: warn() does not use a localized STDERR filehandle, how come?
Message-Id: <3b506e30.378a$37b@news.op.net>

In article <d71d1211.0107131258.586138e3@posting.google.com>,
nico gianniotis <nico@arzoon.com> wrote:
>    {
>        local *STDERR;
>        open(STDERR, ">/tmp/z");
>        warn "oops! this comes out the original stderr! why?\n";
>	print STDERR "however, this goes into /tmp/z as expected\n";
>	close(STDERR);
>    }

This works correctly for me with Perl 5.6.1 on Linux.  If it's not
working for you, please run the 'perbug' program that comes with Perl,
and file a bug report.

But please double-check first with a small, complete test case to make
sure you are really seeing what you think you are.

-- 
@P=split//,".URRUU\c8R";@d=split//,"\nrekcah xinU / lreP rehtona tsuJ";sub p{
@p{"r$p","u$p"}=(P,P);pipe"r$p","u$p";++$p;($q*=2)+=$f=!fork;map{$P=$P[$f^ord
($p{$_})&6];$p{$_}=/ ^$P/ix?$P:close$_}keys%p}p;p;p;p;p;map{$p{$_}=~/^[P.]/&&
close$_}%p;wait until$?;map{/^r/&&<$_>}%p;$_=$d[$q];sleep rand(2)if/\S/;print


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

Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 6 Apr 01)
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.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 V10 Issue 1306
***************************************


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