[9444] in Perl-Users-Digest
Perl-Users Digest, Issue: 3039 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Jul 1 16:07:20 1998
Date: Wed, 1 Jul 98 13:00:31 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Wed, 1 Jul 1998 Volume: 8 Number: 3039
Today's topics:
Re: An interesting observation (Chip Salzenberg)
Re: ANNOUNCEMENT: clpa doesn't accept perl announcement (Chip Salzenberg)
Re: array of objets (Abigail)
Re: array of objets (Kevin Reid)
Re: Associative arrays and LISTS. <wao@aluxs.micro.lucent.com>
Re: decimal to hex, or binary to hex?? (Mark-Jason Dominus)
Re: Dejanews/closed lists/moderated groups/lists [Was: (I R A Aggie)
Re: Dejanews/closed lists/moderated groups/lists [Was: (Michael J Gebis)
Re: Dereferencing Anonymous Hash? <johnc@interactive.ibm.com>
Re: DES crypt (NRE)
detecting time of day (Brian Day)
Re: detecting time of day <rootbeer@teleport.com>
Re: find a number with regular expression <bowlin@sirius.com>
Re: Formating output (Mike Stok)
Getting Oracle info with Perl <probavm@h8mail.laf.cat.com>
HELP....! Very simple array sort question! <krpotter@co.douglas.or.us>
Re: HELP....! Very simple array sort question! (Matt Knecht)
Re: how much filespace ? <barnett@houston.Geco-Prakla.slb.com>
Re: HOW TO: freestanding modules? (Mark-Jason Dominus)
Re: I can't nail down the uninitialized value :( <dean@mail.biol.sc.edu>
Re: Need information about EMBEDDING Perl5 (Mark-Jason Dominus)
Re: PerlScript Arrays <JKRY3025@comenius.ms.mff.cuni.cz>
Re: Q: How to read AND write to a programm? (Jacqui Caren) (Jacqui Caren)
Q: object's memory space <aspa@mail.cern.ch>
Q:How to have perl script act like a printfilter <strat@pacifier.com>
Re: Q:How to have perl script act like a printfilter <rootbeer@teleport.com>
Re: Q:How to have perl script act like a printfilter <strat@pacifier.com>
reading in line-at-a-time (Brian Day)
Re: reading in line-at-a-time <rootbeer@teleport.com>
Re: reading in line-at-a-time (Michael J Gebis)
Re: reading in line-at-a-time (Josh Kortbein)
Re: Running Unix Script in Perl <barnett@houston.Geco-Prakla.slb.com>
Re: Title Caps (Michael Budash)
Using the read function...? <alcazar@netcomp.net>
Vertical Perl <richard.proulx@sun.com>
Virtual functions. <oberegov@pathfinder.com>
Re: Virtual functions. <jdporter@min.net>
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 01 Jul 1998 18:50:00 GMT
From: chip@mail.atlantic.net (Chip Salzenberg)
Subject: Re: An interesting observation
Message-Id: <6ne0ff$tvh$1@cyprus.atlantic.net>
According to stanley@skyking.OCE.ORST.EDU (John Stanley):
>In article <6n6anv$7r1$1@monet.op.net>, Mark-Jason Dominus <mjd@op.net> wrote:
>>My question last week at <6m7rd5$m7k$1@monet.op.net> went unanswered.
>>(So far.)
>
>My request for ....
Well, you _do_ have to consider the source.
While clpm is generous, it does have a memory.
--
Chip Salzenberg - a.k.a. - <chip@pobox.com>
"I brought the atom bomb. I think it's a good time to use it." //MST3K
-> Ask me about Perl training and consulting <-
Like Perl? Want to help out? The Perl Institute: www.perl.org
------------------------------
Date: Wed, 01 Jul 1998 18:47:57 GMT
From: chip@mail.atlantic.net (Chip Salzenberg)
Subject: Re: ANNOUNCEMENT: clpa doesn't accept perl announcements!
Message-Id: <6ne0bm$tut$1@cyprus.atlantic.net>
According to gabor@vmunix.com (Gabor):
>That doesn't change the fact that Tom's complaint is valid.
I think you should say "opinion", not "fact".
--
Chip Salzenberg - a.k.a. - <chip@pobox.com>
"I brought the atom bomb. I think it's a good time to use it." //MST3K
-> Ask me about Perl training and consulting <-
Like Perl? Want to help out? The Perl Institute: www.perl.org
------------------------------
Date: 1 Jul 1998 17:13:28 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: array of objets
Message-Id: <6ndqno$i7g$1@client3.news.psi.net>
Robert Rehammar (Robert.Rehammar@emw.ericsson.se) wrote on MDCCLXV
September MCMXCIII in <URL: news:3599F4F6.9D9E52A8@emw.ericsson.se>:
++ How do I create an array of objects ??
++
@array = map {bless [] => "Foo"} 1 .. 10;
Abigail
--
perl -wle '$, = " "; print grep {(1 x $_) !~ /^(11+)\1+$/} 2 .. shift'
------------------------------
Date: Wed, 1 Jul 1998 15:42:13 -0400
From: kpreid@ibm.net (Kevin Reid)
Subject: Re: array of objets
Message-Id: <1dbhc63.4l8hol3f7e2qN@slip166-72-108-122.ny.us.ibm.net>
Robert Rehammar <Robert.Rehammar@emw.ericsson.se> wrote:
> How do I create an array of objects ??
>
> \\Robert Rehammar
Just like you create an array of anything else.
for (my $i = 0; $i < 10; $i++) {
$array[$i] = new MyObject;
}
--
Kevin Reid. | Macintosh.
"I'm me." | Think different.
------------------------------
Date: Wed, 01 Jul 1998 13:38:48 -0400
From: Bill Oswald <wao@aluxs.micro.lucent.com>
Subject: Re: Associative arrays and LISTS.
Message-Id: <359A7428.DFA1FEDD@aluxs.micro.lucent.com>
Aaron B. Dossett wrote:
> Bill Oswald (wao@aluxs.micro.lucent.com) wrote:
> > This works. But I really want
> >
> > $assoc{"foo"} = ();
> > push ($assoc{"foo"} , $name);
> > ...
> > foreach $tmp($assoc{"foo"})
> > {
> > }
>
> You probably want something like this:
>
> $assoc{"foo"} = []; #Create a reference to an anonymous array
> push @{$assoc{"foo"}}, $name;
Yes! sort of. What I want is the above with...
foreach $tmp (@{$assoc{"foo"}})
{
}
If I don't do this then $tmp = the array reference not each member of the
array.
Thanks!!
Bill
--
We have enough youth. What we need is a fountain of smart!
------------------------------
Date: 1 Jul 1998 14:15:57 -0400
From: mjd@op.net (Mark-Jason Dominus)
Subject: Re: decimal to hex, or binary to hex??
Message-Id: <6nduct$3ll$1@monet.op.net>
In article <6n9sf6$isv$1@msunews.cl.msu.edu>,
AJS <spence79@pilot.msu.edu> wrote:
>Is there an easy way to go from a decimal representation to a hex,
$hex = sprintf("%x", $decimal);
------------------------------
Date: Wed, 01 Jul 1998 13:06:43 -0500
From: fl_aggie@thepentagon.com (I R A Aggie)
Subject: Re: Dejanews/closed lists/moderated groups/lists [Was: Re: Is perl5-porters closed to subscription?
Message-Id: <fl_aggie-0107981306430001@aggie.coaps.fsu.edu>
In article <6ndn1p$f2m$1@nnrp1.dejanews.com>, birgitt@my-dejanews.com wrote:
+ For news groups I understand there is the mechanism available
+ to turn an open group into a moderated/closed group by way
+ of a democratic mechanism, whereby people choose deliberately
+ a "benevolent dicatorship" model to be ruled by.
Yes, and no. In general, it is devilishly hard to convert an
unmoderated newsgroup into a moderated one. I fear you may be
under the impression that clp.misc will become moderated if the
current proposal passes. That is not true, the current proposal
will merely create a new newsgroup, clp.moderated. clp.misc will
still exist in all its unadulterated glory.
+ The moderated group remains open in the sense that anyone
+ can read it, posting is under a registration and review process
+ of the moderators,
Yes.
+ The _guarantee_ of all posts being openly accessable for reading
+ is given by the current dejanews archiving mechanism, yes or no ?
No. AFAIK, dejanews archives only those messages that they receive,
which is in no way, shape, or form guaranteed to be ALL. Further,
they boast of having removed spam from their archive. I looked for
a policy statement about what they keep, but I couldn't find it on their
web site. I suspect they keep everything -- but that's not the same
as stated policy.
+ I thought mailing lists are generally open for registration
+ and posting for anybody in the public.
In general, that's true. However...
+ Is a mailing list in general _owned_ by ONE person ?
Yes.
+ If so, is the owner in general automatically moderator ?
Yes. Their list, their rules.
+ If so, can the owner/moderator of a mailing list decide not
+ to maintain mailing-list archives
Yes.
+ or decide arbitrarily
+ not to pass through subscription requests without announcing
+ such a possible policy ?
Yes, tho that might considered rude.
+ If so, is it guaranteed that all posts ever made are archived
+ by dejanews ?
dejanews only archives newsgroups, not mailing lists, except in cases
where there is a usenet<->mailing list gateway.
+ If that archiving mechanism is guaranteed:
+ Is the mechanism under a sort of democratic supervision ?
Where do you get this idea of "democracy"? Usenet is not a democracy,
it never was, and likely will never be.
+ Who owns dejanews ?
See their web page.
+ How is it guaranteed that ALL posts are archived ?
Its not, and the boast that they eliminate spam.
+ Who pays for dejanews ?
Advertisers.
+ If I pay for dejanews in one way or another indirectly, where is my
+ share of control I should have over the way it is functioning ?
Since your "payment" is indirect, you have no control. The only control
you might be able to exert is to have your posts removed from dejanews
as a violation of your copyright.
James
------------------------------
Date: 1 Jul 1998 17:55:51 GMT
From: gebis@albrecht.ecn.purdue.edu (Michael J Gebis)
Subject: Re: Dejanews/closed lists/moderated groups/lists [Was: Re: Is perl5-porters closed to subscription?
Message-Id: <6ndt77$q07@mozo.cc.purdue.edu>
birgitt@my-dejanews.com writes:
}Who owns dejanews ? How is it guaranteed that ALL posts are
}archived ? Who pays for dejanews ? If I pay for dejanews
}in one way or another indirectly, where is my share of control
}I should have over the way it is functioning ?
Most (if not all) of these are answered in:
http://www.dejanews.com/help/faq.shtml
You pay for dejanews the same way you pay for TV. You get an
equivalent share of control.
--
Mike Gebis gebis@ecn.purdue.edu mgebis@eternal.net
------------------------------
Date: Wed, 01 Jul 1998 13:45:00 +0000
From: John Call <johnc@interactive.ibm.com>
Subject: Re: Dereferencing Anonymous Hash?
Message-Id: <359A3D4C.1B8AEB0@interactive.ibm.com>
> Perl "never" implicitly dereferences a ref; you always have to do it
> yourself.
> --
> Tom Phoenix Perl Training and Hacking Esperanto
> Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
Ok. I thought I was asking a complicated question but after I got back all
the responses (thanks everyone) I found out it was pretty simple. I had just
forgotten how the {} were each doing something a little different (even
though the authors state that).
I appreciate the help.
BTW, I have been a programmer for a few years and consider myself
intermediatte at Perl. I think I know why I haven't been able to understand
all the subtle aspects better. I never bought Learning Perl. I thought since
I knew other languages I would just switch into Perl syntax and keep going.
Boy was I wrong. I just got LP and have learned a lot I didn't know. This
language is like no other and I recommend starting with this book. It
explains a lot of little things I would never have thought of and I think it
will really help push me towards more 'advanced' knowledge even though it is
the 'beginning' book.
my $.02
--
john call
------------------------------
Date: Wed, 01 Jul 1998 13:22:42 +0000
From: "David T. Bath (NRE)" <david.bath@nre.vic.gov.au>
To: Clinton Gormley <clint@netcomuk.co.ukXX>
Subject: Re: DES crypt
Message-Id: <359A3822.7E0524DB@nre.vic.gov.au>
Clinton Gormley wrote:
>
> I'm running PERL with IIS 4.0 on NT
>
> I am trying to use the DES Crypt module at
> ftp://unix.hensa.ac.uk/mirrors/perl-CPAN/modules/by-module/Crypt
>
(snip)
DES and other crypto stuff is tricky outside the US.
The standard for those outside the US, including perl modules
is stuff by Eric A. Young, who wrote implementations of DES,
SSL, etc, etc
Follow your nose from these references
ftp://ftp.psy.uq.oz.au/pub/Crypto
http://www.psy.uq.oz.au/~ftp/Crypto
--
David T. Bath (from home) david.bath@nre.vic.gov.au
Phone: +613 9500 0894 Mobile: 015 824 171 (not always on)
Office: Global Consulting Ph:+613 9347 7511 Fax:+613 9347 0182
#include <std_disclaim.h>
------------------------------
Date: 1 Jul 1998 17:47:34 GMT
From: bday@mtv03install2.eng.sun.com (Brian Day)
Subject: detecting time of day
Message-Id: <6ndsnm$a0l$10@engnews2.Eng.Sun.COM>
Keywords: time
I have another newbie question. Is there some way of detecting the time with Perl.
I thought I remember hearing something about that.
Thanks,
Brian
------------------------------
Date: Wed, 01 Jul 1998 18:13:48 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: detecting time of day
Message-Id: <Pine.GSO.3.96.980701111316.8511O-100000@user2.teleport.com>
On 1 Jul 1998, Brian Day wrote:
> Is there some way of detecting the time with Perl.
I think that the perlfunc manpage should be helpful. Good luck!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Wed, 01 Jul 1998 10:00:08 -0700
From: Jim Bowlin <bowlin@sirius.com>
To: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: find a number with regular expression
Message-Id: <359A6B18.6289621B@sirius.com>
Tom Phoenix wrote:
>
> On Wed, 1 Jul 1998, Jim Bowlin wrote:
>
> > m/^\s*[\+\-]?(\d+\.?\d*|\.\d+)(e[\+\-]?\d+)?$/i;
> >
> > This should be true if and only if $_ will convert to a number successfully.
>
> $number = "1000 "; # :-)
You're absolutely right Tom. I considered adding a note saying that
you can omit the trailing '$' to handle this case but my false
laziness prevailed. Thanks for keeping me honest.
-- Jim Bowlin
------------------------------
Date: 1 Jul 1998 19:15:23 GMT
From: mike@stok.co.uk (Mike Stok)
Subject: Re: Formating output
Message-Id: <6ne1sb$s2e@news-central.tiac.net>
In article <359a4d5b.91572210@news.bigsky.net>,
Keith L. Miller <miller@bigsky.net> wrote:
>Okay, because of my last post, I FIRST READ THE FAQ before this post
>so PLEASE don'ttell me to go read the FAQ this time. If the answer is
>in the FAQ and I missed it then please point me to the location in the
>FAQ.
>
>Okay, here it goes.
>
>I have a number, say: 12345.67890
>
>I want to print it to look like: 12345.68
>
>I have looked through the printf and sprintf man pages, but did not
>understand exactly how to accomplish my goal. Can someone please
>help?
In the debugger:
DB<1> $pi = 22/7
DB<2> print $pi
3.14285714285714
DB<3> printf "pi is %.2f\n", $pi
pi is 3.14
DB<4> $pi = sprintf '%.2f', 22 / 7
DB<5> print "this is pi: $pi"
this is pi: 3.14
printf prints to a filehandle (STDOUT is the default currently selected
handle), and sprintf formats a string which you can store.
Hope this helps,
Mike
(hope TIAC's news server isn't *too* far behind now...)
--
mike@stok.co.uk | The "`Stok' disclaimers" apply.
http://www.stok.co.uk/~mike/ | PGP fingerprint FE 56 4D 7D 42 1A 4A 9C
http://www.tiac.net/users/stok/ | 65 F3 3F 1D 27 22 B7 41
stok@colltech.com | Collective Technologies (work)
------------------------------
Date: Wed, 01 Jul 1998 14:03:39 -0500
From: "Vincent M. Probasco" <probavm@h8mail.laf.cat.com>
Subject: Getting Oracle info with Perl
Message-Id: <359A880B.290B3593@h8mail.laf.cat.com>
Does anyone know of any good web sites that have information on
accessing an Oracle database
using Perl ? I don't remeber seeing anything in the FAQs and I haven't
really found anything too
usefull with search engines.
Thnx in advace,
vince
------------------------------
Date: Wed, 01 Jul 1998 11:40:51 -0700
From: Kevin Potter <krpotter@co.douglas.or.us>
Subject: HELP....! Very simple array sort question!
Message-Id: <359A82B3.7E25@co.douglas.or.us>
I have an array, containing data of the following format:
smith:25:main street:city:state:zip
rray is loaded by:
open(INFILE, "addrtable");
@ary = <INFILE>;
close(INFILE);
I would like to be able to sort this array into a new array, based on
the state field, or zip field. I'm somewhat new to Perl, have been
pouring over the man pages, but don't really understand the sort
function yet. Could anyone offer some help with a line or two or
code... THANKS.
I expect I need something like:
@sorted = sort { $a =~ /????/ <=> $b =~ /????/ } @ary;
But I'm stumped. Thanks to anyone who will help me!
Kevin
--
+----------------------------------------------------------------------+
|Kevin Potter Email: mailto:krpotter@co.douglas.or.us |
|Technical Support Manager Homepage: http://www.co.douglas.or.us |
|Douglas County Courthouse FTP Site: ftp://ftp.co.douglas.or.us |
|1036 SE Douglas Street Phone: (541) 440-4330 |
|Roseburg, OR 97470 Fax: (541) 440-6129 |
+----------------------------------------------------------------------+
------------------------------
Date: Wed, 01 Jul 1998 19:42:54 GMT
From: hex@voicenet.com (Matt Knecht)
Subject: Re: HELP....! Very simple array sort question!
Message-Id: <2jwm1.21$Du.237526@news2.voicenet.com>
Kevin Potter <krpotter@co.douglas.or.us> wrote:
>I have an array, containing data of the following format:
>smith:25:main street:city:state:zip
>rray is loaded by:
>
>open(INFILE, "addrtable");
>@ary = <INFILE>;
>close(INFILE);
>
>I would like to be able to sort this array into a new array, based on
>the state field, or zip field. I'm somewhat new to Perl, have been
>pouring over the man pages, but don't really understand the sort
>function yet. Could anyone offer some help with a line or two or
>code... THANKS.
perlfaq4 holds the answer. Specifically "How do I sort an array by
(anything)?".
You can use a Schwartzian Transform:
@ary = (
'smith:25:main street:city:9',
'smith:25:main street:city:1',
'smith:25:main street:city:3',
'smith:25:main street:city:2',
'smith:25:main street:city:5',
);
@sorted = map { $_->[0] }
sort { $a->[1] <=> $b->[1] }
map { [ $_, (split /:/)[4] ] } @ary;
$, = "\n";
print @sorted, "\n";
__END__
Which gives the expected:
smith:25:main street:city:1
smith:25:main street:city:2
smith:25:main street:city:3
smith:25:main street:city:5
smith:25:main street:city:9
Learn what this is doing... it's extremely useful and flexible.
--
Matt Knecht - <hex@voicenet.com>
"496620796F752063616E207265616420746869732C20796F7520686176652066
617220746F6F206D7563682074696D65206F6E20796F75722068616E6473210F"
------------------------------
Date: Wed, 01 Jul 1998 11:35:56 -0500
From: Dave Barnett <barnett@houston.Geco-Prakla.slb.com>
Subject: Re: how much filespace ?
Message-Id: <359A656C.DFEA4935@houston.Geco-Prakla.slb.com>
Sigi wrote:
>
> Russ Allbery <rra@stanford.edu> wrote:
>
> >du -s /var/test/job
> >
> >This is one of those cases where better tools already exist to solve the
> >problem and reimplementing them in Perl is likely a waste of your time.
>
> Ok. Thanks. I think I had tomatoes on my eyes. :-)
>
> But now there is a problem: If I check the filespace with "du -sPx
> directory" I get a wrong result! Example 1: filespace 500,404 bytes,
> du said 734 kbytes. Example 2: filespace 2,240 bytes, du said 12
> kbytes. What did I do wrong?
>
> Sigi.
>
Do a man du
Have a look at the -k option. If it is a POSIX compliant OS (I think
POSIX set that up), du defaults to reporting in 512 byte segments,
rather than 1024. The -k option tells it to use 1024 Byte segments.
HTH.
Dave
--
"Security through obscurity is no security at all."
-comp.lang.perl.misc newsgroup posting
----------------------------------------------------------------------
Dave Barnett U.S.: barnett@houston.Geco-Prakla.slb.com
DAPD Software Support Eng U.K.: barnett@gatwick.Geco-Prakla.slb.com
----------------------------------------------------------------------
------------------------------
Date: 1 Jul 1998 14:40:13 -0400
From: mjd@op.net (Mark-Jason Dominus)
Subject: Re: HOW TO: freestanding modules?
Message-Id: <6ndvqd$3qi$1@monet.op.net>
Keywords: bridgeable dewdrop foam young
In article <6nb3n7$aoo@news1.panix.com>,
k y n n <NOSPAMkEynOn@panix.comNOSPAM> wrote:
>a way to write a module so that it can also be called by itself as a
>freestanding script.
This strategy might be safer than what you suggest, because it doesn't
break if you rename the file. It might be very useful to be able to
make a symbolic link to your module, so that you could invoke it with
a more mnemonic name that didn't end with `.pm'.
Here's the trick:
package MyModule;
# ... subroutine definitions ...
if (caller) {
# I am a submodule
} else {
# I am a standalone
}
1;
You should also see the `diagnostics' module in the Perl distribution,
which is designed to be used in the way you want, both as an included
module and as a standalone script.
------------------------------
Date: 01 Jul 1998 14:49:03 -0400
From: Dean Pentcheff <dean@mail.biol.sc.edu>
Subject: Re: I can't nail down the uninitialized value :(
Message-Id: <m3ogv95rvk.fsf@mail.biol.sc.edu>
Tom Phoenix <rootbeer@teleport.com> writes:
> On Wed, 1 Jul 1998, Jim Bowlin wrote:
> > > if ($click == 1) {$message{body} .= $_; next SLURP;} # line 50
> > > Use of uninitialized value at Netscape.pm line 50, <ME> chunk 65.
> >
> > The solution is to initialize $message{body} = ''; before the SLURP loop.
>
> I don't know that that's _the_ solution. Using a recent version of perl
> would be my preferred solution. :-)
And _just_ after I've finally gotten myself into the consistent habit
of initializing all variables before concatenating to them or
incrementing them...
-Dean
--
N. Dean Pentcheff <pentcheff@acm.org>
Biological Sciences, Univ. of South Carolina, Columbia SC 29208 (803-777-7068)
------------------------------
Date: 1 Jul 1998 14:46:56 -0400
From: mjd@op.net (Mark-Jason Dominus)
Subject: Re: Need information about EMBEDDING Perl5
Message-Id: <6ne070$3sl$1@monet.op.net>
Keywords: embank nibble nodule purl
In article <6n835b$4ot$1@fir.prod.itd.earthlink.net>,
Andrew Friedl <affriedl@earthlink.net> wrote:
>Any information, hints, clues, URL's
>would be appreciated.
------------------------------
Date: Wed, 01 Jul 1998 20:41:39 -0700
From: Jan Krynicky <JKRY3025@comenius.ms.mff.cuni.cz>
Subject: Re: PerlScript Arrays
Message-Id: <359B0173.2AC1@comenius.ms.mff.cuni.cz>
Brent Johnson wrote:
>
> I had some problems porting Perl code to PerlScript.. one was the fact
> that @arrays did not work. I looked around on the web for any information
> about the differences in straight Perl and PerlScript. Here is the
> error message I get when I try to use it (and I'm using NT4 with IIS4, viewing
> with IE4).
>
> .....
> Active Server Pages error 'ASP 0141'
>
> Page Command Repeated
>
> /brent/temp.asp, line 67
>
> The @ command can only be used once within the Active Server Page.
> .....
>
> Any help would be appreciated,
>
> - Brent
This is not a problem of Perl per se.
ASP.dll thinks that the <% @array=... is some kind of command to it
and emits the error message even before passing that code to PerlSE.dll.
Try to change all
<% @...
to
<% 1; @...
or
<% # comment
@...
HTH, Jenda
------------------------------
Date: Wed, 1 Jul 1998 15:47:11 GMT
From: Jacqui.Caren@ig.co.uk (Jacqui Caren) (Jacqui Caren)
Subject: Re: Q: How to read AND write to a programm?
Message-Id: <EvFAIo.4v0@ig.co.uk>
In article <356F0128.EB@NOSPAM.pirate.de>,
Mark Seuffert <captain@NOSPAM.pirate.de> wrote:
>Hi,
>sure I can write to programm, for example to 'sendmail' to send mails.
>But now I have the problem, that I want also read what the programm
>writes back to STDOUT... what I wanna do:
>
>I want to execute this programm:
> /usr/local/bin/nc 194.1.2.3 9000
>then I write the following lines
> EXEC SELECT Name,Email FROM ADRESSEN
> END
>and now I wanna read what the programm writes to STDOUT
If the executable were sqlplus' - the oracle equivalent of this program?
then I would have given the following answer.
Please consider using one of the following modules...
DBI with a relevant DBD::* module.. (standard perl only)
or
Dave Roth's Win32::ODBC module. (activestate perl only)
This will allow you perl program to connect to your database
and execute the required query.
I include a rather antique DBI example. Read the DBI and the
relevant DBD driver documentation for more up-to-date info.
use DBI;
my $dbh = DBI->connect($database, $username,$password);
die "Could not connect to $username/$password\@$database" unless $dbh;
my $csr = $dbh->prepare("select Name,Email FROM ADRESSEN");
die $dbh->errstr if $dbh->err;
$dbh->execute();
die $dbh->errstr if $dbh->err;
my ($name,$email);
while (($name,$email) = $csr->fetchrow_array()) {
printf "%-20s %s\n", $name,$email;
}
die $dbh->errstr if $dbh->err;
$csr->close();
$dbh->disconnect();
remember that a fork/exec can be very expensive.
Likewise parsing the result (from text) can be a real
pain. DBI or the Win32::ODBC module are a much cleaner
solution.
Jacqui
--
Email: Jacqui.Caren@ig.co.uk http://www.ig.co.uk/
Fax : +44 1483 419 419 http://www.perlclinic.com/
Phone: +44 1483 424 424 http://www.perl.co.uk/
Paul Ingram Group Ltd,140A High Street,Godalming GU7 1AB United Kingdom
------------------------------
Date: Wed, 01 Jul 1998 20:05:51 +0200
From: aspa <aspa@mail.cern.ch>
Subject: Q: object's memory space
Message-Id: <359A7A7F.30E0497F@mail.cern.ch>
hi
is there a way for finding out how much memory space a certain perl
object occupies?
--
aspa
------------------------------
Date: Wed, 1 Jul 1998 10:04:31 -0700
From: "Christian Brink" <strat@pacifier.com>
Subject: Q:How to have perl script act like a printfilter
Message-Id: <359a6d0e.0@news.pacifier.com>
I am just beginning to teach myself perl. I would like to write a program
that strips just the beginning ff off of a printjob then passes it to the
existing filter (for which there is no setting for that, only strip all
ff's). I run Ultrix 4.3 using lp. This is more of a printcap/lp question
but my man pages for Ultrix on printcap,lp, and lpd are severely lacking.
The reason I am doing this I have over 100 diebold programs that the
software engineer felt it was necessary to hardcode an initial ff on all
printjobs (thinking that newer laser printers would not address that).
I thank you for any direction or solution you can provide (or just tell me
I'm in over my head until I learn some more Perl)
--
C. Christian Brink,CNE
IS-Manager
All-Sports Supply, LLC
Clackamas,OR
strat@pacifier.com
chrisb@assi.com
------------------------------
Date: Wed, 01 Jul 1998 17:55:51 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: Q:How to have perl script act like a printfilter
Message-Id: <Pine.GSO.3.96.980701105446.8511M-100000@user2.teleport.com>
On Wed, 1 Jul 1998, Christian Brink wrote:
> I would like to write a program that strips just the beginning ff off of
> a printjob then passes it to the existing filter
Sounds like a plan. How far have you gotten? :-)
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Wed, 1 Jul 1998 11:12:31 -0700
From: "Christian Brink" <strat@pacifier.com>
Subject: Re: Q:How to have perl script act like a printfilter
Message-Id: <359a7c6c.0@news.pacifier.com>
Tom Phoenix wrote in message ...
>On Wed, 1 Jul 1998, Christian Brink wrote:
>
>> I would like to write a program that strips just the beginning ff off of
>> a printjob then passes it to the existing filter
>
>Sounds like a plan. How far have you gotten? :-)
>
>--
>Tom Phoenix Perl Training and Hacking Esperanto
>Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
>
The wondering how to take the arguments from lpd?
Does the print file come from lpd as a filename to open? is it piped?
Do I need to pass the LPD arguments to the next print filter?
------------------------------
Date: 1 Jul 1998 17:25:22 GMT
From: bday@mtv03install2.eng.sun.com (Brian Day)
Subject: reading in line-at-a-time
Message-Id: <6ndre2$8ks$1@engnews2.Eng.Sun.COM>
I am extremely new to Perl, and was wondering if the stdin operator
reads in until white space is encountered, or does it read in the
whole line. If it only reads in a word at a time, is there some way,
like the getline( ) function from C++, to read in the whole line.
Thanks very much,
Brian
------------------------------
Date: Wed, 01 Jul 1998 17:57:55 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: reading in line-at-a-time
Message-Id: <Pine.GSO.3.96.980701105618.8511N-100000@user2.teleport.com>
On 1 Jul 1998, Brian Day wrote:
> I am extremely new to Perl, and was wondering if the stdin operator
> reads in until white space is encountered, or does it read in the
> whole line.
I think you mean the line input operator, which looks something like <FH>.
This is documented in perlop under "I/O Operators". Hope this helps!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: 1 Jul 1998 18:23:57 GMT
From: gebis@albrecht.ecn.purdue.edu (Michael J Gebis)
Subject: Re: reading in line-at-a-time
Message-Id: <6ndurt$qn9@mozo.cc.purdue.edu>
bday@mtv03install2.eng.sun.com (Brian Day) writes:
}I am extremely new to Perl, and was wondering if the stdin operator
}reads in until white space is encountered, or does it read in the
}whole line. If it only reads in a word at a time, is there some way,
}like the getline( ) function from C++, to read in the whole line.
Run to accounting, grab an expense report, and on the way to your car,
write "Learning Perl, Schwartz et al" on it. You will be a much
happier person for it. It is good.
The answer to your question is: If you use the angle brackets, it will
read the whole line. Unless you change the input record separator,
known as "$/". But don't do that until you read _Learning Perl_.
(You may wish to spend the rest of the day visiting www.perl.com, and
reading the FAQ located there. It too is good.)
--
Mike Gebis gebis@ecn.purdue.edu mgebis@eternal.net
------------------------------
Date: 1 Jul 1998 19:24:49 GMT
From: kortbein@iastate.edu (Josh Kortbein)
Subject: Re: reading in line-at-a-time
Message-Id: <6ne2e1$3b2$2@news.iastate.edu>
Brian Day (bday@mtv03install2.eng.sun.com) wrote:
: I am extremely new to Perl, and was wondering if the stdin operator
: reads in until white space is encountered, or does it read in the
: whole line. If it only reads in a word at a time, is there some way,
: like the getline( ) function from C++, to read in the whole line.
In normal situations, it reads in the whole line.
from man perlop:
Evaluating a filehandle in angle brackets yields the next line from that
file (newline, if any, included), or undef at end of file. Ordinarily you
...
You can alter this behavior by playing with the input record separator
variable, but that's another story.
Josh
--
_________________________________________________________
I do not trust your bitch.
- Frederich Nietzche, in _Also Sprach Zarathustra_
------------------------------
Date: Wed, 01 Jul 1998 11:33:09 -0500
From: Dave Barnett <barnett@houston.Geco-Prakla.slb.com>
Subject: Re: Running Unix Script in Perl
Message-Id: <359A64C5.A39D1B1D@houston.Geco-Prakla.slb.com>
Steve Leach wrote:
>
> Is it possible to run a unix script from within a perl script.
>
> If so HOW ? (its got me stuck).
>
> Thanks
>
> Steve
Have a look at system (perldoc -f system), exec (perldoc -f exec) and ``
(those are backtick operators. Look them up in the Blue Camel (and the
Llama?).
perldoc perlop will give you more info on `` (Search for 'Quote').
`` allows you to capture the output
system allows you to run the command
exec behaves just like in the shell. A new process is spawned that
overwrites the current one.
HTH.
Dave
--
"Security through obscurity is no security at all."
-comp.lang.perl.misc newsgroup posting
----------------------------------------------------------------------
Dave Barnett U.S.: barnett@houston.Geco-Prakla.slb.com
DAPD Software Support Eng U.K.: barnett@gatwick.Geco-Prakla.slb.com
----------------------------------------------------------------------
------------------------------
Date: Wed, 01 Jul 1998 12:05:08 -0700
From: mbudash@sonic.net (Michael Budash)
Subject: Re: Title Caps
Message-Id: <mbudash-0107981205090001@d71.pm9.sonic.net>
In article <6nba3s$be7$1@cedar.liii.com>, rglick@liii.com (Ron Glick) wrote:
>> In article <359831C3.45E05923@westaff.com>, Richard Remington
<rremington@westaff.com> wrote:
>> >I've been working on a something I'm sure someone has done before. I'm
>> >pulling ascii data from an Oracle database using DBI. The data I get is
>> >sometimes all caps, sometimes lower case, and sometimes title caps. I
>> >want to convert everything to lower case and then convert to title caps.
>> <snip>
>>
>> Richard,
>>
>> Try this code. It uses the offset parameter of the index function to
>> continuously loop through all the spaces in the string. It assumes that you
>> want the first letter and every letter after a space capitalized. It also
>> assumes you haven't messed with $[ (and God help you if you have).
>>
>> $scalar="\u\L$scalar";
>> $last=0;
>> while (1) {
>> $space_pos=index($scalar,' ',$last);
>> last if ($space_pos == -1);
>> substr($scalar,($space_pos+1),1) =~ tr/a-z/A-Z/;
>> $last=$space_pos+1;
>> }
>>
i used this (from a browser, hence the cgi-ish stuff) and it seemed to
work well:
#!/usr/local/bin/perl -w
print "Content-type: text/plain\n\n";
my $text = 'thiS Is a TeSt of coNVERting TO tItle cAPs';
print "BEFORE: '$text'\n\n";
$text =~ s/^(\S)/uc($1)/e; # capitalize first non-space character
# anybody know how to
include this in the next line??
$text =~ s/(\s+)(\S)([^\s]*)/doit($1,$2,$3)/eg; # couldn't seem to make
it work without a subroutine... damn!
print " AFTER: '$text'\n";
sub doit {
local ($spaces, $first_letter, $rest_of_word) = @_;
return ($spaces . uc($first_letter) . lc($rest_of_word));
}
--
Michael Budash, Owner * Michael Budash Consulting
707-255-5371 * 707-258-7800 x7736
mbudash@sonic.net
------------------------------
Date: Wed, 1 Jul 1998 12:34:58 -0500
From: "Ric Alcazar" <alcazar@netcomp.net>
Subject: Using the read function...?
Message-Id: <eqOZCaRp9GA.75@upnetnews03>
Hello all,
I'm relatively new to perl and would like to some help concerning the read
function and its syntax. Take this scenario:
If I wanted to read lines 2 and 4 from a text file similiar to one below...
this is line1
this is line2
and yet another line
and the last line
... each are placed on newlines. What would the syntax be? Also, does
whitespace after text on a line significant? What syntax do I use to read
only a specified line if text on that line is indefinite?
thank you for your help.
Ric
------------------------------
Date: Wed, 01 Jul 1998 14:16:33 -0400
From: RICHARD PROULX <richard.proulx@sun.com>
Subject: Vertical Perl
Message-Id: <359A7D01.CCDAE9F1@sun.com>
Hi, (Don't know if this made it the first time? It's my 1st time using
news: from netscape's communicator)
Please E-Mail me @ Richard.Proulx@SUN.com
I am a first time Perl user, actually I have used it for about
four days now.
I am trying to print text out vertically from it's horizontal
input:
e.g.
Input = 'string'
Output = 's
t
r
i
n
g'
The purpose is to generate:
headerless
: text-wfi_config ( -- )
\ - _________________________________________________________________
\ - |3|3|2|2|2|2|2|2|2|2|2|2|1|1|1|1|1|1|1|1|1|1|0|0|0|0|0|0|0|0|0|0|
\ - |1|0|9|8|7|6|5|4|3|2|1|0|9|8|7|6|5|4|3|2|1|0|9|8|7|6|5|4|3|2|1|0|
\ - |---------------------------------------------------------------|
." |r r r r|f f f f|c c c c|r r|s|r|d|e|r r r r|n n|r r|l|r r|s|s|s|"
cr
." |s s s s|t t t t|a a a a|s s|a|t|i|n|s s s s|i i|s s|o|a a|e|n|n|"
cr
." |v v v v|q q q q|m m m m|v v|_|s|s|a|v v v v|d d|v v|o|m m| |^ ^|"
cr
." |d d d d|_ _ _ _|_ _ _ _|d d|s|f|a|b|d d d d|^ ^|d d|p|^ ^| |1 0|"
cr
." | |p p p p|c c c c| |h|_|b|l| |1 0| |b|1 0| |v v|"
cr
." | |a a a a|n n n n| |o|e|l|e| |v v| |a|v v| | |"
cr
." | |u u u u|t t t t| |r|n|e|_| | | |c| | | |"
cr
." | |s s s s|^ ^ ^ ^| |t|a|_|p| | | |k| | | |"
cr
." | |e e e e|3 2 1 0| |c|b|h|r| | | |_| | | |"
cr
." | |_ _ _ _|v v v v| |u|l|b|e| | | |e| | | |"
cr
." | |c c c c| | |t|e|u|f| | | | | | | |"
cr
." | |n n n n| | |_| |s|e| | | | | | | |"
cr
." | |t t t t| | |e| |_|t| | | | | | | |"
cr
." | |^ ^ ^ ^| | | | |e|c| | | | | | | |"
cr
." | |3 2 1 0| | | | |c|h| | | | | | | |"
cr
." | |v v v v| | | | | | | | | | | | | |"
cr
\ - _________________________________________________________________
\ - |0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|"
cr
\ - _________________________________________________________________
;
given each field name and range as string and integer scalar variables:
i.e. for the "ftq_pause_cnt" field
$string = "ftq_pause_cnt";
$msb = 27;
$lsb = 24;
I can assume a fixed 80x24 character array if needed.
Questions:
Is there a way to access string elements like
$string[2] = "t" for aboce example
Is there a such thing as character arrays like:
$character_array = (80,24) where $character_array[0,0] gives you the top
row, left column character of the array.
I hope this gives you an idea of what I am trying to accomplish and the
course I am taking.
Thanks
--
/\ Richard A. Proulx
\\ \ Diagnostic/FirmWare/Verification/Embedded Engineer
\ \\ / Sun Microsystems Inc.
/ \/ / / Five Omni Way
/ / \//\ M/S Uchl05-105 Office Uchl05-1324
\//\ / / Chelmsford, MA 01824
/ / /\ / Phone: +01 (978) 442-0522 (x20522)
/ \\ \ Fax: +01 (978) 442-1646
\ \\ Pager: 1-800-759-8888 PIN# 485-7614
\/ EMail: Richard.Proulx@SUN.com
------------------------------
Date: Wed, 01 Jul 1998 13:27:05 -0400
From: Oleg Beregovich <oberegov@pathfinder.com>
Subject: Virtual functions.
Message-Id: <359A7169.185AC910@pathfinder.com>
Can I have pure virtual functions implemented in package.
I want to overload it in derived packages (I will have this function
overloaded in more than one package). If its possible could somebody
write
few lines as an example.
Thanks.
------------------------------
Date: Wed, 01 Jul 1998 18:20:33 GMT
From: John Porter <jdporter@min.net>
Subject: Re: Virtual functions.
Message-Id: <359A7FB6.7072@min.net>
Oleg Beregovich wrote:
>
> Can I have pure virtual functions implemented in package.
> I want to overload it in derived packages (I will have this function
> overloaded in more than one package). If its possible could somebody
> write few lines as an example.
Well, you can't have "pure virtual" methods in the C++ sense, where
they *must* be overridden by the derived class or else kablooi.
But you can get the same effect by writing it that way:
class Parent;
sub good_looks {
my $self = shift;
die "Error: called $self->good_look( @_ ), not overridden!";
}
class Child;
@ISA = qw( Parent );
sub good_looks {
my $self = shift;
$self->preen();
}
my $sis = new Child;
my $dad = new Parent;
$sis->good_looks(); # o.k., calls preen()
$dad->good_looks(); # dies
--
John Porter
------------------------------
Date: 8 Mar 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 8 Mar 97)
Message-Id: <null>
Administrivia:
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.
The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V8 Issue 3039
**************************************