[17415] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4835 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Nov 7 18:15:50 2000

Date: Tue, 7 Nov 2000 15:15:28 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <973638927-v9-i4835@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Tue, 7 Nov 2000     Volume: 9 Number: 4835

Today's topics:
    Re: OOP and information hiding (Damian Conway)
    Re: OOP and information hiding (Abigail)
    Re: Pass by reference from Perl to C (Richard J. Rauenzahn)
    Re: pass by reference to C (Richard J. Rauenzahn)
        Passing args as references <gods-apollo@home.com>
    Re: Passing args as references (Jon Ericson)
    Re: Passing args as references <olthoff@multiboard.com>
    Re: Passing args as references <ren.maddox@tivoli.com>
    Re: Passing Hash to Perl Module Update <bart.lateur@skynet.be>
    Re: Passing Hash to Perl Module Update (Martien Verbruggen)
    Re: pattern matching across two lines (Thomas Baruchel)
    Re: Perl and mysql <greg2@surfaid.org>
    Re: Problem reading a binary file <mjcarman@home.com>
    Re: Problem reading a binary file <flavell@mail.cern.ch>
    Re: Problem reading a binary file <ren.maddox@tivoli.com>
    Re: Problem reading a binary file (Martien Verbruggen)
    Re: Problem reading a binary file <mjcarman@home.com>
    Re: Q: Getting program line number? - Thanks (Gwyn Judd)
    Re: Q: Getting program line number? - Thanks (Martien Verbruggen)
    Re: Q: Getting program line number? - Thanks <joe+usenet@sunstarsys.com>
    Re: Q: Getting program line number? (Martien Verbruggen)
        Quick Perl Question dnay@vbs.net
    Re: Quick Perl Question (John J. Trammell)
    Re: Quick Perl Question <latsharj@my-deja.com>
    Re: Quick short easy question <greg2@surfaid.org>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: 7 Nov 2000 19:52:06 GMT
From: damian@cs.monash.edu.au (Damian Conway)
Subject: Re: OOP and information hiding
Message-Id: <8u9mh6$g06$1@towncrier.cc.monash.edu.au>

cfedde@fedde.littleton.co.us (Chris Fedde) writes:

   > In article <slrn90fvml.ctp.abigail@tsathoggua.rlyeh.net>,
   > Abigail <abigail@foad.org> wrote:
   > >
   > >Perls way of implementing OO is actually anti-OO, as it gives the
   > >user of the class (that is, the inheriting class) all the baggage
   > >of the implementation. Precisely what OO is *NOT* supposed to do.
   > >"Stick to the interface" should all that's needed to succesfully
   > >use objects. But in Perl, it's "stick to the implementation".

With the deepest respect to Abagail, this is FUD.

There are very few object oriented languages in common use that 
actually allow you to inherit without knowing something of the
internals of the base classes, especially under multiple inheritance.

As "Perl Cookbook" demonstrated, the dreaded attribute name clash
problem is easily avoided (yes, very few modules bother to avoid it, but
that's laziness, not incapacity).

And yes, very few CPAN classes bother to encapsulate, but that's mainly 
a cultural phenomenon too: until my book came out, encapsulation was
vaguely frowned upon in the Perl world.

There's now Tie::Securehash that allows you to use hash-based objects
that *do* encapsulate attributes on a class-by-class basis, and also 
to avoid the name attribute collision problem. 

There's now Class::Contract that gives you declarative class
specification, strong encapsulation, no attribute collision, *and*
design-by-contract checking.

The tools are now there, and significantly, they've been written in pure
Perl! There's no point in blaming the language because people are either
too lazy or too acculturated to use them.


   > OK, I'll accept that hash as instance variable was short sighted.

I don't agree. No other Perl data type would have been any better.


   > What is the fix?  Is it even possible to fix things now?

I hope so. See:

        http://www.csse.monash.edu.au/~damian/Perl/RFC/RFC_privateKeys

which was submitted as a proposal for Perl 6.


   > Or will fixing it break backward compatibility? Most of the CPAN
   > classes use this convention because that is what is recommended in the
   > documentation. Can we simply re-write perltoot and perlbot to encourage
   > a safer technique? Maybe we should adopt object as closure as the
   > recommended convention.

No. I believe that uf there should be a recommended convention, it ought
to be flyweight scalars, which are cheaper than closures (and probably
easier for most programmers to understand)


Damian


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

Date: 7 Nov 2000 23:03:25 GMT
From: abigail@foad.org (Abigail)
Subject: Re: OOP and information hiding
Message-Id: <slrn90h2hs.na9.abigail@tsathoggua.rlyeh.net>

On 07 Nov 2000 10:54:18 -0600, Ren Maddox (ren.maddox@tivoli.com) wrote in comp.lang.perl.misc <URL: news:<m37l6fsoxx.fsf@dhcp11-177.support.tivoli.com>>:
++ abigail@foad.org (Abigail) writes:
++ 
++ > In the great Perl tradition of "do it all yourself, the language won't
++ > make it easy for you", the object is implemented as a hashref. You add
++ > your little 2 methods to the object, using one attribute to store data,
++ > and your module goes in production.
++ 
++ One might argue that you are explicitly bypassing the interface by
++ relying on the implementation being a hashref.  But then, I suppose
++ your point is that you pretty much have to do this and that is the
++ problem.
++ 
++ I know that one of the solutions to this is to use package-named
++ attributes within the hash.  Perhaps we need a better,
++ language-supported method of doing this.  What about an implicit
++ package-scoping concept for instance attributes?
++ 
++ Actually, don't the "fields" and "base" pragmas pretty much provide
++ this safe-guard (thought without the package-scoping)?


But that's the problem, isn't it? It isn't in the language, for the
safe guard to work, you have to rely on the interface.

What do you do if the object you use doesn't use fields and base?
What do you do if you need to do multiple inheritance? What do you
do if you rely on fields and base being there, and someone updates
it with a version that doesn't use fields and base, and said someone
updated it knowing it would work because the interface has not changed?


As I said before, there are hacks that more or less works. But they
aren't used that often, and it's still fundamentally wrong to claim
to use OO, and not shield the implementation.

Unless the implementation is totally irrelevant, it ain't OO. What Perl
calls OO is nothing more than ADTs with a fancy syntax.


Abigail


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

Date: 7 Nov 2000 19:17:09 GMT
From: nospam@hairball.cup.hp.com (Richard J. Rauenzahn)
Subject: Re: Pass by reference from Perl to C
Message-Id: <973624627.683742@hpvablab.cup.hp.com>




jaya <jaya_j_k@hotmail.com> writes:
>Hi,
>
>In the following code if I pass @y through the subroutine cfunc,i.e.,
>cfunc(@y)
>it gives the error
>Usage: Datatypes::cfunc(x) at datatypes.pl

Please -- Posting your question once is enough.

Rich

-- 
Rich Rauenzahn ----------+xrrauenza@cup.hp.comx+ Hewlett-Packard Company
Technical Consultant     | I speak for me,     |   19055 Pruneridge Ave. 
Development Alliances Lab|            *not* HP |                MS 46TU2
ESPD / E-Serv. Partner Division +--------------+---- Cupertino, CA 95014


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

Date: 7 Nov 2000 19:14:47 GMT
From: nospam@hairball.cup.hp.com (Richard J. Rauenzahn)
Subject: Re: pass by reference to C
Message-Id: <973624486.384201@hpvablab.cup.hp.com>


Please consider a better subject header in the future.  "Passing list of
scalars to C/XS" is an example of a more informative subject.

The reason your subject is not very informative is because all argument
passing in XS is by reference.

 ..see further comments below..

<vidulats@yahoo.co.uk> writes:
>Hello,
>
>I'm facing a problem while passing a address to C function.
>Will anyone please guide me.
>
>In Perl Script: I have following code:
>
>#!/usr/bin/perl5
>use Datatypes;
>
>@y= ('12','34','56','90','345');
>foreach $x(@y)
>{	
>       	cfunc ($x);
>}
>
>
>This is the code of XS file:
>
>void
>cfunc(x)
>	char *	x
>
>	CODE:
>	{
>		int i;
>		for(i=0;(*x) != '\0';i++,x++)
>		{
>
>			printf("%c\n",*x);
>		}
>	}
>
>This works perfectly OK.

HINT:  Look at the postprocessed .c file to see what this code actually
turns into.

>But, if I change the foreach loop. i.e. instead of 
>foreach $x(@y)
>{	
>       	cfunc ($x);
>}
>
>If I write
>cfunc(@y);
>
>then, it gives the error as
>Usage: Datatypes::cfunc(x) at datatypes.pl

You declared cfunc to take a single string/char *.  You'll see in some
of the generated code (I don't remember if its C or Perl code) that the
generated interface code checks the number of arguments.  Grep for this
error message and you'll find it.

What do you expect your function to do when it receives a list instead
of a single scalar?  You certainly didn't write any code above to handle
a list.  Did you expect Perl to call your function multiple times?  An
expedient solution might be to write a Perl function cfunc that does
that, and have cfunc call an xs function cfunc_one.

Something that helped me figure out how to use XS for my purposes was to
look at modules that did things similar to what I needed.  Off the top
of my head I can only think of one .xs that iterates over a list,
List::Util.  You may want to look at more than one.

Rich
-- 
Rich Rauenzahn ----------+xrrauenza@cup.hp.comx+ Hewlett-Packard Company
Technical Consultant     | I speak for me,     |   19055 Pruneridge Ave. 
Development Alliances Lab|            *not* HP |                MS 46TU2
ESPD / E-Serv. Partner Division +--------------+---- Cupertino, CA 95014


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

Date: Tue, 07 Nov 2000 20:31:52 GMT
From: "John" <gods-apollo@home.com>
Subject: Passing args as references
Message-Id: <YEZN5.64162$E85.1706259@news1.sttls1.wa.home.com>

How do you pass an argument as a reference to a function so you can actually
modify the original variables value as opposed to a function value?

John




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

Date: 7 Nov 2000 20:52:11 GMT
From: Jonathan.L.Ericson@jpl.nasa.gov (Jon Ericson)
Subject: Re: Passing args as references
Message-Id: <8FE58C0E1JonathanLEricsonjpln@137.78.50.25>

nobodyshere@com.home (John) wrote:

>How do you pass an argument as a reference to a function so you can
>actually modify the original variables value as opposed to a function
>value? 

Please read perlsub.  If your question isn't answered there (I don't know 
if I understand what you are asking), rephrase with example code where it 
would be useful.

Jon


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

Date: Tue, 7 Nov 2000 15:51:24 -0500
From: "Darryl Olthoff" <olthoff@multiboard.com>
Subject: Re: Passing args as references
Message-Id: <8u9q0d$ia8$1@panther.uwo.ca>

> How do you pass an argument as a reference to a function so you can
actually
> modify the original variables value as opposed to a function value?

my $Var1 = 'test';
my $Var2 = 'this';

&Function(\$Var1, \$Var2);

sub Function {
  my ($Param1, $Param2) = @_;

  $$Param1 .= 'ing';
  $$Param2 .= ' is a test';

};




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

Date: 07 Nov 2000 14:47:40 -0600
From: Ren Maddox <ren.maddox@tivoli.com>
Subject: Re: Passing args as references
Message-Id: <m3y9yvpl03.fsf@dhcp11-177.support.tivoli.com>

"John" <gods-apollo@home.com> writes:

> How do you pass an argument as a reference to a function so you can actually
> modify the original variables value as opposed to a function value?

Take a look at perlref(1).  Basically, you do this:

#!/usr/local/bin/perl -w
use strict;

sub double {
  my $val_ref = shift;
  $$val_ref *= 2;
}

my $x = 3;
double \$x;
print "$x\n";
__END__


Alternatively (and unrecommended, in my opinion), you can use a
prototype (see perlsub(1)):

#!/usr/local/bin/perl -w
use strict;

sub double (\$) {
  my $val_ref = shift;
  $$val_ref *= 2;
}

my $x = 3;
double $x;
print "$x\n";
__END__


I subscribe to the camp that says the only time that you shouldn't use
prototypes for regular functions.  Rather, they should only be used
in special cases (eg. emulating Perl built-ins).

-- 
Ren Maddox
ren@tivoli.com


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

Date: Tue, 07 Nov 2000 19:28:28 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Passing Hash to Perl Module Update
Message-Id: <3ulg0t4jv2i2qha5gqmtmi64m7hu6n1bdb@4ax.com>

Martien Verbruggen wrote:

>While the general convention in Perl OO is that the standard
>constructor is called new(), there is no reason that it should be. You
>can call it create(), summon(), hocuspocus() or googleBlurph() if you
>feel like it.

I have file related OO modules, in which the constructor is called
"open". It returns a "handle" (which is, actually, an object).

-- 
	Bart.


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

Date: Tue, 07 Nov 2000 22:33:28 GMT
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: Passing Hash to Perl Module Update
Message-Id: <slrn90h0pq.7ck.mgjv@verbruggen.comdyn.com.au>

On 7 Nov 2000 13:25:12 -0000,
	Anno Siegel <anno4000@lublin.zrz.tu-berlin.de> wrote:
> James Taylor  <james@NOSPAM.demon.co.uk> wrote in comp.lang.perl.misc:
>>In article <973521573.25155.0.nnrp-13.c29f015a@news.demon.co.uk>, Gus
>><URL:mailto:gus@black.hole-in-the.net> wrote:
>>
>>Is it necessary to say bless $self, ref $class || $class;
>>or is it enough just to say bless $self, $class; ?
> 
> This is by no means necessary.
> 
> You will need this bit of gymnastics only if you want new() to work as
> an object method as well as a class method, so that you can say
> my $other = $some_obj->new.  In this case the first parameter to new()
> isn't a class, but an object in that class ($some_obj), and ref
> retrieves the class for new().
> 
> Camps are divided whether this kind of polymorphism is even desirable.
> Myself, I usually prefer to have separate object methods for cloning
> existing objects and not saddle new() with that task.

And they will be divided forever, I suppose :)

But cloning isn't the same as using an existing object to find a class
name. This described behaviour may be very useful in factory patterns,
where a method can return objects with the same interface, but
belonging to a different class.

Suppose you have a set of classes that can generate a report from
data, and another set of classes that publish that report somewhere.
Some create text, others create HTML, and yet others create
PostScript. Some of the 'publishing' classes send email, others fax,
send SMS, or put stuff on an Intranet site.  All the generating
classes have the same interface, and all the publishing classes have
an identical interface.

Instead of having logic in a program that decides which of all these
various classes to instantiate and combine, all that logic can be
wrapped in a single method, which is responsible for picking the right
report generator, and the right publicator, based on some other
information. The objects you get back, could be any one of the ones
mentioned above, and you shouldn't care which one.

Now, if at any point in your program you need to have an object of the
same class as the one you're working with (for example, business rules
state that this particular fax needs to be sent to two destinations),
you need to do something like:

my $pub_class = ref $publicator;
$new_publicator = $pub_class->new();

If the class had a clone() method, you might still want to avoid that,
because cloning could be very expensive. It might have to do deep
recursive copies or other expensive stuff. it would be much more
convenient if you could just say:

$new_publicator = $publicator->new();

Of course, you could argue for a name like:

$new_publicator = $publicator->new_instance();

but to me, that's just not worth it.

There are other places where this stuff is useful. Suppose you have a
container with generic objects, but you don't care what these objects
are. If you want to be able to provide the possibility of allowing
your list to grow, and you want to initialise each new slot with an
identical, but uninitialised object, you need to know the class the
object belongs in. Again, you can do that by explicitly using ref()
yourself, but I just do not find this very appealing. The code that
duplicates isn't really interested in the class name.

I like to be able to ask the question: "Can I have another one of
those, please? Thank you."

Martien
-- 
Martien Verbruggen              | 
Interactive Media Division      | 
Commercial Dynamics Pty. Ltd.   | "Mr Kaplan. Paging Mr Kaplan..."
NSW, Australia                  | 


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

Date: 7 Nov 2000 21:46:10 GMT
From: baruchel@libertysurf.france (Thomas Baruchel)
Subject: Re: pattern matching across two lines
Message-Id: <8u9t72$2oh$1@news5.isdnet.net>

>>>How can I match patterns across two lines?

Brest, le lundi 6 novembre

use Sam ;-)
    ^^^ 
-- 
   .~.   Thomas Baruchel
   /V\   baruchel@libertysurf.fr
  // \\    Brest
 /(   )\   FRANCE
  ^`~'^


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

Date: Tue, 07 Nov 2000 22:02:44 +0000
From: Greg Griffiths <greg2@surfaid.org>
Subject: Re: Perl and mysql
Message-Id: <3A087C04.42BE5B11@surfaid.org>

take a look at the PERL DBI module, get the books ( Learning Perl,
Programmng Perl and Programming the Perl DBI) and that should get you on
the road to getting PERl sorted, OReilly also do a MySQL book too.

vivekvp wrote:

>  Hello,
>
> I am not very familiar with perl let alone mysql.
>
> What I am trying to do is create an html form that gets, a unique ID,
> name, phone number and email - store that data, and be able to retrieve
> that data via any query.
>
> But I am not sure what any syntax would be used?  How do I pass the
> data?  How do I retrieve it?
>
> Any help or direction?
>
> Thanks,
>
> V
>
> --
> He who fights and runs away, lives to run another day!
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.



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

Date: Tue, 07 Nov 2000 13:02:30 -0600
From: Michael Carman <mjcarman@home.com>
Subject: Re: Problem reading a binary file
Message-Id: <3A0851C6.32CCFFC4@home.com>

James Taylor wrote:
> 
>  Michael Carman wrote:
> > In reality, "\n" is *not* a character.
> 
> I don't understand what you mean by not really a character.

I mean that you won't find "\n" anywhere in an ASCII table; it's just a
placeholder for "whatever the end-of-line sequence is for my current
platform."

e.g.
Under *nix, \n -> LF
Under DOS,  \n -> CRLF

Internal to Perl, you are correct that you have just linefeeds. That way
length(), chop(), chomp(), substr(), etc., work. A drawback to this
translation is that things like seek() don't work well on text files for
some platforms.

-mjc


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

Date: Tue, 7 Nov 2000 20:46:16 +0100
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: Problem reading a binary file
Message-Id: <Pine.GHP.4.21.0011072042410.25758-100000@hpplus03.cern.ch>

On Tue, 7 Nov 2000, Michael Carman wrote:

> > > In reality, "\n" is *not* a character.
> > 
> > I don't understand what you mean by not really a character.
> 
> I mean that you won't find "\n" anywhere in an ASCII table; it's just a
> placeholder for "whatever the end-of-line sequence is for my current
> platform."

Yes, well that's the problem when you say "in reality" - when you 
meant "in principle".

So it was a problem with your terminology, not with your grasp of the
facts.  "In reality" ;-)

good luck.



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

Date: 07 Nov 2000 12:46:48 -0600
From: Ren Maddox <ren.maddox@tivoli.com>
Subject: Re: Problem reading a binary file
Message-Id: <m3y9yvr55z.fsf@dhcp11-177.support.tivoli.com>

James Taylor <james@NOSPAM.demon.co.uk> writes:

> In article <3A080C67.A2A512FE@home.com>, Michael Carman
> <URL:mailto:mjcarman@home.com> wrote:
> > Perl knows how to convert the platform's idea of "\n" to it's own
> > internal representation. In reality, "\n" is *not* a character. Think of
> > it as a "virtual newline character" which gets translated to/from the
> > real newline sequence on I/O.
> 
> I don't understand what you mean by not really a character. Surely once
> you have read a text file in (perhaps in slurp mode) you will have it
> in memory (perhaps in a scalar) and each newline is represented by a
> genuine linefeed character (ASCII 10). In what way is it not real?

The relevant portion from perlport(1) is:

       Perl uses "\n" to represent the "logical" newline, where
       what is logical may depend on the platform in use.  In
       MacPerl, "\n" always means "\015".  In DOSish perls, "\n"
       usually means "\012", but when accessing a file in "text"
       mode, STDIO translates it to (or from) "\015\012",
       depending on whether you're reading or writing.  Unix does
       the same thing on ttys in canonical mode.  "\015\012" is
       commonly referred to as CRLF.

-- 
Ren Maddox
ren@tivoli.com


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

Date: Tue, 07 Nov 2000 21:51:40 GMT
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: Problem reading a binary file
Message-Id: <slrn90gubf.7ck.mgjv@verbruggen.comdyn.com.au>

On Tue, 07 Nov 2000 08:06:31 -0600,
	Michael Carman <mjcarman@home.com> wrote:
> [Note: All of this is in the docs...]
> 
> James Taylor wrote:
>  
>> Is the effect of binmode simply to turn off newline translation?
> 
> For the most part, but it also allows you to read past a ^Z in a file.
> In text mode that would be seen as an EOF.

\begin{pedantry}
On operating systems where \cZ signifies the end of a text file. On
many operating systems it doesn't.
\end{pedantry}

Martien
-- 
Martien Verbruggen              | 
Interactive Media Division      | In a world without fences, who needs
Commercial Dynamics Pty. Ltd.   | Gates?
NSW, Australia                  | 


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

Date: Tue, 07 Nov 2000 15:26:05 -0600
From: Michael Carman <mjcarman@home.com>
Subject: Re: Problem reading a binary file
Message-Id: <3A08736D.5DE5BF2B@home.com>

"Alan J. Flavell" wrote:
> 
> On Tue, 7 Nov 2000, Michael Carman wrote:
> 
> > > > In reality, "\n" is *not* a character.
> > >
> > > I don't understand what you mean by not really a character.
> >
> > I mean that you won't find "\n" anywhere in an ASCII table; it's 
> > just a placeholder for "whatever the end-of-line sequence is for 
> > my current platform."
> 
> Yes, well that's the problem when you say "in reality" - when you
> meant "in principle".

Heh. Maybe I'm perverse, but I meant it the way I said it. In reality,
there is no "\n" character -- it doesn't exist anywhere in the
underlying implementation. In principle, there is such a beast -- which
is why you can write code and blissfully pretend that "\n" == "newline"

Of course, this could just be anal-retentive pedantry caused by my
training as an engineer. :) Unless we're reading a text file in binary
mode, we can all just put on our rose-colored glasses and pretend that
the world really is the way we want to see it.

> So it was a problem with your terminology, not with your grasp of the
> facts.  "In reality" ;-)

Or at least with my ability to explain myself clearly. :/

-mjc


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

Date: Tue, 07 Nov 2000 21:31:40 GMT
From: tjla@guvfybir.qlaqaf.bet (Gwyn Judd)
Subject: Re: Q: Getting program line number? - Thanks
Message-Id: <slrn90gt5q.hbr.tjla@thislove.dyndns.org>

I was shocked! How could nospam@our.site <nospam@our.site>
say such a terrible thing:

>To the one pedant, you are a genius and I stand in awe of your god like
>ability.

There you have it. I knew all along I was a genius.

-- 
Gwyn Judd (print `echo 'tjla@guvfybir.qlaqaf.bet' | rot13`)
If there were an afterlife, Isaac Asimov would have written a book about
it by now.


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

Date: Tue, 07 Nov 2000 22:06:56 GMT
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: Q: Getting program line number? - Thanks
Message-Id: <slrn90gv83.7ck.mgjv@verbruggen.comdyn.com.au>

On Tue, 07 Nov 2000 16:09:49 +0000,
	nospam@our.site <nospam@our.site> wrote:
> This message has been posted by:  Aengus Stewart
>     <aengus.stewart@REMOVE-THIS-TO-SENDicrf.icnet.uk>
> 
> Thanks to all those who replied, and yes rereading it, it is ambiguous,
> but it was indeed __LINE__ that I wanted.
> 
> To the one pedant, you are a genius and I stand in awe of your god like
> ability.

I didn't think at all that Gwyn's answer was pedantic.

Martien
-- 
Martien Verbruggen              | 
Interactive Media Division      | Freudian slip: when you say one thing
Commercial Dynamics Pty. Ltd.   | but mean your mother.
NSW, Australia                  | 


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

Date: 07 Nov 2000 17:19:36 -0500
From: Joe Schaefer <joe+usenet@sunstarsys.com>
Subject: Re: Q: Getting program line number? - Thanks
Message-Id: <m3r94ne87b.fsf@mumonkan.sunstarsys.com>


mgjv@tradingpost.com.au (Martien Verbruggen) writes:

> On Tue, 07 Nov 2000 16:09:49 +0000,
> 	nospam@our.site <nospam@our.site> wrote:
> > This message has been posted by:  Aengus Stewart
> >     <aengus.stewart@REMOVE-THIS-TO-SENDicrf.icnet.uk>
> > 
> > Thanks to all those who replied, and yes rereading it, it is ambiguous,
> > but it was indeed __LINE__ that I wanted.
> > 
> > To the one pedant, you are a genius and I stand in awe of your god like
> > ability.
> 
> I didn't think at all that Gwyn's answer was pedantic.
> 

Nor did I ;) - apparently she hasn't yet learned to use effectively use 'grep'.

-- 
Joe Schaefer


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

Date: Tue, 07 Nov 2000 22:05:36 GMT
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: Q: Getting program line number?
Message-Id: <slrn90gv5j.7ck.mgjv@verbruggen.comdyn.com.au>

On Tue, 7 Nov 2000 18:10:27 +0000,
	James Taylor <james@NOSPAM.demon.co.uk> wrote:
> In article <slrn90g3l3.boe.mgjv@martien.heliotrope.home>, Martien Verbruggen
><URL:mailto:mgjv@tradingpost.com.au> wrote:
>>
>> Perl. Perl. Perl. Perl. Perl. Perl. Perl.
>> or perl if you talk about the program. If you want to program in it,
>> please get used to spelling the name correctly.
> 
> I agree that this oft repeated mistake is irritating, but given
> that the name Perl is supposed to be an acronym I can also see
> some validity in spelling it PERL.

You might feel that, but, in fact, there isn't. Perl isn't an acronym.
Any acronymity[1] has been retrofitted to match the name.  People get
this wrong very often, which is why the Camel and the documentation
both explain that this is wrong.

# man perlfaq1
[snip]
       What's the difference between "perl" and "Perl"?

       One bit.  Oh, you weren't talking ASCII? :-) Larry now
       uses "Perl" to signify the language proper and "perl" the
       implementation of it, i.e. the current interpreter.  Hence
       Tom's quip that "Nothing but perl can parse Perl."  You
       may or may not choose to follow this usage.  For example,
       parallelism means "awk and perl" and "Python and Perl"
       look OK, while "awk and Perl" and "Python and perl" do
       not.  But never write "PERL", because perl isn't really an
       acronym, apocryphal folklore and post-facto expansions
       notwithstanding.
[snip]

I correct this in every post I reply to, that makes the mistake.
Normally I use a single phrase, but every now and again I get a bit
more vehement about it. There is no particular reason for that, apart
from the irritation that you already mention.

Since Larry is the one who got to name Perl, he should probably be
seen as the authority on how its name should be spelled. Any rationale
that tries to defend any other spelling, is therefore wrong. :)

Martien

[1] Yes, I made that word up.
-- 
Martien Verbruggen              | 
Interactive Media Division      | Can't say that it is, 'cause it
Commercial Dynamics Pty. Ltd.   | ain't.
NSW, Australia                  | 


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

Date: Tue, 07 Nov 2000 21:05:07 GMT
From: dnay@vbs.net
Subject: Quick Perl Question
Message-Id: <8u9qpt$3uh$1@nnrp1.deja.com>

Hello All,  I know that this probably a really simple thing to do in
perl, but I can't seem to get it to work.

Can anyone tell me how to check a string for any characters other than
characters ie. a-z/A-Z and integers 0-9.

like this:

if ($text =~ /check for illegal chars here/) {

print error...

}

I would appreciate any help! Thanks!

Darren Nay - dnay@vbs.net


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


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

Date: 7 Nov 2000 21:18:58 GMT
From: trammell@nitz.hep.umn.edu (John J. Trammell)
Subject: Re: Quick Perl Question
Message-Id: <slrn90g20q.1jr.trammell@nitz.hep.umn.edu>

On Tue, 07 Nov 2000 21:05:07 GMT, dnay@vbs.net <dnay@vbs.net> wrote:
>Can anyone tell me how to check a string for any characters other than
>characters ie. a-z/A-Z and integers 0-9.

if ($string =~ /[^a-zA-Z0-9]/)
{
    warn qq[Illegal characters found in "$string"\n];
}

-- 
John J. Trammell
johntrammell@yahoo.com


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

Date: Tue, 07 Nov 2000 21:26:30 GMT
From: Dick Latshaw <latsharj@my-deja.com>
Subject: Re: Quick Perl Question
Message-Id: <8u9s1s$534$1@nnrp1.deja.com>

In article <8u9qpt$3uh$1@nnrp1.deja.com>,
  dnay@vbs.net wrote:
> Can anyone tell me how to check a string for any characters other than
> characters ie. a-z/A-Z and integers 0-9.
>
> like this:
>
> if ($text =~ /check for illegal chars here/) {
>
> print error...
>
> }

if( $text =~ /[^a-zA-Z0-9]/) {
    print error...
}
--
Regards,
Dick


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


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

Date: Tue, 07 Nov 2000 22:01:05 +0000
From: Greg Griffiths <greg2@surfaid.org>
Subject: Re: Quick short easy question
Message-Id: <3A087BA1.BDC0FEBD@surfaid.org>

This shoud do as you want, but you may be better off looking at
Javascript to give you more control of the window, check out window.open

donoddy@my-deja.com wrote:

> Hi!
>
> I would like to modify this line of my script:
>
> print "<A HREF=\"$advert_url\">";
>
> so it opens the link in a new window. Is this
> the correct way to do it:
>
> print "<A HREF=\"$advert_url\" target=\"_top\">";
>
> I'm completly new to perl thats why this question is a bit
> silly.
>
> Any help is REALLY appriciated!
>
> Donald
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.



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

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


Administrivia:

The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc.  For subscription or unsubscription requests, send
the single line:

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.

For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V9 Issue 4835
**************************************


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