[8234] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1853 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Feb 10 20:15:07 1998

Date: Tue, 10 Feb 98 17:01:36 -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           Tue, 10 Feb 1998     Volume: 8 Number: 1853

Today's topics:
    Re: print a integer with two decimal places <tchrist@mox.perl.com>
    Re: PROBLEM WITH gifs <tchrist@mox.perl.com>
    Re: RFC about ``Matt's Script Archive'' <palincss@nicom.com>
    Re: RFC about ``Matt's Script Archive'' <tchrist@mox.perl.com>
    Re: Rounding Off Decimal Numbers <SNIPhsommer@micro.ti.comSNIP>
    Re: Rounding Off Decimal Numbers <tchrist@mox.perl.com>
    Re: strange split behaviour (Martien Verbruggen)
    Re: Syntax-coloring editor for NT <ldanna@hotmail.com>
    Re: Syntax-coloring editor for NT <ebohlman@netcom.com>
    Re: SYSTEM command - How do you return data to the brow (Martien Verbruggen)
    Re: Too simple to ask but then .... (Martien Verbruggen)
    Re: What can I do when Perl panics? (Martien Verbruggen)
        Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: 11 Feb 1998 00:41:42 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: print a integer with two decimal places
Message-Id: <6bqs46$l7c$12@csnews.cs.colorado.edu>

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

Using that spawn of the devil, Mozilla 3.01 (Macintosh; I; PPC),
rippo@kc3.co.uk writes in comp.lang.perl.misc:

:I need to output an integer to two decimal places.

No, you need to read the FAQ.

    % man perlfaq4
    ...
    Does perl have a round function?  What about ceil() 
    and floor()? Trig functions?

--tom
-- 
	Tom Christiansen	tchrist@jhereg.perl.com

"Patriotism is the virtue of the vicious."
 - Oscar Wilde


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

Date: 11 Feb 1998 00:37:01 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: PROBLEM WITH gifs
Message-Id: <6bqrrd$l7c$11@csnews.cs.colorado.edu>

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

In comp.lang.perl.misc, using the evil Mozilla 3.03Gold (Win95; I),
steph@hotkey.net.au writes:

:I wrote a very simple script to send HTML back to browser.  The HTML all
:loads, but the images dont. Instead, the Windows default viewer for gifs
:is spawned, and the images load there????

This has nothing whatsoever to do with Perl.  It's either a browser
issue, or an operating system problem.  I susgest trying again
in a more appropriate newsgroup.

:I'm using Win95[a] and a Netscape Fast Trak Server for my developing.

That's not our fault.

--tom
-- 
	Tom Christiansen	tchrist@jhereg.perl.com


    "It's later than you don't think." --Larry Wall


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

Date: Tue, 10 Feb 1998 18:08:28 -0800
From: Steve Palincsar <palincss@nicom.com>
Subject: Re: RFC about ``Matt's Script Archive''
Message-Id: <34E1081B.2E15@nicom.com>

Having recently spent some time working with wwwboard, let me add my
two cents' worth:  here's a bulletin board type messaging system that
does not use any form of file locking, that names its messages by 
reading a number from a counter file, closing it, noodling around for
a dozen or more lines, opening it again, incrementing the value, and
writing the new value into the counter file.  Of course, a dozen
people could have gotten that same message number in that amount of
time.

It also uses the main board page as the database to keep track
of relationships between messages, so the main page is being rewritten
all the time.  And the way that is done is he opens the file, reads
it into an array, closes it, adds the new message with linkages
again for many, many lines of code, then opens the main forum page again 
and rewrites it.  

Executive summary:  a train wreck waiting to happen.

Further commentary:  it doesn't take all that long to rewrite the
offending routines and add flocking as required.  Why, oh why
has Matt not done that yet?

Steve Linberg wrote:
> 
> In article <6bqdk0$j6t$3@csnews.cs.colorado.edu>, tchrist@mox.perl.com
> (Tom Christiansen) wrote:
> 
> > In comp.lang.perl.misc, linberg@literacy.upenn.edu (Steve Linberg) writes:
> > :However, in Matt's defense, I would point out that the scripts there are
> > :(a) free and (b) fairly stable -
> >
> > Free stuff isn't by its very nature automatically good stuff.
> > And something that's stable can also be dead.
> 
> Yes, this is true, but I think the most important tests are: Is it
> useful?  Does it help people?  Are people learning from it?  Even if --
> and I'm speaking very abstractly, here -- something is "not good" or
> "dead", it can still be useful.  Matt's scripts have been very useful to a
> lot of people.  I have less of a sense of how much trouble they've been,
> or whether they're the source of a lot of clutter in this group.
> 
> I'm not trying to be pedantic, here, just wondering about the larger goal
> of this thread.  Are you planning some kind of recommendation for or
> against Matt's scripts?
> 
> --
> Steve Linberg                  |    National Center on Adult Literacy
> Systems Programmer etc.        |           University of Pennsylvania
> linberg@literacy.upenn.edu     |        http://www.literacyonline.org


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

Date: 11 Feb 1998 00:15:26 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: RFC about ``Matt's Script Archive''
Message-Id: <6bqqiu$l7c$5@csnews.cs.colorado.edu>

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

In comp.lang.perl.misc, palincss@nicom.com writes:
:Executive summary:  a train wreck waiting to happen.
:Further commentary:  it doesn't take all that long to rewrite the
:offending routines and add flocking as required.  Why, oh why
:has Matt not done that yet?

Bad programmer, or evil.  Take your pick.

--tom
-- 
	Tom Christiansen	tchrist@jhereg.perl.com


		Cloning is the sincerest form of flattery.


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

Date: Tue, 10 Feb 1998 17:05:39 -0600
From: Holly Sommer <SNIPhsommer@micro.ti.comSNIP>
Subject: Re: Rounding Off Decimal Numbers
Message-Id: <34E0DD43.EFE5D5BD@micro.ti.comSNIP>

Chris Wicklas wrote:
 
: Hi all-
:
: I was wondering if someone could give me a hand. I've been trying to 
: get a decimal number such as 57.788 to come out as 57.79. I'm having a 
: hard time getting this to work. It's for a shopping cart that I'm 
: working on and I can't get the final price to come out rounded off 
: after the tax, which ususally ends up being some mega-digited number, 
: is added in.

Far from elegant, but this works, and you can adjust it to round
at any decimal place (plus, the basic algorithm is easily adjusted
to work in any language):

foreach $string (@strings) {
   $string *= 1000;
   $ones = chop $string;
   if ( $ones >= 5 ) { 
      $string++;       # round up
      $string /=100;
   } else {            # don't round
      $string /=100;
   }
}

-Holly


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

Date: 11 Feb 1998 00:05:56 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Rounding Off Decimal Numbers
Message-Id: <6bqq14$l7c$3@csnews.cs.colorado.edu>

In comp.lang.perl.misc, chrisw@solarcomm.com writes:
:I was wondering if someone could give me a hand. I've been trying to get
:a decimal number such as 57.788 to come out as 57.79. 

    % man perlfaq4
    ...
    Does perl have a round function?  What about ceil() 
    and floor()?  Trig functions?

Those who do not consult the FAQ are doomed to repeat it.

--tom
-- 
	Tom Christiansen	tchrist@jhereg.perl.com

#ifdef USE_STD_STDIO    /* Here is some breathtakingly efficient cheating */
    --Larry Wall, from sv.c in the v5.0 perl distribution


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

Date: 10 Feb 1998 22:00:10 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: strange split behaviour
Message-Id: <6bqila$pg4$5@comdyn.comdyn.com.au>

In article <opafbz1o4y.fsf@geolin5.geophys2.uni-bremen.de>,
	Andreas Hartmann <ahartman@geolin5.geophys2.uni-bremen.de> writes:

> $n is 4. The manual page states that any leading spaces are removed, and
> an older version (5.003) on a linux platform behaves like that. 

# perl -v

This is perl, version 5.004_04 built for sun4-solaris

# perl5 -e '$_="   123    234   345"; $n = split; print "$n\n"'
3

As you can see, I don't have that problem. I also don't have that
problem if I write a script that takes a file as input, etc.. etc..

(BTW, do you run perl with the -w flag? Did it warn you not to
implicitly split into @_?)

Maybe your version of perl is broken? Misconfigured? Maybe the input
wasn't what you thought it was?

Martien
-- 
Martien Verbruggen                  | 
Webmaster www.tradingpost.com.au    | Little girls, like butterflies, need no
Commercial Dynamics Pty. Ltd.       | excuse - Lazarus Long
NSW, Australia                      | 


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

Date: Tue, 10 Feb 1998 17:56:49 -0500
From: Larry D'Anna <ldanna@hotmail.com>
Subject: Re: Syntax-coloring editor for NT
Message-Id: <34E0DB31.3C03CF18@hotmail.com>

scott@softbase.com wrote:

> Microsoft is not "screwing the rest of us". Remember the free market,
> the thing that makes the economy run? If there's demand, a product will
> be viable. 

Microsoft IS screwing the rest of us.  The "free market" does not 
exist in the presence of a monopoly.  Microsoft does not have 
competitors, at least not any that last.  They use underhanded 
legalisms, lies, marketing, and their unique position in the economy 
to destroy any competitors that might dare to oppose them.

> If there's no demand, then a product does not survive.  The
> consumer has full choice in the matter of how to spend money.  If the
> products do not sell, the company goes out of business or moves on to
> something else. (Unfortunately, most people tend to forget that the
> economy is based on a free market when it comes to computers. All
> computer zealots should be required to take a test which shows they
> know how the real world works before they are allowed to post diatribes
> :))

Most consumers are stupid.  They buy whatever has the best TV ad or the 
glitzyist interface.  That leaves those of us who know better stuck with 
the choice between superior but incompatible solutions or mainstream 
mediocrity.

> Ironically, MultiEdit, the editor which prompted this rant, is the
> product of a company that does nothing but develop this product.
> They've made it successful by listening to the users, and making each
> iteration of the product better.  They've built their entire company on
> giving users what they want. They're also a small ISV which is still
> surviving in an era of integrated development environments and their
> built-in editors, and big companies, so you know the editor must be
> good to still survive. It is hardly "crap", and it is not from
> Microsoft. Why is it the people who launch into rants never have a clue
> about what they're talking about? Your $100 goes to support a
> small ISV.

Microsoft started small. 

> That is the flaw in free software: it ignores the fact that you have to
> eat. And provide for all other necessities. 

There is a difference between the need to eat and the desire to get rich.

<SNIP>

---------------------------------------------------
|Democracy is the worst system of government. --
|Except for all the others
|               -Winston Churchill
---------------------------------------------------
Larry D'Anna                   "eschew obfuscation"


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

Date: Tue, 10 Feb 1998 23:37:49 GMT
From: Eric Bohlman <ebohlman@netcom.com>
Subject: Re: Syntax-coloring editor for NT
Message-Id: <ebohlmanEo6sB1.LEn@netcom.com>

scott@softbase.com wrote:
: Microsoft is not "screwing the rest of us". Remember the free market,
: the thing that makes the economy run? If there's demand, a product will
: be viable. If there's no demand, then a product does not survive.  The
: consumer has full choice in the matter of how to spend money.  If the
: products do not sell, the company goes out of business or moves on to
: something else. (Unfortunately, most people tend to forget that the
: economy is based on a free market when it comes to computers. All
: computer zealots should be required to take a test which shows they
: know how the real world works before they are allowed to post diatribes
: :))

One could make a fairly good argument that Microsoft's success (or the
success of other large vendors of general-purpose commercial software) is
*not* due to anything resembling classical free-market competition. 
Remember that Microsoft makes most of its money from sales to businesses. 
In all but the smallest business, the people making the decisions about
what software to buy are *not*, for the most part, the people who will be
*using* that software.  In such an environment, it's quite possible that 
if Vendor A's product does a better job of meeting the end users' needs, 
but Vendor B's marketing material does a better job of impressing the 
managers who make purchasing decisions, Vendor B will be more successful.

Classical free-market theory assumes that consumers are making informed
choices, but in the above scenario the role of the "consumer" is split
into two parts that don't communicate with each other, and this assumption
breaks down.  A similar situation occurs with the pricing of hospital
care; it's been empirically observed that in the US economy, this does
*not* obey the law of supply and demand.  The reason is that the
"consumer" role is split into *three* parts: patients receive services,
doctors choose who provides the service and insurers pay for the 
services.  The law of supply and demand, however, holds only when the 
*same* person is occupying all three roles.

The point here is that an actual complex market can produce results that 
are contrary to what an oversimplified theory (Econ 101) will predict.  
The success of free software such as Perl is one of those results.



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

Date: 10 Feb 1998 22:01:36 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: SYSTEM command - How do you return data to the browser?
Message-Id: <6bqio0$pg4$6@comdyn.comdyn.com.au>

In article <6bq4gp$iqn@camel19.mindspring.com>,
	"Rick Ryan" <rickryan@datrixnet.com> writes:
> I'm using the SYSTEM command to run an external .exe file on my NT server.

No you don't. You might be using system(). Perl doesn't have a SYSTEM
command.

> Is there any way to have the output of the called program return directly to
> the browser or back to my perl script? I've tried it several different ways

Have you looked at the documentation?

perldoc -f system

The first paragraph tells you the answer.

Martien
-- 
Martien Verbruggen                  | 
Webmaster www.tradingpost.com.au    | For heaven's sake, don't TRY to be
Commercial Dynamics Pty. Ltd.       | cynical. It's perfectly easy to be
NSW, Australia                      | cynical.


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

Date: 10 Feb 1998 21:49:01 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Too simple to ask but then ....
Message-Id: <6bqi0d$pg4$4@comdyn.comdyn.com.au>

Please read the following information on how to choose a good subject
line:

http://www.perl.com/CPAN/authors/Dean_Roehrich/subjects.post

In article <34DFFDF1.891FF917@csah.com>,
	Gilles Chong <glchy@csah.com> writes:
> Hi guys n gals,

and otherwise oriented beings.

> Im getting into tt PERL thing n would like to do an extremely simple
> thing.

If you already know that it is extremely simple, then why do you need
to ask?

> I wanna display a list of files sitting on a directory on my Unix system
> on a web page. How to proceed? Actually I can use the "system" command
> rite? Like: system "cd /X/Y/Z; ls -l". But then where will the list be
> displayed? N if i wanna display it on my webpage, do i get the list

First, look up system():

perldoc -f system

The first paragraph there will tell you what to look up (qx// or
backticks in the perlop documentation). But I wouldn't do it that way.

> Surely there is a much easier way to do it, rite?

perldoc -f glob

or:

perldoc -f opendir
perldoc -f readdir
perldoc -f closedir

Most of them have example code in the documentation.

> Help help! Pls advise me thru email.

I advise you to buy a new keyboard; one that has all the keys you
need.

Martien
-- 
Martien Verbruggen                  | 
Webmaster www.tradingpost.com.au    | I think I think, therefore I think I
Commercial Dynamics Pty. Ltd.       | am.
NSW, Australia                      | 


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

Date: 10 Feb 1998 21:41:38 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: What can I do when Perl panics?
Message-Id: <6bqhii$pg4$3@comdyn.comdyn.com.au>

In article <34dfb36a.8970873@news.idt.net>,
	JWears@msn.com writes:
> I have a long-running Perl script which dispatches processes as
> prerequisites are completed and system resources are avaliable.  Twice
> it has died with a "panic: leaving_scope inconsistency" message.  The

You should really never see a panic. They're internal problems.

> This is running in Perl 5.003 under AIX 4.1.5 on an RS/6000-40.

Can you reproduce this using perl 5.004_04? There might have been a
bug in 5.003 which has been fixed a while ago. If not just for this
problem, you should consider upgrading to 5.004_04 anyway. Lots of new
stuff, lots of bug fixes.

If you can reproduce it using a current perl, you could submit a bug
report.

Martien
-- 
Martien Verbruggen                  | 
Webmaster www.tradingpost.com.au    | In a world without fences, who needs
Commercial Dynamics Pty. Ltd.       | Gates?
NSW, Australia                      | 


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

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

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