[15801] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 3214 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue May 30 21:10:48 2000

Date: Tue, 30 May 2000 18:10:26 -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: <959735426-v9-i3214@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Tue, 30 May 2000     Volume: 9 Number: 3214

Today's topics:
    Re: including CGI.pm kills the program. (Bart Lateur)
    Re: including CGI.pm kills the program. <csorensen@uptimeresources.net>
    Re: including CGI.pm kills the program. <tony_curtis32@yahoo.com>
    Re: Installing DBI.ppd <deridder@pcisys.net>
    Re: IPC::OPEN2 on NT (jason)
    Re: Is Perl for me? (Abigail)
    Re: Is Perl for me? (Craig Berry)
    Re: modify the environment variables permanently via Pe (Abigail)
    Re: newbee regex question <andkaha@my-deja.com>
        Newbie asks about where to place custom script config f <y-o-y@home.com>
    Re: Newbie asks about where to place custom script conf <tony_curtis32@yahoo.com>
    Re: Newbie asks about where to place custom script conf <brian@bluecoat93.org>
    Re: oops Re: seeking method to encode email addresses i <godzilla@stomp.stomp.tokyo>
    Re: oops Re: seeking method to encode email addresses i <nospam@devnull.com>
    Re: oops Re: seeking method to encode email addresses i <godzilla@stomp.stomp.tokyo>
        Oraperl <jpatterson@elitra.com>
    Re: Oraperl (John D Groenveld)
    Re: Parsing (Abigail)
        Passing print statements <rrauer@mitre.org>
    Re: Passing print statements <tina@streetmail.com>
    Re: Passing print statements <lr@hpl.hp.com>
    Re: Passing print statements <lr@hpl.hp.com>
    Re: Perl unusable as a programming language (Simon Cozens)
    Re: perl-5.6.0 and UTF8 character weirdness (Ilya Zakharevich)
        PerlCOM <t0873@my-deja.com>
        PerlCOM t0873@my-deja.com
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Tue, 30 May 2000 23:31:52 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: including CGI.pm kills the program.
Message-Id: <39344efb.796467@news.skynet.be>

Tony Curtis wrote:

>> read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
>
>This is what CGI.pm does for you.  Notice that this code
>here allows unrestricted amounts of data to be uploaded
>and thus is vulnerable to overflow attacks.

Er... I'd simply expect Perl to get a fatal "out of memory" error, i.e.
the script dies.

Maybe, under mod_perl, you could be in more trouble.

-- 
	Bart.


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

Date: 30 May 2000 20:36:30 EDT
From: Chris <csorensen@uptimeresources.net>
Subject: Re: including CGI.pm kills the program.
Message-Id: <39345E75.56C1CDF2@uptimeresources.net>


any idea what the solution is .. I'd like to just read in all the data and
spew it back out to sendmail.. I don't want cgi.pm limiting the amount of
data I can accept ..



Bart Lateur wrote:

> Tony Curtis wrote:
>
> >> read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
> >
> >This is what CGI.pm does for you.  Notice that this code
> >here allows unrestricted amounts of data to be uploaded
> >and thus is vulnerable to overflow attacks.
>
> Er... I'd simply expect Perl to get a fatal "out of memory" error, i.e.
> the script dies.
>
> Maybe, under mod_perl, you could be in more trouble.
>
> --
>         Bart.



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

Date: 30 May 2000 19:42:17 -0500
From: Tony Curtis <tony_curtis32@yahoo.com>
Subject: Re: including CGI.pm kills the program.
Message-Id: <873dmz5z4m.fsf@limey.hpcc.uh.edu>

>> On 30 May 2000 20:36:30 EDT,
>> Chris <csorensen@uptimeresources.net> said:

> any idea what the solution is .. I'd like to just read
> in all the data and spew it back out to sendmail.. I
> don't want cgi.pm limiting the amount of data I can
> accept ..

Well, I already answered that, but...

use CGI;

does all the input grabbing for you.  The various bits and
bobs from the <form> are then available via the param()
method.

    use CGI qw(:standard);   # handles GET *and* POST for you

    my $name = param('name');

etc.

hth
t


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

Date: Tue, 30 May 2000 23:30:02 GMT
From: steve <deridder@pcisys.net>
Subject: Re: Installing DBI.ppd
Message-Id: <sj8jnqkg5pj23@corp.supernews.com>

First of all:

Are you trying to install from activestate.com or locally?  If locally 
XXX.ppd needs to be used.  Change to the directory or reference it from 
the command line.  If you are trying to install from activestate and have 
a firewall you will have to set some environment varaibles to tell ppm to 
go through a proxy.  Reference activestate faq on ppm.  And you do not 
need to use the .ppd in the filename.  Try ppm install DBI.ppd

hth
Steve

Cedron Johnson wrote:
> 
> I am trying to install the DBI module and have been unsuccessful.  I am
> typing the following at my dos prompt:
> 
> ppm install dbi.ppd
> 
> and I receive the following error:
> 
> Error installing package 'dbi.ppd' : Could not locate a PPD file for
> package dbi.ppd
> 
> I am typing the ppm install comand in the path containing the PPD file.
> 
> I am running Active Perl on WinNT and Apache.  Can anyone help?
> 
> Cedron
> 
> 


--
Posted via CNET Help.com
http://www.help.com/


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

Date: Tue, 30 May 2000 22:18:54 GMT
From: elephant@squirrelgroup.com (jason)
Subject: Re: IPC::OPEN2 on NT
Message-Id: <MPG.139edb73a855e0719896f6@news>

yuri_leikind@my-deja.com writes ..
>Using IPC::Open2 on NT (which has become possible only with $|=1 ) I start in
>my script a program as a function which receives a line in stdin and gives a
>line to stdout.
>
>The problem is after closing both filehandles the process is
>left in memory and is not finished.
>
>Using this program from CMD I stop it by pressing CTRL-Z.
>How do I emulate this in my script if
>close FH1; close FH2;
>doesn't help?

I've successfully used Open2 on NT .. perhaps you could post the 
relevant code (hopefully showing the application you're trying to 
interact with)

-- 
 jason - elephant@squirrelgroup.com -


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

Date: 31 May 2000 00:14:26 GMT
From: abigail@arena-i.com (Abigail)
Subject: Re: Is Perl for me?
Message-Id: <8h1lh2$7ba$11@news.panix.com>

On Tue, 30 May 2000 04:46:56 -0700,
Garbage <peterhardingNOpeSPAM@yahoo.com.invalid> wrote:
++ This maybe isn't the right forum for this type of question, BUT:
++ 
++ I am a UNIX administrator who would like to increase my skill
++ set. I am NOT a programmer, but would like to learn a new skill
++ that will put me in good shape for the future:-
++ 
++ 1. Is Perl going places?

Yes, specially Paris.

++ 2. Is it old hat technology?

Certainly. It's over a decade old, and has strong UNIX roots.

++ 3. Is it in great demand by ISP's?

Not at all. ISPs just need bobs to support windows users.



Abigail


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

Date: Wed, 31 May 2000 00:17:23 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: Is Perl for me?
Message-Id: <sj8mgjke5pj43@corp.supernews.com>

Robert Voesten (robert@pharmapartners.nl) wrote:
: I just started Perl, because I'm a webdesigner; and there are 2 (general)
: ways of getting information from a client, who views your webpages:
: A) ASP
: B) CGI/PERL

CGI is an interface spec; Perl is a programming language.  CGI
applications (that is, apps which make use of the CGI interface spec to
communicate with and through a web server) can be written in any language
which can do basic I/O streaming and read environment variables.  Perl
happens to have properties that make it a popular choice for writing CGI
apps, but there's nothing magical about it in this regard.

Also, CGI and ASP are by no means the only ways.  Servlets (and the
related Java Server Pages (JSP) system) are widely used, along with e.g.
PHP, ColdFusion, and so forth.

-- 
   |   Craig Berry - cberry@cinenet.net
 --*--  http://www.cinenet.net/users/cberry/home.html
   |   "The road of Excess leads to the Palace
      of Wisdom" - William Blake


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

Date: 31 May 2000 00:16:44 GMT
From: abigail@arena-i.com (Abigail)
Subject: Re: modify the environment variables permanently via Perl
Message-Id: <8h1llc$7ba$12@news.panix.com>

On Tue, 30 May 2000 14:07:55 +0200, Andreas Vörg <a.voerg@ieee.org> wrote:
++ Hello,
++ 
++ I am looking for a way to modify the environment variables permanently
++ via Perl.

Easy. Just install VMS.

++ I already read the FAQ and manpages but did not find something useful.

You did? Then tell us, which part of the FAQ that answers this exact
question didn't you understand?



Abigail


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

Date: Tue, 30 May 2000 21:57:39 GMT
From: Andreas Kahari <andkaha@my-deja.com>
Subject: Re: newbee regex question
Message-Id: <8h1dgb$vno$1@nnrp1.deja.com>

In article <MPG.139da885a4f9b1f198ab05@nntp.hpl.hp.com>,
  Larry Rosler <lr@hpl.hp.com> wrote:
> In article <8h0vok$km0$1@nnrp1.deja.com> on Tue, 30 May 2000 18:03:13
> GMT, Andreas Kahari <andkaha@my-deja.com> says...
> > In article <3933F881.B571E960@hotail.com>,
> >   transpulse@hotail.com wrote:
> > > i need help with reqex.
> > > i want to check a certain string for illegal charaters. (legel
> > > charaters are a-z A-Z 0-9 - . /). How can i do this with regex.
> ...
>
> > $str = "illägal";
> >
> > if ($str =~ /[^a-zA-Z0-9\-\.\/]/) {
> >     print "contains illegal characters\n";
> > } else {
> >     print "does not\n";
> > }
> >
> > Another equivalent RE is /[^\d\w\-\.\/]/
>
> That is by no means equivalent to the first.  Now '_' becomes legal,
and
> in some locales the 'ä' in your example data becomes legal also, along
> with a host of other 'letters'.
>

Ai! Sorry about that. However, 'ä' is a perfectly legal letter and not
just a mere "letter" (I'm insulted!)

;-)

/Andreas Kähäri

--
# Andreas Kähäri, <URL:http://hello.to/andkaha/>.
# All junk e-mail is reported to the
# appropriate authorities, no exceptions.


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


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

Date: Wed, 31 May 2000 00:36:58 GMT
From: Andy <y-o-y@home.com>
Subject: Newbie asks about where to place custom script config files?
Message-Id: <K8ZY4.224557$Tn4.1965053@news1.rdc2.pa.home.com>

Hi folks!

My script does a check for 2 files and if they're not found, the script 
branches to a LABEL to print prompt from STDIN to create the files as:

open (IN ,"perlotto.cfg") or goto SETOPTIONS; #for example

It seems acceptable as far as a user-interaction program like PerLotto, 
but I could be wrong.

Is this sound?

Andy


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

Date: 30 May 2000 19:39:57 -0500
From: Tony Curtis <tony_curtis32@yahoo.com>
Subject: Re: Newbie asks about where to place custom script config files?
Message-Id: <8766rv5z8i.fsf@limey.hpcc.uh.edu>

>> On Wed, 31 May 2000 00:36:58 GMT,
>> Andy <y-o-y@home.com> said:

> Hi folks!  My script does a check for 2 files and if
> they're not found, the script branches to a LABEL to
> print prompt from STDIN to create the files as:

> open (IN ,"perlotto.cfg") or goto SETOPTIONS; #for
> example

goto.  Bad.  Bad.  BAD!!!

It sounds like you just want to check the files for open
and use a conditional to prompt if you can't open them.

hth
t
-- 
"Trying is the first step towards failure"
                                           Homer Simpson


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

Date: Tue, 30 May 2000 20:47:08 -0400
From: "Brian Landers" <brian@bluecoat93.org>
Subject: Re: Newbie asks about where to place custom script config files?
Message-Id: <gkZY4.312$u21.14771@news4.atl>

# how about...
( open( FILE1, 'file1.cfg' ) &&
  open( FILE2, 'file2.cfg' ) ) || &set_options();

sub set_options {
  # prompt for filenames here
}

"Tony Curtis" <tony_curtis32@yahoo.com> wrote in message
news:8766rv5z8i.fsf@limey.hpcc.uh.edu...
> >> On Wed, 31 May 2000 00:36:58 GMT,
> >> Andy <y-o-y@home.com> said:
>
> > Hi folks!  My script does a check for 2 files and if
> > they're not found, the script branches to a LABEL to
> > print prompt from STDIN to create the files as:
>
> > open (IN ,"perlotto.cfg") or goto SETOPTIONS; #for
> > example
>
> goto.  Bad.  Bad.  BAD!!!
>
> It sounds like you just want to check the files for open
> and use a conditional to prompt if you can't open them.
>
> hth
> t
> --
> "Trying is the first step towards failure"
>                                            Homer Simpson




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

Date: Tue, 30 May 2000 15:20:51 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: oops Re: seeking method to encode email addresses in web pageforms
Message-Id: <39343EC3.43CFD43@stomp.stomp.tokyo>

The WebDragon wrote:
> In article <3933D1DF.9B6AC663@stomp.stomp.tokyo>, "Godzilla!"
> <godzilla@stomp.stomp.tokyo> wrote:
>  | The WebDragon wrote:
>  | > In article <393066CA.319D5EEE@stomp.stomp.tokyo>, "Godzilla!"
>  | > <godzilla@stomp.stomp.tokyo> wrote:


>  | Precisely. This is why my Perl 4 code does four
>  | times as much with one-fourth the amount of coding
>  | as a Perl 5 version.


> Interesting that you latch on to the first thing I said, and 
> ignored the remainder of my post.. please go back and finish 
> reading it (suggestion, noting the use of the word please) as 
> there was a lot more information there than just this..



My statement is a joke. Stop being so
AR and try laughing a bit. You might
enjoy a little laughter.

Godzilla!


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

Date: 30 May 2000 22:56:51 GMT
From: The WebDragon <nospam@devnull.com>
Subject: Re: oops Re: seeking method to encode email addresses in web pageforms
Message-Id: <8h1gvj$d53$1@216.155.32.165>

In article <39343EC3.43CFD43@stomp.stomp.tokyo>, "Godzilla!" 
<godzilla@stomp.stomp.tokyo> wrote:

 | The WebDragon wrote:
 | > In article <3933D1DF.9B6AC663@stomp.stomp.tokyo>, "Godzilla!"
 | > <godzilla@stomp.stomp.tokyo> wrote:
 | >  | The WebDragon wrote:
 | >  | > In article <393066CA.319D5EEE@stomp.stomp.tokyo>, "Godzilla!"
 | >  | > <godzilla@stomp.stomp.tokyo> wrote:
 | 
 | 
 | >  | Precisely. This is why my Perl 4 code does four
 | >  | times as much with one-fourth the amount of coding
 | >  | as a Perl 5 version.
 | 
 | 
 | > Interesting that you latch on to the first thing I said, and 
 | > ignored the remainder of my post.. please go back and finish 
 | > reading it (suggestion, noting the use of the word please) as 
 | > there was a lot more information there than just this..
 | 
 | My statement is a joke. Stop being so
 | AR and try laughing a bit. You might
 | enjoy a little laughter.

I'm not sure you've properly appreciated the humor inherent in your own 
statement, and you *still* haven't responded to 95% of the body of the 
post.

-- 
send mail to mactech (at) webdragon (dot) net instead of the above address. 
this is to prevent spamming. e-mail reply-to's have been altered 
to prevent scan software from extracting my address for the purpose 
of spamming me, which I hate with a passion bordering on obsession.  


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

Date: Tue, 30 May 2000 17:17:00 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: oops Re: seeking method to encode email addresses in web pageforms
Message-Id: <393459FC.698E6563@stomp.stomp.tokyo>

The WebDragon wrote:
> In article <39343EC3.43CFD43@stomp.stomp.tokyo>, "Godzilla!"
> <godzilla@stomp.stomp.tokyo> wrote:
>  | The WebDragon wrote:
>  | > "Godzilla!" <godzilla@stomp.stomp.tokyo> wrote:
>  | >  | The WebDragon wrote:
>  | >  | > "Godzilla!" <godzilla@stomp.stomp.tokyo> wrote:


>  and you *still* haven't responded to 95% of the body 
> of the post.

Too much word wrapping in your program.
You should take this out. Doesn't look
as pretty. Don't word wrap your lines.

Heh!

It's a nice program. I would be interested to
see printed results and results of a harsh
reality test, not a home system sissy test.
Have you dumped it onto the web yet to see
how it does under realistic conditions?

It would be inappropriate of me to comment on
your actual code. Each person has their own
style and this is to be respected, at all times.
I do not subscribe for a second to this code cop
philosophy in such rancid abundance around here.

Not touching your code, I would comment there is
no need for -w, your code works, right? Strict
reduces your flexibility in imagination, as the
name stict implies, explicitly. Both -w and strict
are junk and insult the beauty of your program.
It's an aesthetic thing with me. Why splatter your
work of art with garbage like -w and strict? Show
some confidence in your obvious well advanced Perl
programming skills.

Posix is well known for its bugs, such as returning 
incorrect times and often causing a Perl core dump 
into your script directory. You could cut your bloat 
factor significantly by dumping Posix. For one kilobyte
of code you could write a better sub-routine which would
do more and do it better than twenty-eight kilobytes of 
Posix could ever do. Calling gmt time will introduce a 
serious bug with Posix in some European time zones, for 
what it isn't worth. Posix is huge bug bloat factor not 
worth the trouble it causes on a routine basis. 

Portability is reduced by use of cgi.pm which introduces 
a bloat factor in the thousands of percent and could 
introduce a lot of its well known bugs, if you expand 
upon this for a user interface. You really don't need
cgi.pm for what you are doing. I see no serious security
issues, unless you expand into an elaborate user interface
which allows input.  You could write your own code in 
one-hundredth of cgi.pm's six-thousand plus lines of code
at a quarter of a megabyte bloat. Maybe a custome code
to replace unreliable cgi.pm with something of class?

I would remove use of 'or die' in favor of better error 
checking with an html diagnostic print-out. This 'or die'
is basically worthless. You can do better than using this
piece of junk 'or die'. Seems your program is a work of
individual art which would be enhanced by replacing this
'or die' with something of great and multiple use. Think
about custom error checking which checks many items all
at once, in one piece of short code. Hmm.. I believe one
of my techniques for this is in a recent article.

Nice coding, well organized, neat in appearance. I like 
your code. Be nice if I could give it one of my reality 
tests. However, well... there is a portability issue.
Won't run under 5.003 Perl. =)

In summary, if I were to make a polite well intended
suggestion, I would get rid of as many modules as
possible, replace them with custom code. This would
turn your fat Mercedes into an asphalt ripping Corvette
Mako Shark, of which, I drive many.

There's your ninety-five percent worth. Bug me again
and I will comment on your code itself.

Godzilla!


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

Date: Tue, 30 May 2000 23:30:19 GMT
From: "Joe Patterson" <jpatterson@elitra.com>
Subject: Oraperl
Message-Id: <faYY4.8$Yu4.1622@news-west.eli.net>

I am trying to install oraperl on an Ultra1, running solaris 8, with Oracle
8.1.6 running.  Perl version is 5.005_03 built for sun4-solaris.

DBD-Oracle-1.03 compiles ok, but when a simple script tries to log into
Oracle, and get a row, this happens:
> ./testoracle.pl
You must install a Solaris patch to run this version of the Java runtime.
Please see the README and release notes for more information.
Exiting.

I have no idea what readme to check, and there don't seem to be any Java
related patches from sunsolve for Solaris8.

Does ANYBODY have Solaris8/Oracle 8.1.6/Oraperl running?

Thanks,
Joe




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

Date: 30 May 2000 20:18:41 -0400
From: groenvel@cse.psu.edu (John D Groenveld)
Subject: Re: Oraperl
Message-Id: <8h1lp1$6ak$1@grolsch.cse.psu.edu>

FYI comp.lang.perl is dead, dead, dead
http://www.xray.mpe.mpg.de/mailing-lists/dbi/2000-04/msg00232.html
Yet another Oracle-erected barrier thats been overcome.
John
groenveld@acm.org


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

Date: 30 May 2000 23:36:47 GMT
From: abigail@arena-i.com (Abigail)
Subject: Re: Parsing
Message-Id: <8h1jaf$7ba$3@news.panix.com>

On Sat, 27 May 2000 22:17:20 GMT, Jack <egn@telebot.net> wrote:
++ I cannot seem to figure out how to parse this FTP listing:
++ 
++ -rwx------   1 user     group     3616310 Aug 30  1998 Alexia - Number
++ one.zip
++ drwx------   1 user     group           0 Apr 18 00:15 Alice Doc.doc
++ 
++ 
++ In the meantime, I've parsed other FTP listing through this code
++ snippet:
++ 
++ ($pr, $fs, $us, $gr, $sz, $d1, $d2, $d3, $fn) = split / +/, $Entry;
++ 
++ but as you can see, the $fn (filename) will only store Alexia, not the
++ full, Alexia - Number one.zip. Can some help me out with this?

   ($pr, $fs, $us, $gr, $sz, $d1, $d2, $d3, $fn) = split / +/, $Entry, 9;



Abigail


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

Date: Tue, 30 May 2000 16:57:49 -0700
From: Ron Auer <rrauer@mitre.org>
Subject: Passing print statements
Message-Id: <3934557D.F9419FC9@mitre.org>

I have a subroutine, and depending on what I pass it, it will print one
of two formats.

E.g.,	$format_one = "%-45s \t%6s \t%-15s\n"
	$format_two = "%-50s \t%10s\n"

This I can pass into the sub with no problem.  What I would like to know
- is there anyway to pass a print statment into the sub as a variable
(of sorts).  I need two print statments for the two format statements.

E.g.	printf $format_one, "Data", "More Data", "And more data"
	printf $format_two, "Data", "More Data"

Here is what I would like to do:
___________________________________________________________

sub test {
printf $_[0];

}

$format = "%-45s \t%6s \t%-15s\n";
$print_statement= $format, "Data", "More Data", "And more data";
test ($print_statement);

$format = "%-50s \t%10s\n";
$print_statement = $format, "Data", "More Data";

___________________________________________________________________

Of course I know this doesn't work, but is there a way to do something
like this?

Ron


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

Date: 31 May 2000 00:16:54 GMT
From: Tina Mueller <tina@streetmail.com>
Subject: Re: Passing print statements
Message-Id: <8h1llm$2716d$4@fu-berlin.de>

hi,

Ron Auer <rrauer@mitre.org> wrote:

> E.g.,	$format_one = "%-45s \t%6s \t%-15s\n"
> 	$format_two = "%-50s \t%10s\n"

> This I can pass into the sub with no problem.  What I would like to know
> - is there anyway to pass a print statment into the sub as a variable
> (of sorts).  I need two print statments for the two format statements.

> E.g.	printf $format_one, "Data", "More Data", "And more data"
> 	printf $format_two, "Data", "More Data"

> sub test {
> printf $_[0];
> }

> $format = "%-45s \t%6s \t%-15s\n";
> $print_statement= $format, "Data", "More Data", "And more data";
> test ($print_statement);

> $format = "%-50s \t%10s\n";
> $print_statement = $format, "Data", "More Data";

it's close to it.
I tried:

$a=99;$b=376;$c=23;
$format = "%d \t%d \t%s\n";
$print_statement= q($format, $a, $b, $c);
test ($print_statement);
$format = "%5s \t%10s\n";
$print_statement = q($format, $a, $b);
test($print_statement);
sub test {
 eval "printf ".shift;
}'

tina

-- 
http://www.tinita.de \  enter__| |__the___ _ _ ___
tina's moviedatabase  \     / _` / _ \/ _ \ '_(_-< of
search & add comments  \    \ _,_\ __/\ __/_| /__/ perception


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

Date: Tue, 30 May 2000 17:24:02 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: Passing print statements
Message-Id: <MPG.139dfb7dfe4202f298ab07@nntp.hpl.hp.com>

In article <3934557D.F9419FC9@mitre.org> on Tue, 30 May 2000 16:57:49 -
0700, Ron Auer <rrauer@mitre.org> says...
> I have a subroutine, and depending on what I pass it, it will print one
> of two formats.
> 
> E.g.,	$format_one = "%-45s \t%6s \t%-15s\n"
> 	$format_two = "%-50s \t%10s\n"
> 
> This I can pass into the sub with no problem.  What I would like to know
> - is there anyway to pass a print statment into the sub as a variable
> (of sorts).  I need two print statments for the two format statements.
> 
> E.g.	printf $format_one, "Data", "More Data", "And more data"
> 	printf $format_two, "Data", "More Data"
> 
> Here is what I would like to do:
> ___________________________________________________________
> 
> sub test {
> printf $_[0];
> }

That isn't indented readably.

> $format = "%-45s \t%6s \t%-15s\n";
> $print_statement= $format, "Data", "More Data", "And more data";

The above evaluates and throws away a set of expressions.  Please use 
the '-w' flag in the future to help eliminate problems such as this.

What you want is to initialize an array, not a scalar.

    perldoc perldata

> test ($print_statement);
> 
> $format = "%-50s \t%10s\n";
> $print_statement = $format, "Data", "More Data";
> 
> ___________________________________________________________________
> 
> Of course I know this doesn't work, but is there a way to do something
> like this?


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

sub test { printf @_ }

my ($format, @print_statement);

$format = "%-45s \t%6s \t%-15s\n";
@print_statement = ($format, "Data", "More Data", "And more data");
test (@print_statement);

$format = "%-50s \t%10s\n";
@print_statement = ($format, "Data", "More Data");
test (@print_statement);


-- 
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: Tue, 30 May 2000 17:41:22 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: Passing print statements
Message-Id: <MPG.139dff91816a3f5a98ab08@nntp.hpl.hp.com>

In article <8h1llm$2716d$4@fu-berlin.de> on 31 May 2000 00:16:54 GMT, 
Tina Mueller <tina@streetmail.com> says...

 ...

> $a=99;$b=376;$c=23;
> $format = "%d \t%d \t%s\n";
> $print_statement= q($format, $a, $b, $c);
> test ($print_statement);
> $format = "%5s \t%10s\n";
> $print_statement = q($format, $a, $b);
> test($print_statement);
> sub test {
>  eval "printf ".shift;
> }'

The use of the 'eval STRING' capability should be a last resort.  This 
is not such a case.  Use a list of arguments, not a string that has to 
be eval'ed to create the list.

-- 
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: 30 May 2000 22:28:04 GMT
From: simon@brecon.co.uk (Simon Cozens)
Subject: Re: Perl unusable as a programming language
Message-Id: <slrn8j8g3k.drl.simon@justanother.perlhacker.org>

Tushar Samant (comp.lang.perl.moderated):
>Perl does "have them" in every sense of the term--if they are undocumented
>*special cases*. I'll again bring up split /^/, which acts like /^/m. This

OK, this needs to be documented. Thanks.

>is a feature which is not optional, or seen only by people who venture "out
>of the box". And the average programmer can only discover it accidentally.

You appear to have carelessly snipped my point that undocumented special
cases in any language leave you unprotected. Perl isn't unique here, and
a formal specification doesn't protect against this behaviour. I'm happy
to do my best to reduce these things - C and other languages, even with
a formal specification, are happy to leave them exist.

>>> If it's true, no experimentation is going to prove it.
>>I apparently have a lot to learn about the scientific method.
>Scientific method is irrelevant here, 

Nope. Earlier you said that you couldn't understand those who abhorred
cargo cult programming and you praised the empirical method. I think we
must differ in terms of definition here, but cargo cult programming is
applying received wisdom without thinking - the empirical method is
getting out there with a command line and poking around, it's
independent investigation. They're not just different, they're exact
opposites.

> and the messiest, DWIM-est language can hardly be comparable to
> unknown "nature".

It is a computer program. It's deterministic. It's *more* deterministic
than nature. Ergo scientific experiments on it have a much greater
chance of validity than scientific experiments in the real world.

> A false statement can be disproved in one case; a true statement
> verified a hundred times will still leave doubt about some special
> case.

This is true in all cases, not just Perl. Doesn't seem to stop
scientists making guesses at how the world works. However, once again,
Perl is at a huge advantage over physical sciences because it's a
deterministic closed system. And we can change its rules if we need to.

We've got the theory - the source code and documentation - and the
experiment - trying things out with the interpreter. Now, if the results
of the experiment aren't what theory predicted, we need to update the
theory.

>As for your example: $a = 1; $a++ giving $a == 2 is immediately
>convincing, since it is documented. However, some paranoid enough
>person would be well within rights to doubt it, because of known
>undocumented special cases (in the language).

If these special cases are known, they're not known to me. Could it be
that you're sitting on bugs and not doing anything about them? Help me
find them and document them, if it's such a concern of yours. However,
I'm getting the feeling you just want to whinge about these things and
not fix them.

[Moderators: I'm not going to post again to this thread.]
-- 
"A few hours later, I'm on the administrative floor, and a secretary asks me 
about some mail I sent that had [scrambled double-byte characters] in it. 
While I do use a Japanese-patched Mutt at work, I've never had any instance of 
it sending scrambled characters, so I went over to her machine to take a look: 
[...] it was my sendmail.cf" - Jonathan Byrne.


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

Date: 30 May 2000 22:48:06 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: perl-5.6.0 and UTF8 character weirdness
Message-Id: <8h1gf6$elj$1@charm.magnus.acs.ohio-state.edu>

[A complimentary Cc of this posting was sent to Alberto Accomazzi 
<aaccomazzi@my-deja.com>],
who wrote in article <8h1bgk$u8p$1@nnrp1.deja.com>:
> I'm planning to make extensive use of the new utf8 handling capabilities
> in perl5.6.0

There are no "new utf8 handling capabilities" in v5.6.0.  What there
is there is a potential to have these capabilities in the future.  In
addition to zillions of bugs there is no way to handle a mixture of
utf8 and no-utf8 data in hashes and RExen.  And there is no i/o
capabilities...

Ilya

P.S.  Yes, there is a way to parse this "there is there is" phrase.  ;-)


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

Date: Tue, 30 May 2000 22:49:21 GMT
From: t0873 <t0873@my-deja.com>
Subject: PerlCOM
Message-Id: <8h1ghb$22q$1@nnrp1.deja.com>



PerlCOM!!

I am trying to run few examples on PerlCOM on Win NT box. I get an
error "Cannot create PerlCOM object"

I register the DLL also, Can somebody help me to find out what i am
doing wrong.

I really appreciate your help
--

Thanks in advance.


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


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

Date: Tue, 30 May 2000 22:46:26 GMT
From: t0873@my-deja.com
Subject: PerlCOM
Message-Id: <8h1gc2$aie$1@nnrp2.deja.com>

Hi,

I am trying to do run few example from
c:\Perl\eg\PDK directory. I am getting error as

Failed to create PerlCOM: Win32::OLE(0.1101)
error 0x80040154: "Class not registered" at
approx.pl line 21.

I tried to register PerlCOM.dll.

Can anybody let me know what I am missing to run
PerlCOM on NT machine. I am using build 522 and
version of Win32::OLE is 0.1101


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


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