[19900] in Perl-Users-Digest
Perl-Users Digest, Issue: 2095 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Nov 8 18:05:42 2001
Date: Thu, 8 Nov 2001 15:05:09 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <1005260709-v10-i2095@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Thu, 8 Nov 2001 Volume: 10 Number: 2095
Today's topics:
Re: Best language for low IQ programmers? <dont.bother.mcondic.auntie.spam@[acm.org>
Re: Best language for low IQ programmers? (Jim Cochrane)
Re: Best language for low IQ programmers? (Patrick Doyle)
Re: hash scope problem - an emergency <darkon@one.net>
Re: hash scope problem - an emergency <gregory@pharmag.pl>
Help needed!! (bhattey)
Re: Help needed!! <loophole64@home.com>
Re: How to assign initial value to variable? <spamfree@go-away.net>
Re: How to find length of scalar var? <tsee@gmx.net>
incorrect logic? <jessica.bull@broadwing.com>
Re: Mounting a drive with Perl <djberge@uswest.com>
Re: Mounting a drive with Perl <jessica.bull@broadwing.com>
need help, error correction <no_mto@hotmail.com>
Re: need help, error correction <mmanso@yahoo.com>
Re: need help, error correction <no_mto@hotmail.com>
Re: need help, error correction (Tad McClellan)
Re: need help, error correction <no_mto@hotmail.com>
Re: need help, error correction <mbudash@sonic.net>
Re: need help, error correction <no_mto@hotmail.com>
Re: Oracle DBI Question (F. Xavier Noria)
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Thu, 8 Nov 2001 14:07:06 -0500
From: "Marin David Condic" <dont.bother.mcondic.auntie.spam@[acm.org>
Subject: Re: Best language for low IQ programmers?
Message-Id: <9sel4s$hj4$1@nh.pace.co.uk>
Wasn't that the joke told by Karl Marx? The funniest of The Marx Brothers?
:-)
MDC
--
Marin David Condic
Senior Software Engineer
Pace Micro Technology Americas www.pacemicro.com
Enabling the digital revolution
e-Mail: marin.condic@pacemicro.com
Web: http://www.mcondic.com/
"Ken Stauffer" <kjs@stauffercom.com> wrote in message
news:9sd6ga$voa$1@slb4.atl.mindspring.net...
>
> Some people took communism seriously, too. Don't be so suprised.
>
>
>
>
------------------------------
Date: 8 Nov 2001 14:53:37 -0700
From: jtc@dimensional.com (Jim Cochrane)
Subject: Re: Best language for low IQ programmers?
Message-Id: <9seut1$hap@flatland.dimensional.com>
Don't feed the trolls, Eirik - or the trolls responding to trolls ... :-)
In article <R1rG7.14$eZi.171124224@news.telia.no>,
Eirik Mangseth <no_spam_eirik@stockpoint.no> wrote:
>
>"jmburton" <jmburton@usenix.org> wrote in message
>news:1005188797788841@usenix.org...
>> > C++ is the best choice for dull programmers. The quality of your code
>will
>> > be indistinguishable from that of a the C++ guru.
>>
>> Are you a troll?
>>
>> In case if you are genuine, which I doubt, I disagree. Eiffel is a
>> better language for dull programmers. Since Eiffel is usually abandoned
>> before software goes into production, no one will ever have to deal
>> with the inevitable bugs left by sloppy Eiffel programmers.
>> Plus, poor performance due to bad algorithms designed by poorly
>> educated programmers can be excused by the natural slowness of Eiffel
>> (garbage collection instead of efficient on-demand memory allocation
>> and deallocation).
>>
>> You have to know C++ anyway, as Eiffel is merely a front end to C++
>> (it is compiled into C++, not native code), and requires external calls
>> to C++ for anything useful like OS services.
>>
>> I studied Eiffel in college and have a buddy who used to program in
>> that sad pathetic language, so I do know what I am talking about.
>
>And pigs will fly.
>
>> - - - - - - - - - - - - - - - - - -
>> J M Burton
>> FreeBSD Consulting & Security Administration
>> * * * This is a .sig virus. Copy it into your .sig to propagate. * * *
>>
>
>-- eirik
>
>"If I can't Eiffel in heaven, I won't go"
>
>
>
--
Jim Cochrane
jtc@dimensional.com
[When responding by email, include the term non-spam in the subject line to
get through my spam filter.]
------------------------------
Date: Thu, 8 Nov 2001 21:46:20 GMT
From: doylep@eecg.toronto.edu (Patrick Doyle)
Subject: Re: Best language for low IQ programmers?
Message-Id: <GMI4H8.99y@ecf.utoronto.ca>
In article <3BEA7120.8A979611@gperkins.co.uk>,
Graham Perkins <gperkins@gperkins.co.uk> wrote:
>
>Now you say four false things (not controversial, actually
>FALSE):
>
> Garbage collection is inefficient
> Eiffel is front end for C++
> Programmer has to know C++ to use Eiffel
> Eiffel programmer has to call C++ for anything useful like OS calls
>
>which makes us think YOU are a troll. Please, if you have some
>sensible questions to ask, about Eiffel and other technologies,
>don't spoil it by making assertions from a position of ignorance.
Ah, Graham. I had a whole response to this all typed up, and then
I realized that this is exactly the purpose of a troll, so I
deleted it. :-)
I must say, though, that this fellow's troll is MUCH better than
the original one. The original one seemed like a joke to me the
first moment I read it.
--
--
Patrick Doyle
doylep@eecg.toronto.edu
------------------------------
Date: Thu, 08 Nov 2001 19:28:02 -0000
From: David Wall <darkon@one.net>
Subject: Re: hash scope problem - an emergency
Message-Id: <Xns915392FCC744Bdarkononenet@207.126.101.97>
"Grzegorz Goryszewski" <gregory@pharmag.pl> wrote on 08 Nov 2001:
> Hello.
>
> I have code like this, my point is to fill hashes and play with
> it outside the loop , but unfortunately outside the while loop
> foreach displays
> only last key value in any hash, what's going on ? Regards
The problem is the lines that look like this:
%users =($user => [$name , $oddz]);
That sets the contents of the entire hash, and wipes out whatever was in
it before. You want something like
$users{$user} = [ $name, $oddz ];
This sets an individual hash entry, without clobbering the rest of the
hash.
Other comments follow....
> #!/usr/bin/perl -w
Warnings are good.
use strict;
is also highly recommended.
> open (USERS , "<./users.txt") or die "error $! users \n";
> open (ZAKONCZ , "<./zakoncz.txt") or die "error $! zakoncz \n";
> open (ROZPOCZ , "<./rozpocz.txt") or die "error $! rozpocz \n";
>
> while (<USERS>)
> {
> chomp;
>
>
> if (/(\d\d);(...);(\S+\s\S+)/)
> {
> $oddz = $1 ;
> $user = $2 ;
> $name = $3 ;
You know more about your input than I do; however, this looks as if
you're splitting the input by semicolons. If so,
my ($oddz, $user, $name) = split /;/;
$users{$user} = [ $name, $oddz ];
might serve you better.
With the strict pragma enabled, you would have to declare your variables
using my(). It also means that you can declare variables inside a loop
(or any block) and have them confined to that loop. See "Private
Variables via my()" in perlsub, or "Coping with Scoping" at
http://perl.plover.com/FAQs/Namespaces.html for an introduction to
scoping.
>
> %users =($user => [$name , $oddz]);
> foreach $luser (keys %users)
> {
> print "inside $users{$luser}[1]\n";
> }
>
>
>
> }
>
> }
>
> ####################NEXT FILE ###############
>
>
> while (<ZAKONCZ>)
> {
> chomp;
>
>
> if (/^CPF/ && /QPADEV/)
Instead of nesting everything inside an if statement, a common idiom is
while ( <ZAKONCZ> ) {
chomp;
next unless /^CPF/ && /QPADEV/;
# parse input ...
}
That way you get rid of one set of braces and the code is easier to read.
> {
> if (/(\d{6}).*?(\d\d\/\d\d\/\d\d)...(\d\d:\d\d:\d\d)/)
> {
> $jobid = $1 ;
> $time = $3 ;
> $data = $2 ;
> $usr = substr $_ , 41 , 3 ;
> %zakoncz = ($jobid => [$time, $data, $usr]);
You just reset the entire contents of %zakonz -- see above.
[snip rest of code]
--
David Wall
darkon@one.net
------------------------------
Date: Thu, 8 Nov 2001 21:43:18 +0100
From: "Grzegorz Goryszewski" <gregory@pharmag.pl>
Subject: Re: hash scope problem - an emergency
Message-Id: <9seqmh$s1b$1@news.tpi.pl>
DQoiRGF2aWQgV2FsbCIgPGRhcmtvbkBvbmUubmV0PiB3cm90ZSBpbiBtZXNzYWdlIG5ld3M6WG5z
OTE1MzkyRkNDNzQ0QmRhcmtvbm9uZW5ldEAyMDcuMTI2LjEwMS45Ny4uLg0KDQpUaGFua3MgdG8g
QWxsIG9mIFlvdSBmb3IgdGhlIHNvbHV0aW9uIGFuZCB2ZXJ5IHVzZWZ1bCBndWlkZWxpbmVzLiBC
ZXN0IHJlZ2FyZHMuDQoNCiAgICBHcnplZ29yeiBHb3J5c3pld3NraQ0KDQoNCg==
------------------------------
Date: 8 Nov 2001 11:44:26 -0800
From: bhattey@hotmail.com (bhattey)
Subject: Help needed!!
Message-Id: <704bbfe6.0111081144.5a35be6c@posting.google.com>
Hello all,
I have a small CGI script. Used to be working fine, but out of
nowhere, now I am getting the following error in the script. Any
advise on where the problem lies would be very helpful.
Software Error:
Operation `eq': no method found, left argument in overloaded package
CGI::Cookie, right argument has no overloaded magic at ./dscipt.cgi
line 527.
------------------------------
Date: Thu, 8 Nov 2001 13:52:40 -0600
From: "Jason Kelley" <loophole64@home.com>
Subject: Re: Help needed!!
Message-Id: <9senn8$mkt$1@news.chorus.net>
Let's see your code.
-Jason
------------------------------
Date: Thu, 08 Nov 2001 20:43:55 GMT
From: "spamfree" <spamfree@go-away.net>
Subject: Re: How to assign initial value to variable?
Message-Id: <f8CG7.7211$mh1.1107141@news1.cableinet.net>
> spamfree <spamfree@go-away.net> wrote:
> >#!/usr/bin/perl -Tw
>
>
> use strict;
I get software server error with strict.
I have heard you advise others to use strict and suggest it should be used
as the default (mandatory) :-)
I get server error even with $var initialized with 'my' and find it
difficult to debug as I don't have access to server logs. What other factors
come into play?
I also have a follow up with T switch... i'll leave that for another post
:-)
>
>
> >Use of uninitialized value at
> >/home/sites/site13/web/cgi-bin/pre-register/pre-register.pl line 139 (#1)
>
> ><cut>
>
>
> [ something horrid has happened to the formatting of your code.
> I hope it doesn't really look like this...
> ]
>
> >sub check_data{
> ^
> ^
>
> That is unbalanced, there's no closing brace below.
Yes, it is in my code futher down -not originally posted
>
>
<snipped>
Tad I now have this:
sub check_data{
if ($firstname =~ tr/a-zA-Z\n\t //c) { #allows alphabetic only
$errormessage = "Special characters are forbidden. You used one in the
FIRSTNAME field. ";
errorpage();
exit;
}
if (length ($firstname) > 50) {
$errormessage = 'The FIRSTNAME field is restricted to Max = 50
characters including spaces!';
errorpage();
exit;
}
#---------------------------------------------------------------------------
-----------------------------
if ( $surname =~ tr/a-zA-Z\n\t //c) { #allows alphabetic only
$errormessage = "Special characters are forbidden. You used one in the
SURNAME field. ";
errorpage();
exit;
}
if (length ($surname) > 50) {
$errormessage = 'The SURNAME field is restricted to Max =
50 characters including spaces!' ;
errorpage();
exit;
}
#more error checking etc.
}# end of sub check_data
Thank Tad
--
millside
_____________
------------------------------
Date: Thu, 8 Nov 2001 20:13:56 +0100
From: "Steffen Müller" <tsee@gmx.net>
Subject: Re: How to find length of scalar var?
Message-Id: <9seld7$bqd$07$1@news.t-online.com>
"G Harper" <vze34thh@verizon.net> schrieb im Newsbeitrag
news:mKnG7.1402$o16.99126@typhoon2.gnilink.net...
| I rather enjoy the original solution :-)
Especially the redundancy /\d|\w/g
--
$_=q;0cb212c210b0bb010c0113bb0c410c0b516c0bb3d212c2b0b0b016b6cb2b2c21010c0
b41110b3bba0e0c0d2c4b2b6bc013d2c0d0b01012b0b0;;s/\n//g;s/(\d)/$1<2?$1:'0'x
$1/ge;s/([a-f])/'1'x(ord($1)-97)/ge;print"\n";$o=$_;push@o,substr($o,$_*8,
8)for(0..24);for(@o){print"\0"x(26-$i).chr(oct('0b'.($_)))."\n";$i++}#st_m
------------------------------
Date: Thu, 08 Nov 2001 21:43:39 GMT
From: "Jessica Bull" <jessica.bull@broadwing.com>
Subject: incorrect logic?
Message-Id: <f0DG7.104313$tb2.8345805@bin2.nnrp.aus1.giganews.com>
All,
I have a script which is used to copy data in an infinate loop to fill drive
space as a test for managment software. The share I am copying from has
about 8 gigs of data and a couple thousand files. I am copying the data in
100 meg chunks. The script runs great except it copies the same files over
and over again instead of going through the entire directory. Can someone
help? Code below.
This is the piece where it seems the problem may be....Entire code below
portion
elsif (($totalsize > $compfilesize) and ($totalsize <
ilesize)){ #if correct amount of data, add current file and copies files
push (@filestocpy, $altoldfile);
foreach $element (@filestocpy){
my @filename = split "/", $element;
$newfile = "$todir/$unique"."$filename[3]";
print "$element : $newfile\n";
copy ($element, $newfile) or die "$!";
}
my $totalsize = 0;
my @filestocpy = ();
sleep 10;
next;
}
ENTIRE CODE:
while($true){ #Run away
loop
opendir (DIR, "$fromdir") or die $!; #open directory to get
files
my $file;
my $totalsize = 0;
my @filestocpy;
sleep 10;
while (defined($file = readdir(DIR))) { #reading in files from
directory
chomp $file; #deleting
carrige return
my $unique = Gettimestamp(); #gathering time stamp
per each iteration of loop
my $newfile; #specifying
that name of file end with timedatestamp to make it unique
my $altoldfile = "$fromdir/$file";
my $filesize=(stat($altoldfile))[7]; #getting size of
file
my $element;
my $compfilesize = 100000000; #least amount of data
copied
my $altfilesize = 101000000; #most amount of data
copied
$totalsize = ($totalsize + $filesize); #adding the size
of file to previous files found to copy correct amt of data
if ((-d $altoldfile) or ("$filesize" eq "0")) {
$totalsize = ($totalsize - $filesize);
next;
}
if ($totalsize < $compfilesize){ #if not enough data,
adding file to be copied and next iteration of loop
push (@filestocpy, $altoldfile);
next;
}
elsif (($totalsize > $compfilesize) and ($totalsize <
$altfilesize)){ #if correct amount of data, add current file and copies
files
push (@filestocpy, $altoldfile);
foreach $element (@filestocpy){
my @filename = split "/", $element;
$newfile = "$todir/$unique"."$filename[3]";
print "$element : $newfile\n";
copy ($element, $newfile) or die "$!";
}
my $totalsize = 0;
my @filestocpy = ();
sleep 10;
next;
}
else { #if too much data, then subtracting the file size and moving
to next file in directory
$totalsize = ($totalsize - $filesize);
next;
}
}#end inside while
}#end infinate loop
------------------------------
Date: Thu, 08 Nov 2001 15:20:06 -0600
From: Mr Sunblade <djberge@uswest.com>
Subject: Re: Mounting a drive with Perl
Message-Id: <3BEAF706.7852DA87@uswest.com>
Jessica Bull wrote:
> All,
> I do all of my programming on a Windows platform. I have been tasked to
> write short script for a Linux platform which copies files to a share. I
> think (open for suggestions on this) that I have to mount a drive for the
> share. Is this correct and how can I do this? I appreciate your help with
> a simple problem.
>
> Jess
Jessica,
Well, this ain't a Perl question.
Sharing a drive between *nix and Windows is hardly a "simple problem". We
ended up using Samba (I think) to accomplish this (I didn't personally set it
up, so I'm not entirely sure). Even so, whenever I copy files across this
"mount", I get "chmod" errors for some reason, although *most* of the time the
copy still works.
Consider asking this is one of the *nix/Windows newsgroups.
Regards,
Mr. Sunblade
--
"Evil will always triumph because Good is *dumb*."
-- Dark Helmet, 'Spaceballs: The Movie'
------------------------------
Date: Thu, 08 Nov 2001 21:32:18 GMT
From: "Jessica Bull" <jessica.bull@broadwing.com>
Subject: Re: Mounting a drive with Perl
Message-Id: <CRCG7.101565$U7.8096237@bin1.nnrp.aus1.giganews.com>
thanks...i didn't know if it was possible to script the mount. i ended up
doing it through the system commands.
"Mr Sunblade" <djberge@uswest.com> wrote in message
news:3BEAF706.7852DA87@uswest.com...
> Jessica Bull wrote:
>
> > All,
> > I do all of my programming on a Windows platform. I have been tasked to
> > write short script for a Linux platform which copies files to a share.
I
> > think (open for suggestions on this) that I have to mount a drive for
the
> > share. Is this correct and how can I do this? I appreciate your help
with
> > a simple problem.
> >
> > Jess
>
> Jessica,
>
> Well, this ain't a Perl question.
>
> Sharing a drive between *nix and Windows is hardly a "simple problem". We
> ended up using Samba (I think) to accomplish this (I didn't personally set
it
> up, so I'm not entirely sure). Even so, whenever I copy files across this
> "mount", I get "chmod" errors for some reason, although *most* of the time
the
> copy still works.
>
> Consider asking this is one of the *nix/Windows newsgroups.
>
> Regards,
>
> Mr. Sunblade
>
> --
> "Evil will always triumph because Good is *dumb*."
> -- Dark Helmet, 'Spaceballs: The Movie'
>
>
>
------------------------------
Date: Thu, 8 Nov 2001 20:54:28 +0100
From: "MAGiC MANiAC^mTo" <no_mto@hotmail.com>
Subject: need help, error correction
Message-Id: <9seo6o$pf3$1@news.kabelfoon.nl>
how can I correct the error?...
in my code I like to use :
$tmp1="";
if($form_username==""){$tmp1="is empty, please enter the field!";}
print $tmp1;
---
Error: Argument "" isn't numeric in numeric eq (==) at c:\!TEST\TEST.CGI
line 61.
------------------------------
Date: Thu, 08 Nov 2001 20:12:14 +0000
From: Miguel Manso <mmanso@yahoo.com>
Subject: Re: need help, error correction
Message-Id: <3BEAE71E.2010409@yahoo.com>
replace $form_username=="" with $form_username eq ""
MAGiC MANiAC^mTo wrote:
> how can I correct the error?...
> in my code I like to use :
>
> $tmp1="";
> if($form_username==""){$tmp1="is empty, please enter the field!";}
> print $tmp1;
>
> ---
>
> Error: Argument "" isn't numeric in numeric eq (==) at c:\!TEST\TEST.CGI
> line 61.
>
>
>
>
>
------------------------------
Date: Thu, 8 Nov 2001 21:26:53 +0100
From: "MAGiC MANiAC^mTo" <no_mto@hotmail.com>
Subject: Re: need help, error correction
Message-Id: <9seq3i$seo$1@news.kabelfoon.nl>
but when I use eq instead of == it gives me the follow message:
Use of uninitialized value in string eq at c:\!TEST\TEST.CGI line 61.
can I also correct this?...
"Miguel Manso" <mmanso@yahoo.com> schreef in bericht
news:3BEAE71E.2010409@yahoo.com...
> replace $form_username=="" with $form_username eq ""
>
>
>
> MAGiC MANiAC^mTo wrote:
>
> > how can I correct the error?...
> > in my code I like to use :
> >
> > $tmp1="";
> > if($form_username==""){$tmp1="is empty, please enter the field!";}
> > print $tmp1;
> >
> > ---
> >
> > Error: Argument "" isn't numeric in numeric eq (==) at c:\!TEST\TEST.CGI
> > line 61.
> >
> >
> >
> >
> >
>
>
------------------------------
Date: Thu, 08 Nov 2001 21:04:20 GMT
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: need help, error correction
Message-Id: <slrn9ulq76.ki5.tadmc@tadmc26.august.net>
MAGiC MANiAC^mTo <no_mto@hotmail.com> wrote:
>how can I correct the error?...
>in my code I like to use :
>
>$tmp1="";
>if($form_username==""){$tmp1="is empty, please enter the field!";}
>print $tmp1;
>
>---
>
>Error: Argument "" isn't numeric in numeric eq (==) at c:\!TEST\TEST.CGI
>line 61.
$tmp1 = "is empty, please enter the field!" unless defined $form_username;
But you *really really* should have "use strict;" turned on you know...
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Thu, 8 Nov 2001 22:48:37 +0100
From: "MAGiC MANiAC^mTo" <no_mto@hotmail.com>
Subject: Re: need help, error correction
Message-Id: <9seusp$12mb$1@news.kabelfoon.nl>
Hi there thanks for your quick answers :)
> But you *really really* should have "use strict;" turned on you know...
When I do this, I get this...
Global symbol "$tmp1" requires explicit package name at c:\!TEST\TEST.CGI
Damn, its very hard to understand all those messages.
I don't know whats happening, everytime those messages for a simply short
code...
Do perl always give messages even when a code is correct?
"Tad McClellan" <tadmc@augustmail.com> schreef in bericht
news:slrn9ulq76.ki5.tadmc@tadmc26.august.net...
> MAGiC MANiAC^mTo <no_mto@hotmail.com> wrote:
>
> >how can I correct the error?...
> >in my code I like to use :
> >
> >$tmp1="";
> >if($form_username==""){$tmp1="is empty, please enter the field!";}
> >print $tmp1;
> >
> >---
> >
> >Error: Argument "" isn't numeric in numeric eq (==) at c:\!TEST\TEST.CGI
> >line 61.
>
>
> $tmp1 = "is empty, please enter the field!" unless defined $form_username;
>
>
> But you *really really* should have "use strict;" turned on you know...
>
>
> --
> Tad McClellan SGML consulting
> tadmc@augustmail.com Perl programming
> Fort Worth, Texas
------------------------------
Date: Thu, 08 Nov 2001 22:10:30 GMT
From: Michael Budash <mbudash@sonic.net>
Subject: Re: need help, error correction
Message-Id: <mbudash-100632.14103408112001@news.sonic.net>
In article <9seusp$12mb$1@news.kabelfoon.nl>, "MAGiC MANiAC^mTo"
<no_mto@hotmail.com> wrote:
>
> "Tad McClellan" <tadmc@augustmail.com> schreef in bericht
> news:slrn9ulq76.ki5.tadmc@tadmc26.august.net...
> > MAGiC MANiAC^mTo <no_mto@hotmail.com> wrote:
> >
> > >how can I correct the error?...
> > >in my code I like to use :
> > >
> > >$tmp1="";
> > >if($form_username==""){$tmp1="is empty, please enter the field!";}
> > >print $tmp1;
> > >
> > >---
> > >
> > >Error: Argument "" isn't numeric in numeric eq (==) at
> > >c:\!TEST\TEST.CGI
> > >line 61.
> >
> > $tmp1 = "is empty, please enter the field!" unless defined
> > $form_username;
> >
> > But you *really really* should have "use strict;" turned on you know...
>
> When I do this, I get this...
>
> Global symbol "$tmp1" requires explicit package name at c:\!TEST\TEST.CGI
>
> Damn, its very hard to understand all those messages.
> I don't know whats happening, everytime those messages for a simply short
> code...
don't complain about them, the messages are there for your own good!
anyway add:
use diagnostics;
and you'll get a more verbose explanation of each error. once you get no
errors, you can remove it if yoou like...
hth-
--
Michael Budash ~~~~~~~~~~ mbudash@sonic.net
------------------------------
Date: Thu, 8 Nov 2001 23:50:34 +0100
From: "MAGiC MANiAC^mTo" <no_mto@hotmail.com>
Subject: Re: need help, error correction
Message-Id: <9sf2gt$172c$1@news.kabelfoon.nl>
Maybe its a good idea to post my code here to request of there is someone
who like to
correct something whats wrong, or give comments, or optimize things in this
code.
I do know its full with errors, but I'm just a beginner and would like to
learn this language...
My languages are visual basic, tpascal, javascript, css, html, and DUTCH ;-)
This code does not do much, but thats not importend.
Heres the code:
P.s. I don't want to use CGI.pm, or such kind of...
------------------------------
#!/usr/bin/perl
use strict;
use diagnostics;
$db1file="db.dat";
# don't change below...
$runlocal=1;
$xid=0;
$xin=1;
$xout=2;
$xinactive=3;
$xpriority=4;
$xresethits=5;
$xuser=6;
$xemail=7;
$xpassword=8;
$xstatics=9;
$xsite=10;
$xdescription=11;
$xurl=12;
print"Content-type: text/html\n\n";
if($ENV{'REQUEST_METHOD'} eq "GET"){
$tmp1=$ENV{'QUERY_STRING'};
}else{
read(STDIN,$tmp1,$ENV{'CONTENT_LENGTH'});
}
@tmp2=split(/&/,$tmp1);
foreach $tmp3(@tmp2){
($tmp4,$tmp5)=split(/=/,$tmp3);
$tmp4=~tr/A-Z/a-z/;
$tmp5=~tr/+/ /;
$tmp5=~s/%([a-fA-F0-9][a-fA-F0-9])/pack("C",hex($1))/eg;
$tmp5=~tr/+/ /;
$tmp5=~s/%([a-fA-F0-9][a-fA-F0-9])/pack("C",hex($1))/eg;
$param{$tmp4}=$tmp5;
}
$param_in=$param{'in'};
$param_out=$param{'out'};
$param_id=$param{'id'};
$form_username=$param{'username'};
$form_email=$param{'email'};
$form_sitename=$param{'sitename'};
$form_description=$param{'description'};
$form_url=$param{'url'};
$form_loginname=$param{'loginname'};
$form_password=$param{'password'};
$form_verifypassword=$param{'verifypassword'};
$form_emailstatics=$param{'emailstatics'};
open(DATA,$db1file) or die "error: can't find the file: $db1file \n\n";
@datalines=<DATA>;
close(DATA);
$lendatalines=@datalines;
# new member signup...
$tmp1="Verify password field is empty!" unless defined $form_verifypassword;
$tmp1="Password field is empty!" unless defined $form_password;
$tmp1="Login name field is empty!" unless defined $form_loginname;
$tmp1="Url field is empty!" unless defined $form_url;
$tmp1="Description field is empty!" unless defined $form_description;
$tmp1="Site name field is empty!" unless defined $form_sitename;
$tmp1="Email field is empty!" unless defined $form_email;
$tmp1="Username field is empty!" unless defined $form_username;
unless($tmp1 eq ""){
print $tmp1;
}
# incomming visitor...
if($param_in eq 1){
for($tmp1=0;$tmp1<$lendatalines;$tmp1++){
@memberinfo1=split(/\|/,$datalines[$tmp1]);
$lenmemberinfo1=@memberinfo1;
if($memberinfo1[$xid] eq $param_id){
$datalines[$tmp1]="";
$memberinfo1[$xin]=$memberinfo1[$xin]+1;
$memberinfo1[$xinactive]=0;
for($tmp2=0;$tmp2<$lenmemberinfo1;$tmp2++){
$datalines[$tmp1]=$datalines[$tmp1].$memberinfo1[$tmp2];
if($tmp2!=($lenmemberinfo1-1)){$datalines[$tmp1]=$datalines[$tmp1]."|"}
}
open(DATA,">$db1file");
if($runlocal eq 0){flock(DATA,2);}
for($tmp1=0;$tmp1<$lendatalines;$tmp1++){
print DATA "$datalines[$tmp1]";
}
if($runlocal eq 0){flock(DATA,8);}
close(DATA);
}
}
}
# outgoing visitor...
if($param_out eq 1){
for($tmp1=0;$tmp1<$lendatalines;$tmp1++){
@memberinfo1=split(/\|/,$datalines[$tmp1]);
$lenmemberinfo1=@memberinfo1;
if($memberinfo1[$xid] eq $param_id){
$datalines[$tmp1]="";
$memberinfo1[$xout]=$memberinfo1[$xout]+1;
for($tmp2=0;$tmp2<$lenmemberinfo1;$tmp2++){
$datalines[$tmp1]=$datalines[$tmp1].$memberinfo1[$tmp2];
if($tmp2!=($lenmemberinfo1-1)){$datalines[$tmp1]=$datalines[$tmp1]."|"}
}
open(DATA,">$db1file");
if($runlocal eq 0){flock(DATA,2);}
for($tmp1=0;$tmp1<$lendatalines;$tmp1++){
print DATA "$datalines[$tmp1]";
}
if($runlocal eq 0){flock(DATA,8);}
close(DATA);
print"Location: $memberinfo1[$xurl]\n\n";
}
}
}
# return list...
for($tmp1=0;$tmp1<($lendatalines-1);$tmp1++){
for($tmp2=($tmp1+1);$tmp2<($lendatalines);$tmp2++){
@memberinfo1=split(/\|/,$datalines[$tmp1]);
@memberinfo2=split(/\|/,$datalines[$tmp2]);
if($memberinfo1[$xin]<$memberinfo2[$xin]){
$tmp3=$datalines[$tmp1];
$datalines[$tmp1]=$datalines[$tmp2];
$datalines[$tmp2]=$tmp3;
}else{
if($memberinfo1[$xout]>$memberinfo2[$xout]){
$tmp3=$datalines[$tmp1];
$datalines[$tmp1]=$datalines[$tmp2];
$datalines[$tmp2]=$tmp3;
}
}
}
}
print"var links=new Array(\n";
for($tmp1=0;$tmp1<$lendatalines;$tmp1++){
print"'$datalines[$tmp1]'";
}
print");\n";
------------------------------
Date: 8 Nov 2001 22:02:09 GMT
From: fxn@retemail.es (F. Xavier Noria)
Subject: Re: Oracle DBI Question
Message-Id: <9sevd1$3far33@news1s.iddeo2.es>
On Wed, 07 Nov 2001 23:53:06 GMT, Turtle <turtle*no-spam*@iislands.com> wrote:
: I downloaded the Oracle module and
: tried to install it but it seems to want Oracle mounted on my local machine.
: The configuration for the project required a central server with the
: database on it accessed from many remote clients. MySQL handles this with
: ease so I thought it would be a no brainier for Oracle.
:
:
: The question is what else do I need to load to get Oracle to do this. Anyone
: worked through this type of situation before? I am using the latest version
: of 8i and Perl.
DBD::Oracle needs things provided by the installation called "for
programmers" (or something like that) you'll found in Oracle's CD.
After that, at least on Linux you may initialize the environment
variable ORACLE_HOME before installing DBD::Oracle to tell it where
those files live.
-- fxn
------------------------------
Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 6 Apr 01)
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.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V10 Issue 2095
***************************************