[18165] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 333 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Feb 22 09:05:45 2001

Date: Thu, 22 Feb 2001 06:05:14 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <982850714-v10-i333@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Thu, 22 Feb 2001     Volume: 10 Number: 333

Today's topics:
    Re: 請問做法 <jck1@seed.net.tw>
        "runtime" code in a module, what block to put in? <johnlin@chttl.com.tw>
    Re: "runtime" code in a module, what block to put in? (Anno Siegel)
    Re: Apache mod_perl & MySQL <jyli-luu@gc2.geracap.fi>
    Re: chop and chomp <bart.lateur@skynet.be>
    Re: chop and chomp (Villy Kruse)
    Re: chop and chomp <flavell@mail.cern.ch>
    Re: chop and chomp <rick.delaney@home.com>
        Clearing Data on a webpage..... <philip.shean@uwe.ac.uk>
    Re: Compiling perl sources? <beable@my-deja.com>
    Re: Compiling perl sources? <meisl@amvt.tu-graz.ac.at>
    Re: Difficult Split Question ianb@ot.com.au
    Re: Free debugger suggestions <soso@open.net>
    Re: Free debugger suggestions <jhood@epix.net>
        How can I detect if program is run by cron? <johnlin@chttl.com.tw>
    Re: How can I detect if program is run by cron? egwong@netcom.com
    Re: How can I detect if program is run by cron? <uri@sysarch.com>
    Re: How can I detect if program is run by cron? <josef.moellers@fujitsu-siemens.com>
    Re: How can I detect if program is run by cron? (Nick Condon)
        Is a function/class library for processing of SMTP-mail <ELF@Messer.de>
    Re: Is this a bug? Can someone explain? (Anno Siegel)
    Re: Is this a bug? Can someone explain? <dev@trahojen.REMOVETHIS.com>
        jeopardy posting <jonni@ifm.liu.se>
    Re: jeopardy posting (Anno Siegel)
    Re: jeopardy posting <beable@my-deja.com>
        Print out an url problem.. <fabian@markisspecialisten.com>
    Re: Print out an url problem.. <josef.moellers@fujitsu-siemens.com>
    Re: Print out an url problem.. <fabian@markisspecialisten.com>
    Re: PROPOSAL: Graphics::ColorNames (Anno Siegel)
    Re: PROPOSAL: Graphics::ColorNames <iltzu@sci.invalid>
    Re: Regexp to match Web urls? (Abigail)
    Re: Regexp to match Web urls? <uri@sysarch.com>
        run in background and see the results in log file <johnlin@chttl.com.tw>
        Storing an array as Attribute of object.  <steve@buggeroff.com>
    Re: Storing an array as Attribute of object. <uri@sysarch.com>
    Re: Storing an array as Attribute of object. <steve@buggeroff.com>
    Re: Storing an array as Attribute of object. (Anno Siegel)
    Re: Storing an array as Attribute of object. (John Joseph Trammell)
    Re: Whats wrong with this???? <bart.lateur@skynet.be>
    Re: why do i get an unitialized value warning when read (Anno Siegel)
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Thu, 22 Feb 2001 11:01:19 +0800
From: "jck1" <jck1@seed.net.tw>
Subject: Re: 請問做法
Message-Id: <97207b$bvo@netnews.hinet.net>

I am sorry.
I send the wrong mail group.
Sorry.

jck1 <jck1@seed.net.tw> wrote in message
news:971s40$5g8@netnews.hinet.net...




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

Date: Thu, 22 Feb 2001 16:48:06 +0800
From: "John Lin" <johnlin@chttl.com.tw>
Subject: "runtime" code in a module, what block to put in?
Message-Id: <972jr3$ltl@netnews.hinet.net>

Dear all,

If my original program is:

die "You are running under Win32, sorry.\n" if $^O eq 'MSWin32';
print "hello\n";

The result is:

You are running under Win32, sorry.

Now I want to extract common parts into a module:

package CheckOS;
die "You are running under Win32, sorry.\n" if $^O eq 'MSWin32';
1
------------------------ checkOS.pl
use CheckOS;
print "hello\n";

The die message becomes messy

You are running under Win32, sorry.
Compilation failed in require at checkOS.pl line 1.
BEGIN failed--compilation aborted at checkOS.pl line 1.

OK, let me put it in INIT {} block.  Better but still messy.
(I want only the first line comes out.)

You are running under Win32, sorry.
INIT failed--call queue aborted.

What else block can I try?  Or any other suggestions?

Thank you.

John Lin





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

Date: 22 Feb 2001 11:39:32 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: "runtime" code in a module, what block to put in?
Message-Id: <972tpk$p4s$1@mamenchi.zrz.TU-Berlin.DE>

According to John Lin <johnlin@chttl.com.tw>:
> Dear all,
> 
> If my original program is:
> 
> die "You are running under Win32, sorry.\n" if $^O eq 'MSWin32';
> print "hello\n";
> 
> The result is:
> 
> You are running under Win32, sorry.
> 
> Now I want to extract common parts into a module:
> 
> package CheckOS;

Why would you enter a package when all you are doing is die or
return?  It servers no purpose.

> die "You are running under Win32, sorry.\n" if $^O eq 'MSWin32';
> 1
> ------------------------ checkOS.pl
> use CheckOS;
> print "hello\n";
> 
> The die message becomes messy
> 
> You are running under Win32, sorry.
> Compilation failed in require at checkOS.pl line 1.
> BEGIN failed--compilation aborted at checkOS.pl line 1.

Instead of die(), warn and then exit:

  if ( $^O eq 'MSWin32' ) {
    warn ""You are running under Win32, sorry.\n";
    exit -1;
  }

The effect should be (almost) the same, and there is no spurious
output.  The difference occurs when there is a __DIE__ or __WARN__
handler in place.  If you have to deal with that, you could use
"print STDERR" instead of "warn" and inspect %SIG for possible
handlers.  I haven't looked into this in depth.

Anno


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

Date: Thu, 22 Feb 2001 13:29:22 +0200
From: "Jaakko Yli-Luukko" <jyli-luu@gc2.geracap.fi>
Subject: Re: Apache mod_perl & MySQL
Message-Id: <972t7q$j7l$1@plaza.suomi.net>


"Rafael Garcia-Suarez" <rgarciasuarez@free.fr> wrote in message
news:slrn997kt3.aso.rgarciasuarez@rafael.kazibao.net...
> Jaakko Yli-Luukko wrote in comp.lang.perl.misc:
> >
> > I am using Apache with mod_perl and my Perl (CGI-)script is accessing
MySQL
> > server.
> >
> > I need to speed up my Apache requests. I understand it is possible to
leave
> > MySQL connection 'open' between Apache request.But I don't know how
should I
> > do that.
> > Can anyone give me a hint for this one?
>
> The mod_perl site (http://perl.apache.org/) has a lot of useful info.
> For a quick overview, look at :
> http://perl.apache.org/src/mod_perl.html#PERSISTENT_DATABASE_CONNECTIONS
> which is also in the mod_perl manpage that should be installed on your
> system. The docs for Apache::DBI may also be useful.
>
> --
> Rafael Garcia-Suarez / http://rgarciasuarez.free.fr/

I tried that and the result was that 10 000 requsts for my script is about
10 seconds slower with Apache::DBI ??

Thaks for help, I'll try something else.

-Jaakko-






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

Date: Thu, 22 Feb 2001 09:23:15 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: chop and chomp
Message-Id: <0im99t0mql2nntsacegu7an8826e58jon4@4ax.com>

Alan J. Flavell wrote:

>But I think you had in mind the use of control characters in the range
>0-31 decimal (i.e ASCII control characters) as part of the language,
>rather than use of characters from that fraught area (128-159 decimal)
>of the iso-8859-* codings...

Yes... It is not apparent from your post that you know this little bit
of trivia: if you write $^W (does that one look familiar ? ;-), the
variable name itself, internally, is control-W. Really. So the range
0-31 already IS in use.

-- 
	Bart.


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

Date: 22 Feb 2001 09:26:04 GMT
From: vek@pharmnl.ohout.pharmapartners.nl (Villy Kruse)
Subject: Re: chop and chomp
Message-Id: <slrn999mpc.n4u.vek@pharmnl.ohout.pharmapartners.nl>

On Wed, 21 Feb 2001 18:40:57 +0100,
        Alan J. Flavell <flavell@mail.cern.ch> wrote:


>On Wed, 21 Feb 2001, Roman Stawski wrote:
>
>(in a posting marked as
>Content-Type: text/plain; charset=iso-8859-1 )
>
>> Couldn't we add $^A (<-Euro symbol) to Perl
>
>No, if only because what you typed was a control-function in
>iso-8859-1 , not a displayable character at all.
>


The Euro symbol has been asigned to 0xA4 in the iso-8859-15 aka. latin-9
character set.  The same code is the general currency symbol in
iso-8859-1



Villy


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

Date: Thu, 22 Feb 2001 10:57:26 +0100
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: chop and chomp
Message-Id: <Pine.LNX.4.30.0102221045290.1239-100000@lxplus003.cern.ch>

On 22 Feb 2001, Villy Kruse wrote:

> The Euro symbol has been asigned to 0xA4 in the iso-8859-15 aka. latin-9
> character set.

Indeed it has, but the hon. Usenaut wasn't posting in iso-8859-15.

There was an interesting comment from mid-1998 (which I've been citing
on my character coding web pages for quite some time) by Misha Wolf,
quoted on a web page by Roman Czyborra at
http://czyborra.com/charsets/iso8859.html#ISO-8859-15

     We have just the place for ISO 8859-15 here in London. It is
     called the Science Museum and is full of charming historical
     relics, like Babagge's difference engine, [...]

     What a relief that we now have Unicode and won't have to
     implement this amusing piece of history.

And it seems to me that the prediction has become true: I see unicode
codings used considerably more often than iso-8859-15.  But more
frequent than both (like it or not, and fwiw I don't) is that
proprietary coding windows-1252, sometimes even advertised correctly,
but rather often (as indeed in this thread) purporting to be
iso-8859-1.

all the best



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

Date: Thu, 22 Feb 2001 13:08:39 GMT
From: Rick Delaney <rick.delaney@home.com>
Subject: Re: chop and chomp
Message-Id: <3A95129D.7C98B114@home.com>

Bart Lateur wrote:
> 
> of trivia: if you write $^W (does that one look familiar ? ;-), the
> variable name itself, internally, is control-W. Really. So the range
> 0-31 already IS in use.

Also, if you actually type it into your program as the two characters $
and ^W instead of the three, $, ^ and W, it will still do what it
should.

-- 
Rick Delaney
rick.delaney@home.com


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

Date: Thu, 22 Feb 2001 11:55:42 GMT
From: "Phil Shean" <philip.shean@uwe.ac.uk>
Subject: Clearing Data on a webpage.....
Message-Id: <G95qGu.7v5@bath.ac.uk>

Hi All,

I am doing some processing of files and outputting some data on the process
as it runs through.

The output of the current state of the process is sent to a webpage.

Would it be possible to clear the generated webpage and create a new page in
its place.

Cheers

Phil....




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

Date: Thu, 22 Feb 2001 12:42:21 GMT
From: Beable van Polasm <beable@my-deja.com>
Subject: Re: Compiling perl sources?
Message-Id: <m366i2j3w7.fsf@beable.van.polasm.bigpond.net.au>

Christian Meisl <meisl@amvt.tu-graz.ac.at> writes:
> I have tried to install Perl 5.6.0 at home (Win95). The sh Configure
> worked perfectly, but the make aborted with an error. Is there a
> general procedure how I can check what went wrong, or will I have to
> dig into the source code itself?

I guess the first thing to do would be to look at what error you
got. But why would you want to build your own perl on Win95 when
you can just download a prebuilt binary?
http://www.activestate.com

cheers
Beable van Polasm
-- 
         This isn't right!! -- WCW Nitro Commentator #1
         This is a travesty! -- WCW Nitro Commentator #2
                        IQC 78189333
          http://members.nbci.com/_______/index.html


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

Date: 22 Feb 2001 14:40:14 +0100
From: Christian Meisl <meisl@amvt.tu-graz.ac.at>
Subject: Re: Compiling perl sources?
Message-Id: <m3snl6x2dd.fsf@famvtpc59.tu-graz.ac.at>

Beable van Polasm <beable@my-deja.com> writes:
> I guess the first thing to do would be to look at what error you
> got. But why would you want to build your own perl on Win95 when
> you can just download a prebuilt binary?

Thanks for your hint, but I use a lot of additional packages, and I am
not sure whether a binary distribution cotains all my packages (like
Date::Calc, Tk, Text::wrap, .......(.

Best regards,
Christian

-- 
Christian Meisl <meisl@amvt.tu-graz.ac.at>        www.amft.tu-graz.ac.at
   Inst. f. Apparatebau, Mech. Verfahrenstechnik und Feuerungstechnik
------ Everybody wants to go to heaven, but nobody wants to die. -------
PGP fingerprint:      DF48 2503 0411 F0EF 149C  851B 1EF0 72B9 78B6 034A


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

Date: 22 Feb 2001 08:16:30 GMT
From: ianb@ot.com.au
Subject: Re: Difficult Split Question
Message-Id: <972hsu$9pi$1@news.netmar.com>

In article <m3lmqz48as.fsf@mumonkan.sunstarsys.com>, Joe Schaefer 
<joe+usenet@sunstarsys.com> writes:

>Here's one way below. Nested parentheses will fail unless the internal 
>ones are escaped (which is certainly the case for a FAQ-derived answer 
>as well).

And for any simple split- or m//g-based solution.

If we can ignore nesting, assume parentheses are matched (important!), no 
whitespace, and no other symbols, we can split on:

  ,(?![\w,]*\))

If we allow escaped parentheses, we can split on (for golf's sake):

  ,(?!(?:\\.|[\w,])*\))

with no need for lookbehind. If other symbols and whitespace are allowed,
these grow slightly.

>Without knowing what test cases are relevant for OP's situation,
>it's hard to say this is a sufficient answer.  But I certainly
>think the split() solution above behaves better than the FAQ-derived 
>one, and I wouldn't consider it a trivial modification of the FAQ 
>answer.

Trying to get a good definition of the data is always difficult. The
examples provided are all very regular and mechanical, and if the data
is really like that, the task is pretty trivial. As soon as they want
proper nested parentheses, they're looking at using a CSV module or
writing a parentheses-balancing parser themselves.

Regards,


Ian


 -----  Posted via NewsOne.Net: Free (anonymous) Usenet News via the Web  -----
  http://newsone.net/ -- Free reading and anonymous posting to 60,000+ groups
   NewsOne.Net prohibits users from posting spam.  If this or other posts
made through NewsOne.Net violate posting guidelines, email abuse@newsone.net


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

Date: 22 Feb 2001 09:52:54 GMT
From: "Martijn Mulder" <soso@open.net>
Subject: Re: Free debugger suggestions
Message-Id: <01c09cb5$ab002160$bcdbf1c3@default>

I suppose you work under DOS/Windows (ESP-modus). Try to get the QEditor
from Symantek. You will do all your programming in a DOS box. You can
configure any keystroke, so the best thing to do is to invoke a .BAT file
when you hit an function key. I run the current Perl program when I hit F5.
When I hit F9, the Make command is executed, F10 gives me instant access to
the makefile etc. The closest to VI you can get in a DOS environment!
Groeten, Martijn

> Any suggestions on another editing tool?
> 


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

Date: Thu, 22 Feb 2001 11:27:32 GMT
From: Jeffrey Hood <jhood@epix.net>
Subject: Re: Free debugger suggestions
Message-Id: <MPG.14fec0771fa240fd989685@newsserver.epix.net>

> the makefile etc. The closest to VI you can get in a DOS environment!
> Groeten, Martijn

Other than if you get cygwin utils for windows, and then either just use 
the vi editor that comes with that, or get the windows port of vim...

JH

-- 

Jeffrey Hood
HM Consulting, Inc.
jhood [you-know-why] at hmcon.com


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

Date: Thu, 22 Feb 2001 16:06:11 +0800
From: "John Lin" <johnlin@chttl.com.tw>
Subject: How can I detect if program is run by cron?
Message-Id: <972heo$ep1@netnews.hinet.net>

Dear all,

How to detect whether the program is run by cron?
Actually my intention is: when the STDOUT is not
available (like in "cron"), output to a file.

if(-w STDOUT) { print "hello STDOUT\n" }
else { open F,">>hello.txt" and print F "hello F\n" }

I can only think of -w STDOUT to test, but it failed
because I received an email from "cron"

Subject: Output from "cron" command
Content-Length: 76

Your "cron" job on localhost
perl test.pl

produced the following output:

hello STDOUT

Can you help me?

Thank you.

John Lin





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

Date: 22 Feb 2001 08:12:22 GMT
From: egwong@netcom.com
Subject: Re: How can I detect if program is run by cron?
Message-Id: <972hl6$2rkc$1@newssvr05-en0.news.prodigy.com>

John Lin <johnlin@chttl.com.tw> wrote:
> How to detect whether the program is run by cron?
> Actually my intention is: when the STDOUT is not
> available (like in "cron"), output to a file.

I believe you want to use the '-t' test, rather than '-w'.


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

Date: Thu, 22 Feb 2001 08:15:29 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: How can I detect if program is run by cron?
Message-Id: <x7snl7i15q.fsf@home.sysarch.com>

>>>>> "JL" == John Lin <johnlin@chttl.com.tw> writes:

  JL> How to detect whether the program is run by cron?
  JL> Actually my intention is: when the STDOUT is not
  JL> available (like in "cron"), output to a file.

  JL> if(-w STDOUT) { print "hello STDOUT\n" }
  JL> else { open F,">>hello.txt" and print F "hello F\n" }

well, since cron will take the output of a program it runs and sends it
via email, you would expect that to be open. try testing STDIN instead
as cron has to close that as there is no input. 

also you could pass an argument or %ENV variable in the cron command
which is safer as your program could be called with no STDIN in other
places.

uri

-- 
Uri Guttman  ---------  uri@sysarch.com  ----------  http://www.sysarch.com
SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX Consulting
The Perl Books Page  -----------  http://www.sysarch.com/cgi-bin/perl_books
The Best Search Engine on the Net  ----------  http://www.northernlight.com


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

Date: Thu, 22 Feb 2001 10:54:50 +0100
From: Josef Moellers <josef.moellers@fujitsu-siemens.com>
Subject: Re: How can I detect if program is run by cron?
Message-Id: <3A94E1EA.FAB5C3C1@fujitsu-siemens.com>

Uri Guttman wrote:
> =

> >>>>> "JL" =3D=3D John Lin <johnlin@chttl.com.tw> writes:
> =

>   JL> How to detect whether the program is run by cron?
>   JL> Actually my intention is: when the STDOUT is not
>   JL> available (like in "cron"), output to a file.
> =

>   JL> if(-w STDOUT) { print "hello STDOUT\n" }
>   JL> else { open F,">>hello.txt" and print F "hello F\n" }
> =

> well, since cron will take the output of a program it runs and sends it=

> via email, you would expect that to be open. try testing STDIN instead
> as cron has to close that as there is no input.

Are you sure? I'd rather expect cron to reopen /dev/null as stdin, since
just closing it might confuse programs more than redirecting it to
/dev/null.
A read(2) on a closed fd will return an error (EBADF, iirc), while a
read on /dev/null will return 0, which will be interpreted as EOF, a
perfectly valid condition.

AAMOF, cron even opens some pipe as stdin:

I ran this program as a cron job:

#! /bin/bash -
ls -l /proc/self/fd > ~/crontest.out

and it produced this output:

lr-x------   1 josef    users          64 Feb 22 10:52 0 -> pipe:[4579]
l-wx------   1 josef    users          64 Feb 22 10:52 1 ->
/home/josef/crontest.out
l-wx------   1 josef    users          64 Feb 22 10:52 2 -> pipe:[4580]
lr-x------   1 josef    users          64 Feb 22 10:52 3 ->
/proc/1008/fd

This was under/on SuSE Linux 7.0.

-- =

Josef M=F6llers (Pinguinpfleger bei FSC)
	If failure had no penalty success would not be a prize
						-- T.  Pratchett


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

Date: 22 Feb 2001 10:53:49 GMT
From: nickco3@yahoo.co.uk (Nick Condon)
Subject: Re: How can I detect if program is run by cron?
Message-Id: <905069252NickCondon@132.146.16.23>

johnlin@chttl.com.tw (John Lin) wrote in <972heo$ep1@netnews.hinet.net>:

>Dear all,
>
>How to detect whether the program is run by cron?
>Actually my intention is: when the STDOUT is not
>available (like in "cron"), output to a file.

Test STDIN to see if it's a tty device. It's not 100% reliable for detecting 
cron, in particular if you pipe something to it's STDIN it'll get confused. 
You're actually testing if the script is running *interactively* or not. 

Here's a code fragment:

if (-t STDIN) { # Is this script running interactively?
  # Called from the commandline - send results to STDOUT
  print "Exectued from command-line.\n";
  print "$subject\n";
  print @message;
} else {
  # Called by cron - send results by email
  open (MAIL, "|/usr/bin/mailx -s \"$subject\" @recipients") or warn "Can't 
execute mailx: $!\n";
  print MAIL "Executed by cron on ". hostname() .", sending results to 
email.\n";
  print MAIL @message;
  close MAIL;
}

-- 
Nick


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

Date: Thu, 22 Feb 2001 13:43:54 +0100
From: "Markus Elfring" <ELF@Messer.de>
Subject: Is a function/class library for processing of SMTP-mails available?
Message-Id: <9730v9$584$1@news.messer.de>

I've found the following:
> man forward
" ...
     If the first character of the address is a vertical bar (|),
     sendmail(1M)  pipes the message to the standard input of the
     command the bar precedes.
 ... "

I want to read this piped message to import it in one of our systems after
the sender and the subject had been checked.
Do you know a function or class library for a programming language (e. g.
PHP, TCL or Perl) that helps me to process this mail?





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

Date: 22 Feb 2001 08:50:43 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Is this a bug? Can someone explain?
Message-Id: <972jt3$c2v$1@mamenchi.zrz.TU-Berlin.DE>

According to Trahojen <dev@trahojen.REMOVETHIS.com>:

[...]

> Stop the wining about it, I'm the one who should be offended, because here I
> ask a simple question due to a simple (somewhat annoying) mistake, and is
> taken as lamer by default.

Ugh... we aren't talking about your particular posting anymore; it has
only been the trigger for this discussion.

Anno


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

Date: Thu, 22 Feb 2001 10:33:38 +0100
From: "Trahojen" <dev@trahojen.REMOVETHIS.com>
Subject: Re: Is this a bug? Can someone explain?
Message-Id: <D25l6.3589$hi2.10404@nntpserver.swip.net>

> Looping is an inefficient way to handle this.  How about a
> lookup table?

Thank you. Lookup tables are nice. And fast. :)


> This is also addressed in Perl FAQ #4:
>
>   http://www.perldoc.com/perl5.6/pod/perlfaq4.html

Where? I couldn't find it a few weeks ago, and I can't find it now either.
Doesn't matter now, anyway.


- Samuel [dev@trahojen.REMOVETHIS.com]




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

Date: Thu, 22 Feb 2001 13:56:14 +0100
From: "Jonas Nilsson" <jonni@ifm.liu.se>
Subject: jeopardy posting
Message-Id: <97327f$ejh$1@newsy.ifm.liu.se>

Can someone please explain this term to me?

By the way. Can someone please tell me where I can read the Netiquette rules
for this newsgroup.
/jN

--
 _____________________     _____________________
|   Jonas Nilsson     |   |                     |
|Linkoping University |   |      Telephone      |
|       IFM           |   |      ---------      |
| Dept. of Chemistry  |   | work: +46-13-285690 |
|  581 83 Linkoping   |   | fax:  +46-13-281399 |
|      Sweden         |   | home: +46-13-130294 |
|_____________________|   |_____________________|




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

Date: 22 Feb 2001 13:15:53 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: jeopardy posting
Message-Id: <9733e9$319$1@mamenchi.zrz.TU-Berlin.DE>

According to Jonas Nilsson <jonni@ifm.liu.se>:
> Can someone please explain this term to me?

When a poster puts a reply at the top, leaving the quoted material at
the bottom we call that "jeopardy posting".  The name refers to a
popular US quiz show where an answer is given and you have to figure
out the question[1].  The characteristic is that the answer precedes
the question.  Usenet old-timers frown on it.

The preferred style is to interleave your reply with the quoted material,
so that what you have to say follows immediately what you are commenting
on.  It takes a little more time to prepare a posting in this way, but
it's *far* better readable.  In fact, while a jeopardy reply may look
acceptable on its own, it becomes an utter mess as soon as a third poster
wants to reply (in either style).
 
> By the way. Can someone please tell me where I can read the Netiquette rules
> for this newsgroup.

General Usenet rules apply, which include avoidance of jeopardy style.
Otherwise I'm not aware of a document that states particular rules
for this group.  That doesn't mean such rules don't exist.  You'll
be told if you break them :)

Anno

[1] I hope that's about right.  I don't know the show first hand.


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

Date: Thu, 22 Feb 2001 13:24:33 GMT
From: Beable van Polasm <beable@my-deja.com>
Subject: Re: jeopardy posting
Message-Id: <m3g0h6hnek.fsf@beable.van.polasm.bigpond.net.au>

"Jonas Nilsson" <jonni@ifm.liu.se> writes:
> Can someone please explain this term to me?

It is another name for "top-posting", which is explained here in
question 7:
http://www.geocities.com/nnqweb/nquote.html

> By the way. Can someone please tell me where I can read the Netiquette rules
> for this newsgroup.

You can find a whole bunch of FAQs at:
ftp://rtfm.mit.edu/pub/usenet-by-hierarchy/news/announce/newusers/
And also more basic information at:
http://www.geocities.com/nnqweb/nnqlinks.html

cheers
Beable van Polasm
-- 
         This is a joke. -- WCW Nitro Commentator
                        IQC 78189333
          http://members.nbci.com/_______/index.html


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

Date: Thu, 22 Feb 2001 10:10:35 GMT
From: "Fabian Thorbj顤nsson" <fabian@markisspecialisten.com>
Subject: Print out an url problem..
Message-Id: <vA5l6.14928$Qb7.2389457@newsb.telia.net>

I can't figure out how to print out my html page from the script.

Easy or hard?




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

Date: Thu, 22 Feb 2001 11:18:49 +0100
From: Josef Moellers <josef.moellers@fujitsu-siemens.com>
Subject: Re: Print out an url problem..
Message-Id: <3A94E789.A518B412@fujitsu-siemens.com>

"Fabian Thorbj=F6rnsson" wrote:
> =

> I can't figure out how to print out my html page from the script.
> =

> Easy or hard?

I'd say "veeery hard", because you have to do the entire layout and
rendering of images yourself. Also, blinking fonts and animated GIFs
don't really come out that good on paper (Sorry, could not resist that
one B-{)
-- =

Josef M=F6llers (Pinguinpfleger bei FSC)
	If failure had no penalty success would not be a prize
						-- T.  Pratchett


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

Date: Thu, 22 Feb 2001 12:19:36 GMT
From: "Fabian Thorbj顤nsson" <fabian@markisspecialisten.com>
Subject: Re: Print out an url problem..
Message-Id: <st7l6.19309$AH6.2615366@newsc.telia.net>

I just want my paper printer to print out a simpe html document.

Fabian

"Josef Moellers" <josef.moellers@fujitsu-siemens.com> skrev i meddelandet
news:3A94E789.A518B412@fujitsu-siemens.com...
"Fabian Thorbj顤nsson" wrote:
>
> I can't figure out how to print out my html page from the script.
>
> Easy or hard?

I'd say "veeery hard", because you have to do the entire layout and
rendering of images yourself. Also, blinking fonts and animated GIFs
don't really come out that good on paper (Sorry, could not resist that
one B-{)
--
Josef M闤lers (Pinguinpfleger bei FSC)
If failure had no penalty success would not be a prize
-- T.  Pratchett








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

Date: 22 Feb 2001 12:55:28 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: PROPOSAL: Graphics::ColorNames
Message-Id: <973280$p4s$3@mamenchi.zrz.TU-Berlin.DE>

According to Brad Baxter  <bmb@ginger.libs.uga.edu>:

>     18  *get_colour = *get_couleur = *get_colore = *get_color;

This aliases not only &get_colour but also $get_colour etc.  In a
general-purpose module this is a bit risky.  use

          *get_colour = *get_couleur = *get_colore = \ &get_color;

Anno


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

Date: 22 Feb 2001 13:00:36 GMT
From: Ilmari Karonen <iltzu@sci.invalid>
Subject: Re: PROPOSAL: Graphics::ColorNames
Message-Id: <982845678.5618@itz.pp.sci.fi>

In article <slrn998h4e.hvb.abigail@tsathoggua.rlyeh.net>, Abigail wrote:
>
>*shrug* I think so too. But, as I said before, it was first said that
>loading a few hundred constants with 3 ints associated data was too
>much of a drain on the system. Hence the suggestion of dbm files.

Right.  Now, I made and retracted that statement, at least in the form
you are expressing it, in the same message, so let me try to get some
sense into this discussion:

This thread is silly.  Standard color namespaces have hundreds of
colors.  Not tens of thousands.  If they did, a DBM of simple strings
would have been appropriate.  But for a few hundred colors, the best
implementation is the one that's easiest to write.
 
Having separate color spaces loaded on demand still seems like a good
idea, if only to make expansion and management easier.

-- 
Ilmari Karonen - http://www.sci.fi/~iltzu/
"Every letter was followed by an 'editor's response' in italics explaining
 politely why the letter writer was an idiot, but it never seemed to
 dissuade the next year's letter."         -- Chad Ryan Thomas in r.a.sf.c

Please ignore Godzilla and its pseudonyms - do not feed the troll.


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

Date: 22 Feb 2001 08:44:36 GMT
From: abigail@foad.org (Abigail)
Subject: Re: Regexp to match Web urls?
Message-Id: <slrn999kbk.spm.abigail@tsathoggua.rlyeh.net>

Uri Guttman (uri@sysarch.com) wrote on MMDCCXXXII September MCMXCIII in
<URL:news:x7vgq3i37j.fsf@home.sysarch.com>:
:: 
:: why (?:[a-zA-Z\d]|-) instead of [a-zA-Z\d-]?


Because it wasn't hand written.



Abigail
-- 
perl -we '$_ = q ;4a75737420616e6f74686572205065726c204861636b65720as;;
          for (s;s;s;s;s;s;s;s;s;s;s;s)
              {s;(..)s?;qq qprint chr 0x$1 and \161 ssq;excess;}'


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

Date: Thu, 22 Feb 2001 08:47:48 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Regexp to match Web urls?
Message-Id: <x7pugbhznv.fsf@home.sysarch.com>

>>>>> "A" == Abigail  <abigail@foad.org> writes:

  A> Uri Guttman (uri@sysarch.com) wrote on MMDCCXXXII September MCMXCIII in
  A> <URL:news:x7vgq3i37j.fsf@home.sysarch.com>:
  A> :: 
  A> :: why (?:[a-zA-Z\d]|-) instead of [a-zA-Z\d-]?


  A> Because it wasn't hand written.

then the code that generated it has a bug when making char classes. the
$\- stuff is wrong.

uri

-- 
Uri Guttman  ---------  uri@sysarch.com  ----------  http://www.sysarch.com
SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX Consulting
The Perl Books Page  -----------  http://www.sysarch.com/cgi-bin/perl_books
The Best Search Engine on the Net  ----------  http://www.northernlight.com


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

Date: Thu, 22 Feb 2001 10:56:16 +0800
From: "John Lin" <johnlin@chttl.com.tw>
Subject: run in background and see the results in log file
Message-Id: <971v7g$a7p@netnews.hinet.net>

Dear all,

When I run myprogram.pl in background, for example: crontab
I hope to see those STDERR STDOUT outputs in myprogram.log
Is there an existing module to use?

Assuming the module is Batch.pm, then

normal run: perl myprogram.pl  or  myprogram.pl (shebanged)
will see the outputs on the console

batch (background) run: perl -MBatch myprogram.pl
will see the outputs in myprogram.log

I tried to write this module by myself and had some problems:

I used tie *STDOUT to redirect STDOUT output.  It works.
But tie *STDERR fails.  warn and die doesn't seem to be
catchable by tie.

Using $SIG{__DIE__} and $SIG{__WARN__} often conflicts with
other modules which also redefine them.  So I'd avoid this.

Then, I've got no other ways to catch STDERR outputs.
Any ideas?

Another question:

If a program is shebanged, can it use more modules
from the command line?  Like this:

myprogram.pl -MBatch -Mstrict

If only the shebang has some switch to allow this

#!/usr/bin/perl -????

Thank you very much.

John Lin





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

Date: Thu, 22 Feb 2001 08:35:32 +0100
From: Steve Button <steve@buggeroff.com>
Subject: Storing an array as Attribute of object. 
Message-Id: <3A94C143.151945D@buggeroff.com>

Hi,

I'm trying to figure out how to store an array (or a reference to an
anonymous array) as a part of my object. I still want my normal
attributes stored in the blessed reference to the hash, but I want my
array ref to be one of those. Does this make sense??

In other words, as well as the normal scalars that I'm storing, I also
want to store an array (within the hash).

I've read through perltoot, perlobj, and perlbot this morning but I
can't seem to find any examples of how to do this.

Cheers,

Steve



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

Date: Thu, 22 Feb 2001 08:49:26 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Storing an array as Attribute of object.
Message-Id: <x7n1bfhzl4.fsf@home.sysarch.com>

>>>>> "SB" == Steve Button <steve@buggeroff.com> writes:

  SB> I'm trying to figure out how to store an array (or a reference to an
  SB> anonymous array) as a part of my object. I still want my normal
  SB> attributes stored in the blessed reference to the hash, but I want my
  SB> array ref to be one of those. Does this make sense??

  SB> In other words, as well as the normal scalars that I'm storing, I also
  SB> want to store an array (within the hash).

	$self->{'array'} = [ qw( some stuff in an array ) ] ;

uri

-- 
Uri Guttman  ---------  uri@sysarch.com  ----------  http://www.sysarch.com
SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX Consulting
The Perl Books Page  -----------  http://www.sysarch.com/cgi-bin/perl_books
The Best Search Engine on the Net  ----------  http://www.northernlight.com


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

Date: Thu, 22 Feb 2001 10:37:12 +0100
From: Steve Button <steve@buggeroff.com>
Subject: Re: Storing an array as Attribute of object.
Message-Id: <3A94DDC7.54DBC869@huntahome.com>



Uri Guttman wrote:

> >>>>> "SB" == Steve Button <steve@buggeroff.com> writes:
>
>   SB> In other words, as well as the normal scalars that I'm storing, I also
>   SB> want to store an array (within the hash).
>
>         $self->{'array'} = [ qw( some stuff in an array ) ] ;
>
> uri
>

I can see how that would work, but I'm kind of wanting to push stuff onto the
array too. I'm sure that I'm being really stupid here but I just can't see how
to do this. I will also need to access the stuff in the array by element number.

Help?

Steve



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

Date: 22 Feb 2001 11:14:38 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Storing an array as Attribute of object.
Message-Id: <972sau$ns0$1@mamenchi.zrz.TU-Berlin.DE>

According to Steve Button  <steve@buggeroff.com>:
> 
> 
> Uri Guttman wrote:
> 
> > >>>>> "SB" == Steve Button <steve@buggeroff.com> writes:
> >
> >   SB> In other words, as well as the normal scalars that I'm storing, I also
> >   SB> want to store an array (within the hash).
> >
> >         $self->{'array'} = [ qw( some stuff in an array ) ] ;
> >
> > uri
> >
> 
> I can see how that would work, but I'm kind of wanting to push stuff onto the
> array too. I'm sure that I'm being really stupid here but I just can't see how
> to do this. I will also need to access the stuff in the array by element number.

Everything you can do with an array you can do with an array reference too.
The basic recipe is this: If EXPR yields an array ref, @{EXPR} is the
corresponding array. (You can leave off the {} if EXPR is sufficiently
simple.)  So, if you can do something to an array @x, just replace "x"
with "{EXPR}" and the operation will work on the referenced array:
"scalar @{EXPR}" is the number of elements "$#{EXPR}" is the index to
the last element, and so on.  In particular, "push @{EXPR}, $something"
pushes $something onto the array.

In some cases there may be shortcuts, but the @{EXPR} syntax will
always give you a working start.

Anno


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

Date: Thu, 22 Feb 2001 13:30:12 GMT
From: trammell@bayazid.hypersloth.net (John Joseph Trammell)
Subject: Re: Storing an array as Attribute of object.
Message-Id: <slrn99a2uo.amc.trammell@bayazid.hypersloth.net>

On 22 Feb 2001 11:14:38 GMT, Anno Siegel wrote:
> Everything you can do with an array you can do with an array reference too.
> The basic recipe is this: If EXPR yields an array ref, @{EXPR} is the
> corresponding array.

In other words,

  push @{$self->{array}}, "new value", "another new value";

et cetera.



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

Date: Thu, 22 Feb 2001 09:34:49 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Whats wrong with this????
Message-Id: <pvm99ts1gf4ua6h9aoh7639mlgr2c3utiq@4ax.com>

Eric Provence wrote:

>See, the person i'm writing this 
>message board for is using a VirtualAve.net free webspace account. And as 
>some of you know, it has the capability for perl, but they don't tell you 
>what the machine path is, so I gotta keep this all in the same folder.

No you don't. You can still use relative paths. For example, you can use
a subdirectory "data", and save your data as "data/$subject". Or you can
go up a level with ".." before digging deeper again. The rules are the
same as  with relative URL's, as is customary for referencing image
files in a HTML file.

But I wouldn't ever use the subject itself as name for the file.
Instead, add a little flat text file as a "database", which converts
subjects into unique file names, which doubles as a message ID. If you
want threading, a "references" mechanism as on Usenet (=news) works
rather nice. Just look at the headers of some posts, and see if you can
find both "Message-ID" and "References" headers. That's how threading
trees are held together.

-- 
	Bart.


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

Date: 22 Feb 2001 11:48:14 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: why do i get an unitialized value warning when reading from a file?
Message-Id: <972u9u$p4s$2@mamenchi.zrz.TU-Berlin.DE>

According to David Efflandt <efflandt@xnet.com>:
> On Wed, 21 Feb 2001, Igor Aptekar <igor_aptekar@programmer.net> wrote:
> >I get this error in quite a few chunks eventhough i use chomp. Can someone
> >explain what it mean and how to prevent it.
> 
> I image that you chomp a blank line, ending up with nothing, and then
> attempt to use nothing for something without testing it.

chomp() won't undefine a defined string.  Think about it.

To the OP: Neither will chomp() define an undefined string.  The
"even though i use chomp" bit makes no sense.

Anno


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

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 V10 Issue 333
**************************************


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