[8849] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 2466 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Apr 30 15:08:08 1998

Date: Thu, 30 Apr 98 12:01:39 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Thu, 30 Apr 1998     Volume: 8 Number: 2466

Today's topics:
        PERL bug using sort with MLDBM? <patrick@kan.co.uk>
        perl modules in rpm form for redhat/suse/caldera linux <chrismcc@nospam.netus.com>
        Perl web server.... <chrisw@webchamps.com>
    Re: Perl web server.... (brian d foy)
    Re: Perl/Wall lingo question (brian d foy)
    Re: Perl/Wall lingo question (John Porter)
    Re: Perl/Wall lingo question (brian d foy)
    Re: Redirect returns text after system process <rootbeer@teleport.com>
    Re: visual basic replacement <rootbeer@teleport.com>
        Way of getting a list of installed modules? <horowitz@ulb.ac.be>
    Re: Way of getting a list of installed modules? <rootbeer@teleport.com>
    Re: Why doesn't this work? <rootbeer@teleport.com>
    Re: You people want Perl to be popular? smitty7777@hotmail.com
        Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: Thu, 30 Apr 1998 18:34:03 +0100
From: Patrick Verdon <patrick@kan.co.uk>
Subject: PERL bug using sort with MLDBM?
Message-Id: <3548B60B.F71D8314@kan.co.uk>

Hi,

I think I've stumbled across a PERL bug while using
the sort function - can someone confirm this?

I read through perlfunc which referred to problems
with qsort, although it didn't suggest how to 
resolve issues.

The problem occurs when I try to sort using a 
reference to a multi-level DBM file (MLDBM module) - 
I get a 'Segmentation Fault (core dumped)'.

I tested exactly the same method using in-memory
multi-level hash tables and didn't experience
the problem.

I'm including two test scripts for each scenario,
i.e. i) in memory hashes and ii) using MLDBM, with 
the associated output.

Note that I also tested the scipt using GDBM_File
and DB_File to ensure that I wasn't running out of
record-space in the DBM file. I got exactly 
the same result.

Also note that with only two "fields", it didn't
exhibit the problem, which is why I have included
all my fields in the example.

Platform info:

SunOS kandinsky 5.5.1 Generic_103640-12 sun4c sparc SUNW,Sun_4_50

PERL 5.004_04
GCC 2.7.2
Data::Dumper 2.081
MLDBM 1.25

SCRIPT 1:
=========

#!/bin/perl -w

use strict;

my %patrick = ();
$patrick{first_name} = "Patrick";
$patrick{last_name} = "Verdon";
$patrick{post_code} = "-";
$patrick{county} = "-";
$patrick{telephone} = "-";
$patrick{email} = "-";
$patrick{anonymous} = "NO";
$patrick{notes} = "-";
$patrick{isp} = "UUNET";
$patrick{organisation} = "Some Company Inc";
$patrick{id} = "1";
$patrick{primary_contact} = "FAX";
$patrick{country} = "UK";
$patrick{address_1} = "-";
$patrick{address_2} = "-";
$patrick{city} = "-";
$patrick{fax} = "-";

my %fred = ();
$fred{first_name} = "Fred";
$fred{last_name} = "Bloggs";
$fred{post_code} = "-";
$fred{county} = "-";
$fred{telephone} = "-";
$fred{email} = "-";
$fred{anonymous} = "NO";
$fred{notes} = "-";
$fred{isp} = "UUNET";
$fred{organisation} = "Some Company Inc";
$fred{id} = "1";
$fred{primary_contact} = "FAX";
$fred{country} = "UK";
$fred{address_1} = "-";
$fred{address_2} = "-";
$fred{city} = "-";
$fred{fax} = "-";

my %joe = ();
$joe{first_name} = "Joe";
$joe{last_name} = "Smith";
$joe{post_code} = "-";
$joe{county} = "-";
$joe{telephone} = "-";
$joe{email} = "-";
$joe{anonymous} = "NO";
$joe{notes} = "-";
$joe{isp} = "UUNET";
$joe{organisation} = "Some Company Inc";
$joe{id} = "1";
$joe{primary_contact} = "FAX";
$joe{country} = "UK";
$joe{address_1} = "-";
$joe{address_2} = "-";
$joe{city} = "-";
$joe{fax} = "-";

my %people = ();
$people{1} = \%patrick;
$people{2} = \%fred;
$people{3} = \%joe;
$people{id} = 4;
my $people_ref = \%people;

my @matches = ( 1, 2, 3 );
my $matches_ref = \@matches;

for my $p ( sort { $people_ref->{$b}{last_name} cmp
$people_ref->{$a}{last_name} } @$matches_ref )
{
    print("PERSON IS: $people_ref->{$p}{last_name},
$people_ref->{$p}{first_name}\n");
}

OUTPUT:
-------

PERSON IS: Verdon, Patrick
PERSON IS: Smith, Joe
PERSON IS: Bloggs, Fred


SCRIPT 2:
=========

#!/bin/perl -w

use strict;

use Fcntl;
use NDBM_File;
use MLDBM qw(NDBM_File);

my $dbm_name = "test_dbm";
my $mode = 0775;

my @matches = ( 1, 2, 3 );
my $matches_ref = \@matches;

my %test_dbm;

tie( %test_dbm, "MLDBM", "$dbm_name", O_CREAT|O_RDWR, $mode ) ||
die("Could not access '$dbm_name'");

$test_dbm{id} = 4;

my $tmp;

$tmp = $test_dbm{1};
$tmp->{first_name} = "Patrick";
$tmp->{last_name} = "Verdon";
$tmp->{post_code} = "-";
$tmp->{county} = "-";
$tmp->{telephone} = "-";
$tmp->{email} = "-";
$tmp->{anonymous} = "NO";
$tmp->{notes} = "-";
$tmp->{isp} = "UUNET";
$tmp->{organisation} = "Some Company Inc";
$tmp->{id} = "1";
$tmp->{primary_contact} = "FAX";
$tmp->{country} = "UK";
$tmp->{address_1} = "-";
$tmp->{address_2} = "-";
$tmp->{city} = "-";
$tmp->{fax} = "-";
$test_dbm{1} = $tmp;

$tmp = $test_dbm{2};
$tmp->{first_name} = "Fred";
$tmp->{last_name} = "Bloggs";
$tmp->{post_code} = "-";
$tmp->{county} = "-";
$tmp->{telephone} = "-";
$tmp->{email} = "-";
$tmp->{anonymous} = "NO";
$tmp->{notes} = "-";
$tmp->{isp} = "UUNET";
$tmp->{organisation} = "Some Company Inc";
$tmp->{id} = "1";
$tmp->{primary_contact} = "FAX";
$tmp->{country} = "UK";
$tmp->{address_1} = "-";
$tmp->{address_2} = "-";
$tmp->{city} = "-";
$tmp->{fax} = "-";
$test_dbm{2} = $tmp;

$tmp = $test_dbm{3};
$tmp->{first_name} = "Joe";
$tmp->{last_name} = "Smith";
$tmp->{post_code} = "-";
$tmp->{county} = "-";
$tmp->{telephone} = "-";
$tmp->{email} = "-";
$tmp->{anonymous} = "NO";
$tmp->{notes} = "-";
$tmp->{isp} = "UUNET";
$tmp->{organisation} = "Some Company Inc";
$tmp->{id} = "1";
$tmp->{primary_contact} = "FAX";
$tmp->{country} = "UK";
$tmp->{address_1} = "-";
$tmp->{address_2} = "-";
$tmp->{city} = "-";
$tmp->{fax} = "-";
$test_dbm{3} = $tmp;

my $test_ref = \%test_dbm;

print("CONTENTS OF MULTI-LEVEL HASH:\n");

while ( my($key, $value) = each %test_dbm )
{
    next if ( $key eq "id" );

    print("ID: $key, NAME: $test_ref->{$key}{first_name}
$test_ref->{$key}{last_name}\n");
}

print("\nSORTING HASH BY LAST NAME:\n");

for my $r ( sort { $test_ref->{$b}{last_name} cmp
$test_ref->{$a}{last_name} } @$matches_ref )
{
    print("PERSON IS: $test_ref->{$r}{last_name},
$test_ref->{$r}{first_name}\n");
}

untie( %test_dbm );

OUTPUT:
-------

1st run:

CONTENTS OF MULTI-LEVEL HASH:
ID: 3, NAME: Joe Smith
ID: 2, NAME: Fred Bloggs
ID: 1, NAME: Patrick Verdon

SORTING HASH BY LAST NAME:
Sort subroutine didn't return single value at sort_mldbm.pl line 96.
Segmentation Fault (core dumped)

2nd run:

CONTENTS OF MULTI-LEVEL HASH:
ID: 3, NAME: Joe Smith
ID: 2, NAME: Fred Bloggs
ID: 1, NAME: Patrick Verdon

SORTING HASH BY LAST NAME:
Bus Error (core dumped)


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


Does anyone have any idea what is going on here?

Thanks.



Patrick

P.S. Apologies for the length of this post.

-- 

#===============================#
\  KAN Design & Publishing Ltd  /
/  T: +44 (0)1223 511134        \
\  F: +44 (0)1223 571968        /
/  E: mailto:patrick@kan.co.uk  \ 
\  W: http://www.kan.co.uk      /
#===============================#


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

Date: Thu, 30 Apr 1998 09:42:00 -0700
From: Christopher McCrory <chrismcc@nospam.netus.com>
Subject: perl modules in rpm form for redhat/suse/caldera linux
Message-Id: <3548A9D8.C8F002DB@nospam.netus.com>

Hello...

        I wrote a script to auto generate rpm .spec files for perl
modules.  Being mostly a net/sys admin, I don't use these modules much
 .  But I would like to know if they work.  If anyone uses any of these
could you test them out before I put the finishing touches on them.  I
still have to add some descriptions, dependencies, etc. If you need a
different perl module, e-mail me and I will add it to my list. The ones
below I picked up because I thought they would be used commonly.  So
please let me know if they _do_ wook as well as if they don't.  The rpms
are at ftp://morticia.netus.net/pub/RPMS/ .

Data-Dumper-2.081-1.i386.rpm          Net-Bind-0.01-1.i386.rpm
DateManip-5.09-1.i386.rpm             Net-Country-0.1-1.i386.rpm
HTML-Parser-2.16-1.i386.rpm           Net-DNS-0.12-1.i386.rpm
HTML-QuickCheck-1.0b1-1.i386.rpm      Net-Daemon-0.02-1.i386.rpm
HTML-Stream-1.44-1.i386.rpm           Net-IRC-0.5b-1.i386.rpm
HTML-Table-0.90-1.i386.rpm            Net-Ident-1.10-1.i386.rpm
HTML-TableLayout-1.001005-1.i386.rpm  Net-Ping-2.02-1.i386.rpm
HTML-Tree-0.50-1.i386.rpm             Net-Telnet-3.01-1.i386.rpm
Logfile-0.115-1.i386.rpm              Net-Whois-0.22-1.i386.rpm
MD5-1.7-1.i386.rpm                    Net-ext-0.84-1.i386.rpm
MIME-Base64-2.05-1.i386.rpm           Time-HiRes-01.16-1.i386.rpm
MIME-Lite-1.121-1.i386.rpm            TimeDate-1.08-1.i386.rpm
MIME-tools-4.113-1.i386.rpm

If you would like a different module let me know and I will gen it up.


--
spam	IN	MX	0 localhost.
-- 

Christopher McCrory
Lead Bithead, Netus Inc.
chrismcc@nospam.netus.com

"Linux: Because rebooting is for adding new hardware"


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

Date: Thu, 30 Apr 1998 13:35:15 -0400
From: Chris Wertman <chrisw@webchamps.com>
Subject: Perl web server....
Message-Id: <3548B653.755C6DB8@webchamps.com>

Some time ago I saw a webserver written in perl.. I have searched .
engines.DejaNews etc and stilll cannot find it ,... any pointers as to
where on the web it may live are appreciated...

Chris Wertman





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

Date: Thu, 30 Apr 1998 14:00:54 -0400
From: comdog@computerdog.com (brian d foy)
Subject: Re: Perl web server....
Message-Id: <comdog-ya02408000R3004981400540001@news.panix.com>
Keywords: from just another new york perl hacker

In article <3548B653.755C6DB8@webchamps.com>, Chris Wertman <chrisw@webchamps.com> posted:

>Some time ago I saw a webserver written in perl.. I have searched .
>engines.DejaNews etc and stilll cannot find it ,... any pointers as to
>where on the web it may live are appreciated...

perhaps you refer to Plexus, although that was a long time ago and was
in Perl 4?

-- 
brian d foy                                  <comdog@computerdog.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
Comprehensive Perl Archive Network (CPAN) <URL:http://www.perl.com>
Perl Mongers <URL:http://www.pm.org>


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

Date: Thu, 30 Apr 1998 13:17:12 -0400
From: comdog@computerdog.com (brian d foy)
Subject: Re: Perl/Wall lingo question
Message-Id: <comdog-ya02408000R3004981317120001@news.panix.com>
Keywords: from just another new york perl hacker

In article <354866B3.500F@aspentech.com>, Ian Boys <boys@aspentech.com> posted:

>Russ Allbery wrote:
>> 
>> [snipped]
>>
>> More specifically, a scalar is a magnitude with no associated
>> direction.

>If you think in terms of a scalar being a variable with zero dimensions 
>then the Perl usage makes sense.  Whenever you want to specify a size 
>as well as a direction for something, then you need more than one 
>number, so zero dimensions of storage is not enough and you need an 
>array.

don't you mean *one* dimension? :)

-- 
brian d foy                                  <comdog@computerdog.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
Comprehensive Perl Archive Network (CPAN) <URL:http://www.perl.com>
Perl Mongers <URL:http://www.pm.org>


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

Date: Thu, 30 Apr 1998 18:05:10 GMT
From: jdporter@min.net (John Porter)
Subject: Re: Perl/Wall lingo question
Message-Id: <MPG.fb288b97050d7c0989683@news.min.net>

On Thu, 30 Apr 1998 13:17:12 -0400,
in article <comdog-ya02408000R3004981317120001@news.panix.com>,
comdog@computerdog.com (brian d foy) wrote:
> In article <354866B3.500F@aspentech.com>, Ian Boys <boys@aspentech.com> posted:
> 
> >Russ Allbery wrote:
> >> 
> >> More specifically, a scalar is a magnitude with no associated
> >> direction.
> 
> >If you think in terms of a scalar being a variable with zero dimensions 
> >then the Perl usage makes sense. 
> 
> don't you mean *one* dimension? :)

I pondered this as well; but a one-dimensional vector is certainly
legit, and is different from a scalar, which is dimensionless.
If anything, this is *more* true in perl than in math, since
$x and ($x) are not the same!

John Porter


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

Date: Thu, 30 Apr 1998 14:49:24 -0400
From: comdog@computerdog.com (brian d foy)
Subject: Re: Perl/Wall lingo question
Message-Id: <comdog-ya02408000R3004981449240001@news.panix.com>
Keywords: from just another new york perl hacker

In article <MPG.fb288b97050d7c0989683@news.min.net>, jdporter@min.net (John Porter) posted:

>On Thu, 30 Apr 1998 13:17:12 -0400,
>in article <comdog-ya02408000R3004981317120001@news.panix.com>,
>comdog@computerdog.com (brian d foy) wrote:

>> In article <354866B3.500F@aspentech.com>, Ian Boys <boys@aspentech.com> posted:


>> >If you think in terms of a scalar being a variable with zero dimensions 
>> >then the Perl usage makes sense. 
>> 
>> don't you mean *one* dimension? :)

>I pondered this as well; but a one-dimensional vector is certainly
>legit, and is different from a scalar, which is dimensionless.

a one-dimensional vector, and a scalar having a dimension aren't
mutually exclusive.  let's remember why the vector is one-dimensional -
it holds one scalar.

but perhaps this is semantics - the definition of "dimension" differing
between physics, math, computer science, and perl.

however, let's remember that even a simple Perl scalar is not just the
data that it represents.  there is all sorts of other info stored with
it to make the special Perly things happen, so in this case, a SCALAR
is a vector! :)

-- 
brian d foy                                  <comdog@computerdog.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
Comprehensive Perl Archive Network (CPAN) <URL:http://www.perl.com>
Perl Mongers <URL:http://www.pm.org>


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

Date: Thu, 30 Apr 1998 17:59:23 GMT
From: Tom Phoenix <rootbeer@teleport.com>
To: whowawoo@yahoo.com
Subject: Re: Redirect returns text after system process
Message-Id: <Pine.GSO.3.96.980430105838.8307I-100000@user2.teleport.com>

On Thu, 30 Apr 1998 whowawoo@yahoo.com wrote:

> It only gives me the text to redirect to another page but doesn't
> actually do it.

If you're following the proper protocol but some browser or server doesn't
cooperate, then it's the other program's fault. If you're not following
the protocol, then it's your fault. If you aren't sure about the protocol,
you should read the protocol specification. If you've read it and you're
still not sure, you should ask in a newsgroup about the protocol. 

Hope this helps! 

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: Thu, 30 Apr 1998 17:55:12 GMT
From: Tom Phoenix <rootbeer@teleport.com>
To: Francesc Guasch <frankie@etsetb.upc.es>
Subject: Re: visual basic replacement
Message-Id: <Pine.GSO.3.96.980430105357.8307G-100000@user2.teleport.com>

On Thu, 30 Apr 1998, Francesc Guasch wrote:

> I wonder if I could make windows applications
> in perl and get rid of visual basic.

You could do that. You could even make Linux applications in perl and get
rid of Windows. :-)

> what I want to know if perl is suitable for building typical windows
> stuff and if there are modules for displaying forms and dialogs ... 

If there's a module which does what you want, it should be listed in
the module list on CPAN. If you don't find one to your liking, you're
welcome and encouraged to submit one! :-)  Hope this helps!

    http://www.perl.org/CPAN/
    http://www.perl.com/CPAN/

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: Thu, 30 Apr 1998 12:25:57 -0600
From: Joel Horowitz <horowitz@ulb.ac.be>
Subject: Way of getting a list of installed modules?
Message-Id: <6iac74$bk$1@nnrp1.dejanews.com>

Hye,
I'd like to know if there's a clever and universal way to get a list of
all the installed modules... I know I could do a loop on @INC and do a
system call using the unix 'find ' utility, but I don't want to do that,
because on every system the command line arguments are different.

	I know I could write a recursive find function, but I don't want to
do that either... Any help? The purpose of all this is to use it when I'm
programming CGI scripts on some people's server. It allways takes ages till
you get the proper info about what's installed, so I want to bypass that...

	Thanks

	Joel Horowitz

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/   Now offering spam-free web-based newsreading


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

Date: Thu, 30 Apr 1998 18:40:39 GMT
From: Tom Phoenix <rootbeer@teleport.com>
To: Joel Horowitz <horowitz@ulb.ac.be>
Subject: Re: Way of getting a list of installed modules?
Message-Id: <Pine.GSO.3.96.980430113839.8307O-100000@user2.teleport.com>

On Thu, 30 Apr 1998, Joel Horowitz wrote:

> I'd like to know if there's a clever and universal way to get a list of
> all the installed modules... 

There isn't, even if you're interested in only the ones stored along the
@INC paths. But it's not hard to use File::Find to get a list of the ones
you want. Hope this helps!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: Thu, 30 Apr 1998 18:15:11 GMT
From: Tom Phoenix <rootbeer@teleport.com>
To: Dave Neuer <daven@ldr.com>
Subject: Re: Why doesn't this work?
Message-Id: <Pine.GSO.3.96.980430111230.8307L-100000@user2.teleport.com>

On Thu, 30 Apr 1998, Dave Neuer wrote:

> still want to know WHY mine DOESN'T work.

Your code ran to several screenfuls. Could you give us one line which
isn't doing what you think it should? Thanks!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: 30 Apr 1998 09:31:17 -0700
From: smitty7777@hotmail.com
Subject: Re: You people want Perl to be popular?
Message-Id: <6ia90l$or@co-op.newsguy.com>

In article <3547D694.A00E8F3C@coos.dartmouth.edu>, Ronald says...
>
>smitty7777@hotmail.com wrote:
>> 
>> In article <x77m49cloe.fsf@sysarch.com>, Uri says...
>> >
>> >>>>>> "CL" == Chris Lambrou <archive@cglis.com> writes:
>> >
>> >  CL> Well?
>> >
>> >it is. but you aren't :-)
>> 
>>Very mature response, Uri.  Perhaps you should get that diaper rash looked at.
>
>Advice from someone who is obviously a *master* of mature responses.  Whatever.
>
>I found Uri's response to be clever and amusing.

who cares...

>-- 
> _ / '  _      /         - aka -             rjk@coos.dartmouth.edu
>( /)//)//)(//)/(    Ronald J. Kimball           chipmunk@m-net.arbornet.org
>    /                                   http://www.ziplink.net/~rjk/
>        "It's funny 'cause it's true ... and vice versa."


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

Date: 8 Mar 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 8 Mar 97)
Message-Id: <null>


Administrivia:

The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc.  For subscription or unsubscription requests, send
the single line:

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.

The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.

The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.

For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V8 Issue 2466
**************************************

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