[10621] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4213 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Nov 13 11:07:22 1998

Date: Fri, 13 Nov 98 08:00:21 -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           Fri, 13 Nov 1998     Volume: 8 Number: 4213

Today's topics:
    Re: & for subroutines   Was:Re: Perl "Newbie" Needs Hel <jdporter@min.net>
    Re: a RE for email addresses? (Clay Irving)
        Bad postscript version of Perl tutorial jkelly5570@my-dejanews.com
    Re: bug bash B19.0. It works on next versions... <ppa@itmasters.com>
    Re: Clear screen? (Andrew M. Langmead)
    Re: Clear screen? <rra@stanford.edu>
    Re: Compiling Perl <perlguy@technologist.com>
        counter/logger problem <fletch@netway.com>
    Re: Definition of "odd characters" in -T/-B documentati (Andrew M. Langmead)
    Re: Fun NYC job consulting/FT Perl/Tk/DBI/C++ jeans + T <jdporter@min.net>
        HELP <mwang@colorbank.com>
        HELP: perl5.00502 does not support <STDIN> with bash on <ppa@itmasters.com>
    Re: HELP: perl5.00502 does not support <STDIN> with bas <uwhoneka@si.bosch.de>
    Re: HELP: perl5.00502 does not support <STDIN> with bas <ppa@itmasters.com>
    Re: HELP: perl5.00502 does not support <STDIN> with bas <uwhoneka@si.bosch.de>
    Re: HELP: perl5.00502 does not support <STDIN> with bas <ppa@itmasters.com>
        Holy Abounding Books, Batman! <dbolton@IdeaPlace.org>
    Re: How can I blank-pad a string variable?? (Tad McClellan)
    Re: how to add on to an array?? <sasho@staff.mgu.bg>
    Re: Occasional Perl Script Failure (James Peregrino)
    Re: OOP or not? (for a Perl module) (Michael Houghton)
        Perl and DosEmu <rogier@business-net.nl>
        Perl mode gets confused (Suresh Srinivasan)
    Re: perl/win95 <perlguy@technologist.com>
    Re: Suidperl? <matt@pcr7.pcr.com>
    Re: What's wrong with this perl program? (Tad McClellan)
    Re: What's wrong with this perl program? (Tad McClellan)
        Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)

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

Date: Fri, 13 Nov 1998 09:56:50 -0500
From: John Porter <jdporter@min.net>
Subject: Re: & for subroutines   Was:Re: Perl "Newbie" Needs Help Debugging Code
Message-Id: <364C48B2.186695BC@min.net>

Snowhare wrote:
> 
> The style issue of CapitalizedFunctions versus monocased_and_underlined is
> a long standing and probably unresolvable issue of contention. Related
> wars exist WRT to indentation styles. The only reasonable guidance that
> can really be provided is use whatever style you prefer _consistently_.

Fortunately, we're only talking about using caps, esp. initial caps;
not about whether to use underscores.  With a short name, like log/Log,
there are no underscores to include/omit.  But you still get the
advantage of avoiding potential name conflicts if you use the upper-case.
That's why packages names are encouraged to have uppers!

You could still get the readability benefits of underscores in long
names, even with uppers used:  Take_Out_The_Trash.

It's not a both-or-neither proposition.

-- 
John Porter

Please Don't "Courtesy CC" me.
I read this newsgroup fanatically.  You know that!
("Emailed only" is fine, though.)

Bill Gates claims to be developing a stable operating system;
Linus Torvalds claims to be bent on world domination.


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

Date: 13 Nov 1998 10:44:42 -0500
From: clay@panix.com (Clay Irving)
Subject: Re: a RE for email addresses?
Message-Id: <72hk5a$63u@panix.com>

In <364B953A.C359E0BB@hotmail.com> sara starre <nospam.gear4u@hotmail.com> writes:

>I tried to use the /.+\@.+\..+(\..+)*/ to find good email addresses, but
>it let
>"my mail@myplace.com" thru, so I modified it to:  /.+\@.+\..+(\..+)*/ &&
>!/[\s]/

>According to my camel book, /.+/ should be one or more characters- is
>whitespace considered a character?

>Does anyone have any better suggestions for RE's to validate email
>addresses? This one seems pretty good:

>good: mymail@mycompany.com
>bad: mymail#myplace.com
>bad: my mail@myplace.com
>bad: mymail@myplace
>good: m1ymail@my1place2.com3good:
>good: m1ymail@my1place2.mystate.com3
>bad: m1ymail@my1place2.mystate. com3

I tried your examples with the Email::Valid module:
   
   #!/usr/local/bin/perl -w
   
   use Email::Valid;
   
   # Read the list of Email addresses
   while (defined($address = <DATA>)) {
     chomp $address;
     $valid = new Email::Valid;
     if ($valid->address( -address => $address)) {
       # the address is valid
       print "good: $address\n";
     } else {
       # the address is not valid
       print "bad: $address\n";
     }
   }
   
   __DATA__
   mymail@mycompany.com
   mymail#myplace.com
   my mail@myplace.com
   mymail@myplace
   m1ymail@my1place2.com3good:
   m1ymail@my1place2.mystate.com3
   m1ymail@my1place2.mystate. com3
   
Result:

   good: mymail@mycompany.com
   bad: mymail#myplace.com
   bad: my mail@myplace.com
   bad: mymail@myplace
   bad: m1ymail@my1place2.com3good:
   good: m1ymail@my1place2.mystate.com3
   good: m1ymail@my1place2.mystate. com3
   
-- 
Clay Irving
clay@panix.com


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

Date: Fri, 13 Nov 1998 15:37:48 GMT
From: jkelly5570@my-dejanews.com
Subject: Bad postscript version of Perl tutorial
Message-Id: <72hjoc$8ma$1@nnrp1.dejanews.com>

Hello,

The postscript version of the perl tutorial at

http://www.cclabs.missouri.edu/things/instruction/perl/perlcourse.ps

has a postscript error and as a result I can't print it from my postscript
viewer. Does anybody have / know where I can find a 'good version' of this
file.

Thanks,
John Kelly <jkelly@shannon.tellabs.com>

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: Fri, 13 Nov 1998 16:18:03 +0100
From: "Patrice M.I. Parmentier" <ppa@itmasters.com>
Subject: Re: bug bash B19.0. It works on next versions...
Message-Id: <364C4DAB.CC60CC73@itmasters.com>

This is a multi-part message in MIME format.
--------------D78865321916ED42E75AD7D4
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

I do not receive the problem with bash B20.0...



--------------D78865321916ED42E75AD7D4
Content-Type: text/x-vcard; charset=us-ascii;
 name="ppa.vcf"
Content-Transfer-Encoding: 7bit
Content-Description: Card for Patrice M.I. Parmentier
Content-Disposition: attachment;
 filename="ppa.vcf"

begin:vcard 
n:PARMENTIER;Patrice
tel;fax:32 4 367 83 12
tel;work:32 4 367 83 04
x-mozilla-html:FALSE
org:IT Masters
version:2.1
email;internet:ppa@itmasters.com
title:Development Engineer
adr;quoted-printable:;;IT Masters SA=0D=0ACentre SOCRAN, av. Pre-Aily;ANGLEUR-Liege;;4031;Belgium
x-mozilla-cpt:;20944
fn:Patrice M.I. PARMENTIER
end:vcard

--------------D78865321916ED42E75AD7D4--



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

Date: Fri, 13 Nov 1998 14:41:06 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: Clear screen?
Message-Id: <F2D7GI.5n2@world.std.com>

gustafl@algonet.se (Gustaf Liljegren) writes:


>I would like to clear the screen between the menus. Like the UNIX
>command "clear" or DOS command "cls". 

Since you are not going to be clearing the screen too frequently, the
fork and exec overhead of "system('clear')" probably won't be much of
a problem for your program. (I honestly can't think of any time it
could be. What program would clear the screen dozens of times a
second.) Other options would be the to use the Term::Cap
<URL:http://reference.perl.com/module.cgi?Term::Cap> or Curses
<URL:http://reference.perl.com/module.cgi?Curses> modules.

If you are creating a menu, you might want to look at the PerlMenu
module <URL:http://www.perl.com/CPAN/authors/id/SKUNZ/perlmenu.v4.0.tar.gz>

One point to make about these solutions as opposed to another reply
what I've seen to your article. These solutions work for any terminal
type. Solutions that say "use this: print "\033[;H\033[2J";" or other
specific escape sequences are depending on someone using a particular
terminal type.

-- 
Andrew Langmead


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

Date: 13 Nov 1998 06:50:32 -0800
From: Russ Allbery <rra@stanford.edu>
Subject: Re: Clear screen?
Message-Id: <yl3e7nabpj.fsf@windlord.stanford.edu>

Andrew M Langmead <aml@world.std.com> writes:

> One point to make about these solutions as opposed to another reply what
> I've seen to your article. These solutions work for any terminal
> type. Solutions that say "use this: print "\033[;H\033[2J";" or other
> specific escape sequences are depending on someone using a particular
> terminal type.

To be fair, \e[H (to return the cursor to the home position) and \e[2J (to
actually clear the screen) are the ANSI-standard escape codes for this and
therefore are pretty widely supported, as most everything tries to be an
ANSI terminal.  (DEC VT100s and later used those codes, and nearly
everything most people use emulates DECs.)

If you're going to be clearing the screen a lot in your application, one
thing to do is:

        $clear = `clear`;

and then just:

        print $clear;

wherever you need to clear the screen.

-- 
#!/usr/bin/perl -- Russ Allbery, Just Another Perl Hacker
$^=q;@!>~|{>krw>yn{u<$$<[~||<Juukn{=,<S~|}<Jwx}qn{<Yn{u<Qjltn{ > 0gFzD gD,
 00Fz, 0,,( 0hF 0g)F/=, 0> "L$/GEIFewe{,$/ 0C$~> "@=,m,|,(e 0.), 01,pnn,y{
rw} >;,$0=q,$,,($_=$^)=~y,$/ C-~><@=\n\r,-~$:-u/ #y,d,s,(\$.),$1,gee,print


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

Date: Fri, 13 Nov 1998 12:33:51 GMT
From: Brent Michalski <perlguy@technologist.com>
Subject: Re: Compiling Perl
Message-Id: <364C272F.6BA6BCA0@technologist.com>

Randy Perryman wrote:
> 
> Help.....
> 
> I am trying to compile the stable.zip of perl and my head hurts.  I am not
> too familiar with the compilers, but I keep getting a syntax error when I
> try.  I am using Microsofts Visual C++ 5.0 with sp3 applied.  Can some one
> help...

And you are not using ActivePerl because.........?

-- 
Java? I've heard of it, it is what I drink when I am hacking Perl. -me
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
$            Brent Michalski             $
$         -- Perl Evangelist --          $
$    E-Mail: perlguy@technologist.com    $
$ Resume: http://www.inlink.com/~perlguy $
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$


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

Date: Fri, 13 Nov 1998 10:45:47 -0500
From: Fletcher Moore <fletch@netway.com>
Subject: counter/logger problem
Message-Id: <364C542A.638AF666@camail2.harvard.edu>

I am using the following counter/logger script on a test page with one
other server-side include. The script works fine from a UNIX shell, and
the second SSI functions, but the counter does nothing at all. Can
anyone figure this out?

Here's the script:

#!/usr/bin/perl

#################
#Change Variables

$your_ip = "0.0.0.0";
$directory = "/usr/home3/SEP98/fletch/public_html/";
$print = '0';
$count = "count.dat";
$log = "log.dat";

##############
#Script Begins

$shortdate = `date +"%D %T %Z"`;
chop ($shortdate);

if ($ENV{'REMOTE_ADDR'} eq $your_ip) {
}

else {
    open (COUNT, "$directory$count");
    $counter = <COUNT>;
    close (COUNT);
    open (COUNT, >$directory$count");
    $counter += 1;
    print COUNT "$counter";
    close (COUNT);

    open (LOG, ">>$log");
    print "Content-type: text/plain\n\n ";
    print LOG "Time: $shortdate\n";
    print LOG "Host: $ENV{'REMOTE_HOST'}\n";
    print LOG "With: $ENV{'HTTP_USER_AGENT'}\n";
    print LOG "From: $ENV{'HTTP_REFERER'}\n\n";
    close (LOG);

      if ($print eq '1') {
    print "$counter";
      }
}
exit;




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

Date: Fri, 13 Nov 1998 15:13:22 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: Definition of "odd characters" in -T/-B documentation.
Message-Id: <F2D8yA.8It@world.std.com>

Lloyd Zusman <ljz@asfast.com> writes:

>Does this mean that the "non-funny" control characters are these? ...

>   \r  \t  \n  <form-feed>

All Uri gave was a reinterpretation of the man page and camel text,
explaining what "funny control characters" meant to him. As you
suspected in your first post, the only real documentation is the
source code.

>From pp_sys.c, in pp_fttext:

    for (i = 0; i < len; i++, s++) {
        if (!*s) {                      /* null never allowed in text */
            odd += len;
            break;
        }
        else if (*s & 128)
            odd++;
        else if (*s < 32 &&
          *s != '\n' && *s != '\r' && *s != '\b' &&
          *s != '\t' && *s != '\f' && *s != 27)
            odd++;
    }
 
So "funny" is described as a control chracter other then carriage
return, linefeed, backspace, horizontal tab, formfeed, or escape.

>And how large is "the first block or so" (quoted from the man page) of
>the file that the `-T/-B' test examines?

I think it used to depend on the block size of the underlying STDIO
library, but it now seems to be limited to 512 bytes. (The comments
seem to imply the limit because of the buffer sizes in sfio, and sfio
support was a fairly recent addition to perl.)

For opened filehandles, it seems to use the stdio (or sfio) buffer if
the file has been open and read already. Otherwise it does a getc()
and ungetc() to cause the buffer to fill. For filenames, it opens the
file and reads 512 bytes.
-- 
Andrew Langmead


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

Date: Fri, 13 Nov 1998 10:08:47 -0500
From: John Porter <jdporter@min.net>
Subject: Re: Fun NYC job consulting/FT Perl/Tk/DBI/C++ jeans + Tshift
Message-Id: <364C4B7F.1076026@min.net>

Larry Rosler wrote:
> 
> These objections are getting stale.  Several quite competent toolkits
> are available (MKS, Cygnus and Gnu come to mind), which provide capable
> shells, editors, and non-system-specific POSIX-standardized commands.
> Though I still do a lot of Perl development on Unix and simply copy the
> programs to Win32 engines, I could migrate completely without a great
> deal of pain.

We're talking about the deficiency of the environment as a whole.
The ways in which NT (not to mention 95) is inferior, as an OS, to Unix
are too numerous to mention.  Security and distributed computing are
two that stand out, in my view.

-- 
John Porter

Please Don't "Courtesy CC" me.
I read this newsgroup fanatically.  You know that!
("Emailed only" is fine, though.)

Bill Gates claims to be developing a stable operating system;
Linus Torvalds claims to be bent on world domination.


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

Date: Fri, 13 Nov 1998 10:26:09 -0500
From: Min Wang <mwang@colorbank.com>
Subject: HELP
Message-Id: <364C4F91.264D82DA@colorbank.com>

Hi:

I have a MAC file to import into database.  But there are a lot of
garbage character in it.  How to write a expression to keep all of
meaningful characters like a - z, 0 - 0, and &, , or ),  and get rid of
these garbage like ^D^@^C and others.


Thanks.


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

Date: Fri, 13 Nov 1998 14:20:30 +0100
From: "Patrice M.I. Parmentier" <ppa@itmasters.com>
Subject: HELP: perl5.00502 does not support <STDIN> with bash on NT
Message-Id: <364C321E.D5B6F1C0@itmasters.com>

This is a multi-part message in MIME format.
--------------93740D4EC1CA31A915CA4046
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

I try the trivial script:

while (<STDIN>) print;

In most cases (when running from a dos shell, or from a real OS
(Solaris, AIX, linux)), it works properly; i.e. the standard output
repeats the entry from the standard input.

The problem arises when i run the script from a bash window (the
distribution from Cygnus) with perl5.00502 on NT: <STDIN> immediately
returns null and the script stops without doing anything.

The problem appears with ActiveState 5.00502 distribution and with my
own versions compiled with VC5 (I tried with and without thread and with
and without perlCRT).

I first thought about problems with the bash distribution BUT the script
works with the standard binary distribution 5.00402 on the same bash!!!
What has changed ???

Questions:
- Does someone already have seen this bug ?
- If not, can someone with bash on NT (or Win95/98) and perl 5.00502
reproduce the bug ?
- How to fix the bug ? (I would appreciate to continue to use bash and
do not be forced to rollback to perl5.00402 since i use PERLOBJECT.
Furthermore, i am forced to port on f... NT platforms).

Thks to anyone for your help.
Patrice Parmentier
ppa@itmasters.com

--------------93740D4EC1CA31A915CA4046
Content-Type: text/x-vcard; charset=us-ascii;
 name="ppa.vcf"
Content-Transfer-Encoding: 7bit
Content-Description: Card for Patrice M.I. Parmentier
Content-Disposition: attachment;
 filename="ppa.vcf"

begin:vcard 
n:PARMENTIER;Patrice
tel;fax:32 4 367 83 12
tel;work:32 4 367 83 04
x-mozilla-html:FALSE
org:IT Masters
version:2.1
email;internet:ppa@itmasters.com
title:Development Engineer
adr;quoted-printable:;;IT Masters SA=0D=0ACentre SOCRAN, av. Pre-Aily;ANGLEUR-Liege;;4031;Belgium
x-mozilla-cpt:;20944
fn:Patrice M.I. PARMENTIER
end:vcard

--------------93740D4EC1CA31A915CA4046--



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

Date: Fri, 13 Nov 1998 14:59:37 +0100
From: "Uwe Honekamp" <uwhoneka@si.bosch.de>
Subject: Re: HELP: perl5.00502 does not support <STDIN> with bash on NT
Message-Id: <72he06$4nj$1@news.fr.internet.bosch.de>

Patrice M.I. Parmentier wrote in <364C321E.D5B6F1C0@itmasters.com>...

>Questions:
>- Does someone already have seen this bug ?

No.

>- If not, can someone with bash on NT (or Win95/98) and perl 5.00502
>reproduce the bug ?

uwe (scratch)> /tools/activestate/bin/perl -we 'while (<STDIN>) {print}'
Hi
Hi
echo
echo

uwe (scratch)> /tools/activestate/bin/perl -v

This is perl, version 5.005_02 built for MSWin32-x86-object

Copyright 1987-1998, Larry Wall

uwe(scratch)> uname -v
19.1


Sorry, can't really help you ...

Uwe

--

Uwe Honekamp * ETAS GmbH * Borsigstr. 10 * D-70469 Stuttgart =20
uwe.honekamp@etas.de * voice: ++49/(0)711/89661-143 * fax: -107






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

Date: Fri, 13 Nov 1998 15:25:43 +0100
From: "Patrice M.I. Parmentier" <ppa@itmasters.com>
Subject: Re: HELP: perl5.00502 does not support <STDIN> with bash on NT
Message-Id: <364C4167.15CBEAC7@itmasters.com>

This is a multi-part message in MIME format.
--------------98EE45E5AD279312CB2C6845
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

mmh, strange... the only difference is that i have bash 19.0 ...

/perl/5.00...n/MSWin32-x86-object$ uname -v
19.0
/perl/5.00...n/MSWin32-x86-object$ perl -we 'while (<STDIN>) {print}'
/perl/5.00...n/MSWin32-x86-object$

Uwe Honekamp wrote:

> uwe(scratch)> uname -v
> 19.1
>
> Sorry, can't really help you ...
>
> Uwe
>
> --
>
> Uwe Honekamp * ETAS GmbH * Borsigstr. 10 * D-70469 Stuttgart
> uwe.honekamp@etas.de * voice: ++49/(0)711/89661-143 * fax: -107

--------------98EE45E5AD279312CB2C6845
Content-Type: text/x-vcard; charset=us-ascii;
 name="ppa.vcf"
Content-Transfer-Encoding: 7bit
Content-Description: Card for Patrice M.I. Parmentier
Content-Disposition: attachment;
 filename="ppa.vcf"

begin:vcard 
n:PARMENTIER;Patrice
tel;fax:32 4 367 83 12
tel;work:32 4 367 83 04
x-mozilla-html:FALSE
org:IT Masters
version:2.1
email;internet:ppa@itmasters.com
title:Development Engineer
adr;quoted-printable:;;IT Masters SA=0D=0ACentre SOCRAN, av. Pre-Aily;ANGLEUR-Liege;;4031;Belgium
x-mozilla-cpt:;20944
fn:Patrice M.I. PARMENTIER
end:vcard

--------------98EE45E5AD279312CB2C6845--



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

Date: Fri, 13 Nov 1998 16:06:30 +0100
From: "Uwe Honekamp" <uwhoneka@si.bosch.de>
Subject: Re: HELP: perl5.00502 does not support <STDIN> with bash on NT
Message-Id: <72hhth$7dl$1@news.fr.internet.bosch.de>

Patrice M.I. Parmentier wrote in <364C4167.15CBEAC7@itmasters.com>...
>mmh, strange... the only difference is that i have bash 19.0 ...

Sorry, but 19.x is the version number of the entire toolset.=20
The version info of your shell is stored in the environment=20
variable BASH_VERSION.=20

My system says BASH_VERSION=3D'2.01.1(2)-release'.

Bye

Uwe

--=20

Uwe Honekamp * ETAS GmbH * Borsigstr. 10 * D-70469 Stuttgart
uwe.honekamp@etas.de * voice: ++49/(0)711/89661-143 * fax: -107




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

Date: Fri, 13 Nov 1998 16:53:58 +0100
From: "Patrice M.I. Parmentier" <ppa@itmasters.com>
Subject: Re: HELP: perl5.00502 does not support <STDIN> with bash on NT
Message-Id: <364C5616.B6BCBE67@itmasters.com>

This is a multi-part message in MIME format.
--------------F9204634D829C7378A8AB3E6
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Anyway, i already have replaced the toolset with version B20.0 and it
works...
I cannot tell my old BASH_VERSION but the one that comes with B20 is

2.02.1(2)-release

Uwe Honekamp wrote:

> Patrice M.I. Parmentier wrote in <364C4167.15CBEAC7@itmasters.com>...
> >mmh, strange... the only difference is that i have bash 19.0 ...
>
> Sorry, but 19.x is the version number of the entire toolset.
> The version info of your shell is stored in the environment
> variable BASH_VERSION.
>
> My system says BASH_VERSION='2.01.1(2)-release'.
>
> Bye
>
> Uwe
>
> --
>
> Uwe Honekamp * ETAS GmbH * Borsigstr. 10 * D-70469 Stuttgart
> uwe.honekamp@etas.de * voice: ++49/(0)711/89661-143 * fax: -107

--------------F9204634D829C7378A8AB3E6
Content-Type: text/x-vcard; charset=us-ascii;
 name="ppa.vcf"
Content-Transfer-Encoding: 7bit
Content-Description: Card for Patrice M.I. Parmentier
Content-Disposition: attachment;
 filename="ppa.vcf"

begin:vcard 
n:PARMENTIER;Patrice
tel;fax:32 4 367 83 12
tel;work:32 4 367 83 04
x-mozilla-html:FALSE
org:IT Masters
version:2.1
email;internet:ppa@itmasters.com
title:Development Engineer
adr;quoted-printable:;;IT Masters SA=0D=0ACentre SOCRAN, av. Pre-Aily;ANGLEUR-Liege;;4031;Belgium
x-mozilla-cpt:;20944
fn:Patrice M.I. PARMENTIER
end:vcard

--------------F9204634D829C7378A8AB3E6--



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

Date: Fri, 13 Nov 1998 09:44:35 -0600
From: "David Bolton" <dbolton@IdeaPlace.org>
Subject: Holy Abounding Books, Batman!
Message-Id: <72hk5n$l17$1@news3.mr.net>

I'd like to learn a little cgi/perl, but after reading Amazon.com book
reviews for a couple of evenings, I have to say that the number of how-to
books on the subject is staggering.

For a beginner (with a modest background in Java programming),  which books
do the better job teaching cgi/perl to the novice?

My tentative plan is:

1) Discover Perl 5 (Barkokati) for a brief intro tutorial.
2) Learning Perl (Schwartz) for the follow-up in-depth learning.
3) Programming Perl (Wall) for reference

Thanks in advance for the help,

Dave




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

Date: Fri, 13 Nov 1998 08:22:57 -0600
From: tadmc@flash.net (Tad McClellan)
Subject: Re: How can I blank-pad a string variable??
Message-Id: <1cfh27.4du.ln@flash.net>

Gary Wolgast (ESGDW@email.ais.unc.edu) wrote:
: I need to set up a variable that is to be 8 bytes long.  The first 5
: characters are alphabetic but the last 3 must be blank.  I'm having no
: luck at all.  Any ideas??  Thanks!


   perldoc -f sprintf


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


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

Date: Fri, 13 Nov 1998 16:46:17 +0200
From: Alexander Avtanski <sasho@staff.mgu.bg>
Subject: Re: how to add on to an array??
Message-Id: <364C4639.80C262A9@staff.mgu.bg>

Justin Park wrote:

> how can i add new things on to an existing array?

Try either:
   push @arr,$something;
or
   $arr[$#arr+1]=$something;

--
Alexander Avtanski
sasho@staff.mgu.bg





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

Date: Fri, 13 Nov 1998 10:29:32 -0500
From: james_peregrino@harvard.edu (James Peregrino)
Subject: Re: Occasional Perl Script Failure
Message-Id: <1difgs2.o06nx410z45ucN@dcepf5.harvard.edu>

If your DNS server times out on you, does your script recover?  Might
want to check that...

-James

James Frogel <tory1@IDT.NET> wrote:

> I have a perl script that sleeps for 30 seconds and then checks for
> the existance of a file. If it finds the file then it ftp's the
> file to another machine. It runs 24x7 and seems to run without
> problems for weeks at a time. 
> 
> However, after a few weeks it appears that the script fails during one
> of the sleeps and drops from the machine. I cant seem to find the error.
> Perhaps it is some sort of spurious kill signal? Anyway, I am on
> Sun Unix Solaris 2.6 with a Sparc 5 96 Meg of memory and 4 Gig 
> hard drive. Doing a "top" on the program every day produces no size
> difference of the perl script executing in the background. 
> 
> Does anyone have any ideas on what this could be or how I could at least
> get some sort of warning or error message?  I am on perl, version 5.004_01
> with the Net module.
> 
> Thanks in Advance
> 
> Jim


-- 
 James Peregrino                                 (617)496-6288 (v)
 Manager of Comp. Services                       (617)495-5685 (f)
 Harvard Div. Cont. Ed.
 james_peregrino@harvard.edu


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

Date: 13 Nov 1998 10:21:15 -0500
From: herveus@Radix.Net (Michael Houghton)
Subject: Re: OOP or not? (for a Perl module)
Message-Id: <72hipb$r3f$1@saltmine.radix.net>

Howdy!

In article <3647e266.7834573@news.erols.com>,
Paul Winkler <zarmzarm@SPAMDIEhotmail.com> wrote:
 >Thanks for the reply, Zenin...
 >
 >On 09 Nov 1998 12:09:11 GMT, Zenin <zenin@bawdycaste.org> wrote:
 >>	Never say never.  I could easily picture a GUI CMusic composer
 >>	being built from a good set of libraries, even ones that spit
 >>	out Perl code to be later run as a composition.
 >
 >Hmmm... I see your point. Still, I want to keep the focus on making it
 >very, very fast and intuitive to write music -- er, code -- using this
 >module.
 >
hmmm... musical scoring == just another programming language... :)

 >
 >>	Moving to OO wouldn't mean much more then moving some of this
 >>	around:
 >>
 >>	my $verse1 = CMusic->new ("some-score-file.sco", [ 4 .. 10 ]);
 >>	my $verse2 = CMusic->new ("some-other-score-file.sco", [ 0 .. 20 ]);
 >>
 >>	$verse1->play (2);
 >>	$verse1->rewind();
 >>	$verse2->play (2);
 >>
 >>	$verse2->shuffle_pfield ($verse2->pfield(5, beats(4 to 9),  *= 2));
 >>	$verse2->play();
 >
 >Ah. That clarifies things a lot. (Maybe my problem with the OO
 >examples I've seen was that they didn't have a direct comparison to
 >something I already understood...)
 >
 >And it forces me to clarify something else: this looks like it would
 >alter the data stored in the object permanently. Occasionally, this is
 >explicitly desirable; but most of the time, I'd want to be working on
 >a temporary copy of the stored pattern before playing it. 
 >
 >So in traditional programming style, I'd have a function load_pattern(
 >some_pattern_name )  that loads the named pattern into a L.o.L., let's
 >call it @current. The data in @current would be accessible like
 >$current[$line][$pfield], and this is the data that  most of my
 >functions would work on by default. In the cases where we DO want to
 >store the current L.o.L. into a named pattern, all it would take would
 >be a function store_current( some_pattern_name ) to do that... So
 >load_pattern(), save_current(), pattern_from_file() would usually be
 >the only things that would directly access the H.o.L.o.L data, but
 >there'd be nothing to prevent a user from directly reading or writing
 >any particular $HoLoL{$pattern_name}[$line][$pfield] any time they
 >felt like it.
 >
 >So, how might I go about that? Maybe something like:
 >
 >$verse1 -> load;
 >$current - > $pfield(5, beats(4 to 9),  *= 2));
 >$current - > play;
 >
 >The only bummer about that is I can't see how to avoid having to type
 >"$current" a thousand times in one composition ... it would be nice to
 >be able to assume $current unless otherwise specified...
 >
CGI.pm allows you to do something like this. For stuff that requires an object
to maintain state, you can take advantage of a default object (whose name is 
given if you need to get into it). I suspect that there are useful hints
to be found there.

yours,
Michael
-- 
Michael and MJ Houghton   | Herveus d'Ormonde and Megan O'Donnelly
herveus@radix.net         | White Wolf and the Phoenix
Bowie, MD, USA            | Tablet and Inkle bands, and other stuff
                          | http://www.radix.net/~herveus/


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

Date: Fri, 13 Nov 1998 16:09:27 +0000
From: rogier <rogier@business-net.nl>
Subject: Perl and DosEmu
Message-Id: <364C59B6.EABC4099@business-net.nl>

Hi,

I'm trying to run a program in DosEmu (V0.66.7) from a perl script and i
need to pass the dos program some parameters to run, the dos program
then writes an output file with those parameters. So what the perl
script actually does is write a batch file saves it and then runs
dosemu. In dosemu the autoexec.bat then runs the batch file i just
created wich executes the dos program with it's parameters. So far so
good the dos program actually works and writes the file I want to have.
Next step is to run the perl script as a CGI script. The script still
runs and doesn't return an error code from dosemu or anything but it
doesn't write my file either. If I do a su nobody (httpd user) and then
run the perl script from the command line it does write the file. This
puzzled me :)
I also posted this in some dosemu related groups, but maybe some of you
have tried something similar before.



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

Date: 13 Nov 1998 14:16:31 GMT
From: suresh@astra.nlm.nih.gov (Suresh Srinivasan)
Subject: Perl mode gets confused
Message-Id: <72hevv$95m$1@lhc.nlm.nih.gov>


All,

I'm running xemacs 19.15 on a Ultra 2 and am having a minor but
irritating problem editing perl programs.  When I have a construct
like:

$foo="foo";
print <<"EOD";
This is foo: ${foo}bar
EOD

if (1) {
    $x=1;
		<-- fails to indent here
}


The ${foo} construct in the print statement apparently confuses
xemacs.  It starts to get annoying later on in the program
when the indents don't happen correctly.

Anyway around this?

Thanks!

--Suresh

-- 
-----------------------------------------------------------------------
Suresh Srinivasan                    National Library of Medicine, MS54
suresh@nlm.nih.gov                   8600 Rockville Pike, Bethesda MD 20894
(301)-435-3174                       http://www.nlm.nih.gov


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

Date: Fri, 13 Nov 1998 12:42:59 GMT
From: Brent Michalski <perlguy@technologist.com>
Subject: Re: perl/win95
Message-Id: <364C2953.DAEB63A5@technologist.com>

forrest reynolds wrote:
> 
> Anyone know how to run a script on a Win 95  machine? In other words,
> _where_   do
> I type "perl hello.pl"?
> 
>                                  Thanks, Forrest

>From a DOS prompt seems to work best for me.

Do you have Perl installed on your machine and perl.exe in your path? 
If so, you should be able to type "perl hello.pl" from anywhere that the
"hello.pl" file is located.

Does this answer your question?

Brent
-- 
Java? I've heard of it, it is what I drink when I am hacking Perl. -me
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
$            Brent Michalski             $
$         -- Perl Evangelist --          $
$    E-Mail: perlguy@technologist.com    $
$ Resume: http://www.inlink.com/~perlguy $
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$


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

Date: Fri, 13 Nov 1998 09:21:51 -0500
From: "Matt Heusser" <matt@pcr7.pcr.com>
Subject: Re: Suidperl?
Message-Id: <adX22.447$nm6.3275@news6.ispnews.com>

>See the perlsec manpage. But, generally, you don't need to know
>anything about suidperl; it's all taken care of for you. You shouldn't
>be explicitly running it, for example. Hope this helps!

VERY VERY MUCH!  Thank you!  I just needed to write a simple
CGI Wrapper to change user to root in C (a sample of which, btw,
if in the perlsec manpage) - and -sha-zam- call my perl process as
root.

thanks Tom!

Matt H.




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

Date: Fri, 13 Nov 1998 08:51:06 -0600
From: tadmc@flash.net (Tad McClellan)
Subject: Re: What's wrong with this perl program?
Message-Id: <q0hh27.riu.ln@flash.net>

Zhengdong Zhang (zzhang@bayou.uh.edu) wrote:


: for ($i = 0; <FILE>;)
               ^^^^^^

   You are discarding the line that you read.

   You probably want to put it in a variable if you want
   to do some processing on it...

      for ($i = 0; $_=<FILE>;)

   

: {
:    
:    if (/!|\+/)

   That is sure hard to read. I think this is easier to grok:

     if ( /[!+]/ )


:    {
:       s/[^A-Z]*//i;
                ^
                ^

   Why bother substituing zero characters for zero characters?

   That pattern matches a *whole bunch* of times...


   The s///i modifier has no effect, as you can match only lower
   case chars anyway.

   You should not include code that does not do anything.


      s/[^A-Z]+//;


:       print LIST;
:       $i++ if ($_ ne "");
:    }   
: }


: open (FLAT, "negative.gb3");
: open (JOIN_FLAT, ">join_flat.gb");


   You should always, yes *always*, check the return value from
   open() calls.


: foreach (<FLAT>)
: {
:    s/\n//;

   tr/\n//d;   # runs many times faster...


:    s/#|%/\n#/;

   s/[#%]/\n#/;  # easier to read/maintain



: open (LIST1,"nega_list") || die "can not open: $! ";
: open (SORT_FLAT, ">sort_flat.gb") || die "can't open for writing: $!";

   Good.

   You test the return value from your open() calls here at least.


: while (defined($name = <LIST1>))
: {
:    chomp ($name);
:    open (FLAT1, "join_flat.gb");


   But not here again...


:    while (defined($line = <FLAT1>))
:    {
:       if ($line =~ m/\Q$name\E/si)
                                 ^
                                 ^

   The m//s modifier can have no effect in that pattern match.

   You should not include code that does not do anything.


   m//s changes the interpretation of the dot (.) metachar.
   But since you have quoted all metacharacters, you don't
   have any dot metachars to change...



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


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

Date: Fri, 13 Nov 1998 10:01:10 -0600
From: tadmc@flash.net (Tad McClellan)
Subject: Re: What's wrong with this perl program?
Message-Id: <64lh27.3uu.ln@flash.net>

Tad McClellan (tadmc@flash.net) wrote:
: Zhengdong Zhang (zzhang@bayou.uh.edu) wrote:


: :       s/[^A-Z]*//i;
:                 ^
:                 ^

:    Why bother substituing zero characters for zero characters?

:    That pattern matches a *whole bunch* of times...


   Uhh, well it would if it was s//g, but it isn't, so it doesn't.

   Sorry.


:    The s///i modifier has no effect, as you can match only lower
:    case chars anyway.


   Uhh, it does have an effect.

   Sorry again.


:    You should not include code that does not do anything.


   Here I am being silly again.


:       s/[^A-Z]+//;


   Hmmm. I think my original comments above are Not So Good, 
   though I cannot guess what it is that you really want to do.

   If you want to remove non-alpha chars at the beginning of
   the string, then your original pattern works.


   Though I think it would be more self-documenting to write
   it as below in that case:

      s/^[^A-Za-z]+//;


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


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

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


Administrivia:

Special notice: in a few days, the new group comp.lang.perl.moderated
should be formed. I would rather not support two different groups, and I
know of no other plans to create a digested moderated group. This leaves
me with two options: 1) keep on with this group 2) change to the
moderated one.

If you have opinions on this, send them to
perl-users-request@ruby.oce.orst.edu. 


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

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