[8989] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 2607 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri May 15 09:17:25 1998

Date: Fri, 15 May 98 06:01:35 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Fri, 15 May 1998     Volume: 8 Number: 2607

Today's topics:
    Re: About perl online doc <soson@tatrahome.sk>
    Re: Addresses (John Porter)
    Re: ANNOUNCE: Bit::Vector 5.3 <kugelman@mnsinc.com>
        Convert military time to unix time routine <ppatton@atltec.com>
    Re: dbfile.lock (urgent!) (Mark-Jason Dominus)
    Re: Does Perl have a IDE?I don't like command line. <webmaster@fccjmail.fccj.org>
    Re: Does Perl have a IDE?I don't like command line. <webmaster@fccjmail.fccj.org>
    Re: Does Perl have a IDE?I don't like command line. (Lasse =?ISO-8859-1?Q?Hiller=F8e?= Petersen)
    Re: Does Perl have a IDE?I don't like command line. (Lasse =?ISO-8859-1?Q?Hiller=F8e?= Petersen)
    Re: Does Perl have a IDE?I don't like command line. (Tina Marie Holmboe)
    Re: Does Perl have a IDE?I don't like command line. <ljz@asfast.com>
    Re: How can you break out of a 'while... ' loop in a fu (Jari Aalto+usenet.nil)
    Re: How can you break out of a 'while... ' loop in a fu (Jari Aalto+usenet.nil)
    Re: image thumbnails (John Porter)
    Re: Is if ($a="something") a bad style? (Jari Aalto+mail.perl)
        Multithreading Server? <tobiasbugala@swol.de>
    Re: New Math Modules (John Porter)
    Re: Perl for Non-programmers (Tina Marie Holmboe)
        Perl on NT -- need some assistance (Marc A. Sonnenberg)
    Re: Regex problem: substituting 3+ identical characters (Tad McClellan)
    Re: Removing ^M at the end of each line of a file. (Alan Schwartz)
        Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: Fri, 15 May 1998 14:15:08 +0200
From: SoSoN <soson@tatrahome.sk>
Subject: Re: About perl online doc
Message-Id: <355C31CC.73A5F04@tatrahome.sk>

try www.perl.com
there's lots of links


chenmin wrote:

> Hi,
> I'm a beginner of Perl.Where can I get some online perl document or some
>
> related sources?
>
> Thanks
> CM





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

Date: Fri, 15 May 1998 12:37:59 GMT
From: jdporter@min.net (John Porter)
Subject: Re: Addresses
Message-Id: <MPG.fc602c2a4d287b99896c9@news.min.net>

On 14 May 1998 22:14:01 GMT,
in article <6jfqb9$o5i$12@csnews.cs.colorado.edu>,
tchrist@mox.perl.com (Tom Christiansen) wrote:
>  [courtesy cc of this posting sent to cited author via email]
> 
> In comp.lang.perl.misc, 
>     "Richard Allan" <Richard.A@Torguish.com> writes:
> :Is it possible to access a system address for read/write. ie to access an
> :expansion card?
> 
> Are you trying to do peek and poke to exact memory locations?
> One can, but it's not very easy.  There's are p/P templates
> in pack/unpack for that.  Good luck!!!

Can we bother you for one simple example?

Say I want to read the word at memory address 0x11223344. How?

John Porter


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

Date: Fri, 15 May 1998 07:00:09 -0400
From: John Kugelman <kugelman@mnsinc.com>
Subject: Re: ANNOUNCE: Bit::Vector 5.3
Message-Id: <355C2039.9F6473FF@mnsinc.com>

Stephan Wilms wrote:
> 
> [posted & mailed]
> 
> Steffen Beyer wrote:
> >
> > I am pleased to announce version 5.3 of the "Bit::Vector" module:
> >
> > The package is available for download either from my web site at
> 
> Please stop that "Announce" SPAM ! It is off topic and of no interest
> here in comp.lang.c. I found 4 "Announce" from you today, SPAMMed to
> a multitude of newsgroups. *STOP IT*
> 
> Stephan

Hm, your usual sig seems to have disappeared. ;-)

-- 
John Kugelman.  kugelman@mnsinc.com

I believe we can change anything.
I believe in my dream.
    - Joe Satriani


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

Date: Fri, 15 May 1998 08:32:12 -0400
From: Pat Patton <ppatton@atltec.com>
Subject: Convert military time to unix time routine
Message-Id: <355C35CB.C727B9E6@atltec.com>

I am new to Perl and this group, so sorry if this has been ask before.

I am looking for a routine to convert military time to unix time (number
of seconds from 1 jan 1970), I will be calling this from a ksh script
passing the time and want the unix time returned to me.

I have search the web for days looking for this routine, please help.
Thanks in advance for any help......




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

Date: 15 May 1998 08:54:57 -0400
From: mjd@op.net (Mark-Jason Dominus)
Subject: Re: dbfile.lock (urgent!)
Message-Id: <6jhdv1$s73$1@monet.op.net>


In article <6jh42l$6p5$1@news1.c2i.net>, Lars <lars-n@hsr.no> wrote:
>I'm getting the error message:" Can't open
>dbfile.lock:/public/www/stud/drageset/public_html/./dbfiles/users.csv.lock:
>No such file or directory"
>
>I am pretty sure the path pointing to the various directories  is correct.
>I have used chmod 755 on all the files and directories
>Any ideas ?

Perhaps the filename in ther error message is not the same as the
filename in the `open' statement.  Check for a typographic error.

Perhaps the server runs in a different root, so that the path should
be `/dbfiles/users.csv.lock' or some such.



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

Date: Fri, 15 May 1998 11:19:10 GMT
From: Bill 'Sneex' Jones <webmaster@fccjmail.fccj.org>
Subject: Re: Does Perl have a IDE?I don't like command line.
Message-Id: <355C22D8.A6884302@fccjmail.fccj.org>

Tom Christiansen wrote:
> It is ultimately depressing to receive daily reminders of how useless
> and ignored my work and that of others at documenting Perl, in manpages,
> FAQS, webpages, and even books.  It is a rude slap in our faces, and
> I don't understand why we're supposed to make kissy face when it
> happens again and again on the very same day.  I don't know how
> any man can.  You don't see Larry here.  You don't see Dennis in the
> C groups.  And you don't wonder why, now do you?

I watched a similar thread in comp.lang.databases.progress
(PSC Progress 4GL, another language I loved.)

People were 'disenchanted', dismayed, and angered by the fact that
PSC took Progress into an almost completely windows-centric world.

Unix was where Progress was born, it achieved about the same level of
power, ease of use, cross-platform (write once run anywhere) abilities
as Perl has.  But no one ran it on Unix anymore; the newsgroup became
flooded with windows-centric questions from novice programmmers.

A great exodus away from Progress began around v6 or v7 and by v8,
when PSC had Progress windows-centric, the demand for Progress
programmers had doubled.  But only where windows was concerned.

In my opinion Progress simply was too expensive for a single 
developer to utilize for application 'practice' as it were.
At about $30,000 average cost for a Unix developers license and
at at an average cost of $4,000 for NT you can start to see why
many went the Windows route.  But companies didn't either understand
or chose to ignore the fact that Progress on Unix was capable of more
than on Windows.

Some businesses and maybe many novice Perl programmmers may feel that
the initial learning curve to grasp Perl at the level which some
here may 'wish' to support it at is too 'expensive.'

I personally feel that the rewards offset the efforts required, I
apperciate the efforts of Larry, Tom (both), Randal, and the rest
of whom has spent many hours answering what amounts to the same
things over and over.

I also must say that books along the lines of "Effective Perl
Programming" are what's needed at this stage.  The blue books 
"Learning Perl, Programming Perl, and Mastering Regular Expressions"
are important, but overwhelming to most novices.  I find the articles
written in The Perl Journal, WebTechniques, and Unix Review much more
enlightning.

I feel that others may feel this way as well, especially those whom
are using Perl and haven't even dreamed of getting involved with
this group yet.  I was using Perl, albeit incorrectly, for over a year
before I even thought about looking for a Perl group to follow
around.  

I truly look forward to the publication of a Perl Cookbook and hope 
that it is in the venue of Effective Perl Programming :-)

So, Tom, your efforts and those of many others are appreciated :-)
____________________________________________________________________________
Bill Jones | FCCJ Webmaster | Voice 1-904-632-3089 | Fax 1-904-632-3007
Florida Community College at Jacksonville | 501 W. State St. | Jax, FL 32202
mailto:webmaster@fccjmail.fccj.org | http://webmaster.fccj.org/Webmaster


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

Date: Fri, 15 May 1998 11:24:22 GMT
From: Bill 'Sneex' Jones <webmaster@fccjmail.fccj.org>
Subject: Re: Does Perl have a IDE?I don't like command line.
Message-Id: <355C2413.D6B8C6D0@fccjmail.fccj.org>

PS - Are there any other magazine you guys (and gals) are writing for
which I haven't subscribed to yet?  I would like to know :-)

-Sneex- 
____________________________________________________________________________
Bill Jones | FCCJ Webmaster | Voice 1-904-632-3089 | Fax 1-904-632-3007
Florida Community College at Jacksonville | 501 W. State St. | Jax, FL 32202
mailto:webmaster@fccjmail.fccj.org | http://webmaster.fccj.org/Webmaster


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

Date: Fri, 15 May 1998 13:44:20 +0100
From: lassehp@imv.aau.dk (Lasse =?ISO-8859-1?Q?Hiller=F8e?= Petersen)
Subject: Re: Does Perl have a IDE?I don't like command line.
Message-Id: <lassehp-1505981344200001@ra.imv.aau.dk>

In article <m33eedq4c2.fsf@windlord.Stanford.EDU>, Russ Allbery
<rra@stanford.edu> wrote:

>Greg Bacon <gbacon@cs.uah.edu> writes:
>
>> There's no rule that says you can't teach your students to increment the
>> value bound to a variable with code like
>
>>     i = i + 1;
>
>> Certain subsets of C or Perl would make nice teaching languages IMHO.
>
>This is true; there are a few problems with this approach, though.  First
>of all, you're not really teaching them C, you're teaching them a subset
>of C.  That's fine so long as they're aware of that, but it's been my
>experience that students will come out of that class and then claim they
>know C, which is just a recipe for disaster down the road.  Using a
>different language keeps the division much clearer.

>From _Programming Perl_ (2.ed.), Preface, page xi:
>>You can learn Perl "small end first". You can program in Perl Baby-Talk,
and we promise not to laugh. Or more precisely, we promise not to laugh
any more than we'd giggle at a child's creative way of putting things.
Many of the ideas in Perl are borrowed from natural language, and one of
the best ideas is that it's okay to use a subset of the language as long
as you get your points across. Any level of language proficiency is
acceptable in Perl culture. We won't send the language police after you. A
perl script is "correct" if it gets the job done before your boss fires
you.<<

(Sometimes I am tempted to post this as a "Learning Perl METAFAQ" for
newbies and wizards alike, but I suppose that would be violating a
copyright or something.)

I believe that when learning programming, you necessarily learn in chunks,
which are definitely subsets. Perl is especially suited for this, as it
doesn't require lots of boilerplate stuff, you can get away with just a
single statement as your program. The problem you mention (perhaps we
could call that "the Ikaros problem"?) is general for any language and
most, if not all students, I suppose.

>It's worth keeping in mind that students often want to learn a language
>they can use in the real world *right now*.  I think it's worthwhile doing
>everything one can to *discourage* that mindset, since it leads to people
>who don't know how to program programming.  It needs to be clear that
>there's a *learning process* that has to happen first.

Learning programming is programming, just as much as (for a baby) learning
to use a spoon is eating. It may be a sight to behold - I'm looking
forward to that phase, BTW - and not something you should be doing in
fancy restaurants, however. (Just like I don't allow anyone here to have
CGI scripts on our server, of course.)

>The second problem, particularly with Perl, is that things that you'd
>rather be syntax errors so that the students don't try to do things that
>way will be accepted by the language because the language is going to
>assume that you know what you're doing.

That would be the biggest problem using Perl as a first language. But
that's true for many other languages often used as a first language. If
you don't want this as a teacher, you possibly shouldn't even choose
Pascal, although it is infinitely better than C for this. At the CS
department here, I believe they have used a locally designed language
(called Trine) until fairly recently. This language has the advantage that
it looks nothing like C syntactically or semantically (it has, for example
if-fi and do-od with guarded commands that are executed
nondeterministically) so people with some programming "experience" will
not have an "head start".

A subset of Perl with mandatory -w and use strict; would be quite good for
learning programming, IMO. But then, I haven't been teaching programming
to anyone, except by helping fellow students. (Which has given me a strong
interest in how programming languages should be to facilitate easy
learning of good programming practices.) I hope I will one day get an
opportunity to use Perl for a programming course.

-Lasse

-- 
No documentation found for "perlsex".


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

Date: Fri, 15 May 1998 14:17:57 +0100
From: lassehp@imv.aau.dk (Lasse =?ISO-8859-1?Q?Hiller=F8e?= Petersen)
Subject: Re: Does Perl have a IDE?I don't like command line.
Message-Id: <lassehp-1505981417570001@ra.imv.aau.dk>

In article <6jctqb$c3k$2@csnews.cs.colorado.edu>, tchrist@mox.perl.com
(Tom Christiansen) wrote:

> [courtesy cc of this posting sent to cited author via email]
>
>In comp.lang.perl.misc, 
>    fl_aggie@thepentagon.com (I R A Aggie) writes:
>:The only draw back to pascal...
>
>Only one?  My God, there are many.  See bwk.

Are you referring to the article _Why Pascal is not my favorite
programming language_? I believe that this was concerned with the "early"
Pascal available at the time of writing, Pascal having evolved quite a bit
since the admittedly very limited early versions. I also remember reading
an analysis and at least partial rebuttal of Kernighan's article, I
believe it was an article by Lecarme in the book _Pascal: the Language and
it's Implementation_, (ed. by D.W. Barron).

Just in case you are interested. (We wouldn't want anyone criticizing Perl
based on Perl4, would we?)

-Lasse

-- 
No documentation found for "perlsex".


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

Date: 15 May 1998 12:42:20 GMT
From: tina@scandinaviaonline.se (Tina Marie Holmboe)
Subject: Re: Does Perl have a IDE?I don't like command line.
Message-Id: <6jhd7c$hu8$3@news1.sol.no>

In article <MPG.fc3d343bbd036b9896bc@news.min.net>,
	jdporter@min.net (John Porter) writes:

> If Pascal Considered Inadequate, then how do Modula-2/Modula-3/Oberon
> stack up as teaching languages?  

  I think I'd like to throw in Simula here... old, yes, but as a teaching
language it stands the test of time. IMO.

-- 
  Tina Marie Holmboe                
  Application Developer (Geeks'R'Us)         [tina@tech.scandinaviaonline.se]
  Scandinavia Online AB Development Dept.    (+46) 08 587 81000 (switchboard)
                                             (+46) 08 587 81189 (direct)


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

Date: 15 May 1998 08:40:19 -0400
From: Lloyd Zusman <ljz@asfast.com>
Subject: Re: Does Perl have a IDE?I don't like command line.
Message-Id: <ltsomb1zd8.fsf@asfast.com>

Eric Bohlman <ebohlman@netcom.com> writes:

> Tom Christiansen <tchrist@mox.perl.com> wrote:
> :  [courtesy cc of this posting sent to cited author via email]
> 
> : In comp.lang.perl.misc, 
> :     Lloyd Zusman <ljz@asfast.com> writes:
> : :If you don't like so many people getting stuck and asking
> : :FAQ's, then do something to help people get the hang of Perl more
> : :easily.
> 
> : It is ultimately depressing to receive daily reminders of how useless
> : and ignored my work and that of others at documenting Perl, in manpages,
> : FAQS, webpages, and even books.  It is a rude slap in our faces, and
> : I don't understand why we're supposed to make kissy face when it
> : happens again and again on the very same day.  I don't know how
> : any man can.  You don't see Larry here.  You don't see Dennis in the
> : C groups.  And you don't wonder why, now do you?
> 
> Tom has in fact put his finger on the problem: a *lot* of people have
> worked *very* hard for *no* pay to create a *very* comprehensive system of
> documentation for Perl, a system that is available for *free* and that
> compares *very well* to commercial documentation that would cost hundreds
> of dollars to purchase.  Those people have worked even harder to make sure
> that every distribution of Perl comes with that set of documentation. 
> They've worked hard to make sure that people who get Perl distributions
> can read that documentation without needing any special tools from
> elsewhere (by creating viewers like perldoc and tkpod, and tools to
> convert the documentation into HTML, Unix man pages, PDF, Tex, Postscript,
> and just about every other format you can imagine).  They've worked hard
> to create a *free* Web site where all that information, and more, can be
> accessed.  In short, they've done everything they can to enable those who 
> want to get the hang of Perl to do so as quickly and conveniently as 
> possible.

And they've done a damn good job, too.

> The problem is that c.l.p.m is getting more and more frequent visits from
> people who want to write programs in Perl, but apparently *aren't* very
> interested in "getting the hang of" Perl.

I'm not sure that I agree with this generalization.

> [ ... ]  They've got a question and they
> want it answered *now*; they don't want to take the time to learn how to
> answer their own questions.

Maybe so, maybe not.  I have certain seen people who exhibit an
urgency to get their questions answered.  I'm not so certain, however,
that most of these people are unwilling to take the time to learn.

> [ ... ] They don't *care* about all the work that
> Perl's developers have put in to making it easy for novice Perl
> programmers to learn how to answer their own questions.  They seem to
> think it's their right to remain perpetual newbies and still do useful
> things with Perl.  They treat c.l.p.m as if it were a store in a mall and
> its posters store employees rather than a public square whose denizens
> come there to talk about things that interest them. 

It almost seems as if you and certain others here have a picture in
your mind that all the "newbies" who post here are the same person, or
the same small group of people.  My impression is that most novices
who come here post one or two questions and then move on.  Very few,
if any, are "perpetual newbies" who come here over and over and over
with a "you owe me help" attitude, although I can see how it might
seem that way given the large numbers of similar FAQ's that are posted
here.

There just seems to be a relatively steady influx of people who are
getting newly interested in Perl all the time.

> I really think the problem here is *not* Unix vs. MS-Windows; the real 
> problem, I suspect, is the tremendous proliferation of Web designers who 
> have found that simple HTML markup (which, of course, is *not* a form of 
> programming) is no longer an adequate set of skills for creating Web 
> pages, and who therefore need to transform themselves into programmers, 
> but instead have transformed themselves into programmer wannabes.  [ ... ]
> [ ... ]
> [ ... ] The 
> programmer wannabe, OTOH, can only deal with code that can be directly 
> cut-and-pasted into his application because he has no mental model of 
> *how* the code accomplishes its task.

I'm sure that there are people who take this attitude.  But so what?
That doesn't make them lazy freeloaders or insipid whiners.  Once they
cut and paste some Perl code into their HTML pages and see the
results, most of them learn very quickly what they're dealing with.
Many of them will give up at this point or soon thereafter, but some
of them will get bitten by the bug and will find that there's
something really compelling and satisfying about programming, and
they'll find themselves experimenting with the language and digging
through the code like the rest of us.  Who cares if they ask a few
questions along the way?

> Note that "newbie" and "programmer wannabe" are *not*, I repeat *not*, the
> same thing.  The newbie who says to himself "I've got a lot to learn, so
> I'd better get started looking for the best resources to learn
> programming" is a novice programmer, not a wannabe.  [ ... ]
> [ ... ]
> [ ... ] The wannabe is the newbie who wants to do
> something useful without having to learn how.  [ ... ]

These "wannabe's" soon realize what they're up against, give up, and
move on.  Very few, if any of them, stick around, asking question
after question after question here in hopes of some free info.

> When the novice programmer turns to others for help, he says "I'm looking
> at this code and I thought, based on what I've learned so far, that this
> construct would do X, but instead it does Y, and I can't seem to find any
> references that would explain it."  He's overjoyed if someone gives him a
> pointer to a resource that will help him understand the construct.  When
> the programmer wannabe turns to others for help, he says "I'm looking at
> this code that does Y and I have no idea what it means, but I need it to
> do X instead."  He gets all snotty if you give him a pointer to a resource
> that will help him understand the code well enough to modify it instead of
> telling him what magic incantation to type in order to make it work the
> way he wants it. 

There are indeed some people who take a huffy attitude when referred
to information resources.  But keep in mind that there is a great deal
of snottiniess on this end, too.  Many references to the docs have
been given in the following "tone of voice": "Go away and check out
the FAQ, you lazy freeloader."  Do you actually get surprised that
some people react negatively to this?  I've seen very few snotty
replies from novices where were pointed to the documentation in a
polite, respectful manner.

I've carped on this in the past, and Tom Phoenix very aptly
paraphrased the main point of my carping as follows: "You catch more
flies with honey than with vinegar."

> Earlier I said that I didn't think that differences between Unix and 
> MS-Windows backgrounds were a major part of the problem.  There is, I 
> think, one exception.  The first Win32 port of Perl available was the 
> ActiveState one, which sadly failed to incorporate all the excellent 
> documentation that Perl's developers had created.  It's still the first 
> port that a Web designer-type is likely to run across.  There is, I feel, 
> a real need to inform its users of the treasure trove of documentation 
> available.  Trying to persuade ActiveState to make the documentation 
> available on its Web site would be a start.

So when someone who has only seen ActiveState comes here and asks a
FAQ, which is the better way to send him or her to the documentation?

(1) "Get a real port of Perl on a real operating system, you luser!"
(2) "There's a treasure trove of great documentation available, and
    here's where to find it ..."

Thankfully, many people here take approach (2).  But I dare say that
most of the "snotty" replies coming back from novices are in response
to comments very similar to (1).

A few people here seem to get genuinely hurt when they make snotty
comments to novices and get equally snotty replies in return.  Most
people here who make these kind of comments are thick-skinned enough
that these non-surprising replies don't bother them.  But if you
happen to be one of those people who can't take it, then don't dish it
out.

> But I categorically reject assertions like "you have to be a Unix
> programmer to use perldoc."  You have to be comfortable with a
> command line, that's all.  And until you're comfortable with a
> command line, you're not going to be able to do any useful
> programming, in Perl or any other language.  And you can't treat the
> Perl distribution as a black box.  It's full of treasures (*not*
> hidden ones) if you just look through it.

I totally agree.

Just remember that each time you say something like this to a novice,
it's probably a *different* novice than the person to whom you said it
the last time.

-- 
 Lloyd Zusman   ljz@asfast.com
 perl -e '$n=170;for($d=2;($d*$d)<=$n;$d+=(1+($d%2))){for($t=0;($n%$d)==0;
 $t++){$n=int($n/$d);}while($t-->0){push(@r,$d);}}if($n>1){push(@r,$n);}
 $x=0;map{$x+=(($_>0)?(1<<log($_-0.5)/log(2.0)+1):1)}@r;print"$x\n"'


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

Date: 15 May 1998 13:49:45 +0300
From: Jari Aalto <<jari.aalto@poboxes.com> (Jari Aalto+usenet.nil) >
Subject: Re: How can you break out of a 'while... ' loop in a function?
Message-Id: <tblns3lsfq.fsf@blue.sea.net>

--Multipart_Fri_May_15_13:49:45_1998-1
Content-Type: text/plain; charset=US-ASCII

| 98-05-12 tina@scandinaviaonline.se (Tina Marie Holmboe) comp.lang.perl.misc
|
| ... *perhaps* next and last isn't the very
| best things in Perl.

Could you give examples where using next and last would be bad?
I can't think any occasion where they wouldn't be welcomed.

| To me, though I am admittedly strange, they translate to goto... there
| *is* some good advice in not breaking out of while-loops - or any other
| loops - in more than one place.

 ... And the word of 'goto' is good :-) There are programmers that claim
"Never use goto, ever". Well, I don't think they have even tried to think
how usefull it could be.

I use 'goto' in my C/C++ code to jump to the end of function
to clean up things and that's the best command for that task. Perl has
done it even better allowing break out multilevel loops in substle manner.

jari


--Multipart_Fri_May_15_13:49:45_1998-1
Content-Type: text/plain; charset=US-ASCII


    // Pseudo C++ how to use goto 

    ..code
    ..code
    ..ooops error here, I have to close SQL database connection
    if ( error )
    {
        goto ABORT_CLEANUP;
    }

    ..code
    ..code

    return 0;       // The normal end of function

    ABORT_CLEANUP: ;
    {
        ...close the connections etc
        return 1;
    }


    ABORT_ROLLBACK: ;
    {
        ...cancel the SQL insert before exiting
        return 1;
    }

--Multipart_Fri_May_15_13:49:45_1998-1--


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

Date: 15 May 1998 14:12:17 +0300
From: Jari Aalto <<jari.aalto@poboxes.com> (Jari Aalto+usenet.nil) >
Subject: Re: How can you break out of a 'while... ' loop in a function?
Message-Id: <tbiun7lre6.fsf@blue.sea.net>

| 98-05-14 tina@scandinaviaonline.se (Tina Marie Holmboe) comp.lang.perl.misc

I see that you haven't used Perl much... the parentheses tell it all :-)

|   From a maintenance-perspective, this is a fairly easy construct to work
| with. Everything you need is in that first line. Consider, next, this:
| 
|     ITR: foreach $key ( sort ( keys ( %hash ) ) ) {
|       if ( $key eq 'lwall' ) { last(ITR) ; }
|       print "$key\n" ;
|     }
| 
|   Now add more tests for special cases inside the
| block. The number of exits are then N>1. and the loop - again in my humble
| opinion - has become much harder to maintain and debug.

Hm. How would many exit point make code more difficult to maintain?
The maintenance comes from programming style and used contructions
(some are more preferred than others, defined in company wide Perl
style guide if you work in big projects) 

I would write that loop like this.  I drop the ITR, because this is
not multilevel loop so there is no doubts where `last' refers to.
I also believe that any execess tokens disturb the code and that English.pm
should be made mandatory for scripts that are distributed.
    
    use English.pm;

    my $LIB = "ThisModule.pm";
    sub Debug($);                           # prototype 

    sub myFunction
    {
        my $id = "$LIB.myFunction";         # function identifier for debug
        my $last;

        for ( sort keys %hash )
        {
            $last = $arg;

            last if $ARG eq 'lwall';
            # ...or any other last condition here

            print $ARG, "\n";
        }

        $debug and Debug "$id: sort loop last value [$last]";
    }

If you need to debug the triggering point, the extra variable $last
will hold the last value accessed. And when you turn on the $debug, you
can trace the source code execution and see the exit points.

| Secondly, I am *not* saying that next() and last() doesn't have
| their rightful place among the tools-of-the-trade, but I am trying
| to point out that from a structure and maintenance perspective one
| should really consider (twice) whether
|
| 
|     a) next()/last() is a good solution, or
|     b) the loop itself needs re-working.


In Perl, no you don't. The tokens `next' and `last' are there to be used.
When one steps into world of Perl, one needs a mind adjustment.
Like when I go and write Lisp, I have to think Lisp way, which
is totally different from both C and Perl or any other language.

jari


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

Date: Fri, 15 May 1998 12:41:11 GMT
From: jdporter@min.net (John Porter)
Subject: Re: image thumbnails
Message-Id: <MPG.fc6038540c9480f9896ca@news.min.net>

On Thu, 14 May 1998 15:10:46 -0400,
in article <6jffl0$6ai@aaron.hamilton.edu>,
kelby@mplx.com (Kelby Valenti) wrote:
> I am wondering if anyone has seen a program which takes an image and shrinks
> it down so that it is a smaller file that i can view in thumbnail format.  I
> have some huge files that need to be seen only occasionally.  And a
> thumbnail saves a great deal of load time.  I would like the program to be
> web based.

I highly recommend you check out the PbmPlus package by Jef Poskanzer.
It has an amazing array of tools for image manipulation.

http://www.acme.com/software/pbmplus/

John Porter


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

Date: 15 May 1998 15:08:01 +0300
From: <jari.aalto@poboxes.com> (Jari Aalto+mail.perl)
Subject: Re: Is if ($a="something") a bad style?
Message-Id: <tbg1iblota.fsf@blue.sea.net>

| 98-05-12 mjd@op.net (Mark-Jason Dominus) comp.lang.perl.misc
| 
| I think it's bad style in C also.  I used to write this:
| 
|       if (p = malloc(...)) {
|       }
| 
| but I decided that it was better to write this:
| 
|       if ((p = malloc(...)) != NULL) {
|       }
| 
| or this:
| 
|       p = malloc(...);
|       if (p) {
|       }
| 
| The `=' is just too deceptive.

Amen. It's sad that the first books from C liked to shrink code
as much as possible and put everything in a one line. People got thinking
that "Neat, it fits on one line" and indirectly thought that it would lead
to more efficient code. The C compiler wouldn't care a dime whether
one shrinked the code or not.

>From the maintenance perspective, nothing complex should not be done
in a one expression. And If I would have to debug the code with command line
debugger, this ine is the best:

        p = malloc(...);
        if (p) 

jari


    


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

Date: Fri, 15 May 1998 14:40:29 +0200
From: Tobias Bugala <tobiasbugala@swol.de>
Subject: Multithreading Server?
Message-Id: <355C37BD.FC@swol.de>

Hi,

my problem is:
I've just copied the example for a multithreading server from the
Camel-Book.
But my problem is, that, if I run it, then connect to it, it should
print out s.th. like "Can't exec fortune", the child-process should be
killed and the parent process should go on.

Well, that's not what it does. Here it prints the message out and then
BOTH processes get killed, printing s.th. like

 ./multiserver.pl 12361: Anforderung 12378 um Fri May 15 14:39:17 1998
 ./multiserver.pl 12361: reaped 12378 with exit 12032 um Fri May 15
14:39:17 1998


Where is my fault?

TOBI


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

Date: Fri, 15 May 1998 12:44:12 GMT
From: jdporter@min.net (John Porter)
Subject: Re: New Math Modules
Message-Id: <MPG.fc604403959f84d9896cb@news.min.net>

On Thu, 14 May 1998 16:20:47 -0400,
in article <355B521F.F2E90D9D@matrox.com>,
aqumsieh@matrox.com (Ala Qumsieh) wrote:
> If you think such modules would be useful, then let me know and I will
> try to add them to the CPAN archive. (at this point I am not sure if
> it's worth the hassle!)

Hard to tell.
Can you give a little more info, such as the functions in the interface,
and module usage?
Thanks.

John Porter


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

Date: 15 May 1998 12:45:29 GMT
From: tina@scandinaviaonline.se (Tina Marie Holmboe)
Subject: Re: Perl for Non-programmers
Message-Id: <6jhdd9$hu8$4@news1.sol.no>

In article <hr2dj6.bt6.ln@localhost>,
	tadmc@flash.net (Tad McClellan) writes:

> Russ Allbery (rra@stanford.edu) wrote:
> 
>: Am I the only person who thinks that strong typing is a useful language
>: feature for a new programmer?  
> 
> 
> No.
> 
> But it may be that there are only two of us  ;-)

  "Alle gode ting er tre" (sorry :)

  Make that three :)

-- 
  Tina Marie Holmboe                
  Application Developer (Geeks'R'Us)         [tina@tech.scandinaviaonline.se]
  Scandinavia Online AB Development Dept.    (+46) 08 587 81000 (switchboard)
                                             (+46) 08 587 81189 (direct)


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

Date: Fri, 15 May 1998 12:26:54 GMT
From: marcs@vbe.com (Marc A. Sonnenberg)
Subject: Perl on NT -- need some assistance
Message-Id: <355c3413.8668450@news.vbe.com>

I'm running Perl 3.16 on NT 4.0.  It worked fine until I upgraded to
IIS 4.0 and now the scripts come back with the following message:

CGI Error

The specified CGI application misbehaved by not returning a complete
set of HTTP headers. The headers it did return are:



Can't open perl script
"???????????????????ll?????????f????????????????????1????????????????????????a???????????":
Invalid argument



What's with all the question marks?  I can't tell if it's not finding
the script, find the script and not running properly, or not starting
perl.

Any help would be appreciated.


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

Date: Fri, 15 May 1998 06:24:00 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: Regex problem: substituting 3+ identical characters with just one
Message-Id: <gk8hj6.19h.ln@localhost>

J|rgen P|nter (Juergen.Puenter@materna.de) wrote:

: here's my problem: printing out man-pages, I get rubbish like 
: '_lll_oooo_kkk' instead of just 'look'. So far, no one can tell me why
: or how to prevent this. 


   man perl | col -b | lpr



: (why does the printout look the way it does?).


That's how you do underlining on a teletype (TTY).

You do a backspace and an underscore (overstriking).



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


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

Date: 15 May 1998 12:38:20 GMT
From: alansz@araw.mede.uic.edu (Alan Schwartz)
Subject: Re: Removing ^M at the end of each line of a file.
Message-Id: <6jhcvs$hp8$1@piglet.cc.uic.edu>

N6006024 <pernande@dev.amadeus.net> writes:
>After having saved a perl script with Homesite 3.0, when I open the script
>using vi I can see that each line is ended by a  ^M. Consequently, I made a
>perl script to remove ^M.
>My code looks like this :
>
>open (FILE, ">$ARGV[0]") || die "Cannot open $ARGV[0] : $!";
>while (<FILE>) {
>s/\^M//g;
> print <FILE> $_;
> }
>close(FILE) || die $!;
>
>Thanks in advance for your help,
>
>Philippe.


Far easier would be:

perl -pi~ -e 's/\015//g' filename

Or, if you're in vi already, you could just do:

:%s/^M//g

(enter ^M as control-V control-M)

Or, since you're on some kind of Unix system, you might have the
'dos2unix' program which will do the same.

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
                       Alan Schwartz <alansz@uic.edu>
Asst. Prof. of Clinical Decision Making | University of Illinois at Chicago
Adj. Asst. Prof. of Psychology          | Department of Medical Education
   "Life is what happens to you while you're busy making other plans"
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-



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

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


Administrivia:

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

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.

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

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

The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.

The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.

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


------------------------------
End of Perl-Users Digest V8 Issue 2607
**************************************

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