[16698] in Perl-Users-Digest
Perl-Users Digest, Issue: 4110 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Aug 23 18:15:48 2000
Date: Wed, 23 Aug 2000 15:15:33 -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: <967068932-v9-i4110@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Wed, 23 Aug 2000 Volume: 9 Number: 4110
Today's topics:
Re: Please help, 1024 char limit writing to DB's? <panderse@us.ibm.com>
Re: Please help, 1024 char limit writing to DB's? (Eric Bohlman)
Re: problems with regex <tim@ipac.caltech.edu>
Re: Rationale Behind 'Use of Uninitialized Value' Warni (Abigail)
Re: Rationale Behind 'Use of Uninitialized Value' Warni (Abigail)
Re: Rationale Behind 'Use of Uninitialized Value' Warni (Greg Bacon)
s''' not behaving as expected <ren.maddox@tivoli.com>
script that use Logfile::Rotate ferrowies@my-deja.com
Re: script that use Logfile::Rotate rereidy@my-deja.com
Re: script that use Logfile::Rotate <e.g.ijff@chello.nl>
Re: Sitescooper in Mandrake jpai@rocketmail.com
Re: Sitescooper in Mandrake jpai@rocketmail.com
Re: Unexpected behavior of shift in a loop (Jeff HIll)
Re: write a file in an array <undergronk@my-deja.com>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 23 Aug 2000 14:01:57 -0500
From: "Paul R. Andersen" <panderse@us.ibm.com>
Subject: Re: Please help, 1024 char limit writing to DB's?
Message-Id: <39A41FA5.5AD3EA96@us.ibm.com>
perlnewbie@my-deja.com wrote:
>
> I am encountering an error when I try and write to a DB file in WinNT
> using Active Perl. Here is the error message I receive:
>
> "Tue Aug 22 09:54:07 2000: sdbm store returned -1, errno 22,
> key "92"..."
>
> It seems that I am only allowed to write a maximum of 1024 characters.
> I was wondering if there is any way to work around this limitation?
> Below is a code snippet of the function which is writing to the DB
> file. I am trying to migrate an existing site in Unix environment to
> WinNT and I am running Active Perl.
If you are using SDBM the limit is 1024 bytes. (SDBM comes with Perl.)
I ran into this too and there are two options. Either rebuild part of
the distribution yourself or go get the BerkelyDB and install it. I
took the second course and had no trouble (though I installed on a Unix
platform). I have not hit any limits yet after a couple of years.
Good luck.
--
Paul Andersen
+++++++++++++
The difference between theory and practice is that in theory there is no
difference between theory and practice; but in practice there is.
------------------------------
Date: 23 Aug 2000 19:15:45 GMT
From: ebohlman@netcom.com (Eric Bohlman)
Subject: Re: Please help, 1024 char limit writing to DB's?
Message-Id: <8o17t1$81m$1@slb6.atl.mindspring.net>
perlnewbie@my-deja.com wrote:
: I am encountering an error when I try and write to a DB file in WinNT
: using Active Perl. Here is the error message I receive:
:
: "Tue Aug 22 09:54:07 2000: sdbm store returned -1, errno 22,
: key "92"..."
:
: It seems that I am only allowed to write a maximum of 1024 characters.
That's an inherent limit of SDBM. Grab a copy of DB_File from
ActiveState; it doesn't have this limit.
------------------------------
Date: Wed, 23 Aug 2000 12:14:51 -0700
From: Tim Conrow <tim@ipac.caltech.edu>
Subject: Re: problems with regex
Message-Id: <39A422AB.E6A12EC@ipac.caltech.edu>
Martin Gieseking wrote:
> I have to transform many text files with special control sequences into TeX
> source files. My problem consists in the variable number of possible
> parameters of the commands.
> Example: The text files contain commands like this:
> {ZT quotation text}{source of quote}
Check out Damian Conway's Text::Balanced from your local CPAN site and save
yourself the headaches.
--
-- Tim Conrow tim@ipac.caltech.edu 626-395-8435
------------------------------
Date: 23 Aug 2000 19:19:16 GMT
From: abigail@foad.org (Abigail)
Subject: Re: Rationale Behind 'Use of Uninitialized Value' Warning
Message-Id: <slrn8q88sa.tj3.abigail@alexandra.foad.org>
Gabe (grichard@uci.edu) wrote on MMDXLVIII September MCMXCIII in
<URL:news:8nurbe$80e$1@news.service.uci.edu>:
.. I have not been using -w because I don't like getting all the "Use of
.. Uninitialized Value" warnings. What's the value of the warning? Why is it
.. better to say "my $foo = '';" as opposed to "my $foo;"? The latter is
.. quicker to type, and doesn't seem to increase my probability of making
.. programming errors. So what gives?
You don't get use of unitialized value errors if you just do "my $foo;".
You get it when you use $foo as if it had a value. Like using it in
addition, interpolation or a comparison. Which is likely to be a bug,
hence the warning.
.. The people who wrote Slash seem to agree too.
And your point is?
Abigail
--
# Perl 5.6.0 broke this.
%0=map{reverse+chop,$_}ABC,ACB,BAC,BCA,CAB,CBA;$_=shift().AC;1while+s/(\d+)((.)
(.))/($0=$1-1)?"$0$3$0{$2}1$2$0$0{$2}$4":"$3 => $4\n"/xeg;print#Towers of Hanoi
------------------------------
Date: 23 Aug 2000 19:21:14 GMT
From: abigail@foad.org (Abigail)
Subject: Re: Rationale Behind 'Use of Uninitialized Value' Warning
Message-Id: <slrn8q88vv.tj3.abigail@alexandra.foad.org>
Gabe (grichard@uci.edu) wrote on MMDXLVIII September MCMXCIII in
<URL:news:8nv28p$b2c$1@news.service.uci.edu>:
|| Craig Berry <cberry@cinenet.net> wrote in message
|| news:sq5vtf3vt9159@corp.supernews.com...
||
|| > This is a stylistic and debugging question. I have found that by
|| > enforcing the discipline of insisting on explicit value assignments, I
|| > both write more readable code and catch more bugs, more easily. YMMV.
||
|| Hmmm. OK, how do you catch more bugs? Here's the situation. I want to assign
|| the variable in a loop, but I want it's scope to be out of the loop so I can
|| do something with it so my code is like:
||
|| my $foo;
||
|| while (condition) {
|| if (condition) {$foo = 'foo'};
|| }
That does not trigger the warning.
|| #do something with $foo...
This *may* trigger the warning depending on how you use $foo, and depending
whether condition is true or not. If the condition is false, $foo remains
uninialized. What are you doing with $foo?
|| Now why would it be better to say
||
|| my $foo = '';
||
|| instead?
It isn't. It's how you use $foo.
Abigail
--
package Z;use overload'""'=>sub{$b++?Hacker:Another};
sub TIESCALAR{bless\my$y=>Z}sub FETCH{$a++?Perl:Just}
$,=$";my$x=tie+my$y=>Z;print$y,$x,$y,$x,"\n";#Abigail
------------------------------
Date: Wed, 23 Aug 2000 20:56:07 GMT
From: gbacon@HiWAAY.net (Greg Bacon)
Subject: Re: Rationale Behind 'Use of Uninitialized Value' Warning
Message-Id: <sq8ej74ut91114@corp.supernews.com>
In article <8nurbe$80e$1@news.service.uci.edu>,
Gabe <grichard@uci.edu> wrote:
: The people who wrote Slash seem to agree too.
One can do much better than Rob Malda when it comes to choosing a Perl
hero. :-)
Greg
--
People should think first, then wave with awards.
-- Abigail
------------------------------
Date: 23 Aug 2000 11:17:05 -0500
From: Ren Maddox <ren.maddox@tivoli.com>
Subject: s''' not behaving as expected
Message-Id: <m33djw7y0u.fsf@dhcp11-177.support.tivoli.com>
v5.6.0 for i686-linux-thread-multi (ActiveState build 616)
The following script:
#!/usr/local/bin/perl -wl
$_='$foo';
s'$foo'$bar';
print;
Produces as output:
$foo
Escaping $foo ( s'\$foo'$bar' ) results in:
$bar
However, running each of these through -MO=Deparse results in:
$_ = '$foo';
s/\$foo/\$bar/;
print $_;
- syntax OK
I assume this is a bug. Is it a known bug?
--
Ren Maddox
ren@tivoli.com
------------------------------
Date: Wed, 23 Aug 2000 19:49:08 GMT
From: ferrowies@my-deja.com
Subject: script that use Logfile::Rotate
Message-Id: <8o19rc$a90$1@nnrp1.deja.com>
Trying an example from "Perl for System
Administration" book, I have this error message:
Can't call method "HUP" without a package or
object reference at ./rotlogs.pl line 15.
Anyone can help me?
TIA
Fernando Rowies
This is the script rotlogs.pl:
#!/usr/bin/perl
use Logfile::Rotate;
$logfile = new Logfile::Rotate(
File =>
"/var/log/httpd/saxofonistas/error_log",
Count => 5,
Gzip => "/usr/bin/gzip",
Signal =>
sub {
open PID,
"/var/run/httpd.pid" or
die "No se pudo abrir
archivo pid:$!\n";
chomp($pid = <PID>);
close PID;
kill -HUP $pid;
}
);
$logfile->rotate();
undef
$logfile;
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Wed, 23 Aug 2000 20:28:21 GMT
From: rereidy@my-deja.com
Subject: Re: script that use Logfile::Rotate
Message-Id: <8o1c4c$d88$1@nnrp1.deja.com>
Does it need backticks?
Ron Reidy
Oracle DBA
Reidy Consulting, L.L.C.
In article <8o19rc$a90$1@nnrp1.deja.com>,
ferrowies@my-deja.com wrote:
> Trying an example from "Perl for System
> Administration" book, I have this error message:
>
> Can't call method "HUP" without a package or
> object reference at ./rotlogs.pl line 15.
>
> Anyone can help me?
> TIA
> Fernando Rowies
>
> This is the script rotlogs.pl:
>
> #!/usr/bin/perl
>
> use Logfile::Rotate;
>
> $logfile = new Logfile::Rotate(
> File =>
> "/var/log/httpd/saxofonistas/error_log",
> Count => 5,
> Gzip => "/usr/bin/gzip",
> Signal =>
> sub {
> open PID,
> "/var/run/httpd.pid" or
> die "No se pudo abrir
> archivo pid:$!\n";
> chomp($pid = <PID>);
> close PID;
> kill -HUP $pid;
> }
> );
>
> $logfile->rotate();
> undef
> $logfile;
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
>
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Wed, 23 Aug 2000 22:53:12 +0200
From: Bert IJff <e.g.ijff@chello.nl>
Subject: Re: script that use Logfile::Rotate
Message-Id: <39A439B8.DB30E1C8@chello.nl>
ferrowies@my-deja.com wrote:
>
> Trying an example from "Perl for System
> Administration" book, I have this error message:
>
> Can't call method "HUP" without a package or
> object reference at ./rotlogs.pl line 15.
>
> Anyone can help me?
> TIA
> Fernando Rowies
>
> This is the script rotlogs.pl:
>
> #!/usr/bin/perl
>
> use Logfile::Rotate;
>
> $logfile = new Logfile::Rotate(
> File =>
> "/var/log/httpd/saxofonistas/error_log",
> Count => 5,
> Gzip => "/usr/bin/gzip",
> Signal =>
> sub {
> open PID,
> "/var/run/httpd.pid" or
> die "No se pudo abrir
> archivo pid:$!\n";
> chomp($pid = <PID>);
> close PID;
> kill -HUP $pid;
use
kill HUP, $pid;
see
perldoc perlfunc
perldoc perlipc
perldoc -f kill
> }
> );
>
> $logfile->rotate();
> undef
> $logfile;
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
------------------------------
Date: Wed, 23 Aug 2000 19:48:30 GMT
From: jpai@rocketmail.com
Subject: Re: Sitescooper in Mandrake
Message-Id: <8o19q6$a8c$1@nnrp1.deja.com>
I checked my system and found out I did miss a lot of perl components. I
tried to install them, and it seemed that I get some improvemnet, but
still not quite there yet. I am guessing if I can upgrade perl to 5.600,
it may help. However, I did a wrong thing to force it to replace my old
5.005 version, and it seems to break a few things including kpackage. I
would like to remove perl 5.005 cleanly from my system and reinstall
5.600 with all the necessary components to run sitescooper, what will be
the procedures to do that? I can now only run console "rpm". What should
I remove, and what should I reinstall to have a clean perl environment?
Thanks!
In article <moGo5.59107$rd1.10807717@typhoon-news1.southeast.rr.com>,
"Philip Garrett" <philipg@atl.mediaone.net> wrote:
> <jpai@rocketmail.com> wrote in message
news:8nuvbu$jtp$1@nnrp1.deja.com...
> >
> > Reading configuration from "/root/.sitescooper/sitescooper.cf".
> > Can't locate LWP/UserAgent.pm in @INC (@INC contains:
> > /usr/lib/perl5/5.00503/i386-linux /usr/lib/perl5/5.00503
> > /usr/lib/perl5/site_perl/5.005/i386-linux
/usr/lib/perl5/site_perl/5.005
> > . /usr/bin/lib /usr/bin/site_perl /usr/bin/../share/sitescooper/lib
> > /usr/bin/../share/sitescooper/site_perl) at Scoop.pm line 701.
> >
> >
> > I know next to nothing about perl. I will appreciate if somebody can
> > give me a hint on how to fix this and make it work.
> >
>
> There's a Perl module missing that your program needs. You can get
the
> Mandrake RPM from
>
ftp://ftp.twoguys.org/pub/linux/distributions/mandrake/current/Mandrake/RPMS
> /perl-libwww-perl-5.47-3mdk.i586.rpm
> (or any other mdk mirror)
>
> Or, you can build it yourself:
>
> perl -MCPAN -e 'install Bundle::LWP'
>
> hth
> Philip
>
>
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Wed, 23 Aug 2000 19:49:38 GMT
From: jpai@rocketmail.com
Subject: Re: Sitescooper in Mandrake
Message-Id: <8o19sa$a9f$1@nnrp1.deja.com>
I did install LWP module. It should be something else.
In article <39A332DF.165FDAE7@rochester.rr.com>,
Bob Walton <bwalton@rochester.rr.com> wrote:
> jpai@rocketmail.com wrote:
> ...
> ...
> > Can't locate LWP/UserAgent.pm in @INC (@INC contains:
> ...
> > I know next to nothing about perl. I will appreciate if somebody can
> > give me a hint on how to fix this and make it work.
> ...
> Sounds like you need to download the LWP module. Get it from CPAN.
> --
> Bob Walton
>
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Wed, 23 Aug 2000 20:04:02 GMT
From: jeffahill@lucent.com (Jeff HIll)
Subject: Re: Unexpected behavior of shift in a loop
Message-Id: <39a42dbe.101928468@nntp.lucent.com>
On Tue, 22 Aug 2000 14:48:01 GMT, marcel@codewerk.com (Marcel
Grunauer) wrote:
>That loop wouldn't be executed at all, since after assigning 0 to $i,
>you then test if it is equal to 3, which it isn't, so the loop terminates
>before executing even once.
Doh! Oops, my bad, thanks for catching that.
And thanks to Ren Maddox for his suggestion. It seems to be the
shortest possible bit of code, and it seems to do the most. Thanks
again.
Jeff Hill
------------------------------
Date: Wed, 23 Aug 2000 20:59:36 GMT
From: Scott Kirk <undergronk@my-deja.com>
Subject: Re: write a file in an array
Message-Id: <8o1dvb$fgr$1@nnrp1.deja.com>
> > Javier Hijas <jhijas@yahoo.es> wrote:
> >
> >> > Can you tell me a nice way to copy an entire file in an array?
> >>
> >> Ok, I already found a fancy way!!:
> >>
> >> while (<FILE>) {
> >> push @file,$_;
> >> }
> On Tue, 22 Aug 2000 13:16:29 GMT Scott Kirk was puzzled and asked:
> > In article <39A24AF5.3B7A9862@yahoo.es>,
> > Yes. But _why_ would you want to do it this way?
In article <8nvt9i$51g$1@orpheus.gellyfish.com>,
Jonathan Stowe <gellyfish@gellyfish.com> wrote:
> Memory consumption. In crude tests I find that the push() method uses
> about 20% less memory for a file of ~400k
Hmm. Top tip. Could come in handy. :-)
> this might become extremely significant for a large file.
But would you use this method for an extremely large file?
<Nice Benchmarks snipped>
--
Scott Kirk
My deja.com mailbox is full of spam. Use this instead:
perl -e '$_ = "znvygb: haqretebax\@lnubb.pbz";
tr/A-Za-z/N-ZA-Mn-za-m/; print;'
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 16 Sep 99)
Message-Id: <null>
Administrivia:
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V9 Issue 4110
**************************************