[12753] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 163 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Jul 16 05:07:15 1999

Date: Fri, 16 Jul 1999 02:05:09 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Fri, 16 Jul 1999     Volume: 9 Number: 163

Today's topics:
        $ENV{} Variable List  (Ben Short)
    Re: C-like #define macros in Perl <matt@sergeant.org>
        Full path to file justinchaffey@my-deja.com
    Re: Full path to file (Bart Lateur)
    Re: help with perl (Bart Lateur)
    Re: how do i convert a integer to string. (Bart Lateur)
        How do I find the current line-number while the script  <mike@crusaders.no>
        How to disable auto-loading? <lichtin@bivio.com>
        LWP::Simple --- can't get URL. <bloodlet19@hotmail.com>
    Re: Net::NNTP problem <vtt@de.uu.net>
    Re: Net::NNTP problem <vtt@de.uu.net>
        odbc and setting dsn <dominique_bertrand@Non-HP-France-om3.om.hp.com>
    Re: ok, DBI alt row colors - phrased better w/code (Abigail)
    Re: Perl before Swine? (Abigail)
    Re: Perl before Swine? <matt@sergeant.org>
        Problem installing modules. (Meeko)
    Re: question on mail attachments (Abigail)
        Sending attachments with qmail and perl (Spudnic)
        Simple Question: How do I call a subroutine in a differ (Don Soloway)
    Re: Simple Question: How do I call a subroutine in a di (Bart Lateur)
    Re: Tiny error in perlfaq5 <matt@sergeant.org>
    Re: Tiny error in perlfaq5 <thoren@csi.com>
    Re: using slices in a hash of a hash (brian d foy)
    Re: Variable limitations (Abigail)
    Re: What's faster: GDBM or Storable <thomas@bibsyst.no>
        Why can't install these two perl modules? Help please. <zzhang@bayou.uh.edu>
        Digest Administrivia (Last modified: 1 Jul 99) (Perl-Users-Digest Admin)

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

Date: Fri, 16 Jul 1999 18:51:51 +1000
From: bshort@n0spam.shortboy.dhs.org (Ben Short)
Subject: $ENV{} Variable List 
Message-Id: <MPG.11f99db669e7d3c49896c7@loomi.telstra.net>

Hi,
I'm looking for the list of expessions of $ENV{} that can be used for 
gaining data about remote hosts.

I I realise there is the %ENV hash, which contains local info, but I need 
remote information like $ENV{'REMOTE_ADDR'}. I intend to make a 
statistical sort of CGI script to gain some demographics of the people 
acessing my site.

Is there a list of what expressions can be used with the $ENV{} floating 
around somewhere. If so, can someone drop me an email (remove the n0spam) 
a list, or URL?

Thanks
Ben
-- 
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Ben Short                http://www.shortboy.dhs.org
Shortboy Productions     mailto:bshort@n0spam.shortboy.dhs.org

*Remove n0spam to email me*
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-


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

Date: Fri, 16 Jul 1999 09:30:51 +0100
From: Matt Sergeant <matt@sergeant.org>
Subject: Re: C-like #define macros in Perl
Message-Id: <378EEDBB.B71A4537@sergeant.org>

Abigail wrote:
> 
> Uri Guttman (uri@sysarch.com) wrote on MMCXLIV September MCMXCIII in
> <URL:news:x7n1wxnbjo.fsf@home.sysarch.com>:
> &&
> && d'oh! i knew that! can she allow her lusers to use deja? here is the url
> && for the post with the whole description of how i used -P
> 
> Well, access to deja isn't forbidden, but access to the keyboard is.
> And there's no mouse.

Wow. Someone else who reads usenet by osmosis... cool.

Matt.


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

Date: Fri, 16 Jul 1999 06:47:33 GMT
From: justinchaffey@my-deja.com
Subject: Full path to file
Message-Id: <7mmki3$75v$1@nnrp1.deja.com>

I'm building a perl script for processing groups
of files and I somehow need to find the full
network path to each file.  But, not by examining
the command line arguments if possible.

As far as I can see, the 'stat' command cannot
help.  And, after quite a lot of searching I have
not found any other options.

Grateful for any suggestions!

Justin



Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.


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

Date: Fri, 16 Jul 1999 08:15:05 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: Full path to file
Message-Id: <3790e8d1.6117162@news.skynet.be>

justinchaffey@my-deja.com wrote:

>I'm building a perl script for processing groups
>of files and I somehow need to find the full
>network path to each file.  But, not by examining
>the command line arguments if possible.
>
>As far as I can see, the 'stat' command cannot
>help.  And, after quite a lot of searching I have
>not found any other options.

Uh... does this mean that you can access the file anyway? That it's
specification is somehow relative to the current directory? In that
case, the module Cwd may be of assistance.

	use Cwd;
	print "I am in ". cwd;

It will tell you the Current Working Directory. You may be able to work
it out from there. You can always store the current CWD, do a chdir() to
the dir of the file, and check the cwd() there. Afterwards, restore the
old CWD, and you're back where you started, ready for the next file.

   HTH,
   Bart.


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

Date: Fri, 16 Jul 1999 07:22:56 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: help with perl
Message-Id: <378fdbd3.2790519@news.skynet.be>

Abigail wrote:

>Oh, golly. Bart tries to be smart again. Too bad he couldn't control 
>himself and had to post before reading the rest of what Jim had to say:

Pot. Kettle. Black.

	Bart.


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

Date: Fri, 16 Jul 1999 07:40:14 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: how do i convert a integer to string.
Message-Id: <378ee0b9.4044951@news.skynet.be>

cramey@my-deja.com wrote:

>i want to convert an integer
>
>specifically
>
>1111111 to a string with
>
>str[0] == 1
>.
>.
>.
>str[6] == 1
>
>is there an easy way to do this ?

Is that front to back, or back to front?

Let's see (add reverse() if you must):

$_ = "1111111";
 A)
	@str = split //;

 B)
	@str = /(\d)/g;
or
	@str = /(.)/g

 C) Manually, and backwards:

	my $i = 0;
	while($_) {
		$str[$i++] = $_ % 10;
		$_ = int($_/10);
	}

	Bart.


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

Date: Fri, 16 Jul 1999 10:40:19 +0200
From: "Trond Michelsen" <mike@crusaders.no>
Subject: How do I find the current line-number while the script is running?
Message-Id: <NdCj3.67$nz6.124@news1.online.no>

I have a small problem. I have to make a small wrapper for the die()
function, so that instead of just dying, the program closes a database,
writes to a logfile, then removes a lockfile and finally just dies.

This sort of works fine, but when die() report which line it died at, it
will of course only report the line-number of the die() function and I'd
like to know the linenumber where harakiri() kicked in.

sub harakiri

my ($progName, $bang)=@_;
my $end = (times)[0];

# Lukke nyhetsdatabasen
$rdb->close($database);

print LOG scalar localtime, "\n";
print LOG"
 update  ".int($supdate)."
 throw   ".int($sthrow)."
 new     ".int($snew)."
 unknown ".int($sunknown)."
 ";
print  LOG "\nInterrupted: $progName:$bang\n";
printf LOG "\nDone, elapsed time: %.2f seconds. Bye!\n", $end-$start;
close (LOG);

# sletter filer og laaser opp prosessen.
unlink $LOCK;

die("$progName : $bang");
}

--
Trond Michelsen




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

Date: Fri, 16 Jul 1999 08:41:15 +0000
From: Martin Lichtin <lichtin@bivio.com>
Subject: How to disable auto-loading?
Message-Id: <378EF02B.75167387@bivio.com>

Hi,

I'd like to avoid transient state in a Perl application and
therefore disable the built-in auto-load feature.
Is there any way to build Perl without that feature?

Thanks,
Martin


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

Date: Fri, 16 Jul 1999 07:34:31 GMT
From: bandhunt <bloodlet19@hotmail.com>
Subject: LWP::Simple --- can't get URL.
Message-Id: <7mmna7$8tf$1@nnrp1.deja.com>

I am using Simple.pm and I can't get certain URL's that seem to
redirect.
A good example is "http://www.ubl.com"
it uses ASP(I don't know if thats relevant to the problem).
When "ubl.com" is typed into a browser it redirects to
"http://www.ubl.com/fp.asp?layout=main_front_page". When I use this URL
in my script it works fine.

use LWP::Simple;

$file = get("http://www.ubl.com");

Anyone know how to crawl around this?

Thanks,
    D.J.
P.S.  Sorry about my last post I did a search and didn't see that the Q
had been answered.


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.


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

Date: Fri, 16 Jul 1999 10:19:58 +0200
From: "Van-Thieu Tran" <vtt@de.uu.net>
Subject: Re: Net::NNTP problem
Message-Id: <7mmpvd$10m$1@newsread.do.de.uu.net>

Hi,
> #!/usr/bin/perl
Why don't you use "#!/usr/bin/perl -w" and give us the error output ?

Isn't something missing here ?
use Net::NNTP;

> open(DB, "newsserver.db");    # Open the file
> @nntpserver = <DB>;           # Read it into an array
> close(DB);                    # Close the file
>
> foreach $hostname (@nntpserver) {
> print "\n";
> print "Fetching newsgroups from $hostname\n";

Remove the LF :
chomp($hostname);

> my $nntp = Net::NNTP->new("$hostname", Timeout=>60, Debug=>On) | die
> "Couldn't connect to server $hostname";

Are you sure that the Debug-option is used correctly ? Remove it...

> open(OUTF,">groups/$hostname");
I have tested your program...IT WORKS.
(Sub-Dir "groups" must exist.)

mfg.
Van-Thieu Tran




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

Date: Fri, 16 Jul 1999 10:23:06 +0200
From: "Van-Thieu Tran" <vtt@de.uu.net>
Subject: Re: Net::NNTP problem
Message-Id: <7mmq59$13t$1@newsread.do.de.uu.net>

Hi again,
one more correction...

 > my $nntp = Net::NNTP->new("$hostname", Timeout=>60, Debug=>On) |
die"Couldn't connect to server $hostname";

use "or" instead of "|".

mfg.
Van-Thieu Tran





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

Date: Fri, 16 Jul 1999 09:59:35 +0200
From: domninique bertrand <dominique_bertrand@Non-HP-France-om3.om.hp.com>
Subject: odbc and setting dsn
Message-Id: <378EE667.AC49F3D3@Non-HP-France-om3.om.hp.com>

I have tried to set a dsn for using odbc but i have only seen that you
can set the DSN name, the user and the password whit the syntax :
$test="DSN=test, UID=test, PWD=test";

But i want to set the server name and the odbc driver as you can do when
you set a data source in the Windows NT control panel. is it possible
and how ?



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

Date: 16 Jul 1999 01:15:33 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: ok, DBI alt row colors - phrased better w/code
Message-Id: <slrn7otjf7.c9j.abigail@alexandra.delanet.com>

K. Paul Mallasch (pmallasch@mail.starnews.com) wrote on MMCXLV September
MCMXCIII in <URL:news:q7xj3.350$Cs3.4178062@news.netdirect.net>:
__ 
__ 
__ An if/then statement for each <td> each time thru? If so, what to check
__ against?


A flipflop:


package FlipFlop;


use strict;


sub TIESCALAR {my $class = shift; bless [reverse @_] => $class}
sub FETCH     {my $state = shift; (@$state = reverse @$state) [0]}
sub STORE     {die "Cannot modify read only variable\n"}


package main;


tie my $flip => 'FlipFlop', 'Red', 'Green';


foreach (1 .. 10) {
    print $flip, "\n";
}


__END__
Red
Green
Red
Green
Red
Green
Red
Green
Red
Green




Abigail
-- 
perl -we 'print split /(?=(.*))/s => "Just another Perl Hacker\n";'


  -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
   http://www.newsfeeds.com       The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including  Dedicated  Binaries Servers ==-----


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

Date: 16 Jul 1999 01:20:26 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Perl before Swine?
Message-Id: <slrn7otjoc.c9j.abigail@alexandra.delanet.com>

Burton Kent (burton@lucent.com) wrote on MMCXLIV September MCMXCIII in
<URL:news:378E3BDE.1AA8CE34@lucent.com>:
&& How do I make Perl grab/conserve all the memory it can?	
&& My program needs a lot more memory for recursion...


my $x  = 'x';
   $x .= 'x' while $x;



Abigail
-- 
perl -e '$a = q 94a75737420616e6f74686572205065726c204861636b65720a9 and
         ${qq$\x5F$} = q 97265646f9 and s g..g;
         qq e\x63\x68\x72\x20\x30\x78$&eggee;
         {eval if $a =~ s e..eqq qprint chr 0x$& and \x71\x20\x71\x71qeexcess}'


  -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
   http://www.newsfeeds.com       The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including  Dedicated  Binaries Servers ==-----


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

Date: Fri, 16 Jul 1999 09:47:16 +0100
From: Matt Sergeant <matt@sergeant.org>
Subject: Re: Perl before Swine?
Message-Id: <378EF194.73DAD702@sergeant.org>

Burton Kent wrote:
> 
> How do I make Perl grab/conserve all the memory it can?
> My program needs a lot more memory for recursion...

my $x;
while(1) {
	$x .= ' ' x 100_000;
}

Matt.


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

Date: Fri, 16 Jul 1999 08:17:34 GMT
From: meeko@meeko.org (Meeko)
Subject: Problem installing modules.
Message-Id: <378ee950.100096383@news.earthlink.net>

Can someone tell me what it means when I try to install a module, but
on the 'make' step, it fails with the following error:

cc -c  -Dbool=char -DHAS_BOOL -I/usr/local/include -O2    -
DVERSION=\"2.11\" -DX
S_VERSION=\"2.11\" -fpic -I/usr/lib/perl5/5.00503/i386-linux/CORE  
Base64.c
In file included from Base64.xs:32:
/usr/lib/perl5/5.00503/i386-linux/CORE/perl.h:2546: redefinition of 
`union semun
'
make: *** [Base64.o] Error 1


This happens on many modules I am trying to install, including Base64,
and LWP.  I can't seem to find any documentation on this problem, so I
thought someone here could help.  Thanks in advance!

-Meeko



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

Date: 16 Jul 1999 01:23:15 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: question on mail attachments
Message-Id: <slrn7otjtl.c9j.abigail@alexandra.delanet.com>

tommylebrun@my-deja.com (tommylebrun@my-deja.com) wrote on MMCXLIII
September MCMXCIII in <URL:news:7miu3o$sa1$1@nnrp1.deja.com>:
;; Anyone know how to attach a file to an email then send it? Thanks.


:r file<RETURN>



Abigail
-- 
perl -wlne '}{print$.' file  # Count the number of lines.


  -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
   http://www.newsfeeds.com       The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including  Dedicated  Binaries Servers ==-----


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

Date: Fri, 16 Jul 1999 08:28:14 GMT
From: nospam@spam.com (Spudnic)
Subject: Sending attachments with qmail and perl
Message-Id: <3790ed02.1515212593@news.supernews.com>

I have been using a perl script I wrote that sends email messages,
including binary attachments that have been base64 encoded.

This works fine as long as the smtp host is sendmail.  The script can
send mail that does not include attachments via qmail, but stick an
attachment in and it dies.

Here is a bit of the code.  This is within a loop for then number of
attachments to send.  I have the same problem whether I'm sending 1
attachment or 20.  Don't laugh, I'm using this to try to learn perl.

      print S "--$boundry\r\n";
      if (/.gif$/i) {
         print S "Content-Type: Image/GIF; name=\"$_\"\r\n";
         print S "Content-Disposition: attachment\;
filename=\"$_\"\r\n";
         print S "Content-Transfer-Encoding: BASE64\r\n\r\n";
      } elsif (/.zip$/i) {
         print S "Content-Type: Application/ZIP; name=\"$_\";
type=PKZIP Archive\r\n";
         print S "Content-Disposition: attachment\;
filename=\"$_\"\r\n";
         print S "Content-Transfer-Encoding: BASE64\r\n\r\n";
      } elsif (/.z$/i) {
         print S "Content-Type: Application/ZIP; name=\"$_\";
type=GZIP Archive\r\n";
         print S "Content-Disposition: attachment\;
filename=\"$_\"\r\n";
         print S "Content-Transfer-Encoding: BASE64\r\n\r\n";
      } else {
         print S "Content-Type: Application/Octet-stream; name=\"$_\";
type=Unknown\r\n";
         print S "Content-Disposition: attachment\;
filename=\"$_\"\r\n";
         print S "Content-Transfer-Encoding: BASE64\r\n\r\n";
      }
      $senditup = "$attdir\\$_";
      open(FILE, $senditup) || print "Can't open file \n";
      binmode FILE;
      while (read(FILE, $buf, 60*57)) {
         print S encode_base64($buf);
      }
      close (FILE);

If I remark out the  line print S encode_base64($buf); the message
sends fine, of course without the attachment in it.

If I change the line to something like print S "Howdy"; it works and I
get the word Howdy back relative to the number of chunks the binary
file is.

Once again, it work fine with no changes if the smtp server is
sendmail.

Any ideas?

--James



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

Date: Fri, 16 Jul 1999 07:07:09 GMT
From: don@infi.net (Don Soloway)
Subject: Simple Question: How do I call a subroutine in a different file?
Message-Id: <378ed84d.76870456@news.supernews.com>

I would like to creat a file of subroutines and be able to call them
from perl scripts.  The subroutines take parameters and returns one.
What is the simplest way of doing this?  

For example I have the subroutine I call clean in clean.pl and looks
like this:

# Subroutines

sub clean {
    $string = shift;
    $string =~ s/\+/ /g;
    $string =~ s/\n//g;
    $string =~ s/\r//g;
    return($string);
}

#------------------------------------------

and my perl script looks like this:

#!/usr/bin/perl

read_net_input();  

$name = &clean($GLOBAL{'FullName'});

and some other stuff.....

#-----------------------------------------

Thank you very much,
Don Soloway




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

Date: Fri, 16 Jul 1999 08:03:38 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: Simple Question: How do I call a subroutine in a different file?
Message-Id: <378ee6bf.5587025@news.skynet.be>

Don Soloway wrote:

>I would like to creat a file of subroutines and be able to call them
>from perl scripts.  The subroutines take parameters and returns one.
>What is the simplest way of doing this?  

See require(). Put your subs in a common file, add (for example) the
statement "1;" at the end of the file, and save it. Put it somewhere in
one of the directories indicated by @INC.

Now, all you have to do is 

	require "thatfile.pl";

(if "thatfile.pl" is the filename)

and it is as if the subs are simply pasted into your script.

   HTH,
   Bart.


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

Date: Fri, 16 Jul 1999 09:43:03 +0100
From: Matt Sergeant <matt@sergeant.org>
Subject: Re: Tiny error in perlfaq5
Message-Id: <378EF097.25D83F57@sergeant.org>

Tom Christiansen wrote:
> 
> :Binary build 518 provided by ActiveState Tool Corp.
> :http://www.ActiveState.com
> :Built 13:14:00 Jun 24 1999
> :
> :so... activestate feature or bug? ;)
> 
> Yes.
> 
> How many randbits?

AS Perl is built with 15 randbits.

Matt.

(don't CC me on replies. I read the NG)


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

Date: Fri, 16 Jul 1999 10:42:47 +0200
From: "Thoren Johne" <thoren@csi.com>
Subject: Re: Tiny error in perlfaq5
Message-Id: <u0Yd2c2z#GA.302@nih2naaa.prod2.compuserve.com>

Tom Christiansen <tchrist@mox.perl.com> wrote in message
news:378e552f@cs.colorado.edu...

> How many randbits?

randbits='15';

not enough i guess...

gruß
thoren

--
8#X





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

Date: Fri, 16 Jul 1999 02:06:40 -0500
From: brian@pm.org (brian d foy)
Subject: Re: using slices in a hash of a hash
Message-Id: <brian-1607990206400001@90.bloominton-01rs13-14rt.il.dial-access.att.net>

In article <us2oghdmbpm.fsf@fht2006.fm.intel.com>, Michael Kelly - FVC PCD
VET ~ <kelly@pcocd2.intel.com> wrote:

>S Starre <sstarre@my-deja.com> writes:
>
>> 
>>  I'm tyring to use something like:
>> 
>>   foreach (@main::names2)
>>
>>    {@h{$_}{@main::names} = @main::thelist;
>> 
>> and I get:
>> 
>> Can't use subscript on hash slice at x.pl line 23, near "@main::names}"
>> 
>> why? @h{$_}{@main::names} is a slice isn't it?
>
>        Been there...Either you think you're over writing the list
>@main::names pointed to with $h{$_} by the assignment, which you would
>do with  $h{$_} = @main::names.  Or you're trying to use each element
>of the list  @h{$_}{@main::names} as a key pointing to each value in
>the list @main::thelist, in which case you would use 'map', which I
>have never done.

if you don't know what you are saying, don't say anything.  guessing
only confuses others.

the example he gives is a hash slice, but the slice is @h{$_}, 
which is not the intended behaviour.  here is the way it should
be done:

   #!/usr/bin/perl -w

   $hash{minnow}{gilligan} = 'foo';
   $hash{minnow}{skipper}  = 'bar';
   $hash{minnow}{ginger}   = 'baz';

   #notice the braces around the reference $hash{minnow}
   #which is the reference to the hash on which we want
   #to slice
   @values = @{$hash{minnow}}{ qw(gilligan skipper ginger) };

   print "@values\n";

-- 
brian d foy                    
CGI Meta FAQ <URL:http://www.smithrenaud.com/public/CGI_MetaFAQ.html>
Perl Monger Hats! <URL:http://www.pm.org/clothing.shtml>


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

Date: 16 Jul 1999 01:27:52 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Variable limitations
Message-Id: <slrn7otk6a.c9j.abigail@alexandra.delanet.com>

Rasmus Aaen (rasmus@aen.dk) wrote on MMCXLIV September MCMXCIII in
<URL:news:Wohj3.74$V81.200@news.get2net.dk>:
## 
## Is it true, that scalar variables in Perl has a size limit? If so, how do
## you change that limit?


Become super user and kill all luser processes, except your Perl program.



Abigail
-- 
perl -e '* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
         / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / 
         % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %;
         BEGIN {% % = ($ _ = " " => print "Just Another Perl Hacker\n")}'


  -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
   http://www.newsfeeds.com       The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including  Dedicated  Binaries Servers ==-----


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

Date: Fri, 16 Jul 1999 09:20:02 +0200
From: Thomas Weholt <thomas@bibsyst.no>
Subject: Re: What's faster: GDBM or Storable
Message-Id: <378EDD21.F163052C@bibsyst.no>

Hi,

I think you`ll have to look at some indexing-routines for really fast
performance.  If you`re thinking of doing some sequential
search, the performance will depend on number of entries. This is
sloooow, but takes up less space than indexing.

I use MLDBM and DB_File with lots of entries, build an index for
keywords to lookup, and the whole thing has great response
time. The price to pay is the size and number of index-files. Doing
something like

each ($key, $value)

or

foreach $blab (keys %db-file)

will be slow as hell on larger data

nkaiser@my-deja.com wrote:

> I have an application which uses GDBM hash files for the database.
> However, to accomodate the win32 people (I know there is a port), I
> converted to use Perl data structures (assoc. arrays) and use the
> Storable module.
>
> Does anyone have any benchmarks on what would have faster access,
> saving, etc?
>
> Thanks
>
> Sent via Deja.com http://www.deja.com/
> Share what you know. Learn what you don't.

--
<----0000o--[(.)-(.)]---o0000-----------------<<
Thomas Weholt           | Consequence, -
thomas@bibsyst.no       | now the panic comes.
>>-----------=======---------- Support Linux -->





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

Date: Fri, 16 Jul 1999 01:05:00 -0500
From: Zhengdong Zhang <zzhang@bayou.uh.edu>
Subject: Why can't install these two perl modules? Help please.
Message-Id: <378ECB8C.406A@bayou.uh.edu>

I tried to install several perl modules yesterday on a Red Hat Linux 5.0
machine using CPAN module. All but LWP and DBD::mysql were successfully
installed.
Both of the installation of LWP and DBD::mysql cannot pass the test(DBI
module has been installed). For LWP, the error message is:

 ...(messages above are omitted)...
Running make test
/usr/bin/perl -e 'use Config; chdir q{./blib/script}; foreach (qw(GET
HEAD POST)) {' \
-e 'unlink "$_";' \
-e 'system("$Config{\"lns\"} lwp-request $_") && die; }'
/usr/bin/perl t/TEST 0
base/common-req.....ok
base/cookies........ok
base/date...........ok
base/headers-auth...ok
base/headers-etag...ok
base/headers-util...ok
base/headers........ok
base/listing........ok
base/mediatypes.....ok
base/message........ok
base/negotiate......ok
base/response.......ok
base/status.........ok
robot/rules-dbm.....ok
robot/rules.........ok
robot/ua............HTTP Server terminated
FAILED tests 1-3, 5, 7
        Failed 5/7 tests, 28.57% okay
local/autoload......ok
local/get...........ok
local/http..........HTTP Server terminated
Can't call method "is_redirect" without a package or object reference at
local/http.t line 186, <DAEMON> chunk 1.
dubious
        Test returned status 9 (wstat 2304, 0x900)
Undefined subroutine &Test::Harness::WCOREDUMP called at
/usr/lib/perl5/Test/Harness.pm line 252.
make: *** [test] Error 2
  /usr/bin/make test -- NOT OK
Running make install
  make test had returned bad status, won't install without force




For DBD::mysql, the message is: 


 CPAN.pm: Going to build JWIED/Msql-Mysql-modules-1.2201.tar.gz

Which drivers do you want to install?

    1)  MySQL only
    2)  mSQL only (either of mSQL 1 or mSQL 2)
    3)  MySQL and mSQL (either of mSQL 1 or mSQL 2)
    4)  mSQL 1 and mSQL 2
    5)  MySQL, mSQL 1 and mSQL 2

Enter the appropriate number:  [3] 1


Do you want to install the MysqlPerl emulation? You might keep your old
Mysql module (to be distinguished from DBD::mysql!) if you are concerned
about compatibility to existing applications! [n] 
Where is your MySQL installed? Please tell me the directory that
contains the subdir 'include'. [/usr] 
Which database should I use for testing the MySQL drivers? [test] 
On which host is database test running (hostname, ip address
or host:port) [localhost] 
User name for connecting to database test? [undef] 
Password for connecting to database test? [undef] 
Creating files for MySQL ....................
Checking if your kit is complete...
Looks good
Using DBI 1.13 installed in /usr/lib/perl5/site_perl/i386-linux/auto/DBI
Writing Makefile for DBD::mysql
Writing Makefile for Msql-Mysql-modules
mkdir ./blib
mkdir ./blib/lib
mkdir ./blib/arch
mkdir ./blib/arch/auto
mkdir ./blib/arch/auto/Msql-Mysql-modules
mkdir ./blib/lib/auto
mkdir ./blib/lib/auto/Msql-Mysql-modules
mkdir ./blib/man1
/usr/bin/perl -I./blib/arch -I./blib/lib
-I/usr/lib/perl5/i386-linux/5.00404 \
-I/usr/lib/perl5 -Ilib -MExtUtils::PerlPP \
-e "ppp('dbd/dbimon.in', 'dbimon', 'lib/DBD/mysql/Install/Config.pm')"
pod2text mysql/lib/DBD/mysql.pm >README
/bin/sh: pod2text: command not found
make: *** [README] Error 127
  /usr/bin/make  -- NOT OK
Running make test
  Oops, make had returned bad status
Running make install
  Oops, make had returned bad status

cpan>


Any ideas and suggestions will be appreciated. Thanks.

-- 
Have a nice day,
zz
zzhang@bayou.uh.edu


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

Date: 1 Jul 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 1 Jul 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.  

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 V9 Issue 163
*************************************


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