[10898] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4499 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Dec 26 23:07:16 1998

Date: Sat, 26 Dec 98 20:00:16 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Sat, 26 Dec 1998     Volume: 8 Number: 4499

Today's topics:
    Re: "^M" with no ASCII Transfer (Tad McClellan)
    Re: ------What should I use as a Win32 perl interpreter (Randal L. Schwartz)
    Re: a nicer way? <chatmaster@c-zone.net>
    Re: a nicer way? <tchrist@mox.perl.com>
    Re: a nicer way? dturley@pobox.com
    Re: a nicer way? (Michael Rubenstein)
    Re: ActivePerl perlscript and IIS <mobetta@conquestcreations.com>
    Re: attach html file to email <bwb@dowebpages.com>
    Re: Basic Perl DOS/Win95 + WWW + CGI course for Newbies <chatmaster@c-zone.net>
    Re: faster than regexp (Ronald J Kimball)
    Re: faster than regexp (Alan Barclay)
    Re: hashes with arrays as values? <zenin@bawdycaste.org>
        locating module GDBM_File (Jarle H Knudsen)
    Re: locating module GDBM_File (Ronald J Kimball)
    Re: PERL OO: Function overloading <zenin@bawdycaste.org>
    Re: Problem with Active Perl <chatmaster@c-zone.net>
    Re: Problem with Active Perl <debot@xs4all.nl>
    Re: Problem with Text files with my Program. <niall_wallace@yahoo.com>
    Re: Problem with Text files with my Program. <niall_wallace@yahoo.com>
    Re: Problem writing a file from web browser <jamesht@idt.net>
    Re: sizeof() function? (Bart Lateur)
        Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)

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

Date: Sat, 26 Dec 1998 15:30:04 -0600
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: "^M" with no ASCII Transfer
Message-Id: <sgk367.kud.ln@magna.metronet.com>

Thomas Brian Holdren (irc_addict@hotmail.com) wrote:

: I have a rather embarassing question.  You know that little "^M" character that 
: Windows just loves to put at the end of lines?  Well, I know that doing an FTP 

: a multi-line text-box "comments" entry.  So ASCII won't help me here.  I've 
: tried substituting for newlines, I've tried chomping, nothing seems to be 
                         ^^^^^^^^

   That won't do it because they aren't newlines.

   They are Carriage Returns.

   Try substituting for carriage returns instead   ;-)


      tr/\r//d;


--
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


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

Date: 26 Dec 1998 14:22:05 -0800
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: ------What should I use as a Win32 perl interpreter-----
Message-Id: <m190fuwnle.fsf@halfdome.holdit.com>

>>>>> "Geir" == Geir Magnusson <gmj@netaxis.com> writes:

Geir> QnJldHQgU3VtbWVyZXIgd3JvdGU6DQoNCj4gICAgICAgICBSaWdodCBub3cgSSB1c2UgQWN0
Geir> aXZlUGVybCwgYmVjYXVzZSBpdCdzIGZyZWUuICBBbnkgb3RoZXINCj4gaWRlYXM/ICBBbHNv
Geir> LCBkb2VzIGFueW9uZSBrbm93IHdoZXJlIEkgY2FuIGZpbmQgYSBkZWNlbnQgYm9vayBvbg0K
Geir> PiBnZXR0aW5nIHBlcmwgc2NyaXB0cyB0byBydW4gb24gYSBOVCBib3g/ICBBbGwgb2YgdGhl
Geir> IG9uZXMgdGhhdCBJIGZvdW5kDQo+IGFyZSB3cml0dGVuIHdpdGggVU5JWCBpbiBtaW5kLiAg
Geir> SSBkbyBteSBkZXZlbG9wbWVudCBvbiBTcGFycXMsIGJ1dCBvdXINCj4gd2ViIHNlcnZlciBp
Geir> cyBEb21pbm8gb24gTlQuDQo+DQo+ICAgICAgICAgLUJyZXR0IFN1bW1lcmVyDQo+IHN1bW1l
Geir> cmUxQHBpbG90Lm1zdS5lZHUNCg0KV2hhdCBhYm91dCBnZXR0aW5nIGFuZCBjb21waWxpbmcg
Geir> dGhlIHJlZ3VsYXIgZGlzdHJpYnV0aW9uPyAgSSBkbyB0aGF0LA0KYW5kIEkgYW0gaGFwcHkg
Geir> YXMgYSAgY2xhbS4NCg0KZ2Vpcg0KDQotLQ0KR2VpciBNYWdudXNzb24gSnIuDQpnbWpAbmV0
Geir> YXhpcy5jb20NClBlcmwncyBnYXJiYWdlIGNvbGxlY3RvciBhYmhvcnMgYSBuYWtlZCBjaXJj
Geir> dWxhcml0eS4gLXRjDQpDaGFzZSB0aGUgZHJlYW0sIG5vdCB0aGUgY29tcGV0aXRpb24uDQoN
Geir> Cg0K

No, I'm quite sure that *won't* work as a win32 perl interpreter.
Try again.

:-)

-- 
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: Sat, 26 Dec 1998 15:54:27 -0800
From: TRG Software <chatmaster@c-zone.net>
Subject: Re: a nicer way?
Message-Id: <36857733.9EFCB661@c-zone.net>

Jason Costomiris wrote:
> 
> On 26 Dec 1998 01:22:04 GMT, Tom Christiansen <tchrist@mox.perl.com> wrote:
> : In the case of the overwhelming majority of uses of CGI.pm, the object
> : interface produces annoyingly repetitive code that is harder to read
> : and thus maintain than what the procedural interface generates.  It's a
> : waste of your time and the time of those who come after you -- as well
> : as those who would like to, like me.
> 
> You might want to clue Lincoln Stein in on this.  In my copy of the
> man page to CGI.pm (obviously, gen'd from the embedded pod), all of
> his examples use the OO syntax.
> 
> I guess Lincoln's a nut too.  Permit me to be the first to congratulate
> Lincoln on his status as a nut!  You're really getting absurd here, Tom.
> 
> Oh, and BTW Tom, awk is fine as is (I'm sure you'll find that utterly
> shocking, coming from me).
> 
> Not everything has to be an object, but many times, they are useful,
> like in conjunction with CGI.pm.  Obfuscation?  Now I could see you
> claiming obfuscation if I had pack() and unpack()'d everything using
> some sort of funky args, and did some bit shifts to hide the meaning
> of my code.  Invoking methods of an object?  That's not obfuscation.
> 
> Tom's a great guy, who's done a lot for perl.  He's also human, that is,
> occasionally will be wrong.  IMHO, this is one of those occasions.
> 
> --
> Jason Costomiris <><            | Linux...
> jcostom@jasons.org              | "Find out what you've been missing
> http://www.jasons.org/~jcostom/ | while you've been rebooting Windows NT."
> #include <disclaimer.h>         |         --Infoworld

No offense Jason... I do understand what you originally inquired about,
but to be honest, you're really in over your head here. Sure, everyone
*can* make mistakes, but that doesn't mean they do, and moreover, Tom
didn't.

--
Regards,
Tim Greer - chatmaster@c-zone.net
TRG Software and The Link Worm
http://www.linkworm.com
The Chat Base
http://www.chatbase.com
-----------------------------------------------------------------------
* Creator of Paradise Chat, Chat Central & Spiral Chat
* Receiving over 250,000+ hits a day from users Worldwide!!!
* Sales of custom chat server scripts * CGI/Perl scripting
* Script trouble shooting/security * Modify & debug scripts
* Freelance Perl Scripting for any purpose or application


       Copyright ) 1998 TRG Software and The Link Worm.


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

Date: 27 Dec 1998 00:13:54 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: a nicer way?
Message-Id: <763u42$h42$1@csnews.cs.colorado.edu>

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

In comp.lang.perl.misc, chatmaster@c-zone.net writes:
:No offense Jason... I do understand what you originally inquired about,
:but to be honest, you're really in over your head here. Sure, everyone
:*can* make mistakes, but that doesn't mean they do, and moreover, Tom
:didn't.

I don't think you're going to make any headway with this fellow.
He has now sprinkled my mailbox with several messages full of insult and
invective, ending them with a pleasant "And I can't read your replies,
because I've redirected them to /dev/null."  Some people really can't
stand not getting the last word, especially when they're wrong.

Merry Christmas,

--tom
-- 
    :  I've heard that there is a shell (bourne or csh)  to perl filter, does
    :  anyone know of this or where I can get it?
    Yeah, you filter it through Tom Christiansen.  :-)  --Larry Wall


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

Date: Sun, 27 Dec 1998 00:49:01 GMT
From: dturley@pobox.com
Subject: Re: a nicer way?
Message-Id: <76405t$dt9$1@nnrp1.dejanews.com>

In article <761dns$235$1@csnews.cs.colorado.edu>,
  tchrist@mox.perl.com (Tom Christiansen) wrote:

> In the case of the overwhelming majority of uses of CGI.pm, the object
> interface produces annoyingly repetitive code that is harder to read
> and thus maintain than what the procedural interface generates.  It's a
> waste of your time and the time of those who come after you -- as well
> as those who would like to, like me.

I've been following this thread with interest since I've failed to see the
point of the OO use of CGI.pm, for most scripts. (As I fail to see the point
of writing CGI scripts *without* CGI.pm.) I agree with Mr. C's posts on the
matter. Now could someine make a point *for* using OO when there is only one
CGI object used in the script?


--
____________________________________
David Turley
dturley@pobox.com
http://www.binary.net/dturley/

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: Sun, 27 Dec 1998 03:39:07 GMT
From: miker3@ix.netcom.com (Michael Rubenstein)
Subject: Re: a nicer way?
Message-Id: <368d9e2b.288219197@nntp.ix.netcom.com>

On Sun, 27 Dec 1998 00:49:01 GMT, dturley@pobox.com wrote:

>In article <761dns$235$1@csnews.cs.colorado.edu>,
>  tchrist@mox.perl.com (Tom Christiansen) wrote:
>
>> In the case of the overwhelming majority of uses of CGI.pm, the object
>> interface produces annoyingly repetitive code that is harder to read
>> and thus maintain than what the procedural interface generates.  It's a
>> waste of your time and the time of those who come after you -- as well
>> as those who would like to, like me.
>
>I've been following this thread with interest since I've failed to see the
>point of the OO use of CGI.pm, for most scripts. (As I fail to see the point
>of writing CGI scripts *without* CGI.pm.) I agree with Mr. C's posts on the
>matter. Now could someine make a point *for* using OO when there is only one
>CGI object used in the script?

The problem with Tom Christensen's posts isn't that he's wrong, it's
that he's treating his view as an absolute.  

Read Jason's orginal post on the subject.  It wasn't very provocative.
Tom's "don't be a nut" response was uncalled for.

Jason recognized that Tom's solution is correct and presented an
alternative.  He even refers to the major advantage of Tom's approach,
though not in terms that I'd have chosen.  He calls it "fewer
keystrokes."  The advantage of Tom's approach is that the program is
smaller and, by some reasonable measures, simpler.  That affects not
only ease of inputting the program, which I consider of little
importance, but also readability and maintainability, which I consider
very important.

The advantage of Jason's approach is, at least in some sense,
consistency.  There is a real advantage to always using objects in the
same way.  Unlike the documentation, one does not (at least, not if
one is working for me) use names like $q to refer to the CGI object;
one uses a name line $cgi, so the $cgi-> makes it clear when
maintaning the program where the function came from.  The object
approach also prevents polluting your namespace with the functions
defined in the class (you can avoid this by not importing the names
and using the qualified names, but, as I see it, this gives you the
disadvantages of both, with the advantages of neither).

Programs have a tendency to grow.  New requirements keep coming up.
What happens when you suddenly discover that it would be better to use
another CGI object?  If you've used the procedural interface, you have
to either change your code or use the procedural interface for the
default object and the object interface for other objects.  The former
is error prone and I'd call the inconsistency of the latter a serious
problem.  Having said this, I'll add that I consider this reason
rather tenuous.  I can't recall ever writing a script that used two
CGI objects.  However, those with different experience may consider it
more important.

My point is not to argue for one approach or the other.  I've used
both and am not going to say which one I've settled on.  If you're
happy with the procedural approach, use it.  Or you might do as I have
done and try both in various scripts and then decide which one you
find better.

I do not believe that Jason's views deserve the disdain they have
received here.  There IS more than one way to do it.
--
Michael M Rubenstein


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

Date: Sat, 26 Dec 1998 19:59:45 -0500
From: "MoBetta" <mobetta@conquestcreations.com>
Subject: Re: ActivePerl perlscript and IIS
Message-Id: <764120$r6o$1@fir.prod.itd.earthlink.net>

You can use ActivePerl build 507 and later to run perlscript in ASP pages.
Once installed, create a virtual directory to the
eg\aspsamples directory under your perl install directory. There are 2
examples of using perlsctript and vbscript. Basically in your script
declaration the language="perlscript". The only problem I've encountered is
with arrays using the @ symbol. If you define all the script on the page
witn <@! Language....> beginning of the page, the ASP will return with the
error that only 1 @ is allowed.

tenthousand@geocities.com wrote in message
<75ufd8$c9g$1@nnrp1.dejanews.com>...
>In article <366BAA08.F5BF687@teamamiga.org_NOSPAM>,
>  matt@teamamiga.org wrote:
>> brian.parks@stn.siemens.com wrote:
>> >
>> > I just installed ActivePerl (build 507) and want to write some ASP
pages
>using
>> > PerlScript rather than VBScript.
>> > ActivePerl installed OK, and I can run standard perl cgi scripts, but
I'm
>> > having problems with the following perlscript (ASP):
>>
>> [snip]
>>
>> > My browser returns the following error message:
>>
> --------------------------------------------------------------------------
-
>> > $Response->writeblock(0); $Response->write("Hello World"); error
'80004005'
>> >
>> > Can't call method "writeblock" on an undefined value.
>>
>> You have an installation problem. Try re-installing ActivePerl. If that
>> doesn't work, reinstall IIS.
>
>The company I work at has the same problem. I've tried to instal new builds
>of ActivePerl several time, but we always need to re-install build 502.
>However, on another server, we started with build 505 and it worked
>perfectly...
>
>It is a bit of a problem, because of course we would like to keep our
server
>synchronised...
>
>Also, when i recently tried to install build 507, the server said when I
>started that "because several programs were using this or that, the
>installing would probably go not as we liked... We've never had this
before,
>and actually some part of the message made no sense...
>
>BVH
>
>BTW a tip: Index Server runs havoc on your server... at our place it
removed
>every "default file" type (.shtml etc) except the ones that come standard
with
>IIS... thank you micro$oft!
>
>-----------== Posted via Deja News, The Discussion Network ==----------
>http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own





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

Date: Sat, 26 Dec 1998 21:32:02 -0600
From: Bill Binkley <bwb@dowebpages.com>
Subject: Re: attach html file to email
Message-Id: <3685AA31.F4087262@dowebpages.com>

Clay thank you very very much,

In the spirit of Christmas I will make some friendly comments. I have been working in the computer industry since 1956, I am considered an expert in JavaScript, was a Netscape JavaScript
champion for a while, have answered many many questions on the JavaScript news groups.

While I was learning JavaScript I only asked ONE question on the news groups as I bought many books on JavaScript and used those for the information I needed. The point here is I do believe
in learning and not bothering people with unnecessary questions.

I do minimum programming in perl, and therefore only review the perl news groups when I need information, I also have three rather large reference books on perl, which I always research for
possible answers to my questions. When some one says this question has been answered before I wonder if they think all people review all news groups all the time?  I some times have spend
HOURS on a simple line in perl coding that probably thousands of people could have commented on in less than 3 minutes. But I did not ask on the perl news groups because of the flaming
attitude that some have. If a person is knowledgeable about finding information about perl they probably don't need the information.

This question about attaching a HTML file to a email, I read over 150 messages about this subject and most provided no help. I reviewed email sources that had attachments, etc. Finally it
became clear that there was no answer EXCEPT by using  MIME-light, MIME-tools, or MIME-base 64, (there are probably exceptions to this statement.) Even if you know what you want to find at a
CPAN site if takes considerable time until you are experienced with all their indexes, etc. Not knowing previously I assumed there was a statement like, "print MAIL ", etc. I now have the
information and I am waiting after the holidays to see if my ISP will install MIME-light.

If I venture forth and ask another question on this news group, know that I have done some or maybe a lot of research on the question.

I sincerely hope this message will be of benefit to all.

Happy a happy holiday,

Bill

Clay Irving wrote:

> In <3682ED99.D6C198CA@dowebpages.com> Bill Binkley <bwb@dowebpages.com> writes:
>
> >Need to attach an html file to a email that I am sending with a perl
> >script!
>
> >Any information or where to look would be appreciated very much,
>
> This question is asked every few days in this newsgroup. Try:
>
>     http://www.dejanews.com/dnquery.xp?QRY=attach&DBS=2&ST=PS&defaultOp=AND&LNG=ALL&format=terse&showsort=score&maxhits=25&subjects=&groups=comp.lang.perl.misc&authors=&fromdate=&todate=
> --
> Clay Irving
> clay@panix.com

--
Bill Binkley
Software Composers, Inc.
http://www.dowebpages.com

Go to this URL for JavaScript examples
and sample code. For JavaScript at it's
best see the "European Tour". If you
have a question about the examples, put
it in the comments of the visitors form.




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

Date: Sat, 26 Dec 1998 17:51:37 -0800
From: TRG Software <chatmaster@c-zone.net>
Subject: Re: Basic Perl DOS/Win95 + WWW + CGI course for Newbies , Christmas free  offer .
Message-Id: <368592A9.22EBB6B1@c-zone.net>

Expert wrote:
> 
> I would like to give basic Perl course for newbies.
> Integration of CGI Perl scripts with WWW pages.
> Setting up simple WIN95/ web server and setting up web pages + CGI
> programs running on your PC , for testing purposes.
> 
> Hope this course to be free, interactive, mayby on shareware basis.
> 
> If some of you guys are interested I set up  news group to move us
> there.
> regards,
> Jack

I might be interested in helping you with this (if you need any more
help), but I'll need more details. :-)

Good luck
--
Regards,
Tim Greer - chatmaster@c-zone.net
TRG Software and The Link Worm
http://www.linkworm.com
The Chat Base
http://www.chatbase.com
-----------------------------------------------------------------------
* Creator of Paradise Chat, Chat Central & Spiral Chat
* Receiving over 250,000+ hits a day from users Worldwide!!!
* Sales of custom chat server scripts * CGI/Perl scripting
* Script trouble shooting/security * Modify & debug scripts
* Freelance Perl Scripting for any purpose or application


       Copyright ) 1998 TRG Software and The Link Worm.


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

Date: Sat, 26 Dec 1998 16:54:47 -0500
From: rjk@linguist.dartmouth.edu (Ronald J Kimball)
Subject: Re: faster than regexp
Message-Id: <1dknl6v.w59151fbqblmN@bos-ip-1-109.ziplink.net>

Alan Barclay <gorilla@elaine.drink.com> wrote:

> >m!^                # To get rid of "Leaning-Toothpick Syndrome"
> >  ([a-z.]+)        # Domain (could just use \S+)
> 
> Domain names can have numbers and "_"'s in them, and even though they're
> not strictly allowed, some domains have  "-"'s too.

I believe you are mistaken.  Hyphens are allowed, underscores are not.

[a-zA-Z0-9\-.] would be an appropriate character class.


http://www.internic.net/faq/new-reg.html

    3. What are the valid characters for a domain name and how long can
       it be?

              The only valid characters for a domain name are letters,
              numbers and a hyphen. Special characters like the
              underscore (_) or an exclamation mark (!) are NOT
              permitted. Domain names cannot contain spaces or begin or
              end with a hyphen.

-- 
 _ / '  _      /         - aka -          rjk@linguist.dartmouth.edu
( /)//)//)(//)/(     Ronald J Kimball      chipmunk@m-net.arbornet.org
    /                                  http://www.ziplink.net/~rjk/
        "It's funny 'cause it's true ... and vice versa."


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

Date: 27 Dec 1998 03:25:06 GMT
From: gorilla@elaine.drink.com (Alan Barclay)
Subject: Re: faster than regexp
Message-Id: <914729104.857843@elaine.drink.com>

In article <1dknl6v.w59151fbqblmN@bos-ip-1-109.ziplink.net>,
Ronald J Kimball <rjk@linguist.dartmouth.edu> wrote:
>Alan Barclay <gorilla@elaine.drink.com> wrote:
>
>> >m!^                # To get rid of "Leaning-Toothpick Syndrome"
>> >  ([a-z.]+)        # Domain (could just use \S+)
>> 
>> Domain names can have numbers and "_"'s in them, and even though they're
>> not strictly allowed, some domains have  "-"'s too.
>
>I believe you are mistaken.  Hyphens are allowed, underscores are not.

You are correct. Minor brain fritz.


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

Date: 26 Dec 1998 20:55:14 GMT
From: Zenin <zenin@bawdycaste.org>
Subject: Re: hashes with arrays as values?
Message-Id: <914705809.709682@thrush.omix.com>

Jerome O'Neil <jeromeo@atrieva.com> wrote:
: bj wrote:
	>snip<
: > devnull[me][54]$ perlindex hashes
: Very Nifty!  Is this going to be part of the standard distribution?

	Not that I know of, but it *really* should be. -Or better yet, tied
	into perldoc directly so we don't have two standard documentation
	utilities to confuse users.

-- 
-Zenin (zenin@archive.rhps.org)           From The Blue Camel we learn:
BSD:  A psychoactive drug, popular in the 80s, probably developed at UC
Berkeley or thereabouts.  Similar in many ways to the prescription-only
medication called "System V", but infinitely more useful. (Or, at least,
more fun.)  The full chemical name is "Berkeley Standard Distribution".


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

Date: Sun, 27 Dec 1998 00:46:36 GMT
From: no.unsolicited.mail.please@jarle.com (Jarle H Knudsen)
Subject: locating module GDBM_File
Message-Id: <3685829a.40107243@news1.telia.com>

I'm having a hard time locating the GDBM_File module on CPAN. Can
someone please advise me?

(I'm using "perl, version 5.005_02 built for MSWin32-x86-object".)

-- 
  Jarle H. Knudsen



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

Date: Sat, 26 Dec 1998 22:10:28 -0500
From: rjk@linguist.dartmouth.edu (Ronald J Kimball)
Subject: Re: locating module GDBM_File
Message-Id: <1dko02r.16iyg4dgaqqvmN@bos-ip-1-107.ziplink.net>

Jarle H Knudsen <no.unsolicited.mail.please@jarle.com> wrote:

> I'm having a hard time locating the GDBM_File module on CPAN. Can
> someone please advise me?

GDBM_File is actually included in the core distribution, in the
directory ext/GDBM_File/.

-- 
 _ / '  _      /         - aka -          rjk@linguist.dartmouth.edu
( /)//)//)(//)/(     Ronald J Kimball      chipmunk@m-net.arbornet.org
    /                                  http://www.ziplink.net/~rjk/
        "It's funny 'cause it's true ... and vice versa."


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

Date: 26 Dec 1998 21:13:43 GMT
From: Zenin <zenin@bawdycaste.org>
Subject: Re: PERL OO: Function overloading
Message-Id: <914706916.892115@thrush.omix.com>

[posted & mailed]

hoangngo@usa.net wrote:
: Can anyone out here tell me if PERL offers function overloading?

        No.  There is no need for it in Perl (and it's not "PERL" btw, it's
        not an acronym.  Would you call it "JAVA" too?).

: I am trying to create a function and depends on the parameter passed to it
: (scalar, array, or hash) it will behave differently.
: One way is to detect the type of parameter,

        That's the only way in Perl.  Here's one of the more funkier ways to
        implement this if you really want different complete functions per
        type.  In this form, foo() is simply the type based dispatcher that
        Java et al have built into the language.  It transparently
        redirects the calls to foo() with different argument types to
        different _fooType() functions.  If you're doing a lot of this, it's
        likely best to throw this part into a generic AUTOLOAD() method but
        that's another class :-)

        sub foo ($) {
            for (ref $_[0]) {
                /SCALAR/    && goto &_fooScalar;
                /ARRAY/     && goto &_fooArray;
                /HASH/      && goto &_fooHash;
                die "Invalid parameter type '$_[0]'";
            }
        }

        sub _fooScalar {
            my $arg = ${ $_[0] };
        }
        sub _fooArray {
            my @arg = @{ $_[0] };
        }
        sub _fooHash {
            my %arg = %{ $_[0] };
        }

        But as with anything in Perl, TMTOWTDI. :-)

: the other way is use function overloading.
: Unfortunately, i couldn't find the solutions in PERL documentation. Please
: drop me a line if you have any information on this.

        You must be comming from a much more strongly typed language
        background ala Java, C++, etc.  Perl isn't nearly as anal (read
        "annoying") about typing issues.

-- 
-Zenin (zenin@archive.rhps.org)           From The Blue Camel we learn:
BSD:  A psychoactive drug, popular in the 80s, probably developed at UC
Berkeley or thereabouts.  Similar in many ways to the prescription-only
medication called "System V", but infinitely more useful. (Or, at least,
more fun.)  The full chemical name is "Berkeley Standard Distribution".


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

Date: Sat, 26 Dec 1998 16:11:57 -0800
From: TRG Software <chatmaster@c-zone.net>
Subject: Re: Problem with Active Perl
Message-Id: <36857B4D.BAE2E3D4@c-zone.net>



hi@there.com wrote:
> 
> I'm using Active Perl and I've got a problem:
> 
> When I run a program, the MS-DOS window opens as usual.  If there are
> errors the appropriate error messages are displayed.  Then, the window
> closes!!!  I don't get a chance to see the errors!
> 
> Does anyone know how to get around this?
> 
> Please reply to:
> nc@cyberdude.com
> 
> Thanks!

That's because you're running it in a Windows-dos window. :-)
Try actually going to the DOS shell and typing "perl nameofscript.pl"
and that should help you. You can also configure the DOS window to run
in full screen mode (and only in DOS, not any windows). If you run a
perl script by clicking on an icon on your desktop, or by other
"windows-ish" means, then it'll exit the screen when it's done.
--
Regards,
Tim Greer - chatmaster@c-zone.net
TRG Software and The Link Worm
http://www.linkworm.com
The Chat Base
http://www.chatbase.com
-----------------------------------------------------------------------
* Creator of Paradise Chat, Chat Central & Spiral Chat
* Receiving over 250,000+ hits a day from users Worldwide!!!
* Sales of custom chat server scripts * CGI/Perl scripting
* Script trouble shooting/security * Modify & debug scripts
* Freelance Perl Scripting for any purpose or application


       Copyright ) 1998 TRG Software and The Link Worm.


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

Date: Sun, 27 Dec 1998 02:00:58 +0100
From: Frank de Bot <debot@xs4all.nl>
Subject: Re: Problem with Active Perl
Message-Id: <368586C9.7EA6D70B@xs4all.nl>

You must first open the MS-prompt in the Start menu Programs . After that
go to the directory a type: perl myscript.pl

It just one of the many nasty things of Microsoft. ( I've learned a little
bit to work with the bugs )


hi@there.com wrote:

> I'm using Active Perl and I've got a problem:
>
> When I run a program, the MS-DOS window opens as usual.  If there are
> errors the appropriate error messages are displayed.  Then, the window
> closes!!!  I don't get a chance to see the errors!
>
> Does anyone know how to get around this?
>
> Please reply to:
> nc@cyberdude.com
>
> Thanks!



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

Date: Sat, 26 Dec 1998 23:52:56 -0000
From: "Wallace" <niall_wallace@yahoo.com>
Subject: Re: Problem with Text files with my Program.
Message-Id: <763t0h$nre$1@newnews.global.net.uk>

>It seems like you think the "@" indicates an array, and "$" indicates a
>scalar. That's only partly right. Actually, @hosts[$len] is an array
>slice, (a "subarray"), which contains one scalar element.


Um yeah.

>If you want one element of an array, it IS a scalar. So you need the
>"$". The "[...]" following it is indication enough to tell Perl to use
>the array.
>
>So, a first correction would be
>
>        $len = @hosts;
>        $hosts[$len] = $hostin;
>
>But it looks to me as if you want to add an element at the end of an
>array. Then do it this way:
>
> push @hosts,$hostin;
>
> Bart.

Ahh that's how you do it, Ill try that er Now.

Wallace




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

Date: Sat, 26 Dec 1998 23:56:22 -0000
From: "Wallace" <niall_wallace@yahoo.com>
Subject: Re: Problem with Text files with my Program.
Message-Id: <763t6v$o0q$1@newnews.global.net.uk>


Rich Grise wrote in message <36847A4A.6E1D@entheosengineering.com>...
>Wallace wrote:
>>
>> Arrrrgh!!!!!!!!!!! (Shouting at self)
>>[...]
>> Due to me misreading (I.e. not paying attention) the sections on what I
was
>> doing,
>> I accidentally slipped back into BASIC mode.
>[...]
>> Wallace
>
>BASIC????? Ewwwwww! At least when I started with perl, I made my
>mistakes in C!
>


Basically, oops um er.....

The programme im writing has all ready been written in True BASIC and er its
file size limit is
wait for it.............
 ........

50Kb.

No use if your Web Log is 25Gb is it.

The original program/script that I posted did the same in 1 sheet of A4
paper as TB did in 3 pages.

Wallace




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

Date: Sat, 26 Dec 1998 22:29:19 -0500
From: jamesht <jamesht@idt.net>
To: Jason Swett <swettboy@ncats.net>
Subject: Re: Problem writing a file from web browser
Message-Id: <3685A98F.A0E6861D@idt.net>

Hello,

This is very hard to say without a little more info.

It'd be nice to see some code along with any useful output it might have.

James



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

Date: Sat, 26 Dec 1998 23:37:40 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: sizeof() function?
Message-Id: <3685713a.955365@news.skynet.be>

Abigail wrote:

>Bart Lateur wrote:
>++ Another alternative:
>++ 
>++ 	$\ = "\n";
>++ 	print $foo;
>++ 
>++ Very readable, and in my mind the nicest option if ALL print statements
>++ need to be terminated with a newline.
>
>I usually prefer -l then.

I didn't know about this, so I've looked it up. What it does, is set $\
at startup. Quite nice.

>   perl   [ -l[*octal*] ]

>    -l[*octnum*]
>         enables automatic line-ending processing. It has two
>         effects: first, it automatically chomps "`$/'" (the input
>         record separator) when used with -n or -p, and second, it
>         assigns "`$\'" (the output record separator) to have the
>         value of *octnum* so that any print statements will have
>         that separator added back on.

What I don't like, is the fact that it seems to be limited to ONE
character (*octnum* is the character code). So, you can't set $\ to CRLF
( chr(13).chr(10) ) on Unix, using this option alone.

	Bart.


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

Date: 12 Dec 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Special: Digest Administrivia (Last modified: 12 Dec 98)
Message-Id: <null>


Administrivia:

Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing. 

]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body.  Majordomo will then send you instructions on how to confirm your
]subscription.  This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.

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

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