[15862] in Perl-Users-Digest
Perl-Users Digest, Issue: 3275 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Jun 7 09:05:27 2000
Date: Wed, 7 Jun 2000 06:05:14 -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: <960383114-v9-i3275@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Wed, 7 Jun 2000 Volume: 9 Number: 3275
Today's topics:
[Perl] How to find the Perl FAQ <rootbeer&pfaq*finding*@redcat.com>
Re: [Q] access remote oracle in perl <gellyfish@gellyfish.com>
Re: Activeware perl 313 and makemake.pm <abe@ztreet.demon.nl>
Re: counter script in Perl <gellyfish@gellyfish.com>
Dumb question.. How to prompt the user and get the inpu <mattking@techie.com>
Re: Dumb question.. How to prompt the user and get the <mattking@techie.com>
exists() on sub-hash creates a key in super-hash <szhzp2@no.spam.com>
Re: exists() on sub-hash creates a key in super-hash (Clinton A. Pierce)
Re: Extracting info from /etc/printcap <gellyfish@gellyfish.com>
Re: Fill In With Spaces Command <steve@gte.net>
Re: ftp client - PERL <gellyfish@gellyfish.com>
Re: getpwnam and Shadow Passwords <gellyfish@gellyfish.com>
Re: good perl coding style (Peter J. Acklam)
Re: good perl coding style (Bart Lateur)
Re: how to return multiple hashtables from sub (Eric Bohlman)
Re: Net::Ping keeps returning 0? <syjef@mail.mdanderson.org>
Re: New user: Accessing C APIs <gellyfish@gellyfish.com>
ODBC, DBI Column Types Won't Bind? bayers@my-deja.com
open an array? <nasobem_hh@my-deja.com>
Re: Perl and memory consumption <dan@tuatha.sidhe.org>
Re: Perl and memory consumption <dan@tuatha.sidhe.org>
Ruby -- A better OO Perl than Perl? Python 3000 feature <schneiker@jump.net>
Re: shell command <you.will.always.find.him.in.the.kitchen@parties>
smtp socket not working eddie.bragg@wize.net
Re: smtp socket not working <red_orc@my-deja.com>
Re: Stupid Question: scripts won't recognize opening li <rereidy@indra.com>
Re: Tar module <gellyfish@gellyfish.com>
Re: the end of perl? <flavell@mail.cern.ch>
Re: Value of <HANDLE> construct can be "0" ??? <gellyfish@gellyfish.com>
Re: Win32 Perl read weirdness <flavell@mail.cern.ch>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 07 Jun 2000 10:22:49 GMT
From: Tom Phoenix <rootbeer&pfaq*finding*@redcat.com>
Subject: [Perl] How to find the Perl FAQ
Message-Id: <pfaqmessage960373441.28260@news.teleport.com>
Archive-name: perl-faq/finding-perl-faq
Posting-Frequency: weekly
Last-modified: 29 Apr 2000
[ That "Last-modified:" date above refers to this document, not to the
Perl FAQ itself! The last _major_ update of the Perl FAQ was in Summer
of 1998; of course, ongoing updates are made as needed. ]
For most people, this URL should be all you need in order to find Perl's
Frequently Asked Questions (and answers).
http://www.cpan.org/doc/FAQs/
Please look over (but never overlook!) the FAQ and related docs before
posting anything to the comp.lang.perl.* family of newsgroups.
For an alternative way to get answers, check out the Perlfaq website.
http://www.perlfaq.com/
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
Beginning with Perl version 5.004, the Perl distribution itself includes
the Perl FAQ. If everything is pro-Perl-y installed on your system, the
FAQ will be stored alongside the rest of Perl's documentation, and one
of these commands (or your local equivalents) should let you read the FAQ.
perldoc perlfaq
man perlfaq
If a recent version of Perl is not properly installed on your system,
you should ask your system administrator or local expert to help. If you
find that a recent Perl distribution is lacking the FAQ or other important
documentation, be sure to complain to that distribution's author.
If you have a web connection, the first and foremost source for all things
Perl, including the FAQ, is the Comprehensive Perl Archive Network (CPAN).
CPAN also includes the Perl source code, pre-compiled binaries for many
platforms, and a large collection of freely usable modules, among its
560_986_526 bytes (give or take a little) of super-cool (give or take
a little) Perl resources.
http://www.cpan.org/
http://www.perl.com/CPAN/
http://www.cpan.org/doc/FAQs/FAQ/html/
http://www.perl.com/CPAN/doc/FAQs/FAQ/html/
You may wish or need to access CPAN via anonymous FTP. (Within CPAN,
you will find the FAQ in the /doc/FAQs/FAQ directory. If none of these
selected FTP sites is especially good for you, a full list of CPAN sites
is in the SITES file within CPAN.)
California ftp://ftp.cdrom.com/pub/perl/CPAN/
Texas ftp://ftp.metronet.com/pub/perl/
South Africa ftp://ftp.is.co.za/programming/perl/CPAN/
Japan ftp://ftp.dti.ad.jp/pub/lang/CPAN/
Australia ftp://cpan.topend.com.au/pub/CPAN/
Netherlands ftp://ftp.cs.ruu.nl/pub/PERL/CPAN/
Switzerland ftp://sunsite.cnlab-switch.ch/mirror/CPAN/
Chile ftp://ftp.ing.puc.cl/pub/unix/perl/CPAN/
If you have no connection to the Internet at all (so sad!) you may wish
to purchase one of the commercial Perl distributions on CD-Rom or other
media. Your local bookstore should be able to help you to find one.
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
Comments and suggestions on the contents of this document
are always welcome. Please send them to the author at
<pfaq&finding*comments*@redcat.com>. Of course, comments on
the docs and FAQs mentioned here should go to their respective
maintainers.
Have fun with Perl!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: 7 Jun 2000 09:06:38 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: [Q] access remote oracle in perl
Message-Id: <8hkvqe$t9f$1@orpheus.gellyfish.com>
On Tue, 06 Jun 2000 14:14:27 GMT madsere@my-deja.com wrote:
> In article <akGW4.2017$%E1.29383@news2.bora.net>,
> "±èµ¿¿í" <baksoo@serome.co.kr> wrote:
>> We have a problem with accessing remote oracle DB from perl script in
>> another machine
>> Our system configuration is as follows:
>> site A : linux, apache web server, perl scripts running here
>> site B : solaris, oracle database server
>>
>> We have to access oracle(site B) from perl script(site A).
>> I am told that DBI and DBD are required.
>> My question arises at this point.
>>
>> Question 1. Does Oracle have to be installed in site A to install DBD?
>> 1-1. Is it possible that DBD binary is built in another
> machine and
>> moved to site A?
>>
>> Question 2. After DBD is built successfully, sql*net is still
> required in
>> site A?
>>
>
> I have Machine A and B as you describe below, but both with Oracle
> *installed* - however on machine A nothing is active, i.e. the
> Oralistener is shut down - and it still works fine connecting from A
> to the DB on B.
>
> I now need to install DBD::Oracle on "C" - a machine that doesnt have
> Oracle installed (and that I can't install Oracle to) so I have same
> question as you in point 1. No answers though.
>
You will need to install the appropriate Oracle client libraries on the
machine for DBD::Oracle to be installed and working - there is no way
around it as far as I know.
/J\
--
Here's good news! According to this eye-catching article, SAT scores
are declining at a slower rate!
--
fortune oscar homer
------------------------------
Date: Wed, 07 Jun 2000 12:53:49 +0200
From: Abe Timmerman <abe@ztreet.demon.nl>
Subject: Re: Activeware perl 313 and makemake.pm
Message-Id: <o89sjsgak7cldp1tjrsu2ut0ag1a6afs53@4ax.com>
[please don't quote up-side-down]
On Wed, 7 Jun 2000 09:03:23 +0100, "Paul D.Smith" <pds@x-datcon.co.uk>
wrote:
> "Abe Timmerman" <abe@ztreet.demon.nl> wrote in message
> news:ilhqjso8nf432qbeives3tskfctcp90ht4@4ax.com...
> > On Tue, 6 Jun 2000 16:20:30 +0100, "Paul D.Smith" <pds@x-datcon.co.uk>
> > wrote:
> >
> > > Anyone hit this? I have tried to install some Perl libraries (libnet)
> but
> > > have found that ExtUtils/MakeMaker.pm is absent. This is with the
> Windows
> > > NT Activeware port of Perl (build 313). Anyone know the "correct"
> solution
> > > to this?
> > >
> > > FYI: I cannot upgrade as this is the "official and supported" version of
> > > Perl which we currently use. No doubt in time we'll upgrade but for now,
> > > this is what I have :-).
> > Well since it is official and *supported*, ask whoever supports this
> > rather old version. If they won't help you, it's not supported I would
> > say.
>
> Aha - by "official and supported" I meant that if I have a problem using
> tools which were written "in house" using this version of Perl then I get
> support but if I try to go "off the beaten track" then I'm on my own. And
> the old adage "if it ain't broke, don't fix it" is rigourously applied until
> we find an "official" need to "move up" to a later level of Perl.
If it doesn't support ExtUtils::MakeMaker it _is_ broke!
There are security reasons for not using perls before 5.004_??, but I
don't feel like doing your homework.
For me (and you I hope), that version of perl is broke, so it should be
fixed :-)
Or are you expected to use the Office 95 suite aswell?
>
> Thanks for the suggestions though. I'll try "ActiveWare".
They are now called ActiveState, and don't support any perl before 522 I
would guess. (It's been 3 odd years since they changed!)
--
Good luck,
Abe
------------------------------
Date: 7 Jun 2000 09:09:37 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: counter script in Perl
Message-Id: <8hl001$tri$1@orpheus.gellyfish.com>
On Tue, 6 Jun 2000 11:52:04 -0400 M.E. wrote:
> I've posted this to alt.html.tags to see if it was something I was missing
> in the html coding. I've also posted this in the
> alt.uu.comp.os.linux.questions newsgroup to see if it was something I was
> missing that I should do in linux. But I haven't received any comments. SO -
> I'm trying here to see if there's something I should be doing in perl:
> -----------------------------------------------------------
>
> I'm trying to use a simple graphical counter on a web page on a linux box.
> The html I'm using to call the counter program is:
>
> <IMG SRC="cgi-bin/counter.pl">
>
> All that shows up is a broken graphic icon and not the counter images.
>
> I'm wondering if there's something I'm missing in regards to the above tag.
> Should it be coded differently? Has anyone had success with such a thing?
>
I'm not quite sure what it has to do with Perl but you are missing a '/'
/J\
--
Friendship is far more tragic than love. It lasts longer.
--
fortune oscar homer
------------------------------
Date: Wed, 7 Jun 2000 13:05:50 +0200
From: "Matt King" <mattking@techie.com>
Subject: Dumb question.. How to prompt the user and get the input.
Message-Id: <8hlabd$1cb8$1@news2atm.raleigh.ibm.com>
I have been hammering these docs, and the perldoc - f/q, but I just can not
find this simple thing. I need to be able to prompt the use for input, save
the input into a var and then work with the var.
I'm using Active Perl for Win32. The script will be ran from a DOS window. I
was thinking that it would be something like $input=stdin; but I can't find
it in the docs or with the search program nor does it work.
Matt
------------------------------
Date: Wed, 7 Jun 2000 14:55:25 +0200
From: "Matt King" <mattking@techie.com>
Subject: Re: Dumb question.. How to prompt the user and get the input.
Message-Id: <8hlgp6$kme$1@news2atm.raleigh.ibm.com>
I found it. I wasn't far off in my thinking...
$input = <stdin>;
Man, that simple, and it took forever to find it.
Matt
Matt King <mattking@techie.com> wrote in message
news:8hlabd$1cb8$1@news2atm.raleigh.ibm.com...
> I have been hammering these docs, and the perldoc - f/q, but I just can
not
> find this simple thing. I need to be able to prompt the use for input,
save
> the input into a var and then work with the var.
>
> I'm using Active Perl for Win32. The script will be ran from a DOS window.
I
> was thinking that it would be something like $input=stdin; but I can't
find
> it in the docs or with the search program nor does it work.
>
> Matt
>
>
------------------------------
Date: Wed, 7 Jun 2000 12:26:12 +0200
From: Vincent <szhzp2@no.spam.com>
Subject: exists() on sub-hash creates a key in super-hash
Message-Id: <Pine.LNX.4.21.0006071128250.2482-100000@w01b04vc.flur.zuerich.ubs.ch>
Hi All,
Following program:
$hash{'foo'}{'bar'} = 'foobar';
print "PASS 1 ", join(', ', keys(%hash)), "\n";
print "PASS 2\n" if (exists($hash{'bar'}{'foo'}));
print "PASS 3 ", join(', ', keys(%hash)), "\n";
print "PASS 4 $hash{'bar'}\n";
print "PASS 5 ", join(', ', keys(%{$hash{'bar'}})), "\n";
Produces following output:
PASS 1 foo
PASS 3 foo, bar
PASS 4 HASH(0xb7828)
PASS 5
Discussion:
- $hash{'foo'}{'bar'} is set to 'foobar'. (No big deal)
- Hence, %hash contains one key: 'foo'
- The test with 'exists()' for $hash{'bar'}{'foo'} obviously fails. But,
it seems to create a key 'bar' in %hash with a reference to an empty
hash.
(FYI, 'defined()' in stead of 'exists()' or an assignement like
'$x = $hash{'bar'}{'foo'}' both produce the same behaviour)
Question:
Is this behaviour 'as designed', an ommision in the design or a bug?
Version info:
I've tested this with version 5.004_04.
Cheers,
Vincet Zocca
--
Vincent Zocca
Vincent.Zocca@UBS.com
Usual disclaimer:
Opinions expressed here are explicitly my own and not of UBS!!!
------------------------------
Date: Wed, 07 Jun 2000 11:50:19 GMT
From: clintp@geeksalad.org (Clinton A. Pierce)
Subject: Re: exists() on sub-hash creates a key in super-hash
Message-Id: <%Fq%4.101494$h01.802852@news1.rdc1.mi.home.com>
[Posted and mailed]
In article <Pine.LNX.4.21.0006071128250.2482-100000@w01b04vc.flur.zuerich.ubs.ch>,
> Question:
> Is this behaviour 'as designed', an ommision in the design or a bug?
This feature is called autovivification. perldoc perlref for more
information.
--
Clinton A. Pierce Teach Yourself Perl in 24 Hours!
clintp@geeksalad.org for details see http://www.geeksalad.org
"If you rush a Miracle Man,
you get rotten Miracles." --Miracle Max, The Princess Bride
------------------------------
Date: 7 Jun 2000 08:47:12 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Extracting info from /etc/printcap
Message-Id: <8hkum0$r7b$1@orpheus.gellyfish.com>
On Tue, 06 Jun 2000 10:19:57 GMT scarey_man@my-deja.com wrote:
> Is there a perl modules for getting information on print queues e.g.
> Remote Port (rp), Remote Machine (rm), Spool Directory (sd) for a
> specified queue?
I'd go for something like this but it is before 09.00 so I wouldnt take
my word for it.
#!/usr/bin/perl -w
#
use strict;
my $printcap_file = '/etc/printcap';
open(PRINTCAP,$printcap_file) || die "Can't open $printcap_file - $!\n";
my $line;
my %attrs;
while (<PRINTCAP>)
{
next if (/^#/ || /^\s*$/);
chomp;
s/^\s+//g;
s/\s+$//g;
$line .= $_;
unless ($line =~ s/\\$//g)
{
$line =~ s/::+/:/g;
my @line = split /:/,$line;
my $printer = shift @line;
%{$attrs{$printer}} = map { my ($key,$value) = split /=/ ;
$value ||= '';
($key, $value);
} @line;
$line = '';
}
}
foreach my $printer (keys %attrs)
{
print "$printer :\n";
foreach my $attribute (keys %{$attrs{$printer}})
{
print "\t$attribute : $attrs{$printer}->{$attribute}\n";
}
}
/J\
--
Ahh, the college roadtrip. What better way to spread beer fueled mayhem?
--
fortune oscar homer
------------------------------
Date: Wed, 07 Jun 2000 12:53:13 GMT
From: "SteveSingletary" <steve@gte.net>
Subject: Re: Fill In With Spaces Command
Message-Id: <ZAr%4.108$oH1.24429@dfiatx1-snr1.gtei.net>
Got it!!! Thank you all so much. I'm sure I'll be talking to you all soon!
Thanks,
Steve
SteveSingletary <steve@gte.net> wrote in message
news:ILe%4.2335$ee7.158997@dfiatx1-snr1.gtei.net...
> What is the best way to fill a field in with spaces. example - I fill in
a
> field with "Steve". When I write this field to my file I need the field
to
> be a fixed 25 spaces. Is there an easy way to write the Steve variable to
> my file and fill in the remainder with spaces?
> Thanks
> Steve
>
>
------------------------------
Date: 7 Jun 2000 09:14:12 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: ftp client - PERL
Message-Id: <8hl08k$unj$1@orpheus.gellyfish.com>
On Mon, 05 Jun 2000 23:35:34 GMT Brian A wrote:
> I want to allow others to upload to my site using standard ftp
> software on their computers. I want to be able to restrict access as
> necessary to each individual user.
Then you want to read the documentation for the ftp daemon software
on your server.
/J\
--
What is abnormal in Life stands in normal relations to Art. It is the
only thing in Life that stands in normal relations to Art.
--
fortune oscar homer
------------------------------
Date: 6 Jun 2000 22:14:17 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: getpwnam and Shadow Passwords
Message-Id: <8hjpj9$avj$1@orpheus.gellyfish.com>
On Mon, 05 Jun 2000 13:40:02 +0200 Marco Natoni wrote:
> Andreas,
>
> Andreas Kahari wrote:
>>> I wonder if someone can point me to a module (or give me just a
>>> tip) in order to verify the UNIX authentication of an user when
>>> the shadow password system is used.
>> It's in the FAQ: "perldoc -q shadow"
>
> Yes, indeed. But, as a terrifying caveat recites, "If perl was
> installed correctly, and your shadow library was written properly, the
> getpw*() functions described in the perlfunc manpage should in theory
> provide (read-only) access to entries in the shadow password file.".
>
> That theory is unfortunately not effective for my system: In fact,
> getpwname returns a disconsolate 'x' in the password field.
>
In 5.6.0 this has been fixed for OS that have System V style shadow
password functions (such as Linux or SCO ) although it still says the
same thing in perlfunc - I have submitted a doc patch via perlbug.
/J\
--
It's a good thing that beer wasn't shaken up any more, or I'd have looked
quite the fool. An april fool, as it were.
--
fortune oscar homer
------------------------------
Date: 07 Jun 2000 12:30:42 +0200
From: jacklam@math.uio.no (Peter J. Acklam)
Subject: Re: good perl coding style
Message-Id: <wkzooxdbql.fsf@math.uio.no>
abigail@arena-i.com (Abigail) writes:
> And there's also PostScript, that has
>
> COND {BLOCK} {BLOCK} ifelse
>
> (Of course, that still has the condition on the left).
And the HP48 handheld calculator that has
COND VALUE1 VALUE2 IFTE
which leaves VALUE1 or VALUE2 on the stack depending on COND.
Peter
--
$\="\n";$_='The quick brown fox jumps over the lazy dog';print +(split
//)[20,5,24,31,3,36,14,12,31,1,2,11,9,23,33,29,35,15,32,36,7,8,28,29];
------------------------------
Date: Wed, 07 Jun 2000 12:16:52 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: good perl coding style
Message-Id: <39403b64.19262307@news.skynet.be>
W Kemp wrote:
>So perhaps the "if X then Y " logic is better for the brain of a C
>programmer ( back to the start of the thread).
I'll give you a counter-example.
if(!(pfile = fopen(filename, "r"))) {
die("Cannot open file");
}
The visual focus is on the code in the code block. However, this is only
an error condition, which only happens if the main functionality of this
code fails. That main functionality is wel hidden inside the if
condition test. The purpose is to open a file and abort if it fails, not
abort if some condition isn't met!
It's all a matter of focus.
--
Bart.
------------------------------
Date: 7 Jun 2000 11:49:41 GMT
From: ebohlman@netcom.com (Eric Bohlman)
Subject: Re: how to return multiple hashtables from sub
Message-Id: <8hlcsl$pa$1@slb6.atl.mindspring.net>
Patrick_Krusenotto (pkrusenoNOpkSPAM@ley.de.invalid) wrote:
: Hello,
: i have a problem with the return function.
:
: my sub shall return three hashtables to the caller. Ive tried
: this by "return (%a,´%b,%c)".
: if i call my function with "(%x,%y,%z) = foo()" , the caller
: receives the three tables unified in %x. What do I wrong ?
You've forgotten that a hash in list context flattens out to a list, and
therefore several hashes in list context flatten out to a single list.
Your sub needs to return a list of hash *references* and your caller
needs to dereference them. Read perlref if you haven't already done so.
------------------------------
Date: Wed, 7 Jun 2000 07:54:25 -0500
From: "Jonathan Fosburgh" <syjef@mail.mdanderson.org>
Subject: Re: Net::Ping keeps returning 0?
Message-Id: <393dab24$1@mdanews.mdacc.tmc.edu>
"Helza" <xxx@planet.nl> wrote in message
news:8hk2pt$6vc99$1@reader3.wxs.nl...
> Hi,
>
> After reading some post for the problems i had (pinging a server to see
if
> its online) i got the suggestion to use the net::ping command.
>
> The problem is that i tryed using it but for some unknown reason it always
> returns 0 to me, even though i'm 100% sure the ip/server is online..
> Nomatter what I try
>
>
> Any suggestions? :)
>
> I use the following code:
> ----
>
> #!/usr/bin/perl
>
> use Net::Ping;
>
> $host = "216.147.115.199";
> $p = Net::Ping->new();
> $retval = $p->ping($host,5);
> $p->close();
>
> print "Content-type: text/html\n\n";
> print "$retval";
>
> ----------
>
>
I've had Net::Ping give me trouble with anything other than icmp pings
(which require root). I can't remember what Net::Ping defaults to, but you
might try "tcp"/"udp"/"icmp" in the new() and see if any of them work for
you.
------------------------------
Date: 7 Jun 2000 09:26:04 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: New user: Accessing C APIs
Message-Id: <8hl0us$1b4$1@orpheus.gellyfish.com>
On Mon, 05 Jun 2000 20:02:22 GMT rpool@my-deja.com wrote:
>
> I have been asked to write a perl script to interface with OpenView's
> API, which is a C API, so that specific events will be given to the
> script to handle.
You will probably want to read the perlxstut manpage in the first place.
/J\
--
Mmmm, sacrilicious.
--
fortune oscar homer
------------------------------
Date: Wed, 07 Jun 2000 12:41:00 GMT
From: bayers@my-deja.com
Subject: ODBC, DBI Column Types Won't Bind?
Message-Id: <8hlfsp$s2f$1@nnrp1.deja.com>
I can't seem to get the column types to bind. Everything from the
originating source wants to be a varchar. I have to use
MSSQL 'convert' feature to convert the strings back into float.
Works fine otherwise.
Thanks in advance.
===================================================
use DBI;
$db2 = DBI->connect('dbi:ODBC:MSSQL', 'user', 'password', { RaiseError
=> 1});
$db2->do("DROP TABLE SIS");
$db2->do(qq{CREATE TABLE "dbo"."SIS" (
"STUDENT_ID" varchar (9) NOT NULL ,
"NAME" varchar (32) NULL ,
"RESIDENCY" varchar (2) NULL ,
"INFO_RELEASE_FLAG" varchar (2) NULL ,
"TERM_CODE" varchar (3) NULL ,
"GENDER" varchar (1) NULL ,
"FOREIGN_STUDENT_CODE" varchar (1) NULL ,
"DORM" varchar (5) NULL ,
"BIRTH_DT" varchar (8) NULL ,
"CITIZENSHIP" varchar (2) NULL ,
"ETHNIC_ORIGIN" varchar (1) NULL ,
"COLLEGE" varchar (2) NULL ,
"PRIMARY_MAJ1" varchar (4) NULL ,
"PRIMARY_MAJ2" varchar (4) NULL ,
"PRIMARY_MNR1" varchar (4) NULL ,
"CLASS_CODE" varchar (3) NULL ,
"CUMGPA" "float" NULL ,
CONSTRAINT "PrimaryKey" PRIMARY KEY NONCLUSTERED
(
"STUDENT_ID"
)
)
});
$db1 = DBI->connect('dbi:ODBC:UIS', 'user', 'password', { RaiseError =>
1});
$st1 = $db1->prepare("SELECT ZSIS_AA1.STUDENT_ID, ZSIS_AA1.NAME,
ZSIS_AA1.RESIDENCY, ZSIS_AA1.INFO_RELEASE_FLAG, ZSIS_RT1.TERM_CODE,
ZSIS_AA1.GENDER, ZSIS_AA1.FOREIGN_STUDENT_CODE, ZSIS_AA1.DORM,
ZSIS_AA1.BIRTH_DT, ZSIS_AA1.CITIZENSHIP, ZSIS_AA1.ETHNIC_ORIGIN,
ZSIS_RT1.COLLEGE,ZSIS_RT1.PRIMARY_MAJ1, ZSIS_RT1.PRIMARY_MAJ2,
ZSIS_RT1.PRIMARY_MNR1, ZSIS_RT1.CLASS_CODE, ZSIS_RP3.GPA FROM
ZSIS_AA1,ZSIS_RT1,ZSIS_RP1,ZSIS_RP3 WHERE ZSIS_AA1.STUDENT_ID =
ZSIS_RT1.STUDENT_ID AND ZSIS_AA1.STUDENT_ID = ZSIS_RP1.STUDENT_ID AND
ZSIS_AA1.STUDENT_ID = ZSIS_RP3.STUDENT_ID AND ZSIS_RT1.CAREER =
ZSIS_RP3.CAREER AND ZSIS_RT1.TERM_CODE ='$TERM_CODE' AND
ZSIS_AA1.HONORS_ACTIVE='Y' AND ZSIS_RT1.CAREER='U'");
$st1->execute();
my
($f01,$f02,$f03,$f04,$f05,$f06,$f07,$f08,$f09,$f10,$f11,$f12,$f13,$f14,$
f15,$f16,$f17);
$rv = $st1->bind_columns
(\($f01,$f02,$f03,$f04,$f05,$f06,$f07,$f08,$f09,$f10,$f11,$f12,$f13,$f14
,$f15,$f16,$f17));
my $st2 = $db2->prepare(qq!INSERT INTO SIS (
STUDENT_ID, NAME, RESIDENCY, INFO_RELEASE_FLAG, TERM_CODE, GENDER,
FOREIGN_STUDENT_CODE, DORM, BIRTH_DT, CITIZENSHIP, ETHNIC_ORIGIN,
COLLEGE, PRIMARY_MAJ1, PRIMARY_MAJ2, PRIMARY_MNR1, CLASS_CODE, CUMGPA )
VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,convert(float,?))!);
while($st1->fetch()) {
print "$f01\n";
$st2->execute
($f01,$f02,$f03,$f04,$f05,$f06,$f07,$f08,$f09,$f10,$f11,$f12,$f13,$f14,$
f15,$f16,$f17);
}
$db1->disconnect;
$db2->disconnect;
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Wed, 07 Jun 2000 12:10:24 GMT
From: Dr. Markus <nasobem_hh@my-deja.com>
Subject: open an array?
Message-Id: <8hle34$qpt$1@nnrp1.deja.com>
Hi,
The following problem just came up:
can I "open" an array (that consists of lines previosuly read from a
Filedescriptor) like I would a standard filedescriptor?
Background is this:
I wrote a little script that calls an external program (which runs
rather long) in a loop.
Whenever the external program is called a second/third/fourth/... time
with the same set of parameters, I'd rather read the output (which will
be the same a when last called with this parameterset) from an array
into which i have previously stored the output. The arrays will be
stored in hashes, referenced by the individual parameter-set.
Because there is a lot of code that reads from this filedescriptor
recursively, I rely on the filedescriptor very much and I'd rather find
a way to access my Arrays through the filedescriptor than copy my code
and execute both variants in an if/else-context
TIA,
Markus
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Wed, 07 Jun 2000 11:20:42 GMT
From: Dan Sugalski <dan@tuatha.sidhe.org>
Subject: Re: Perl and memory consumption
Message-Id: <eeq%4.104240$hT2.421912@news1.rdc1.ct.home.com>
Godzilla! <godzilla@stomp.stomp.tokyo> wrote:
> |Odo| wrote:
> (snipped here and there)
>
>> I have a script which is running into Apache RLimitMEM walls
>> and so I'm trying to reduce the amount of memory it uses.
>> What kind of overhead is associated with using modules?
> Module overhead is roughly analogous to the
> size of Godzilla's head, or perhaps the
> size of King Kong's head.
No. There's a very small overhead to using a module, less than 200 bytes
certainly (unless the filename is very large), and that's the same
overhead that you get when require-ing or do-ing a file. There's also a
small cost to adding another package into the symbol table, once again in
the sub-1k range and it doesn't really matter whether you're using a
module or not.
Your biases and lack of knowledge of perl's workings are getting in the
way again.
Modules certainly *can* take a lot of memory, but they don't have to, just
as any code can take a lot of space but doesn't have to.
>> There must be some HOWTOs or something I overlooked
>> that explain how to reduce memory consumption / overheat
>> when using Perl.
> Best and most reliable method to prevent blowing
> a Perl radiator hose, is use of your fingers and
> your keyboard, along with some elbow grease.
Not when writing CGI code it's not. People get that wrong amazingly often.
The best and most reliable way to do it is write the code once, stick it
in a module, and use it there. It leaves you only one place to fix when
you mess up (and everybody inevitably does) and it saves you from typos
or silly cut and paste errors.
> As a very loose and rough guesstimation, each
> module, averaging all modules together, represents
> a memory bloat factor of one-thousand percent over
> what your fingers can do with a keyboard.
No. This is very, *very* wrong. The overhead to using a module as opposed
to including the code in your program is on the order of tens of bytes.
Making it a module (i.e. sticking it in a .pm file and use-ing it) costs
almost nothing. You pay for the cost of a single string scalar in the %INC
hash. Period.
> Clear example. With a Steve Brenner type read and
> parse, including security coding, you can do in
> less than five kilobytes, a very generous amount,
> what takes cgi.pm to do in a quarter of megabyte.
No. Bad example. You're confusing modules in general with CGI.pm in
specific. That CGI.pm is huge doesn't mean that modules have to be huge.
They can be big, or small, or anyplace in between. Being a module per se
doesn't up your memory requirements.
Dan
------------------------------
Date: Wed, 07 Jun 2000 11:31:17 GMT
From: Dan Sugalski <dan@tuatha.sidhe.org>
Subject: Re: Perl and memory consumption
Message-Id: <9oq%4.104242$hT2.421853@news1.rdc1.ct.home.com>
|Odo| <jasonb885@my-deja.com> wrote:
> I have a script which is running into Apache RLimitMEM walls and so I'm
> trying to reduce the amount of memory it uses.
> What kind of overhead is associated with using modules?
Very little. Costs you an entry in the %INC hash and a few opcodes. Same
cost as this code:
$foo{"my module name"}++;
1;
> If I use module A and B in a script and module A uses module B, do I end
> up with two copies of module B or just one?
Just one.
> I've been trying to use (soft) references as often as possible. Could I
> be overlooking things that are increasing memory consumption more than
> might otherwise need to occur?
Yech. Don't use symbolic references--use hard references. Too error-prone.
Hard references are slightly smaller, too, though not enough to make a
difference really, unless your variables have huge names. (Plus you can't
soft-ref lexicals)
> I attempted to figure out how much memory some of the modules I use
> consume with top (just total memory, not accounting for shared or
> anything). I came up with these figures:
> Perl = 2228KB
Most of this is shareable.
> DBI = 580KB
plus a DBD module, I presume?
> Empty Module = 8KB (108K - 100K module penalty)
Empty how? That 8k's a bit high, though if you're using the template that
h2xs spits out it's probably about right.
> POSIX = 820KB
If you can avoid POSIX, do it. It's huge as you see. The module takes up
less memory in perl 5.6.0, IIRC.
> Carp = 32KB
> Time::ParseDate = 396KB
Might want to dodge this one if you can, as it is big.
> CGI = 296KB
> First Module Penalty: 100KB
Nope. This is the cost of using the Exporter module I bet.
> I came up with First Module Penalty because using two empty modules only
> consumed 8K more, so I guessed that it costs me 100K to use at least one
> module.
That's the cost of Exporter, which isn't cheap as you see. A cost you pay
only once, though.
> Are those figures even remotely accurate?
They look pretty close. Most of that memory isn't written to, though, so
it should be shared between Apache child processes. Still not free, but
certainly less RAM used. (Assuming you're using mod_perl. If you're not
then by all means, start!)
> There must be some HOWTOs or something I overlooked that explain how to
> reduce memory consumption / overheat when using Perl.
Nope. Care to write one? :) Avoiding POSIX is a good rule of thumb, using
mod_perl is another.
Dan
------------------------------
Date: Wed, 7 Jun 2000 05:32:07 -0500
From: "Conrad Schneiker" <schneiker@jump.net>
Subject: Ruby -- A better OO Perl than Perl? Python 3000 features available now?
Message-Id: <8hl866$bt5$1@news.jump.net>
Well, at least _some_ people regard Ruby as a better OO Perl than Perl or as
a means of getting anticipated Python 3000 features now. Maybe if you knew
more about Ruby, you might become one of them.
Obviously for a great many people, situations, and applications, Perl or
Python are clearly their best respective choices. (I still use Perl from
time to time and I still sometimes recommend that people check out Python.)
However I suspect there are still a great many other people who generally
like Perl or Python, but who for reasons of need and temperament are not
locked into them, and who also would like something that provides a more
powerful and more uniform and easier to use variation on the same sorts of
themes that made Perl or Python initially attractive and useful power tools.
The purpose of this note is simply to let such people know about Ruby. (I
discovered Ruby in a passing reference I chanced across when perusing
comp.lang.python last year, and I am trying to pass on that inadvertent
favor in this experiment.)
1 About Ruby.
1.1 What is Ruby?
Ruby is a relatively new, very high level, fully OO language that
integrated many good ideas from Perl, Python, Smalltalk, Eiffel,
ADA, Clu, and Lisp. (Ruby is more fully OO than Python.) In
addition to common OO features, Ruby has threads, singleton
methods, mix-ins, fully integrated closures and iterators, plus
proper meta-classes. Ruby is a relatively easy to learn and easy
to read language, yet it is very powerful and sophisticated. Ruby
has a true mark-and-sweep garbage collector, which makes code more
reliable and simplifies writing extensions. For many of us, Ruby
is "better Perl than Perl" and a "better Python than Python". You
could characterize the Ruby philosophy as "there's a better way to
do it" (TABWTDI).
1.2 Where can I find out more about Ruby?
Ruby's home web site:
http://www.ruby-lang.org/en (Ruby English language home page.)
Follow the links to documentation, downloads, the Ruby
application archive, the Ruby mail list archives, and lots
of other interesting information.
http://www.ruby-lang.org/en/whats.html (Ruby feature list.)
Ruby FAQ:
http://www.rubycentral.com/faq/
Ruby classes, modules, and methods reference:
http://www.rubycentral.com/ref/
English language Ruby books:
Two forthcoming English-language Ruby are planned for
publication later in Y2K:
<<Don't know title yet.>> by Yukihiro Matsumoto
"Pragmatic Ruby" by Dave Thomas and Andrew Hunt
Ruby newsgroup:
comp.lang.ruby
------------------------------
Date: Wed, 7 Jun 2000 22:46:22 +1200
From: "Tintin" <you.will.always.find.him.in.the.kitchen@parties>
Subject: Re: shell command
Message-Id: <960374735.897154@shelley.paradise.net.nz>
<cess23@my-deja.com> wrote in message news:8hkttm$fr1$1@nnrp1.deja.com...
> Hi all. Good day!
>
> I am actually new with Perl/CGI. And I have a project to finish.
> I have a problem with my script. My script goes something like this:
>
> #!/usr/bin/perl
> # result.cgi
>
> print "Content-type: text/html\n\n";
> $result = `/sbin/dev -l /dev/sda`;
> print "This is the result:: $result\n";
> .
> .
> .
> .
>
>
> when i try to run this in my browser, only this can be shown,
> "This is the result:: " ...$result doesn't give any value.
>
> i tried looking at the error log, it says there;
> "Cannot open /dev/sda"
>
> but i tried running it in shell command line: ./result.cgi
> this is the result::
> Disk /dev/sda: 255 heads, 63 sectors, 1111 cylinders
> .....
> ..... and etc....
>
> it would mean that /dev/sda can be seen. I need to see those data
> produced by that command. But why is it that when I run it in the
> browser, it cannot see /dev/sda. And I need to run it thru a browser.
>
> Am I missing some configurations here?
>
> My other scripts without such shell sommand is working well.
>
> I would really appreciate it if you can help me with this problem. I
> tried using "exec", "system" & "syscall" but it will just produce the
> same result.
CGI processes run as the owner of the web server (generally nobody on unix
systems). You'll notice that /dev/sda has no read permission for nobody.
------------------------------
Date: Wed, 07 Jun 2000 12:08:37 GMT
From: eddie.bragg@wize.net
Subject: smtp socket not working
Message-Id: <8hldvp$qno$1@nnrp1.deja.com>
I have written a script to send mail via smtp virtual server on Win2000.
I am sending it by opening a socket. It connects to the server Ok but
when I send the following command is stops.
send Socket_Handle, "MAIL From: email\@somewhere.com\n", 0;
Can anyone help me with the PERL or the smtp server setup.
Thanks
Eddie
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Wed, 07 Jun 2000 12:35:58 GMT
From: Rodney Engdahl <red_orc@my-deja.com>
Subject: Re: smtp socket not working
Message-Id: <8hlfjd$ro6$1@nnrp1.deja.com>
In article <8hldvp$qno$1@nnrp1.deja.com>,
eddie.bragg@wize.net wrote:
> I have written a script to send mail via smtp virtual server on
Win2000.
>
> I am sending it by opening a socket.
why not just use Net::SMTP ?
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Wed, 07 Jun 2000 05:13:57 -0600
From: Ron Reidy <rereidy@indra.com>
Subject: Re: Stupid Question: scripts won't recognize opening line
Message-Id: <393E2E75.D63A89CA@indra.com>
Kurt Krieger wrote:
>
> I've had a problem with perl scripts that were uploaded (ftp'd) to the
> server in binary mode, leaving the ^M character at the end of each line.
> This trashes the shebang line so that the shell can't determine what file
> to execute. This would explain why your script works fine when you
> explicitly tell the shell what file to execute using "perl test.pl".
>
> In your case, if the file was actually called test.pl, and the error
> message actually said something like "can't find test.pl", then open the
> file in vi and see if ^M is at the end of all the lines. If so, either
> re-upload the file in ascii mode, or issue these commands:
> % dos2unix test.pl newfile.pl
> % mv newfile.pl test.pl
> This strips off the ^M chars and spools the results to newfile.pl. Then
> rename it back to your original file name.
>
> Kurt
>
> Charles Petersen wrote:
>
> > Ok, there is probably a very simple solution to this, but I can't seem
> > to solve it.
> >
> > I'm running perl on Redhat 6..2. I have one script that works just
> > fine, it's debugged and I start it by simply typing
> >
> > ./simulation.pl
> >
> > it then executes and works fine.
> >
> > I have another script which works fine when i type "perl test.pl" but
> > doesn't work when i type
> >
> > ./test.pl
> >
> > the permissions are chmod 755 and the permissions are the same as the
> > previous. the opening line is:
> >
> > #!/usr/bin/perl -w
> >
> > the error it gives me is:
> >
> > bash: ./index.pl: No such file or directory
> >
> > suggestions?
> >
> > Charles Petersen
Another possible problem is the #! line points to a perl that doesn't
exist. Check that.
--
Ron Reidy
Oracle DBA
Reidy Consulting, L.L.C.
------------------------------
Date: 7 Jun 2000 08:50:00 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Tar module
Message-Id: <8hkur8$rp7$1@orpheus.gellyfish.com>
On Tue, 06 Jun 2000 14:44:19 +0100 Haris Siakalis wrote:
> Hello,
> i have used with success the module Tar to create a tar archive. Is
> there a way to untar the archive in perl? I have checked the docs but
> couldn't
> make out if i can.In my opinion I cannot.
>
Archive::Tar both creates and extracts tar archives. Check out its most
excellent documentation.
/J\
--
Facts are meaningless. You could use facts to prove anything that's even
remotely true!
--
fortune oscar homer
------------------------------
Date: Wed, 7 Jun 2000 12:18:23 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: the end of perl?
Message-Id: <Pine.GHP.4.21.0006071211490.1201-100000@hpplus03.cern.ch>
On Wed, 7 Jun 2000, Bart Lateur wrote:
> >> >Unicode still has room (more than "a few").
> >>
> >> But how much of it is Ascii?
> >
> >Sorry, I'm not sure what your point is. Ascii is a 7-bit
> >code, fully defined some two decades back.
>
> It's simple. All characters used in the definition of virtually any
> programming language, including Perl, are in Ascii.
The thread has gone completely off the rails. I thought I was
following up to a discussion which had been about the Euro character
and had drifted to a discussion of character codes which have control
functions. But I think I have now grasped that you were talking about
something else entirely.
|> A special case is the $^(letter) syntax, which isn't abslutely
|> clear to me, but I think it represents control characters. I think
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|> there are still a few unused places left.
I now think that you meant "a few unused places" in Perl syntax. I
previously thought you were talking about unused places in the
character coding.
> (I'm talking about the language
> itself, not embedded literal strings.) Didn't you ever notice?
No, I didn't, not before. I thought we were still talking about
character codings - I hadn't previously noticed that you'd switched to
a different tack. Hence the mutual incomprehension.
all the best
------------------------------
Date: 7 Jun 2000 09:07:52 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Value of <HANDLE> construct can be "0" ???
Message-Id: <8hkvso$tgs$1@orpheus.gellyfish.com>
On Tue, 06 Jun 2000 15:06:07 GMT adrian2001@my-deja.com wrote:
> Perl gurus,
> I wrote a script that, when run with the -w option, gives this warning:
>
> Value of <HANDLE> construct can be "0"; test with defined() at myscript.pl
> line 65535
>
> Problem is, the script does NOT have 65535 lines. And there is nothing called
> HANDLE (i.e., I think this is a "generic" warning.) What is going on? The
> script works fine, but the warning upsets me. Platform is: Sun - Solaris -
> perl 5
>
Upgrade to more recent version of Perl. This message has not appeared
since 5.005
/J\
--
You couldn't fool your mother on the foolingest day of your life if you
had an electrified fooling machine.
--
fortune oscar homer
------------------------------
Date: Wed, 7 Jun 2000 12:25:39 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: Win32 Perl read weirdness
Message-Id: <Pine.GHP.4.21.0006071221550.1201-100000@hpplus03.cern.ch>
On Wed, 7 Jun 2000, Clinton A. Pierce wrote:
> perldoc -f binmode
> It's a Windows/DOS misfeature that some people forget about.
I think it's fair to say that there are rather few non-unix OSes that
don't need a distinction to be made between binary and text.
You might want to conclude that non-unix OSes are a misfeature, "but I
couldn't possibly comment".
The best advice seems to be to always make the conceptual distinction,
and thus always apply binmode when relevant, even in the special case
where it's a non-event.
------------------------------
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 3275
**************************************