[15731] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 3144 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed May 24 06:05:48 2000

Date: Wed, 24 May 2000 03:05:13 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <959162712-v9-i3144@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Wed, 24 May 2000     Volume: 9 Number: 3144

Today's topics:
    Re: &#037; translating ascii to unicode? <bill.kemp@wire2.com>
    Re: Accounting Systems Written In Perl??? otrcomm**NO_SPAM**@wildapache.net
        alias mail and script perl ghorghor@my-deja.com
    Re: alias mail and script perl (Rafael Garcia-Suarez)
    Re: alias mail and script perl <gellyfish@gellyfish.com>
    Re: array within array revisited <rhomberg@ife.ee.ethz.ch>
    Re: Basic scripting question <dave@dave.org.uk>
    Re: Basic scripting question <thunderbear@bigfoot.com>
        Compile problems - perl5.6.0, AIX 4.3.3.0, gcc 2.95.2.  (Amit Bhati)
    Re: Converting special chars... <bert@scanlaser.nl>
        Copy A File? <nospam@nospam.com>
    Re: Copy A File? <moltimer@yahoo.com>
    Re: Copy A File? <makarand_kulkarni@My-Deja.com>
    Re: Copy A File? <blah@nospam.com>
        creating graphs with perl..? suot@iobox.com
    Re: creating graphs with perl..? <makarand_kulkarni@My-Deja.com>
    Re: cut off text after a <br> <gellyfish@gellyfish.com>
    Re: file locking <rick.delaney@home.com>
    Re: file locking <rick.delaney@home.com>
        forking bhelton@my-deja.com
    Re: Forum for 'how to do it' questions? (Philip 'Yes, that's my address' Newton)
    Re: Forum for 'how to do it' questions? (Philip 'Yes, that's my address' Newton)
    Re: How do I convert? <yhvhboy1@home.com>
    Re: How to read a float type data? <michael.schlueter@philips.com>
        How to split this ? <moltimer@yahoo.com>
    Re: How to split this ? <jeff@vpservices.com>
    Re: How to split this ? <moltimer@yahoo.com>
        ht auth admin-type scripts <burger@post.queensu.ca>
    Re: Including variables defined outside the script (Bart Lateur)
    Re: join " ", do {$x++}, do {$x++}, do {$x++}; <rhomberg@ife.ee.ethz.ch>
    Re: Measuring excecution times in milliseconds <rhomberg@ife.ee.ethz.ch>
    Re: my algorythms suck (Bart Lateur)
        Newbie-- Sendmail <agi@feib.com.tw>
    Re: odd behavior printing after randomizing an array fr (Decklin Foster)
    Re: odd behavior printing after randomizing an array fr <kiera@nnickee.com>
        package naming <kenneth.lee@alfacomtech.com>
    Re: parse a string question, regexp? bj0rn@my-deja.com
        SV: Accounting Systems Written In Perl??? <thomas2@dalnet.se>
    Re: Untaint URL character class (Philip 'Yes, that's my address' Newton)
        writing Form content to a File-CGI devynckj@sans.co.za
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Wed, 24 May 2000 09:02:05 +0100
From: "W Kemp" <bill.kemp@wire2.com>
Subject: Re: &#037; translating ascii to unicode?
Message-Id: <959155419.4342.0.nnrp-01.c3ad6973@news.demon.co.uk>

>> >this "translating ascii to unicode".  us-ascii is a proper subset of
>> >unicode, and so is iso-8859-1,
>
>> Are you sure about that one (iso-8859-1)
>
>Yes Sir, I am...
>
>> Things go slightly wrong between hex 80 and 9F (strictly speaking
>> 0080 and 009F) unicode viewing these as control characters
>
>Indeed, but this follows on from iso-8859-* usage, which also defines
>them as control characters.


>Refer to a very boring table at

>ftp://ftp.unicode.org/Public/MAPPINGS/ISO8859/8859-1.TXT


Actually quite an interesting table (for me)

>In case anyone's got confused by the Empire: the codes between 128 and
>159 decimal (x80 to x9f) are assigned to control functions, in unicode
>_and_ in the iso-8859-* codings.


Yes I have been led astray by the dark empire.
Thank-you for leading me back towards the light.
(The only trouble is- customers think its part of latin-1)




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

Date: Wed, 24 May 2000 05:25:10 GMT
From: otrcomm**NO_SPAM**@wildapache.net
Subject: Re: Accounting Systems Written In Perl???
Message-Id: <392b6606.1594943@news.wildapache.net>

Hello,

No, I am looking for an opensource financial accounting system written in
Perl, with MySQL support that will run on a Linux system.

I realize now that this is probably not the correct forum to pose this
question too, but I figured that people who work in Perl are generally well
up on what is available wrt Perl apps.

Murrah Boswell

On 23 May 2000 16:26:28 PST, neil@pacifier.com wrote:

>otrcomm**NO_SPAM**@wildapache.net wrote:
>> Hello,
>
>> Does anyone know if there are any decent accounting systems written in perl
>> that will run on a Linux system?
>
>I think what you are really looking for is an accounting system that will
>run on Linux, not specifically that it has to be written in Perl. Try one
>of the linux groups such as comp.os.linux.misc.
>
>-- 
>
>Neil



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

Date: Wed, 24 May 2000 08:11:31 GMT
From: ghorghor@my-deja.com
Subject: alias mail and script perl
Message-Id: <8gg2rc$suf$1@nnrp1.deja.com>

hello

i m working on an unix system.

I ve created an alias in the file aliases like this :

test_mailing : "|/usr/local/.../script.pl"

the script should recieve the mail through stdin but it doesn t work

someone could help me

thanks


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


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

Date: Wed, 24 May 2000 09:19:01 GMT
From: garcia_suarez@hotmail.com (Rafael Garcia-Suarez)
Subject: Re: alias mail and script perl
Message-Id: <slrn8in7qc.4pi.garcia_suarez@rafael.kazibao.net>

ghorghor@my-deja.com wrote in comp.lang.perl.misc:
>hello
>
>i m working on an unix system.
>
>I ve created an alias in the file aliases like this :
>
>test_mailing : "|/usr/local/.../script.pl"
>
>the script should recieve the mail through stdin but it doesn t work

Can you be more precise in the description of your problem?
Perhaps your sendmail (if you're using sendmail) is configured to use
smrsh (the senmail restricted shell)? (look for 'smrsh' in sendmail.cf).
In this case it won't execute your script unless you configure smrsh to
allow it -- look at the relevant man pages.

-- 
Rafael Garcia-Suarez


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

Date: Wed, 24 May 2000 09:55:07 GMT
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: alias mail and script perl
Message-Id: <%FNW4.804$6T1.133153@news.dircon.co.uk>

On Wed, 24 May 2000 08:11:31 GMT, ghorghor@my-deja.com Wrote:
> hello
> 
> i m working on an unix system.
> 
> I ve created an alias in the file aliases like this :
> 
> test_mailing : "|/usr/local/.../script.pl"
> 
> the script should recieve the mail through stdin but it doesn t work
> 

In what way doesnt it work ?  Any number of things could be wrong and
only a few of them might have anything to do with Perl.

/J\


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

Date: Wed, 24 May 2000 11:15:35 +0200
From: Alex Rhomberg <rhomberg@ife.ee.ethz.ch>
Subject: Re: array within array revisited
Message-Id: <392B9DB7.BF37EC60@ife.ee.ethz.ch>

Tk Soh wrote:

> Spraying a bunch of print statements in the program for debugging
> purpose is hardly a good programming practice, and that already assumes
> you remember to clean them up after they did their job.
> 
> Perl already has a pretty good debugging tool, use it:
> 
>    perldoc perldebug

Don't underestimate the debugging power of a print statement.
I have encountered enough situations where it was the best tool
available

- Alex


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

Date: Wed, 24 May 2000 07:41:50 +0100
From: Dave Cross <dave@dave.org.uk>
Subject: Re: Basic scripting question
Message-Id: <uaumis83mds5se5tc70hmjcu23ldncpvib@4ax.com>

On Tue, 23 May 2000 10:16:08 -0700, "Godzilla!"
<godzilla@stomp.stomp.tokyo> wrote:

>Chris Allen wrote:
>
>> Anyone smart enough to put a perl script together in the
>> first place would have examined the one-liner posted
>> and agreed it was an elegant solution to the problem.
>
>
>Except for one thing; it doesn't work right.

Incorrect. It _does_ work. It simply had unless instead of if which
inverted the sense of the OP's request. It's still an elegant and
useful was to solve the problem.

Dave...

-- 
<http://www.dave.org.uk>  SMS: sms@dave.org.uk
yapc::Europe - London, 22 - 24 Sep <http://www.yapc.org/Europe/>

"There ain't half been some clever bastards" - Ian Dury [RIP]


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

Date: Wed, 24 May 2000 09:27:12 +0200
From: =?iso-8859-1?Q?Thorbj=F8rn?= Ravn Andersen <thunderbear@bigfoot.com>
Subject: Re: Basic scripting question
Message-Id: <392B8450.DA504264@bigfoot.com>



"Godzilla!" wrote:

> $ perl -v
> 
> This is perl, version 5.003 with EMBED
> built under solaris at Aug 15 1996 12:10:42

Is this the one that runs the Perl4 scripts we have heard so much about?


-- 
  Thorbjørn Ravn Andersen         "...plus...Tubular Bells!"
  http://bigfoot.com/~thunderbear


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

Date: Wed, 24 May 2000 06:56:57 GMT
From: amit@visi.com (Amit Bhati)
Subject: Compile problems - perl5.6.0, AIX 4.3.3.0, gcc 2.95.2. Help.
Message-Id: <Z2LW4.4024$BW6.386396@ptah.visi.com>

make fails with the following:

`sh  cflags libperl.a perlio.o`  perlio.c
          CCCMD =  gcc -DPERL_CORE -c -D_ALL_SOURCE -D_ANSI_C_SOURCE
          -D_POSIX_SO
URCE -fno-strict-aliasing -I/usr/local/include -O
perlio.c:534: conflicting types for `vprintf'
/usr/local/lib/gcc-lib/powerpc-ibm-aix4.3.3.0/2.95.2/include/stdio.h:262: previous declaration of `vprintf'
perlio.c:541: conflicting types for `vfprintf'
/usr/local/lib/gcc-lib/powerpc-ibm-aix4.3.3.0/2.95.2/include/stdio.h:261: previous declaration of `vfprintf'
make: *** [perlio.o] Error 1

I know, it would help to have the IBM C Compiler instead, but I cant afford
that luxury right now. Any help much appreciated.

-amit
amit@visi.com


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

Date: Wed, 24 May 2000 11:05:34 +0200
From: Bert IJff <bert@scanlaser.nl>
To: "David A. Pegram" <dpegram@paragen.com>
Subject: Re: Converting special chars...
Message-Id: <392B9B5E.8FF1E515@scanlaser.nl>

"David A. Pegram" wrote:
> 
> How can I convert a special character within a string to some other
> character?
> 
> For example, I'd like to convert "ö" to "o".
> 
> TIA,
> 
> David


It greatly depends on the underlying character set (i.e. where does
your inout text come from)

For example (character set looked up in some old book) this ö
(copy/pasted from your text)

is char(154) in MC Text ,

is char(246) in Windows 3.1 Latin 1 , ISO 8859/1 Latin 1 , Windows 3.0
Latin 1 , ISO 8859/2 Latin 2 ,  Windows 3.1 Latin 2 , Windows 3.1
Latin 5 , ISO 8859/9 Latin 5 , (and also here on my screen which
probably is ISO 8859/1)

is char(148) in PC-8 Code Page 437 , PC-850 Multilingual , PC-8
Danish/Norwegian , PC-852 Latin 2 , PC-Turkish , (old MS-Dos)

is char(206) in Roman-8 , Ventura International

First find out what the underlying encoding is, then go for Uri
Guttman's approach, I'd say.

Good luck,
Bert


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

Date: Wed, 24 May 2000 09:34:24 +0100
From: "NoSpam" <nospam@nospam.com>
Subject: Copy A File?
Message-Id: <DsMW4.802$6T1.133053@news.dircon.co.uk>

What is the Perl command to copy a file from a folder to another?

Cheers

Paul.




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

Date: Wed, 24 May 2000 18:09:24 +0900
From: "Moltimer" <moltimer@yahoo.com>
Subject: Re: Copy A File?
Message-Id: <8gg5tf$eid$1@news2.kornet.net>



NoSpam ÀÌ(°¡) ¸Þ½ÃÁö¿¡¼­ ÀÛ¼ºÇÏ¿´½À´Ï´Ù...
>What is the Perl command to copy a file from a folder to another?
>
>Cheers
>
>Paul.
>
>

This will works.
`cp aaa/file.txt bbb/file.txt`;




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

Date: Wed, 24 May 2000 02:25:35 -0700
From: Makarand Kulkarni <makarand_kulkarni@My-Deja.com>
Subject: Re: Copy A File?
Message-Id: <392BA00E.322DD241@My-Deja.com>

> What is the Perl command to copy a file from a folder to another?

use File::Copy;
--



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

Date: Wed, 24 May 2000 11:40:21 +0200
From: Marco Natoni <blah@nospam.com>
Subject: Re: Copy A File?
Message-Id: <392BA385.2D2EAE0F@nospam.com>

NoSpam,

NoSpam wrote:
> What is the Perl command to copy a file from a folder to another?

  A number of ways is available but the simplest I see is:

	system 'YOUR_OS_CP_COMMAND path1 path2';


	Best regards,
		Marco


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

Date: Wed, 24 May 2000 08:41:01 GMT
From: suot@iobox.com
Subject: creating graphs with perl..?
Message-Id: <8gg4is$u4f$1@nnrp1.deja.com>

Hey, my purpose was to create simple scientific graphs with Perl via
HTML-pages. We are running
 NT-server.
 I've found only couple of UNIX-modules for Perl to create those graphs
but none for NT. Could anyone give
 a hand..?


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


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

Date: Wed, 24 May 2000 03:00:07 -0700
From: Makarand Kulkarni <makarand_kulkarni@My-Deja.com>
Subject: Re: creating graphs with perl..?
Message-Id: <392BA827.C26FE739@My-Deja.com>

> Hey, my purpose was to create simple scientific graphs with Perl via
> HTML-pages. We are running
>  NT-server.
>  I've found only couple of UNIX-modules for Perl to create those graphs
> but none for NT. Could anyone give
>  a hand..?

use CGI, Perl and GNUPlot, see this article
Perl Journal, Volume 4, Number 2 (#14), Summer 1999

On-the-Fly Web Plots Made Easy
Using Gnuplot to graph web logs
 Lincoln D. Stein




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

Date: 24 May 2000 06:57:13 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: cut off text after a <br>
Message-Id: <8gfqvp$ff1$1@orpheus.gellyfish.com>

On Tue, 23 May 2000 13:16:05 +0100 W Kemp wrote:
> This line looks odd to me, I would have thought it just gives '1' for  match
> '0' for no match.
> 
> $tmpnewshtml = $newstext =~ m/(.*)?<br>/;
> 

Yes. The LHS of the assignment here must be in array context for the captured
elements to be assigned :

  ($tmpnewshtml) = $newstext =~ m/(.*)?<br>/;

/J\
-- 
Don't let Krusty's death get you down, boy. People die all the time,
just like that. Why, you could wake up dead tomorrow! Well, good night.
-- 
fortune oscar homer


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

Date: Wed, 24 May 2000 04:41:12 GMT
From: Rick Delaney <rick.delaney@home.com>
Subject: Re: file locking
Message-Id: <392B5DD2.F65958D2@home.com>

Michel Dalle wrote:
> 
> After some trouble, I managed to "scramble" some output by launching
> about 30 processes in background, each trying to append a few
> hundreds of long lines and sleeping for a second between every 16
> prints.

Thanks, that put me on the right track and I managed to get some mixing
on Linux.  Here is my script if anyone wants to try it.  You may have to
fiddle with the numbers for your system.

use strict;
my $x = "a";
for (1..4) {
    if (fork) {
    	$x++;
    }
    my $str = $x x 10000;
    open F, ">>append.tmp" or die $!;
    print F "$str\n";
}

Check that all lines in the file have the same length:

$ perl -lne '$x{+length}++;END{print scalar keys %x}' append.tmp
3

-- 
Rick Delaney
rick.delaney@home.com


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

Date: Wed, 24 May 2000 04:46:52 GMT
From: Rick Delaney <rick.delaney@home.com>
Subject: Re: file locking
Message-Id: <392B5F26.1A1CD968@home.com>

"Randal L. Schwartz" wrote:
> 
> Rick> <aol>I'd like to know the answer to this too.</aol>
> 
> "asked and answered", the lawyers would scream.  Just go up a few
> messages in this thread.

That looks like banter, not an answer.  You'll have to use smaller
words  or more of them to explain it to this non-C programmer.  :-)
 
> If it's less than the buffering size of your STDIO buffer (typically
> 8K or so), it's probably gonna be a single write(2) call, and you get
                  ^^^^^^^^

> O/S assistance to ensure atomicity.  If it's greater than that, you
> will probably lose at some point.  Solution, use syswrite(), but be
       ^^^^^^^^
> prepared for the rare short write (which again won't be atomic, but at
> least you'll know it happened).

That's a good start.

I understand the second "probably" to mean "by chance".  Does the first
also mean this, or does it mean "depending on the implementation"?

-- 
Rick Delaney
rick.delaney@home.com


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

Date: Wed, 24 May 2000 07:08:05 GMT
From: bhelton@my-deja.com
Subject: forking
Message-Id: <8gfv4g$pj4$1@nnrp1.deja.com>

I'm trying to do something I thought would be simple.  It may still be
and I just have been using the wrong approach.  I want to fork from my
perl program and run a du -sk from the child process and while the du -
sk is calculating disk usage I want the parent to report to the screen
the progress.  Nothing fancy, I just want to do like a lot of unix
package scripts do and have #'s scroll across for every second the
child process is running calculating the disk usage.  Any pointers
would be more than appreciated.  Thanks,

Brandon


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


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

Date: Wed, 24 May 2000 08:22:55 GMT
From: nospam.newton@gmx.li (Philip 'Yes, that's my address' Newton)
Subject: Re: Forum for 'how to do it' questions?
Message-Id: <392b8a62.9064142@news.nikoma.de>

On Fri, 19 May 2000 15:59:00 -0400, tadmc@metronet.com (Tad McClellan)
wrote:

>We do not object to newbie questions here.
>
>We DO object to questions whose answers are already installed
>on your hard disk.

Oh, and many in c.l.p.misc also object to questions which have little to
do with Perl, and more to do with the operating system used, the CGI,
HTML, and similar -- where the problem encountered would be similar
regardless of whether the program was in Perl, Python, C, or whatever.

Cheers,
Philip
-- 
Philip Newton <nospam.newton@gmx.li>
If you're not part of the solution, you're part of the precipitate.


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

Date: Wed, 24 May 2000 08:22:56 GMT
From: nospam.newton@gmx.li (Philip 'Yes, that's my address' Newton)
Subject: Re: Forum for 'how to do it' questions?
Message-Id: <392b8b6a.9327746@news.nikoma.de>

On 22 May 2000 11:19:56 -0400, David Meyers <dmeyers@panix.com> wrote:

>jones <ra.jones@NO_UCE*cwcom.net> writes:
>
>> >> > And in your own interest, _do_ desist from upside-down-quoting.
>> >
>> >> That seems to be a matter of opinion.
>> >Perhaps, but the opinion of this newsgroup is as Alan said.  Look back
>> >through the archives (at www.deja-news.com) under the keyword
>> But as I went on to say - I have no problem with retaining the quote 
>> above the reply. It certainly makes the reply easier to understand. We 
>> have no dispute here.
>
>And one more minor note of convenience for your readers, add a touch
>of whitespace.

Specifically, a blank line between the end of a quote and the beginning
of your reply. This for each bit of quote (if you interspace original
material and your replies). Makes paragraphs easier to tell apart
visually -- especially if one's newsreader doesn't colour-code or
otherwise mark quoted material.

Cheers,
Philip
-- 
Philip Newton <nospam.newton@gmx.li>
If you're not part of the solution, you're part of the precipitate.


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

Date: Wed, 24 May 2000 07:57:49 GMT
From: yhvhboy1 <yhvhboy1@home.com>
Subject: Re: How do I convert?
Message-Id: <392B8BEF.5BED292D@home.com>



Tom Briles wrote:

> [ Please place your response *after* the quoted text. ]
>
> Bert IJff wrote:
> >
> > Calle Dybedahl wrote:
> > >
> > > >>>>> "Anthony" == Anthony John Doyle <strad@mondenet.com> writes:
> > >
> > > >   I am wanting to read 8 bit characters in from a file
> > > >   and I want to convert each of those bytes to its decimal
> > > >   equivalent for example from 0 to 255.
> > >
> > > perl -le 'print for map {ord} split "",<>;' < file
> >
> > With perl5 on a Unix box the given script gives the error message
> >
> > Missing $ on loop variable at -e line 1.
> >
>
> 'EXPR foreach EXPR' was introduced in 5.005.  The error you saw is
> coming from an older version.

if you want to convert repost in alt.religion.islam
i'm sure someone there would be more than
happy to help you out =o)
--
have you read your quran today? ( http://islam.org )



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

Date: Wed, 24 May 2000 10:46:28 +0200
From: "Michael Schlueter" <michael.schlueter@philips.com>
Subject: Re: How to read a float type data?
Message-Id: <8gg0rc$mss$1@porthos.nl.uu.net>

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

my @data;
open F, "your_file_name_here" or die;

@data = <F>;    # read in data

my $a = $data[2];    # should be your 7.5

# that's it

Regards,
Michael Schlueter





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

Date: Wed, 24 May 2000 13:34:24 +0900
From: "Moltimer" <moltimer@yahoo.com>
Subject: How to split this ?
Message-Id: <8gflpr$mot$2@news2.kornet.net>

I split a value by "_"
The odinary value should have only two of "_" like "A_B_C".

If there are many "_"s in middle word like "A_B-1_B-2_B-3_much_more_C,
How can I get value like "A", "B-1_B-2_B-3_much_more" and "C"
instead of "A", "B-1" and "B-2" ?

@lets = split(/\_/, $value);
$lets[0] should be "A"
$lets[0] should be "B-1_B-2_B-3_much_more"
$lets[0] should be "C"

Thanks.





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

Date: Tue, 23 May 2000 21:45:29 -0700
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: How to split this ?
Message-Id: <392B5E69.2AC75D42@vpservices.com>


Moltimer wrote:
> 

It is not polite to ask the same thing twice in the same group with a
differnt subject heading (especially with less than two hours separating
the postings).  I already answered you the first time.  If for some
reason your news server does not pick up my answer, you can find it in
the archives of the group at www.deja-news.com probably tomorrow.

-- 
Jeff


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

Date: Wed, 24 May 2000 14:25:02 +0900
From: "Moltimer" <moltimer@yahoo.com>
Subject: Re: How to split this ?
Message-Id: <8gfooq$r3r$2@news2.kornet.net>

Sorry for making trouble.
I deleted the earlier post because of some of mis-spelling I wrote.

Anyway, I could't find yours from dejanews.
Would you please re-answer about it for me.

Thanks.

Jeff Zucker ÀÌ(°¡) <392B5E69.2AC75D42@vpservices.com> ¸Þ½ÃÁö¿¡¼­
ÀÛ¼ºÇÏ¿´½À´Ï´Ù...
>
>Moltimer wrote:
>>
>
>It is not polite to ask the same thing twice in the same group with a
>differnt subject heading (especially with less than two hours separating
>the postings).  I already answered you the first time.  If for some
>reason your news server does not pick up my answer, you can find it in
>the archives of the group at www.deja-news.com probably tomorrow.
>
>--
>Jeff




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

Date: Wed, 24 May 2000 01:13:14 -0400
From: Bob Burge <burger@post.queensu.ca>
Subject: ht auth admin-type scripts
Message-Id: <Pine.GSO.4.21.0005240109580.6365-100000@post.queensu.ca>

Hello, everyone.  Does anyone have pros/cons on using a particular perl
module for managing authen-type dbm's?

Thanks, Bob
burger@post.queensu.ca



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

Date: Wed, 24 May 2000 09:39:03 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: Including variables defined outside the script
Message-Id: <392c928d.3361904@news.skynet.be>

Joshua J. Kugler wrote:

>> 	$::var = 'data';
>> 
>> which even makes 'strict' happy.
>
>OK, I try that, but now I get
>
>Variable "$var" is not imported at file.cgi line 180

Well, you won't get that if you use them as $::var in your main script,
too. I wouldn't mind this syntax, because that notation of the name of
the variables clearly indicates them as "globals", i.e. shared between
files (and packages).

Or, you can declare them. Pre 5.6:

	use vars qw($var);

New in 5.6:

	our($var);

Now you can do

	print $var;

in package main.

-- 
	Bart.


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

Date: Wed, 24 May 2000 10:36:47 +0200
From: Alex Rhomberg <rhomberg@ife.ee.ethz.ch>
Subject: Re: join " ", do {$x++}, do {$x++}, do {$x++};
Message-Id: <392B949F.5EFD7F03@ife.ee.ethz.ch>

Bart Lateur wrote:

>         print $x++, $x++;
> 
> is a very similar case. The second increment also changes the first
> parameter, because they point to the same value.

But it doesn't. The postincrement first stores (a reference to) the
current value of $x on the parameter stack and then increments $x. With
preincrement, $x is incremented and then a reference is pushed on the
stack.

Witness:

sub modify { $_[0]++}

my $x = 0;
$\=$,=$/;
print $x, ++$x, $x++, $x+0, $x += 10, ++$x;
# first, second and the two last arguments are passed by reference,
# third and fourth by value

print $x;
modify ($x+=10); # pass by reference
print $x;
modify ($x++); # pass by value
print $x;

13
13
1
2
13
13
13
24
25

Arguments seem to be evaluated left to right, arguments passed by
reference use the value in the variable at the time the function is
called (including all modifications later in the argument list),
arguments passed by value use the value at the time the argument is
examined.

- Alex


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

Date: Wed, 24 May 2000 10:52:25 +0200
From: Alex Rhomberg <rhomberg@ife.ee.ethz.ch>
Subject: Re: Measuring excecution times in milliseconds
Message-Id: <392B9849.ADCD73C5@ife.ee.ethz.ch>

Tim Blair wrote:

> I *did* check the FAQ, looked at various time() functions, the Benchmark
> module, and the profiling stuff.  However, there's nothing in there that I
> can measure times in *milli* seconds (or even micro - just more accurate
> than seconds).

Measuring times in something more accurate than milliseconds is often a
problem which there might be no easy solution for on your system. The
only resolution you certainly get on e.g. Linux systems is a system
tick, which is 1ms on my systems.

I am currently profiling a program. On some system, gettimeofday(2)
delivered microsecond resolution, on SMP it only delivered tick
resolution. I had to read a clock value from a PCI card for exact
timing.

- Alex


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

Date: Wed, 24 May 2000 09:39:07 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: my algorythms suck
Message-Id: <392d94d1.3942296@news.skynet.be>

David Wall wrote:

>That's just what I used in a basic little web board I wrote last year.  I was 
>hoping that I could find a non-recursive way to do it, but you seem to be 
>saying there's no other way to do it.   Bummer.

Ow ow ow! Stop it right there! There is ALWAYS a way to convert
recursive algorithms into non-recursive ones! It's so generic that even
automated tools could do it. All you really need, is a data stack. Now,
Perl's arrays, together with the functions push() and pop(), work very
nicely for a stack. So it's not even that hard in Perl.

But, looking at the source, I wouldn't bother. The non-recursive version
can't be but (far) more complicated than the recursive version.

Now, putting my money where my mouth is: assuming that the data
structures are the same as in the original code, here's a non-recursive
way to dump the messages.

    my @stack = [ $children{0}, 0 ];
    while(@stack and my($array, $i) = @{pop @stack}) {
        while($i < @$array) {
            my $id = $array->[$i];
            print '  ' x @stack, ">", $msgs{$id}{name},"\n";
            $i++;
            if($children{$id}) {
                push @stack, [ $array, $i ];
                ($array, $i) = ($children{$id}, 0);
            }
        }
    }

-- 
	Bart.


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

Date: Wed, 24 May 2000 04:58:21 GMT
From: Agi <agi@feib.com.tw>
Subject: Newbie-- Sendmail
Message-Id: <8gfnh9$ksl$1@nnrp1.deja.com>

Hello,theres
  I want to sent a HTML file to someone using Perl.
  Which module can achieve my goal ??

  ps.I'm new in Perl.

Best Regards,
Agi Chen


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


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

Date: 24 May 2000 04:18:29 GMT
From: fosterd@hartwick.edu (Decklin Foster)
Subject: Re: odd behavior printing after randomizing an array from STDIN
Message-Id: <slrn8imm0k.iip.fosterd@photek.dhs.org>

Kiera <kiera@nnickee.com> writes:

> #!perl -w
> srand;
> print "List of strings: "; 
> my @b = <STDIN>;
> print "Answer: $b[rand(@b)]";
> #__END__

OK, now do it in a constant amount of space. That is, I can feed the
program a 10GB file and it will still work (we'll assume here you have
less than that much RAM.) Hint: it can be done in one line.

[p.s. What's up with those comments?]
[p.p.s. Use <>, not <STDIN>.]

> Right?  Cept.. it didn't print anything.  Not even the word "Answer:".

This is something to do with the win98 command interpeter. I don't
know about the internals, but I suspect it might just be moving the
cursor to the beginning of the line and overwriting your output. Or it
might be line buffering.

> Ok, so I guess my question is... is this behavior specific to win98?

I have no idea, but the correct thing to do is add the \n *after* the
string. Do this every time, and you will get what you expect on all
architectures.

> Why is the sky blue? [0]

Magic. ;-)

-- 
There is no TRUTH. There is no REALITY. There is no CONSISTENCY. There
are no ABSOLUTE STATEMENTS. I'm very probably wrong. -- BSD fortune(6)


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

Date: Wed, 24 May 2000 00:36:41 -0500
From: Kiera <kiera@nnickee.com>
Subject: Re: odd behavior printing after randomizing an array from STDIN
Message-Id: <6FF2038E75C5851E.FEE9859800FAA811.11A35383AA816799@lp.airnews.net>

On 24 May 2000 04:18:29 GMT, someone claiming to be
fosterd@hartwick.edu (Decklin Foster) said:

>Kiera <kiera@nnickee.com> writes:

>> #!perl -w
>> srand;
>> print "List of strings: "; 
>> my @b = <STDIN>;
>> print "Answer: $b[rand(@b)]";
>> #__END__

>OK, now do it in a constant amount of space. That is, I can feed the
>program a 10GB file and it will still work (we'll assume here you have
>less than that much RAM.) Hint: it can be done in one line.

I'm sure it can be.  But I'm trying to not get ahead of myself here
and actually work my way thru the book chapter by chapter (I have a
Good Reason for doing so... I'm trying to unlearn what a certain
$Perl_book_with_the_number_5_in_the_title "taught" me and replace that
"knowledge" with the correct way of doing things (yeah, yeah,
TMTOWTDI)). [1]

>[p.s. What's up with those comments?]

What comments?  The #__END__ ?  <shrug> Dunno... just looked like a
good place to drop it in there :)

>[p.p.s. Use <>, not <STDIN>.]

Again, going thru the book chapter by chapter, so far all I "know" [2]
is <STDIN>.  And the code snippet above is *from* the answer section
of the book (so the <STDIN> there is copied).

>> Right?  Cept.. it didn't print anything.  Not even the word "Answer:".

>This is something to do with the win98 command interpeter. I don't
>know about the internals, but I suspect it might just be moving the
>cursor to the beginning of the line and overwriting your output. Or it
>might be line buffering.

<nod>  I figured it was something like that.  I mean, I know all books
are going to have printing errors, but I didn't figure this particular
instance was a result of an error (or heaven forbid, not having been
tested :)  Although.... the cover says both "Windows NT" up in the
corner as well as "Win32 Systems" in the title, so..... maybe this
_should_ be documented somewhere or other?

>> Ok, so I guess my question is... is this behavior specific to win98?

>I have no idea, but the correct thing to do is add the \n *after* the
>string. Do this every time, and you will get what you expect on all
>architectures.

Yup, that worked when added to the original code.  See footnote [1]
below, however..... <g>

>> Why is the sky blue? [0]

>Magic. ;-)

So *that* explains it! :)  And here I've been thinking that Larry
coded it that way :)

Thanx a bunch :)
Kiera

[1] aww, what the heck:

while(<>) {@b = <>} print "\n$b[rand(@b)]\n";

(how'd I do?  btw.. had some interesting results while playing with
that... one of them being that I had to ctrl-z *twice* rather than
once to get anything to print; another that it wasn't printing
anything without the \n before the $b[rand....; and another that if I
put my before the @b= it wouldn't print anything (these are all with
-w btw) 

[2] the icky book of course talked about <> but I'm trying really hard
to forget everything I learned from it



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

Date: Wed, 24 May 2000 17:57:23 +0800
From: Kenneth Lee <kenneth.lee@alfacomtech.com>
Subject: package naming
Message-Id: <392BA783.41E6D692@alfacomtech.com>

Suppose I'm subclassing A::B, would it be better to name the subclass 
A::B::C, or A::C?  A is a non-existent package, there's no A.pm et al.
I just want keep my modules alone from the public ones.

I know the name is nothing to do with inheritance, I just want to see 
which one people usually choose, and happy with, and looks nice, and..

An example would be the HTML::* modules. There's no HTML.pm, and 
HTML::HeadParser is a subclass of HTML::Parser.

Feedbacks are appreciated.
Kenneth


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

Date: Wed, 24 May 2000 08:54:06 GMT
From: bj0rn@my-deja.com
Subject: Re: parse a string question, regexp?
Message-Id: <8gg5b9$uo5$1@nnrp1.deja.com>

Thanks everyone for your help!
I didn't think it would be that easy to do what I wanted to do
really! :)

Perl is pretty fantastic!

Thanks again!

-Bj0rN


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


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

Date: Wed, 24 May 2000 07:24:14 GMT
From: "Thomas Åhlen" <thomas2@dalnet.se>
Subject: SV: Accounting Systems Written In Perl???
Message-Id: <ysLW4.25$Dj2.11353@dummy.bahnhof.se>

Check out http://www.webmin.com/webmin

Thomas Å

<otrcomm**NO_SPAM**@wildapache.net> skrev i
diskussionsgruppsmeddelandet:392aef62.2826917312@news.wildapache.net...
> Hello,
>
> Does anyone know if there are any decent accounting systems written in
perl
> that will run on a Linux system?
>
> Thanks,
> Murrah Boswell
>
> ******
> Remove the **NO_SPAM** part of return email address if you want to reply
> via email.




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

Date: Wed, 24 May 2000 08:22:57 GMT
From: nospam.newton@gmx.li (Philip 'Yes, that's my address' Newton)
Subject: Re: Untaint URL character class
Message-Id: <392b8c42.9544111@news.nikoma.de>

On Mon, 22 May 2000 14:53:01 +0200, "Alan J. Flavell"
<flavell@mail.cern.ch> wrote:

> The trailing slash is never optional.  Adding it makes a different
> and independent URL, in technical terms.   It's only a common
> convention that /dirname , intended to point to a directory (strictly
> speaking, "to the default resource in a directory"), gets redirected
> to /dirname/ - but it doesn't _have_ to be that way, and some servers
> are configured to behave differently.

Such as the CPAN multiplexor, where .../CPAN and .../CPAN/ result in two
different things; neither is a redirect for the other.

Cheers,
Philip
-- 
Philip Newton <nospam.newton@gmx.li>
If you're not part of the solution, you're part of the precipitate.


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

Date: Wed, 24 May 2000 09:45:46 GMT
From: devynckj@sans.co.za
Subject: writing Form content to a File-CGI
Message-Id: <8gg8c7$rj$1@nnrp1.deja.com>

Hi
I want to write the form contents to an HTML or text file. I use -
open(NAME, ">>filename.html");
print NAME "$FORM{contents}\n";
close(NAME);

But it does not open the file. Nothing gets added to the file. I am
using an IIS server. Any suggestions? Thanks.


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


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