[8392] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 2009 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Mar 3 12:17:20 1998

Date: Tue, 3 Mar 98 09:00:30 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Tue, 3 Mar 1998     Volume: 8 Number: 2009

Today's topics:
    Re: "Learning Perl" or "Programming Perl" (Ed Jamison)
    Re: [Q] How to redirect STDERR to a subroutine? <jdporter@min.net>
    Re: About the foreach statement (Michael Kelly)
        Another DynaLoader problem <danilche@cs.umass.edu>
    Re: Books? (Ed Jamison)
        can't get rmdir to succeed (Kevin B Cohen)
    Re: can't get rmdir to succeed (Michael J Assels)
    Re: can't get rmdir to succeed (Kevin B Cohen)
    Re: can't get rmdir to succeed (I R A Aggie)
    Re: can't get rmdir to succeed (Kevin B Cohen)
    Re: Conflict in this Newsgroup (Billy Chambless)
        Controlling TWO input files (merging) <rpinder@usc.edu>
    Re: Cookie question (steve)
    Re: Courthouse and Perl <jdporter@min.net>
        Custom headers to solve conflict in this Newsgroup (was (John Moreno)
        Custom headers to solve conflict in this Newsgroup (John Moreno)
        DB_File problems (Boris Pelakh)
        Dynamic loading on SCO Openserver <tom@hollyhall.com>
        Elementary Number Theory (was: Why I have a result such <tchrist@mox.perl.com>
    Re: Help please: Conversion problems from numeric to as <aichner@ecf.teradyne.com>
    Re: Help please: Conversion problems from numeric to as <aichner@ecf.teradyne.com>
    Re: Is dynamic loading of subroutines possible? (Andrew M. Langmead)
    Re: Is dynamic loading of subroutines possible? <jdporter@min.net>
    Re: Module for multi-set manipulations (Kevin B Cohen)
    Re: Q: Appropriateness of (my $x = shift;) vs (my $x =  (Gabor)
        Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: Tue, 03 Mar 1998 15:46:38 GMT
From: edwardj@weblogic.cncoffice.com (Ed Jamison)
Subject: Re: "Learning Perl" or "Programming Perl"
Message-Id: <MPG.f65e08bb9e5ab9c989782@news.ais.net>

I recently got into Perl myself.  I started in on a few of the Learn CGI 
with Perl in 5 days and similar books for a while.  Then a guy I work 
with gave me the Learning Perl ORA book.  I learned more in the first 
chapter of that book than 150 pages of any other.  It's really the best 
book that you could ask for if you want to learn Perl.  Of course, with 
time you'll have to move to Programming Perl with time, but Learning Perl 
is the best way to start.

Good Luck,
Edward Jamison

A long time ago (Sat, 28 Feb 1998 12:39:47 -0600) in a land far away, 
this was said by benbean@yahoo.com-*nospam*- 
> Hi,
> 
> I'm trying to get started with Perl and I'd like to purchase a book
> from those fine people at O'Reilly but minimize my initial expenses by
> only getting one. My question is "Learning Perl" or "Programming
> Perl"?
> 
> They both cover a lot of material. Is there much overlap between the
> two? Do they complement each other or offer different things? Is
> "Programming Perl" more advanced, or does it too start from scratch?
> 
> I'm a Windows developer familiar with C, C++, Pascal and all sorts of
> OSs and major and minor languages so I don't need to be completely
> hand-held... I need a quick introduction to bring me up to speed.
> 
> Any thoughts would be appreciated.
> 


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

Date: Tue, 03 Mar 1998 10:48:21 -0500
From: John Porter <jdporter@min.net>
Subject: Re: [Q] How to redirect STDERR to a subroutine?
Message-Id: <34FC2645.1C13@min.net>

Mark W. Schumann wrote:
> 
> I've read the FAQs and perldoc'd it to death, but I still don't
> see a clear solution.  Perhaps the minds of clpm have some
> insight or BTDT.
> 
> Scenario: Program already has a Log class that is used to write
> program log and debug data to a file.  One module used by the
> program (it happens to be Net::FTP) writes to STDERR.  I would
> love for the STDERR output to be redirected, not to a file but to
> the Log::write method.  The idea is for
> 
>   print STDERR "We print anything";
> 
> to be equivalent to
> 
>   $logobject->write ("We print anything");
> 
> I'm wondering whether I should redirect STDERR to a pipe that is
> read by a child process that reads that input in a loop to write
> to Log::write... well, I'm not sure that's the most robust way.

What an excellent and worthy question!

I hope you have at least perl 5.4, because if you do, you have
the TIEHANDLE capability of tie.  As with other ties, you need
to make a new class to implement your desired functionality.
Here's and extremely simple example which approximates your need:

    package fooHandle; # heh

	sub TIEHANDLE { # constructor, called on tie
	  my $pkg = shift;
	  my $logobject = shift;
	  bless { 'log' => $logobject }, $pkg;
	}

	sub PRINT {  # called on print
	  my $self = shift;
	  $self->{log}->write( @_ );
	}

	sub DESTROY { # called on untie
	  my $self = shift;
	  # nothing to do?
	}


    package main;

	$logobject = new LogObject ...; # whatever;

	tie *STDERR, 'fooHandle', $logobject;

	print STDERR "Wow! it goes to the log!\n";

	untie *STDERR; # when done.

Hope this helps!
And read the latest documentation on tie! (perltie)

John Porter


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

Date: Tue, 03 Mar 1998 11:32:48 -0500
From: mkelly99@NOSPAMgate.net (Michael Kelly)
Subject: Re: About the foreach statement
Message-Id: <35013035.2299447@news.gate.net>

On Sun, 01 Mar 1998 22:09:53 GMT, odie@algonet.seREMOVE (Odie Deth) wrote:

>Hello.
>
>Given a statement such as:
>
>foreach (@variable ) {
>  print $_;
>}
>
>Is there a way to find out what $variable it's at?
>I am currently using statements such as:
>
>$i = 0;

Well, if you don't use 'strict' you can eliminate the $i line
above.  Better than nothin'! [pardon poor pun] :)

>foreach (@variable) {
>  print "$_ ($i)";
>  $i++;
>}
>
>And I would really like to lose the $i, it's not very handsome code.
>
>I don't know if I'm clear enough, but I would be grateful for some
>help.
>---
>Odie Deth  -  odie@algonet.se  -  http://www.algonet.se/~odie


Mike

"Genius gives birth, talent delivers."

                - Jack Kerouac

(remove NOSPAM from address, if present, to reply)


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

Date: Tue, 03 Mar 1998 10:45:53 -0500
From: Victor Danilchenko <danilche@cs.umass.edu>
Subject: Another DynaLoader problem
Message-Id: <34FC25B1.26CFF3C6@cs.umass.edu>

Hiya folks
	I work for my university's tech support. I have been trying to build
Perl 5.004_04 for 8 of our hardware platforms (DU, Ultrix, Solaris,
SunOS, AIX, HPUS, SGI5/6, Linux), and weird things are happening.
	I configure Perl to compile with DynaLoader enabled (on all platforms
but Ultrix). I define appropriate .xs file, compile without errors...
Looks good, right? No...
	I run the new perl executable with -V option. ON ALL PLATFORMS except
Digital Unix, it claims to have been compiled with dl_none.xs. So, I
check the make log. It LOOKS like it was using the correct .xs file!

Specifically (output for SunOS, other platforms are similar; log
contains all output from make):

#grep dl_none.xs log
<no output>

#grep .xs config.sh
dlsrc='dl_dlopen.xs'

#grep dl_dlopen.xs log
cp dl_dlopen.xs DynaLoader.xs

#grep DynaLoader.xs log
cp dl_dlopen.xs DynaLoader.xs
 ../../miniperl -I../../lib -I../../lib ../../lib/ExtUtils/xsubpp\
-noprototypes -typemap ../../lib/ExtUtils/typemap DynaLoader.xs\
>xstmp.c && mv xstmp.c DynaLoader.c

#perl -V
  Platform:
    osname=sunos, osvers=4.1.4, archname=sun4-sunos
    uname='sunos canberra. 4.1.4 1 sun4m '
    hint=recommended, useposix=true, d_sigaction=define
    bincompat3=n useperlio=undef d_sfio=undef
  Compiler:
    cc='gcc', optimize='-O', gccversion=2.7.2.1
    cppflags='-ansi'
    ccflags ='-ansi'
    stdchar='unsigned char', d_stdstdio=define, usevfork=false
    voidflags=15, castflags=0, d_casti32=define, d_castneg=define
    intsize=4, alignbytes=8, usemymalloc=y, prototype=define
  Linker and Libraries:
    ld='ld', ldflags ='-L/exp/rcf/share/lib -L/usr/lib -L/usr/ccs/lib'
    libpth=/exp/rcf/share/lib /usr/local/lib /lib /usr/lib /usr/ucblib
    libs=-lnsl -lgdbm -ldbm -ldb -lm -lc -lposix
    libc=/usr/lib/libc.a, so=none
    useshrplib=false, libperl=libperl.a
  Dynamic Linking:
    dlsrc=dl_none.xs, dlext=none, d_dlsymun=undef, ccdlflags=''
    cccdlflags='', lddlflags=''

Characteristics of this binary (from libperl): 
  Built under sunos
  Compiled at Mar  3 1998 09:40:41
  @INC:
    /exp/rcf/share/perl/5.004/lib
    /exp/rcf/common/lib/perl/5.004/lib
    /exp/rcf/share/perl/5.004/lib/site_perl
    /exp/rcf/common/lib/perl/5.004/lib/site_perl
    .


	What is going on? Why is it that it is configured and made with
dl_dlopen.xs, but reports dl_none.xs?!. And why does this occur on
everything but Digital Unix? Any ideas? Please?..

An e-mail CC would be appreciated.
-- 
				Victor A. Danilchenko
					danilche@cs.umass.edu


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

Date: Tue, 03 Mar 1998 15:49:09 GMT
From: edwardj@weblogic.cncoffice.com (Ed Jamison)
Subject: Re: Books?
Message-Id: <MPG.f65e120d40abe87989783@news.ais.net>

A long time ago (Sat, 28 Feb 1998 12:18:47 +0100) in a land far away, 
this was said by mfrana@spm.it 
> What are the best books about Perl?
> 
See http://www.ora.com , get Learning Perl.

Hope That Helps,
Edward Jamison


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

Date: 3 Mar 1998 10:18:10 -0500
From: kcohen@julius.ling.ohio-state.edu (Kevin B Cohen)
Subject: can't get rmdir to succeed
Message-Id: <6dh6vi$853@julius.ling.ohio-state.edu>

greetings---

my problem is that rmdir won't succeed.  i'm running the following
snippet on NT:

# recheck directory contents--make sure it's empty

@NewContents = readdir (DATE);

if ($#NewContents <= 1) {

    rmdir ($date) || print "couldn't delete the directory named $date.\n";

}
else {
    print "didn't remove the directory named $date, as it didn't seem
    to be empty.\n";
}

i allow for @NewContents to have 2 elements since it will contain .
and .. (current and parent directory).

what happens is that i get the message "couldn't delete the directory
named $date."  (looking over this message, it occurred to me that i
ought to try putting the variable $date in double quotes, but that
didn't help.)

having two books with blue animals on the covers, i've looked up rmdir
in both of them, and the only condition i can find that must be met
for rmdir to be met is that the directory to be removed must be empty.
the directories that this is failing on are, in fact, empty.  so, i
don't see why rmdir is failing....  yes, i've looked at the win-32
faq, and didn't see this addressed there.  or in the other Free
Documentation, either.

kevin





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

Date: 3 Mar 1998 15:32:51 GMT
From: mjassels@cs.concordia.ca (Michael J Assels)
Subject: Re: can't get rmdir to succeed
Message-Id: <6dh7r3$9ns$1@newsflash.concordia.ca>

In article <6dh6vi$853@julius.ling.ohio-state.edu>,
Kevin B Cohen <kcohen@julius.ling.ohio-state.edu> wrote:
>greetings---
>
>my problem is that rmdir won't succeed.  i'm running the following
>snippet on NT:
>
># recheck directory contents--make sure it's empty
>
>@NewContents = readdir (DATE);
>
>if ($#NewContents <= 1) {
>
>    rmdir ($date) || print "couldn't delete the directory named $date.\n";

Change that to

     rmdir($date) || warn "Can't rmdir $date: $!\n";

and the $! might give you a hint.

Michael


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

Date: 3 Mar 1998 10:43:33 -0500
From: kcohen@julius.ling.ohio-state.edu (Kevin B Cohen)
Subject: Re: can't get rmdir to succeed
Message-Id: <6dh8f5$8kh@julius.ling.ohio-state.edu>

In article <6dh7r3$9ns$1@newsflash.concordia.ca>,
Michael J Assels <mjassels@cs.concordia.ca> wrote:

>Change that to
>
>     rmdir($date) || warn "Can't rmdir $date: $!\n";
>
>and the $! might give you a hint.

what a great trick!  sure enough---$! gives me "The process cannot
access the file because it is being used by another process."  i can't
imagine what that process could be, since the only thing i've got
going on it is the open directory handle....  AHAH! yep, adding
closedir(DATE) to the code did it.  All thanks to Michael J. Assels!



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

Date: Tue, 03 Mar 1998 10:48:12 -0500
From: fl_aggie@thepentagon.com (I R A Aggie)
Subject: Re: can't get rmdir to succeed
Message-Id: <fl_aggie-0303981048120001@aggie.coaps.fsu.edu>

In article <6dh6vi$853@julius.ling.ohio-state.edu>,
kcohen@julius.ling.ohio-state.edu (Kevin B Cohen) wrote:

+ rmdir ($date) || print "couldn't delete the directory named $date.\n";

You might want to try printing out the contents of $!, which contains
the value of the system error string (when used in a string context!).

+ what happens is that i get the message "couldn't delete the directory
+ named $date."

As-is?? that's odd.

James
Consulting Minister for Consultants, DNRC
The Bill of Rights is paid in Responsibilities - Jean McGuire
To cure your perl CGI problems, please look at:
<url:http://www.perl.com/CPAN-local/doc/FAQs/cgi/idiots-guide.html>


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

Date: 3 Mar 1998 11:07:04 -0500
From: kcohen@julius.ling.ohio-state.edu (Kevin B Cohen)
Subject: Re: can't get rmdir to succeed
Message-Id: <6dh9r8$93l@julius.ling.ohio-state.edu>

In article <fl_aggie-0303981048120001@aggie.coaps.fsu.edu>,
I R A Aggie <fl_aggie@thepentagon.com> wrote:
>+ what happens is that i get the message "couldn't delete the directory
>+ named $date."
>
>As-is?? that's odd.


not really as-is----the directory name is, in fact, interpolated for
$date.

kev



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

Date: 3 Mar 1998 16:50:48 GMT
From: billy@cast.msstate.edu (Billy Chambless)
Subject: Re: Conflict in this Newsgroup
Message-Id: <6dhcd8$h8u$1@nntp.msstate.edu>

In article <34FB019D.DFC@schwaben.de>, Joergen Lang <Joergen.Lang@schwaben.de> writes:
 
|> A newbie perspective (mid - Llama - level):
 
|> I have only recently asked my first question in this newsgroup and was
|> amazed by the amount of support I got. Within only a few hours after I
|> posted, I had a solution. Having checked FAQ / CPAN before, goes without
|> question.

Now here's an example of how things are supposed to work! ;)

|> The only problem I have is that I do not feel confident enough, yet to
|> reward this by answering other people's questions. 

Ah, but that's not a problem. There are plenty of experts posting now,
and you are in the process of becoming an expert. You'll know when it's
time to start answerinf questions. It's not a matter of "Damn, I better
go answer some questions today"  -- it's more a matter of "Here's some
poor sod having the same problem that I stayed up all night figuring out
last week". 

*That's* when you start making a useful contribution.

Actually, you've already made contributions by RTFMing before asking
questions and by sharing your experience in the current post.

|> So, the few "Gives" I can offer for the moment are to say "Thanks" when
|> a question is answered and keep following the ongoing issues in this
|> newsgroup. Eventually I hope to be able to participate more actively and
|> re - distribute the knowledge I got. 

Excuse me for philosophising, but:

Helping newbies is about the only way to repay the old farts who
helped you get started.
 
|> But then, how could I assure that I don't tell people something wrong or
|> worse, especially if there are people around who know it much better ?
|> What I had a working solution for someones problem and post it. What if
|> the solution was insecure or outdated ?
|> Hm, I suppose I'd just have to put up with the flames....:-)

Treat your answer the same way you treat your questions -- research them
to make sure they make sense.

And hey, the flames are part of the game!

|> I'm not sure what measures apply to be able to switch to "give", I
|> suppose it's just reading the postings and giving it a try to answer
|> when I think I can help.

Exactly. Just try to avoid the trap of feeling that you *must* answer
questions; I've seen people make utter folls of themselves that way.

Just hang in there and keep learning. ;)

-- 
* "And there _is_ a real world. In fact, some of you
*    are in it right now."  -- Gene Spafford


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

Date: Tue, 03 Mar 1998 08:15:09 -0800
From: Rich Pinder <rpinder@usc.edu>
Subject: Controlling TWO input files (merging)
Message-Id: <34FC2C8D.643DA5AF@usc.edu>

Hello.

I'm trying to read two files at the same time, keeping file pointer in
sync on records of each file, and end up 'merging' info from line 1 of
file A with line 1 of file B.

heres the first three lines of each file:

file a:                                file b:
1    dog                            1    breath
2    tree                            2    squirrel
3    wild                           3    willie

and the output file should be:

file c:
1    dog breath
2    tree squirrel
3    wild willie


i tried adding a second file handle in the while statement...but it
didnt like that !!

thanks for your help


rich pinder
usc school of medicine
rpinder@usc.edu



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

Date: Tue, 03 Mar 1998 15:31:53 GMT
From: steveh@cent.com (steve)
Subject: Re: Cookie question
Message-Id: <35042251.174493732@news.cent.com>

SET COOKIE is before CONTENT TYPE

On Tue, 03 Mar 1998 07:25:56 -0500, Mark McKay <kitfox@golden.net>
wrote:

>Jan H.W.G. wrote:
>> 
>> Hello,
>> 
>> I have trided and trided to install the cookie script from
>> matt@worldwidemart.com but it seems to be that I still have to learn a
>> lot.
>> 
>
>I've had a lot of cookie problems myself.  Because of that, I completely
>ignore the 'official' modules used to handle them and implement them
>directly.
>
>To send a browser a cookie, the first two lines of your document must
>look like this:
>
>print "Content-Type: text/html\n"
>print "Set-Cookie: <name>=<value>; expires=<date>; path=<PATH>;
>domain=<DOMAIN; secure\n"
>print "\n"
>print "<HTML><TITLE>.........
>
>Note that the 'Set-Cookie' is issued immediatly after the Content-Type
>and not two lines after, like HTML code.
>
>The only field necessary in the set-cookie line is <name>=<value>.  Only
>include 'secure' if you want your cookie to be secure.
>
>To read cookies, just examine the environment variable
>$ENV{'HTTP_COOKIE'}.
>
>Mark
>
>-- 
>+---------------------------------------------------------+
>| Mark McKay - Hacker, news group lurker and nacho eater  |
>|              extraordinare.     *********************** |
>| Surf on over to my web page;    * If I could think of * |
>|    there are some cool Java     * something witty, it * |
>|    programs I wrote there.      * would go here...    * |
>| http://www.kitfox.com           *********************** |
>+---------------------------------------------------------+



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

Date: Tue, 03 Mar 1998 11:00:24 -0500
From: John Porter <jdporter@min.net>
Subject: Re: Courthouse and Perl
Message-Id: <34FC2918.6BE2@min.net>

Fain wrote:
> 
> know).I know of 2 really good tutorials at:
> http://www.upstatepress.com/dave/tutor.html

I just tried this link, and it was broken.
However, Dave's perl page, with links to tutorials,
is at http://www.upstatepress.com/perl/

John Porter


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

Date: Tue, 3 Mar 1998 10:48:51 -0500
From: phenix@interpath.com (John Moreno)
Subject: Custom headers to solve conflict in this Newsgroup (was Re: if you're going to answer FAQs)
Message-Id: <4482E22DE948584B.326451222CA569C2.5E348E112AB87083@library-proxy.airnews.net>

Russell Schulz <Russell_Schulz@locutus.ofB.ORG> wrote:

> aml@world.std.com (Andrew M. Langmead) writes:
> 
> > Steven Tolkin <steve.tolkin@fmr.com> writes:
> >
> >> I agree completely.  I read Tom's postings for the information they
> >> contain.  But recently there have been a lot of "see the FAQ".
> >
> > 1. It still leaves the original question unkilled. Its the FAQs that
> > are the real problem, not the posts that tell the FAQ asker that their
> > question is a FAQ. 
> 
> this is an independent problem.

And I've proposed handling it by using a custom header also -
X-FAQs-Read and/or the same thing in the sigs (for those unable to add
custom headers).

This allows the same effect as self-moderation.  Only people who
actually read the documentation get answers, the rest are easily
filtered out by killfiles and they don't get completely ignored - have a
autoresponder which tells them about the faq and the header.

> the problem I mentioned is dealing with a bimodal person where half
> of the posts are useful, and half are the same rote text.
> 
> we just want to easily ignore the rote text ones.

Well, I'd like to ignore both - both the question and the answers
(unless they are unusally good flames of course).

> > 4. Some people use awful little newsreaders that thread based on
> > subject lines rather than references headers.
> 
> I had suggested an extra header.  perhaps `SEEFAQ' in the Keywords:
> header would be enough.  perhaps a `FAQ-Pointer: yes' would.

Not bad, but I'd prefer to simply not see the question at all.  I'm by
no stretch of the imagination a perl expert but I answer questions when
I can, a couple of months ago I started to respond to a simple question
(sorting numerically) the problem seemed obvious and I took a couple of
minutes to verify that the obvious solution worked and I wasn't being
misled by inexerience.  I thought this was so obvious that I must be
missing something (surely this guy's tried THIS) so I checked the manual
to see what it said about sort - and there it was.  Not in the FAQ, not
a bug, nothing but laziness and not bothering to check into it himself.

This isn't a big deal, it was only five minutes and a real expert
wouldn't have needed thirty seconds - but I resented it and I can
imagine how much the experts resent having to see 20 or 30 stupid
questions like that in a single day, day after day.

I read the newsgroup looking for interesting questions at my level, I
don't want to see questions that are covered in the MANUAL.

-- 
John Moreno


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

Date: Tue, 3 Mar 1998 10:48:45 -0500
From: phenix@interpath.com (John Moreno)
Subject: Custom headers to solve conflict in this Newsgroup
Message-Id: <C2E6F3D944694D18.13F739E377AC831F.5964EA9EA993F917@library-proxy.airnews.net>

Scott Kirk <scott.kirk@liffe.com> wrote:

> John Moreno <phenix@interpath.com> wrote in article 
> > As for something that will work in today's environment - I propose
> > moderation via kill files and custom header/sig file.  Anybody posting
> > without the custom header/sig file get's sent the mini-faq.  Anybody
> > posting without the custom header/sig file who uses munging doesn't get
> > a answer unless somebody decides to demunge and answer.
> > 
> > Works like the moderation on alt.dev.null - you've got to do the
> > required reading before you get any answers.
> 
> I've hesitated to post to this group before because I know too little
> to answer dumb questions and too much to ask them :)

Well, you could probably answer 80% of the questions on this group
simply by searching the manual and FAQ.  Then if you answered the
question with the location of the answer in the documentation, the
people you are responding to would accuse you of being a rude expert.
And the real experts wouldn't think you were a idiot when you went to
ask YOUR questions - I don't think any of them object to answering
simple questions, they just don't want to answer the SAME simple
question.

> The idea of custom headers/sigs has been discussed a couple of times,
> but not many seem to have picked this up.  IMHO this seems like the 
> ideal solution.  Any post without an approved tag gets a polite automated
> reply.  Dedicated killfilers can just filter out the noise.

And not very complicated filters either (I saw somebody on
news.software.readers say they didn't want to use Tom C. killfile
because he refused to use software smarter than most people).

> Custom tags in the response like [SEEFAQ] etc seem like a good idea too.

Yeah.

-- 
John Moreno


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

Date: 3 Mar 1998 16:21:07 GMT
From: pelakh@rsn.hp.com (Boris Pelakh)
Subject: DB_File problems
Message-Id: <6dhalj$762$1@news.rsn.hp.com>

I have written a CGI application to track problem reports for a computer
store. It uses a DB_HASH Berkeley DB database to store the information.
In the last couple of weeks, I have run into some problems, the most
serious of which is the presence of duplicates in the file, i.e. when I
each() through the hash tied to the DB_File, I get multiple records with
identical keys (sometimes as many as 3). 

I understand that the recently released Berkeley DB 2.0 is supposed to fix a
lot of problems with hashes. Has anyone tried building it ? I am looking for a 
386-bsdos executable for an Intel system running BSDI 3.1. Will DB_File.pm
require any mods ? Also, is there a convenient way to dump an old 1.85
database and re-load it in 2.0 format ?

-- 
Boris Pelakh             SPP DevSW / HP CXDL              pelakh@rsn.hp.com
Natural selection saw to it that professional heroes who at a crucial moment 
tended to ask themselves questions like "What is my purpose in life?" very 
quickly lacked both.                 -- (Terry Pratchett, Interesting Times)


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

Date: Tue, 03 Mar 1998 11:23:41 -0500
From: Tom Albrecht <tom@hollyhall.com>
Subject: Dynamic loading on SCO Openserver
Message-Id: <34FC2E8D.6562@hollyhall.com>

I'm trying to get the MySQL Perl benchmarks running.  A created a
Perl5.004_4 using a hints/sco.sh for SCO Openserver 5.0.4 from Paul
Mahoney for dynamic loading.  Perl seems to make and install OK, with
the following info:

#perl -V
Summary of my perl5 (5.0 patchlevel 4 subversion 4) configuration:
  Platform:
    osname=sco_sv, osvers=3.2, archname=i386-sco_sv
    uname='sco_sv gcbnet 3.2 2 i386 '
    hint=recommended, useposix=true, d_sigaction=define
    bincompat3=y useperlio=undef d_sfio=undef
  Compiler:
    cc='cc', optimize='-O0', gccversion=
    cppflags='-w0 -U M_XENIX -belf -I/usr/local/include'
    ccflags ='-w0 -U M_XENIX -belf -I/usr/local/include'
    stdchar='unsigned char', d_stdstdio=undef, usevfork=false
    voidflags=15, castflags=0, d_casti32=define, d_castneg=define
    intsize=4, alignbytes=4, usemymalloc=y, prototype=define
  Linker and Libraries:
    ld='cc', ldflags =' -L/usr/local/lib'
    libpth=/usr/local/lib /shlib /lib /usr/lib /usr/ccs/lib
    libs=-lintl -lsocket -lnsl -lndbm -ldbm -ldl -lld -lm -lc -lcrypt
-lPW -lx
    libc=/lib/libc.so, so=so
    useshrplib=false, libperl=libperl.a
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-W
l,-Bexport'
    cccdlflags=' ', lddlflags='-G -L/usr/local/lib'  

Characteristics of this binary (from libperl):
  Built under sco_sv
  Compiled at Mar  2 1998 15:45:29
  @INC:
    /usr/local/lib/perl5/i386-sco_sv/5.00404
    /usr/local/lib/perl5
    /usr/local/lib/perl5/site_perl/i386-sco_sv
    /usr/local/lib/perl5/site_perl  

If I try to install the DBD::mysql module (Msql-Mysql-modules-1.1827), I
get the following errors when I do a 'make test':

        PERL_DL_NONLAZY=1 /usr/bin/perl -I.././blib/arch -I.././blib/lib
-I/usr/
local/lib/perl5/i386-sco_sv/5.00404 -I/usr/local/lib/perl5 -e 'use
Test::Harness
 qw(&runtests $verbose); $verbose=0; runtests @ARGV;' t/*.t
t/00base............
install_driver(mysql) failed: Can't load
'.././blib/arch/auto/DBD/mysql/mysql.so' for module DBD::mysql: Unknown
error - dlerror() not implemented at
/usr/local/lib/perl5/i386-sco_sv/5.00404/DynaLoader.pm line 166.

 at (eval 1) line 2

        DBI::install_driver('DBI', 'mysql') called at t/00base.t line 38
dubious
        Test returned status 2 (wstat 512, 0x200)
DIED. FAILED tests 4-5
        Failed 2/5 tests, 60.00% okay    


 ... and a bunch of other similar errors.

Does anyone know why Perl "Can't load
'.././blib/arch/auto/DBD/mysql/mysql.so'"?  Is there something I'm
missing to get this to work on SCO?

-- 
Tom Albrecht                         tom@greatchristianbooks.com
IS Manager                           http://www.greatchristianbooks.com
Great Christian Books                410-392-3590


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

Date: 3 Mar 1998 16:44:46 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Elementary Number Theory (was: Why I have a result such as 108.879999999999)
Message-Id: <6dhc1u$dbk$1@csnews.cs.colorado.edu>

 [courtesy cc of this posting sent to cited author via email]

In comp.lang.perl.misc ff@public.fz.fj.cn, who obviously hasn't read
the FAQ on this matter, questions why numbers don't come out the way he
thinks they should.  The explanation requires a nothing but the exercise
of trivial reasoning:

  1. There exist infinite (and uncountably so) distinct real numbers
     between any two points on the number line.

  2. Using finite memory storage (say, using N bits) to store a number,
     there exist finite (2**N in this case) distinct bit patterns, and
     consequently only finite (2**N, in fact) possible different numbers.

  3. Because the quantity of values in point one exceeds that quantity
     given in point two, there must exist real numbers that cannot be
     exactly represented on your computer (using traditional storage
     techniques).

Determining the ratio of the quantities in points 2 and 1 is an exercise
left to the reader.  For extra credit: define, explain, and prove that the
quantity of missing real numbers exceeds the quantity of missing integers.

Welcome to real computer science.

--tom
-- 
	Tom Christiansen	tchrist@jhereg.perl.com


It's all magic.  :-)    --Larry Wall in <7282@jpl-devvax.JPL.NASA.GOV>


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

Date: 03 Mar 1998 16:16:29 +0100
From: Adrian Aichner <aichner@ecf.teradyne.com>
Subject: Re: Help please: Conversion problems from numeric to ascii
Message-Id: <rxshg5f24aa.fsf@tomorrow.ecf.teradyne.com>

>>>>> "victor" == victor  <churchjv@boat.bt.com> writes:

    victor> On Sat, 21 Feb 1998 13:10:55 -0500, Brent <brent@sympatico.ca> wrote:
    >> I'm trying to convert a number to a letter based upon the ascii
    >> ...
    >> I have tried using the $userid[$i]=chr($randomnum) within a loop
    >> however from extensive testing, the chr() function doesn't seem to be
    >> returning anything.  
    victor> I had a lot of trouble getting at the contents of a string: the trap
    victor> is that square brackets don't do what you would expect from other
    victor> languages. I suspect yr problem may be in the LHS rather than in the
    victor> chr() function. Try using substr($userid,i,1) = chr ...
    victor> hth

perl -e 'foreach $i (0 .. 255) { printf("%d:%s:\n", $i, chr($i)); }'

The above example run under (perl -V):

Summary of my perl5 (5.0 patchlevel 3 subversion 0) configuration:
  Platform:
    osname=solaris, osver=2.5, archname=sun4-solaris
    uname='sunos engine 5.5 generic sun4m sparc sunw,sparcstation-20 '
    hint=recommended, useposix=true, d_sigaction=define

suggests that the character is returned as a string rather than a
character. Neither man pages nor HTML docs for perl5 make that clear.

Trying to print the returned value as character (%c) as opposed to
string (%s) will print the NULL character for almost all integers in
the range 0 .. 255.

When you assign the result of chr() to a variable its value may later
be interpreted as number or string, depending on context:

perl -e '$x = "3"; print $x . "cm\n", $x + 4;'

$x . "cm\n"
	will concatenate "cm\n" to the STRING value of $x.

$x + 4
	will add 4 to the NUMERIC value of $x.

Good Luck,

-- 

Adrian


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

Date: 03 Mar 1998 16:26:30 +0100
From: Adrian Aichner <aichner@ecf.teradyne.com>
Subject: Re: Help please: Conversion problems from numeric to ascii
Message-Id: <rxsen0j23tl.fsf@tomorrow.ecf.teradyne.com>

>>>>> "Odie" == Odie Deth <odie@algonet.seREMOVE> writes:

    Odie> Earlier, Brent <brent@sympatico.ca> wrote:
    >> I have tried using the $userid[$i]=chr($randomnum) within a loop
    >> however from extensive testing, the chr() function doesn't seem to be
    >> returning anything.  I tested this by performing a dump of the variable
    >> contents prior and after conversion attempt.

    Odie> I think I can see the problem here. In a TP string, $string[0] holds
    Odie> the length of the string. To create an eight-character password, for
    Odie> instance, you must insert the line:
    Odie> $userid[0]:=chr(8);

Huh? The := operator is new to me in the language of perl.
It's certainly not documented in the perlop man pages.

    Odie> somewhere, to make the string eight characters long.

    Odie> ---
    Odie> Odie Deth  -  odie@algonet.se  -  http://www.algonet.se/~odie

-- 

Adrian


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

Date: Tue, 3 Mar 1998 15:35:16 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: Is dynamic loading of subroutines possible?
Message-Id: <Ep91ys.Ev6@world.std.com>

gbrock@email.sjsu.edu writes:
>I would like to
>know if it is possible to dynamically load a perl subroutine while
>it is running?  Basically, I am trying to execute a perl subroutine,
>but I don't know what it is called yet.  So I ask the user to input the
>filename, copy the contents to a predefined and set file, and then require
>that file, all during run time.

That should work (at least for the first file, then require will think
that it loaded it already) but is a rather roundabout way of going
about it.

The do() and require() functions can both take a variable as the name of
the file. Why not just prompt the user for the file and call do().

-- 
Andrew Langmead


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

Date: Tue, 03 Mar 1998 11:07:36 -0500
From: John Porter <jdporter@min.net>
Subject: Re: Is dynamic loading of subroutines possible?
Message-Id: <34FC2A96.932@min.net>

gbrock@email.sjsu.edu wrote:
> 
> Hi.  I was wondering if someone could help me out.  I would like to
> know if it is possible to dynamically load a perl subroutine while
> it is running?  Basically, I am trying to execute a perl subroutine,
> but I don't know what it is called yet.  So I ask the user to input the
> filename, copy the contents to a predefined and set file, and then require
> that
> file, all during run time.  However, I get a <STDIN> chunk 3 run-time error
> every time. I would really appreciate any help I can get on this one.

1. show us the code.  how can we help you debug if you don't show the
code?

2. Help yourself debug:
	#!perl -w
	use strict;
	use diagnostics;

John Porter


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

Date: 3 Mar 1998 10:28:10 -0500
From: kcohen@julius.ling.ohio-state.edu (Kevin B Cohen)
Subject: Re: Module for multi-set manipulations
Message-Id: <6dh7ia$8d8@julius.ling.ohio-state.edu>

in my spare time i've been mucking about with functions to perform
such operations on finite state machines.  i'm also in columbus---give
me a call at 764-0143, if you like. (don't have overly high hopes---i
haven't gotten that much done, since i don't have that much spare
time!  or brains.)


kevin cohen




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

Date: 3 Mar 1998 15:12:42 GMT
From: gabor@vmunix.com (Gabor)
Subject: Re: Q: Appropriateness of (my $x = shift;) vs (my $x = @_;)
Message-Id: <slrn6fo82c.2s0.gabor@vnode.vmunix.com>

In comp.lang.perl.misc, John "Chris" Wren <jcwren@atlanta.com> wrote :
# 
# 	I've succeeded in teaching myself enough Perl from net-based
# tools to be very dangerous.  I've even got my application sort of
# working.
# 
# 	However:  I can find virtually nothing that explains the @_
# operator.  I seem to know that when a subroutine is called, whatever
# arguments are passed into the @_ variable.
:), yes, the arguments are passed into subroutines in the @_ array

# 	I've seen some code that uses
# 
# 		my $somevar = shift;
this is a scalar assignment and in a sub you get the zero'th element of
@_, in the main package you get the zeor'th element of @ARGV

# 	and some code that uses
# 
# 		my $somevar = @_;
this is a scalar assignment so you get the size of the array.

# 	and even
# 
# 		my ($var1, $var2, $var3) = @_;
this is a list assignment from @_ into three variables which will get
the first 3 elements of @_

# 	I understand the third usage, but I don't understand what
# makes the first two different.  I've tried changing my code from the =
# shift to the = @_ version, and it breaks.
you can change it if you put brackets around the var, thereby forcing
a list context.


gabor.
--
    It's all magic.  :-)
        -- Larry Wall in <7282@jpl-devvax.JPL.NASA.GOV>


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

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 2009
**************************************

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