[8913] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 2531 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu May 7 15:07:52 1998

Date: Thu, 7 May 98 12:02:01 -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, 7 May 1998     Volume: 8 Number: 2531

Today's topics:
    Re: Grieving our dying community (Chris Nandor)
    Re: Grieving our dying community <gbarr@ti.com>
    Re: Grieving our dying community (Nathan V. Patwardhan)
    Re: Grieving our dying community (Tina Marie Holmboe)
    Re: Grieving our dying community (Michael J Gebis)
    Re: Grieving our dying community (Nathan V. Patwardhan)
    Re: Grieving our dying community (Will Smith)
    Re: help a novice in perl! <aqumsieh@matrox.com>
    Re: Help with comma seperated file with "'s inside fiel (brian d foy)
    Re: Help... validate FTP links? <rootbeer@teleport.com>
    Re: How do I print a string that is in a certain format <aqumsieh@matrox.com>
    Re: How to add a space to a variable after 'x' many cha (Craig Berry)
    Re: How to delete an element in an array? (Mark-Jason Dominus)
    Re: How to delete an element in an array? <aqumsieh@matrox.com>
    Re: Insert data into long raw column in oracle table (John D Groenveld)
    Re: Julian Dates <rootbeer@teleport.com>
    Re: Looking for ANY Suggestions on parsing this line!! <keithmur@mindspring.com>
        Maintaining File position. <greg_piney@mhc-smtp-mail.mcgraw-hill.com>
    Re: Multiple packages in a single .pm file <ragoff@sandia.gov>
    Re: Multiple packages in a single .pm file <ragoff@sandia.gov>
    Re: out of memory problem <brian_wilson@om.cv.hp.com>
    Re: perl scripts dealing with /etc/passwd <star@sonic.net>
    Re: perl scripts dealing with /etc/passwd <greg_piney@mhc-smtp-mail.mcgraw-hill.com>
        pipe turns off the alarm() ? kis1380@cs.rit.edu
        Problem with taint on perl 5.004_04 Solaris 2.6 <Elan_Kaplan@globalcenter.net>
    Re: Problem with taint on perl 5.004_04 Solaris 2.6 (brian d foy)
    Re: Problem with taint on perl 5.004_04 Solaris 2.6 <rootbeer@teleport.com>
    Re: removing nested parentheses <aqumsieh@matrox.com>
        returning a list from a recursive function zbrown@lynx.neu.edu
    Re: stat function <rootbeer@teleport.com>
    Re: tr/[\000-\177]/[\200-\377]/ doesn't work for '[' <rootbeer@teleport.com>
    Re: tr/[\000-\177]/[\200-\377]/ doesn't work for '[' (Honza Pazdziora)
        Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: Thu, 07 May 1998 17:10:37 GMT
From: pudge@pobox.com (Chris Nandor)
Subject: Re: Grieving our dying community
Message-Id: <pudge-0705981308450001@192.168.0.3>

In article <6ismnc$n4a$1@ns1.arlut.utexas.edu>, smcdow@arlut.utexas.edu
(Stuart McDow) wrote:

# Why? Simple. They're used to being spoon-fed. They don't know how to
# program. They know nothing of software engineering. <WHINY VOICE>It's
# too *hard*.....</WHINY VOICE> They don't know how to offer
# solutions. All they can do is point click point click point click and
# complain. Ultimately, they don't want to program a computer, they want
# to use an appliance.

I agree, but I want to offer a caveat: computers are more and more
becoming applicance-like, and in many respects this is a Very Good
Thing(TM).  However, if you are going to be a programmer, or if you are
going to program, you have to have a different mindset.  You will not be
spoonfed.  You will not have blinking lights warning you when you are
going to delete your hard drive.  You will become dangerous to yourself
and those around you.

  Don't shoot your parents and ask for mercy because you are an orphan.

  i.e., The Management Assumes No Responsibility.

Programming cannot be simultaneously powerful and simple to use.  There is
always a tradeoff.  Now, perl can be simple to use.  This is all well and
good.  But while it is simple to use, it is lacking in the power that is
gained through more complex and complicated functionality.

If you want to do simple programming, fine, but don't complain when you
have not the skills to do more complex things.  Do not blame the complex
tools or those who created them because they are complex.  Blame yourself
for not putting in the time and effort to figure them out.  Or better yet,
blame no one, and RTFM and ask questions about your reading of people who
know when you get stuck.

If you want to buy an iMac and do word processing and browse the web,
great.  But if you want to do more, you have to actually study and learn
and RTFM (you can start with my book :).

I always first assume that if I do not know something, that it is because
I have not read the docs.  Only after scouring the docs do I ASK where I
might find some information.  Only after getting confirmation that
something is not documented or does not exist do I assume that it is not
documented or does not exist.  At THAT point do I complain if necessary. 
I don't think that is off-base.

-- 
Chris Nandor          mailto:pudge@pobox.com         http://pudge.net/
MacPerl: Power and Ease (ISBN 1881957322), http://www.ptf.com/macperl/
%PGPKey = ('B76E72AD', [1024, '0824090B CE73CA10  1FF77F13 8180B6B6'])


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

Date: Thu, 07 May 1998 11:58:30 -0500
From: Graham Barr <gbarr@ti.com>
Subject: Re: Grieving our dying community
Message-Id: <3551E836.40ED3657@ti.com>

I was going to reply to Nathan's article directly, but then I saw
that Tom had written a reply and thought I woudl read that first.

I agree 100% with what both have said, while reading the original article
the word Microsoft entered my head. 

-- 
Graham Barr <gbarr@ti.com>
Life would be so much easier if we could just look at the source code.


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

Date: 7 May 1998 17:16:41 GMT
From: nvp@shore.net (Nathan V. Patwardhan)
Subject: Re: Grieving our dying community
Message-Id: <6isq9p$ftr@fridge.shore.net>

Tina Marie Holmboe (tina@scandinaviaonline.se) wrote:

:   CPAN *can* be improved - I for one have have spent too much time actually
: digging useful things out of it to check for problems. But it seems to me
: that you also sweep the same broom over most everything, Nathan.

Never said that it couldn't.  Definitely want to be part of the group
who improves it.  My remark was aimed at those who complain but don't
help fix, or complain but don't even propose a solution.

: problems. But: I am not competent to hand in a patch to emacs. I could be,
: had I the time to become so. But I don't have that time either.

As a responsible user, you're also doing the right thing by pointing
out bugs.  But it's far different to point out a bug then it is to
complain and whine when something doesn't work.  I'm sorry if my
remark was taken another other way.

:   I came into this late; I've not read it all. But still; what you wrote
: struck me as very true about some users, some complaints - but very unfair

You came into this early.  I just posted it.  :-)  I've decided to
confront the lazy mass and move them into a constructive position,
instead of a predatory one.

:   Those of us who are "inbetween" - who use Perl as our daily tool to get
: things done, to put bread on our respective tables - do try. I don't think
: we complain too much; and when we can, we help.

And it's appreciated.  But this newsgroup is now composed of 70-80%
takers, and it's unlikely that they'll ever return the favor.  Again,
I'm interested in getting everyone involved.

Complaining without action is not effective anymore.

--
Nathan V. Patwardhan



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

Date: 7 May 1998 17:39:12 GMT
From: tina@scandinaviaonline.se (Tina Marie Holmboe)
Subject: Re: Grieving our dying community
Message-Id: <6isrk0$avj$2@news1.sol.no>

In article <6isq9p$ftr@fridge.shore.net>,
	nvp@shore.net (Nathan V. Patwardhan) writes:

> Never said that it couldn't.  Definitely want to be part of the group
> who improves it.  My remark was aimed at those who complain but don't
> help fix, or complain but don't even propose a solution.

  Your sentiments are definetly reflected by me, and I think by quite a few
others - the silent majority ? Is there a thing like a silent majority here ?
I think there may be. Perhaps I am naive.




> As a responsible user, you're also doing the right thing by pointing
> out bugs.  But it's far different to point out a bug then it is to
> complain and whine when something doesn't work.  I'm sorry if my
> remark was taken another other way.

  We *do* agree - what I *thought* I saw was not what you wrote, as is so 
often the case. One, or both, of us are tired :)



> You came into this early.  I just posted it.  :-)  I've decided to
> confront the lazy mass and move them into a constructive position,
> instead of a predatory one.

  Uum, and you want your remains sent to... ? :)



> takers, and it's unlikely that they'll ever return the favor.  Again,
> I'm interested in getting everyone involved.

  Well, for what it is worth - I seem to recall that I was on the list of top
10 posters at one time (ONE time ;) and I'm back. I'll try to do my bit,
atleat.



> Complaining without action is not effective anymore.

  Was it ever ?

-- 
  Tina Marie Holmboe                
  Application Developer (Geeks'R'Us)         [tina@tech.scandinaviaonline.se]
  Scandinavia Online AB Development Dept.    (+46) 08 587 81000 (switchboard)
                                             (+46) 08 587 81189 (direct)


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

Date: 7 May 1998 18:00:05 GMT
From: gebis@albrecht.ecn.purdue.edu (Michael J Gebis)
Subject: Re: Grieving our dying community
Message-Id: <6issr5$6rk@mozo.cc.purdue.edu>

nvp@shore.net (Nathan V. Patwardhan) writes:

}Or was I just dreaming the past (almost) decade away?  Or was it both
}dreaming and stupidity?  Whichever it was, I can't recall that I've
}*ever* seen a more selfish, boorish and misguided group of individuals
}than many of those I've seen on comp.lang.perl.misc.

Hey, if we're complaining about the group, how about this?

Newbie innocently asks a question which has been answered
many times before.  This is annoying.  Five or six people
respond with, "You jerk.  Read the FAQ!" which is not only
more annoying to read, but also spreads the message that
courtesy is not valued in this group.

Newbie asks a question which really is a Unix or shell
or CGI question, but the newbie lacks the context to
make this determination himself.  Five or six people
respond with, "You jerk.  Leave!" and another five or
six respond with, "Any self-respecting shell globs
for you!" which certainly didn't clear anything up for
the newbie, and simply wasted the time of anybody
capable of understanding the answer.

Newbie asks a question which is really more difficult
that he expects.  He's told, "Use a module!" which 
may indeed be the right answer, but the newbie doesn't
understand why he's got to install three other packages
to do something as easy as sending e-mail.  After all,
the newbie does it dozens of times each day without
thought.

I'm not saying that the flood of newbie questions doesn't
get on my nerves, but I think a lot of people who should
know better are only adding noise and hostility to the mix.

-- 
Mike Gebis  gebis@ecn.purdue.edu  mgebis@eternal.net


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

Date: 7 May 1998 18:06:51 GMT
From: nvp@shore.net (Nathan V. Patwardhan)
Subject: Re: Grieving our dying community
Message-Id: <6ist7r$kd8@fridge.shore.net>

Michael J Gebis (gebis@albrecht.ecn.purdue.edu) wrote:

: Hey, if we're complaining about the group, how about this?

The issues are MUCH larger than the group.  It's a worldwide problem.

--
Nathan V. Patwardhan



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

Date: Thu, 07 May 1998 18:05:09 GMT
From: wsmith@NOSPAM.ctron.com (Will Smith)
Subject: Re: Grieving our dying community
Message-Id: <3551f5a5.77284145@roch-news>

On 7 May 1998 16:49:59 GMT, tina@scandinaviaonline.se (Tina Marie
Holmboe) wrote:

|>> What is it with many of you people?  Why do you complain complain
|>> complain without offering any solutions?  You're destroying all of the
|>> good things that the free software community was built on: dedication,
|>
|>  CPAN *can* be improved - I for one have have spent too much time actually
|>digging useful things out of it to check for problems. But it seems to me
|>that you also sweep the same broom over most everything, Nathan.

I agree with you to an extent, Tina.  Although I've been reading the
complaints about CPAN's ability (or otherwise) to lead a user to what
s/he has been looking for with a sympathetic mind, I agree with Nathan
that a solution (in any form whatsoever) could at least be hinted to.
for example, if a user said something like, "well, i find access at
CPAN to be a BEAR, but here's a few ideas that i think could make it
better", then listed off either some function(s) to do the job or even
an outline of the task, then THAT would be better than SOME of the
complaints that i've been reading....  me?  sure, i've had trouble.
but, i don't know exactly where to begin on ideas to improve, so i
keep quiet until i know enough to make some legible ideas known.  :)

|>  I often see errors in programs - emacs, for instance - which I would like
|>to see corrected. Once in a blue moon I point out, or complain, about such
|>problems. But: I am not competent to hand in a patch to emacs. I could be,
|>had I the time to become so. But I don't have that time either.

aye...  i understand this, too.  i've no interest in LISP, and i don't
use EMACS, but i know what you mean...

|>  Yes, I can understand this critique towards those that do nothing *but*
|>complain, with absolutely no depth, and no thought to what has gone into
|>the products they complain about.

people that simply rant annoy me to no end.

|>  But please, Nathan... there are those among us who would complain if we
|>found errors, but could not offer anything helpful apart from that. There is
|>an inherent value in complaints; if they actually point out something which
|>is a problem, and not simply stupidity...

i think the idea is that even if you couldn't provide a code snippet
to solve a problem, simply saying, "I think that CPAN could be made
better if it could do something along this line" is a far sight better
than just complaining...

|>  I came into this late; I've not read it all. But still; what you wrote
|>struck me as very true about some users, some complaints - but very unfair
|>to others. Please don't use the same comb to brush us all away ?

i think Nathan was very good about not making sweeping
generalizations...  :)

|>  There is a small minority who make all the noise without attempting to
|>provide solutions. There is another group of us who *make* noise when we
|>find something is wrong, but who atleast *try* to the best of our often
|>limited ability.

I'd like to think that Nathan was aiming for the noise makers....

of course, I don't aim to speak for Nathan...  <g>

ttyl...

---
William Smith
#include <disclaimer.h>
Remove the obvious when sending e-mail...


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

Date: Thu, 07 May 1998 13:49:44 -0400
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: help a novice in perl!
Message-Id: <3551F438.9E98EB45@matrox.com>

> On Tue, 5 May 1998 17:04:07 +0200, sg wrote :
>
> >hello everybody!!
> >
> >I would wanted to do a perl script which can
> >put in a table, *.html files founded in a directory.
> >but (even if i've made some researches on
> >FAQ, and try to found an information on perl
> >book) i didn't found a function which can return
> >(or repertoriate) the *.html files in a directory.
> >

 I wonder how accurate your "research" was!
Open the index of ANY perl book and look under "directory".
I happen to have the Camel Book which says:

directories
    ......
    ......
    reading entries from, 202
    ......
    ......

PS. I don't call that "research" !!

--
Ala Qumsieh             | "How much wood would a woodchuck
ASIC Design Engineer    |  chuck if a woodchuck could
Matrox Graphics Inc.    |  chuck wood?"
Montreal, Quebec        |             - Trivial ... 5!





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

Date: Thu, 07 May 1998 13:18:00 -0400
From: comdog@computerdog.com (brian d foy)
Subject: Re: Help with comma seperated file with "'s inside fields
Message-Id: <comdog-ya02408000R0705981318000001@news.panix.com>
Keywords: from just another new york perl hacker

In article <Pine.LNX.3.95.980507092307.13498K-100000@meridian.kendeco.com>, Tom Cross <tomc@kendeco.com> posted:


>"PART NUMBER","DESCRIPTION PENCIL 2" YELLOW",1,2,3,4,5
>
>In order for this file to work with the Text::CSV modules, the 2" part
>should be escaped like this:  2"" and then it works.  However, none of my
>files are escaped and there are about 800 parts that have quotes inside
>the description.

perhaps i'm mising something, but isn't this simply a problem of finding
all of the " not aren't in the qq|","| and escape them, then send the
result through Text::CSV?

i've had to deal with such stuff from clients lately, and i've simply
changed every occurance of qq|","| to some character not in the data,
then escaped the "s (or whatevers, like commas!), then undo the
first substitution.  i haven't run into problems yet, but there might
be some gotchas i haven't run into.

good luck :)

-- 
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, 07 May 1998 18:43:29 GMT
From: Tom Phoenix <rootbeer@teleport.com>
To: "Jocke..." <m-39772@mailbox.swipnet.se>
Subject: Re: Help... validate FTP links?
Message-Id: <Pine.GSO.3.96.980507114058.28811N-100000@user2.teleport.com>

On Thu, 7 May 1998, Jocke... wrote:

> From: "Jocke..." <m-39772@mailbox.swipnet.se>
> Reply-To: m-39772@mailbox.swipnet.se[NO SPAM]

It doesn't help anyone in the world to munge only one of those. It merely
inconveniences those of whom you're asking a favor.

> Everytime a user adds a link, I want the script to check if the FTP
> and the directory really exists... is this possible?

Maybe you want one of the net-savvy modules from CPAN. Hope this helps!

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



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

Date: Thu, 07 May 1998 13:39:12 -0400
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: How do I print a string that is in a certain format?
Message-Id: <3551F1C0.8617E09A@matrox.com>

Bryan T Hoch wrote:

> For example, if I had the following string $string that contained
>
> 231, Hello, 43, (big: medium: small), (right: wrong)
>
> What code could I write so that it would print out in the format of:
>
> 231 Hello 43 big    right
>              medium wrong
>              small
>
> What I thought I should do is break it up into seperate elements in an
> array using the split command and using , as a delimiter. Thus the array
> would contain:
> 231
> Hello
> 43
> (big: medium: small)
> (right: wrong)
>
> But I am unsure where to go from here.
> Any help would be appreciated.
> Thanks in advance.
>                                                 Bryan H

 From there, you can split() again the last two strings on the colon. (You
should also remove the brackets if you don't need them.
To print out in the desired format, well, you should use FORMAT ;-)

Enjoy,

--
Ala Qumsieh             | "How much wood would a woodchuck
ASIC Design Engineer    |  chuck if a woodchuck could
Matrox Graphics Inc.    |  chuck wood?"
Montreal, Quebec        |             - Trivial ... 5!





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

Date: 7 May 1998 18:39:43 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: How to add a space to a variable after 'x' many characters??
Message-Id: <6isv5f$34a$3@marina.cinenet.net>

Darrick Wolfe (bravo@bravodesign.com) wrote:
: I'm wanting to add a space after, say 20 characters in a variable
: (inputed from a form: $IN{'stuff'} ), so that if someone submits
: something like:
: 
: ttttttttttttthhhhhhhhhhhhhhhhhhhhhhiiiiiiiiiiiiiiiiiiiiiiiissssssssssssssssssssssssssssss
: 
: it will place a blank space after every 20th character.


If you want to insert a space every 20 characters no matter what:

  s/(.{20})/$1 /g;

If you only want a space inserted after 20 non-whitespace characters:

  s/(\S{20})/$1 /g;

: Also, how do you count the actual characters in a variable?

If you mean how many characters of any type are in it (the string 
length), perldoc -f length.

To count the nonwhitespace characters:

  my $count = tr/\S//;

and similarly for other possible character categories.

---------------------------------------------------------------------
   |   Craig Berry - cberry@cinenet.net
 --*--    Home Page: http://www.cinenet.net/users/cberry/home.html
   |      Member of The HTML Writers Guild: http://www.hwg.org/   
       "Every man and every woman is a star."


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

Date: 7 May 1998 14:08:53 -0400
From: mjd@op.net (Mark-Jason Dominus)
Subject: Re: How to delete an element in an array?
Message-Id: <6istbl$4rv$1@monet.op.net>
Keywords: holocaust Jules mobility veranda


In article <6invtl$rio@hplntx.hpl.hp.com>, Larry Rosler <lr@hpl.hp.com> wrote:
> I can't decide if you were
>being facetious (if so, why?) or instructive.  

I was trying to be instructive.

> If the latter, why not teach him hash slices too:

Well, you can't put in everything, can you?

>I'm sure that would mystify him even more than the "map" way, 

In spite of what you say about not being able to decide, it sounds to
me like you *did* decide whether I was being facetious or instructive.

Sometimes people ask the wrong question.  They want to know `how can I
do X with Y' and the real best answer is `do X with Z instead.'  Since
people don't know they're asking the wrong question, they can't tell
you this; you have to guess.

Often times people coming from other programming languages try to use
Perl's arrays as sets.  This leads naturally to the question of how to
remove an item from an array.  In Perl, this is usually the wrong
question.  ``How do I remove a certain item from an unknown position
in an array'' is the question from someone who has already decided to
represent sets with arrays.  But for this person, the rea, unasked
question is `what's the best way to do sets in Perl?', and the right
answer to this question is usually (not always, but usually) ``do sets
with hashes, not lists.''

I guessed (correctly) that several people would have suggestions about
`grep' and soforth.  There's no point in duplicating these answers.  I
wanted to make an orthogonal suggestion which had a chance of turning
out to be an answer to the question he should have asked but didn't.

I'm not an obfuscator.  I never post code just to confuse or embarrass
the person I'm responding to.



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

Date: Thu, 07 May 1998 13:53:38 -0400
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: How to delete an element in an array?
Message-Id: <3551F522.684C5B31@matrox.com>

Mark-Jason Dominus wrote:

> In article <354F3CD1.18FC648@cbmi.upmc.edu>,
> Rich Tsui  <tsui@cbmi.upmc.edu> wrote:
> >For example, I have an array @foo=('Jan', 'Feb', 'Dec', 'Bar', 'Mar') and I
> >would
> >like to delete item 'Bar' in array @foo without knowing the index of the item
> >'Bar'.
> >
> >Any suggestion?
>
> You should be using a hash instead.
>
>         %foo = map {($_ => 1)}  @foo;
>
>         # Now forget about @foo, and never use it again.
>         undef @foo;
>
>         $foo{new_item} = 1;   # Insert new item into list
>         delete $foo{Bar};     # Delete item from list
>
>         foreach $item (keys %foo) {
>           # Do something for each item in the list
>         }

 That's cheating ... not solving the problem.
I suggest splice()!

Enjoy,

--
Ala Qumsieh             | "How much wood would a woodchuck
ASIC Design Engineer    |  chuck if a woodchuck could
Matrox Graphics Inc.    |  chuck wood?"
Montreal, Quebec        |             - Trivial ... 5!





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

Date: 7 May 1998 13:02:07 -0400
From: groenvel@cse.psu.edu (John D Groenveld)
Subject: Re: Insert data into long raw column in oracle table
Message-Id: <6ispef$hg2$1@tholian.cse.psu.edu>

As README.longs in the DBD-Oracle distribution states, you must specify
the bind-type.

$dbh->do("CREATE TABLE foobar (foo NUMBER, bar LONG RAW)")
        or die "$DBI::err: $DBI::errstr\n";
my $sth = $dbh->prepare("INSERT INTO foobar VALUES (?, ?)")
        or die "$DBI::err: $DBI::errstr\n";
$sth->bind_param(1, "1");
$sth->bind_param(2, $long_raw, {"ora_type", 24});
$sth->execute()
        or die "$DBI::err: $DBI::errstr\n";
$sth->finish
        or die "$DBI::err: $DBI::errstr\n";

Consult the Oracle docs for a complete list of Oracle types, most likely
the Oracle precompilers book.
John
groenveld@acm.org


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

Date: Thu, 07 May 1998 17:31:49 GMT
From: Tom Phoenix <rootbeer@teleport.com>
To: Cathal.G.Meehan@aib.ie
Subject: Re: Julian Dates
Message-Id: <Pine.GSO.3.96.980507103027.28811H-100000@user2.teleport.com>

On Thu, 7 May 1998 Cathal.G.Meehan@aib.ie wrote:

>     Is it possible to convert gregorian dates to julian in perl. 

Yes, and if you read the FAQ it's even easy. :-) Hope this helps!

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



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

Date: Thu, 07 May 1998 12:13:00 -0500
From: "Keith G. Murphy" <keithmur@mindspring.com>
Subject: Re: Looking for ANY Suggestions on parsing this line!!
Message-Id: <3551EB9B.7126621C@mindspring.com>

- wrote:
> 
> mgjv@comdyn.com.au (Martien Verbruggen) Said this:
> 
> >In article <6g0u85$jbe$1@nnrp1.dejanews.com>,
> >    randy.paries@avex.com writes:
> >
> >> the problem is that the program that does the export(that I do not have
> >> control over) does not put quotes around word 2 and word 8. Even though it is
> >> suppose to be a csv, they put comma's in the values if over 1000. ARG!@!
> >
> >That is a serious bug. Contact the author of that program and yell at
> >him/her.
> >
> >> does anyone have any ideas of how to parse this line into words. The values of
> >> course will be of the same type but different values.
> >>
> >> "MGORDON",$1,860.65,"STAR","$539.35","$1,139.35","$1,739.35",0,$1,860.65
> >> "LE GRAVES",$1,822.43,"STAR","$577.57","$1,177.57","$1,777.57",0,$822.43
> >
> 
> This looks like something from Microsoft Access (the worst db product
> on the planet).
> 
> The problem isn't in the size of the value, it's that it doesn't quote
> any fields unless they are text or memo fields.  Number, currency, etc
> are not quoted.
> 
> just make all your fields text, and you shouldn't have this problem to
> begin with.
> 
> One more reason why microsoft SUCKS.

Hmmm, I can't *make* Access export a currency or number field with "$",
",", etc.  So making a field text would seem to be unnecessary.  I'll
take a wild guess he's not using Access at all.


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

Date: Thu, 07 May 1998 14:35:25 -0400
From: Greg Piney <greg_piney@mhc-smtp-mail.mcgraw-hill.com>
Subject: Maintaining File position.
Message-Id: <3551FEED.E9937CE1@mhc-smtp-mail.mcgraw-hill.com>

Is there any easy way (oxymoron) to do the following

read in a file till a "marker" is read.
do something to all that has been read until, but not including, the
marker.
resume reading at the "marker"
loop through the above until EOF.

Thanks in Advance

Greg Piney
The McGraw-Hill Companies



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

Date: Thu, 07 May 1998 11:54:22 -0600
From: Robert Goff <ragoff@sandia.gov>
To: John Siracusa <macintsh@cs.bu.edu>
Subject: Re: Multiple packages in a single .pm file
Message-Id: <3551F54E.D180E242@sandia.gov>

>         use Cooking::Lunch;
> 
>         Inside /usr/local/lib/perl5/site_perl/Cooking/Lunch/
> 
>         Chef.pm
>         Fridge.pm
>         Knife.pm
>         Sandwich.pm
>         ...etc....

Certainly all these would be useful in future Cooking::Dinner and
Cooking::Breakfast class.  Having them in separate files would make that
easier, maybe just a single Cooking::Utensils module.
-- 
=================================================
Robert Goff             email: ragoff@sandia.gov
Sandia National Labs    Phone: (505)284-3639


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

Date: Thu, 07 May 1998 11:55:05 -0600
From: Robert Goff <ragoff@sandia.gov>
Subject: Re: Multiple packages in a single .pm file
Message-Id: <3551F579.284A3EFE@sandia.gov>

> Most people don't understand the import issues.  Therefore, bad.

So where would most people go to understand the import issues?
-- 
=================================================
Robert Goff             email: ragoff@sandia.gov
Sandia National Labs    Phone: (505)284-3639


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

Date: Thu, 07 May 1998 10:41:19 -0700
From: Brian Wilson <brian_wilson@om.cv.hp.com>
Subject: Re: out of memory problem
Message-Id: <3551F23F.6634@om.cv.hp.com>

Tom Phoenix <rootbeer@teleport.com> wrote:
> On Tue, 5 May 1998, Brian Wilson wrote:
> 
> > I get an 'out of memory!' error while building a scalar with an
> > sprintf(). 
> 
> > >     $in_list = sprintf("%s%s,", $in_list, $k);
> >
> > ...But that's probably not the best way to use Perl, anyway! :-)  Try this
> > line instead.
> >
> >     $in_list .= "$k,";
> 
> Either approach can cause pathological behaviour if perl is using a
> malloc() that's bad at coalescing free()d space.  What happens is that,
> as $in_list grows, a succession of buffers too small to hold it is
> free()d.  Unless malloc() can coalesce them and so make the space
> available for use by the expanded form of $in_list, perl's memory use
> balloons.
> 
> However, I'm not aware that HP-UX has this problem: on this platform
> perl uses its own malloc(), which doesn't waste memory in this
> situation.  It's on hosts where perl has to use the system's malloc()
> that the problem can bite.  You get better behaviour on such systems
> with something like this:
> 
> push(@bits, $stuff) while $more_stuff;
> $whole_ball_of_wax = "@bits";
> 
> Change a local copy of $" to your preferred separator if you don't like
> the default of a space, or consider using join() instead, as Tom
> suggested:
> >
> > Of course, you could probably do what you want with join. Hope this helps!
> 

> Dominic Dunlop

Many Thanks to Tom and Dominic for the lucid comments and solutions...

Brian Wilson


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

Date: Thu, 07 May 1998 11:37:40 -0800
From: ~arthur <star@sonic.net>
Subject: Re: perl scripts dealing with /etc/passwd
Message-Id: <35520D7F.19C8@sonic.net>

I am no pro but I found this useful http://www.rlaj.com/scripts/

~arthur
star@sonic.net



David A. Lyons wrote:
> 
> Somebody please point me to a resource where I can analyze perl scripts
> that do various things to the /etc/passwd file, like add, remove,
> change, view, sort entries, check password, etc.  I don't know perl, but
> I'm planning to add a database to a web site where users can enter,
> change & remove their entries and it'll use a username/password so
> others can't affect another's entry.  I figure looking at perl scripts
> that work with the /etc/passwd will be a good place to start on the
> learning curve, since my will be implemented similarly.
> 
> Dave


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

Date: Thu, 07 May 1998 14:40:42 -0400
From: Greg Piney <greg_piney@mhc-smtp-mail.mcgraw-hill.com>
Subject: Re: perl scripts dealing with /etc/passwd
Message-Id: <3552002A.50AB3D37@mhc-smtp-mail.mcgraw-hill.com>

Having tried something similar, Don't Do It. I Twice blew away a production
/etc/passwd file while trying to futz with it.

Greg PIney
The  Mcgraw-Hill Companies

David A. Lyons wrote:

> Somebody please point me to a resource where I can analyze perl scripts
> that do various things to the /etc/passwd file, like add, remove,
> change, view, sort entries, check password, etc.  I don't know perl, but
> ***TEXT DELETED ***



> Dave





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

Date: Thu, 07 May 1998 17:02:15 GMT
From: kis1380@cs.rit.edu
Subject: pipe turns off the alarm() ?
Message-Id: <6ispen$6fm$1@nnrp1.dejanews.com>

Dear Perl Gods,

I am using the following script to rsh to a computer and execute a command -
in this case, the command is date.
I fork a child because if the computer that I connect to is "hosed" the rsh
will take forever to come back with something like "RPC error" or "Connection
timed out" (if it comes back).
In this script I give the rsh 6 seconds to complete, and after that the alarm
goes off and kills the child. The parent is waiting for the child to finish
(or be finished). This works fine, but I need to pass the result from the rsh
back to the parent. As far as I know I can do that with pipe. However when I
use pipe the alarm does not go off - neither the parent's nor the child's
alarm.
I can always have the child write to a file and parent read it, but this is
not a very good solution.

If somebody has an idea of how this could work I would appreciate it very
much.

Thank you!


Katerina


#!/usr/local/bin/perl


pipe(INPUT,OUTPUT);
$retval = fork();


if($retval != 0){
	#parent
	close(OUTPUT);
	alarm(10);
	$procid = wait();
	alarm();
	$date = <INPUT>;
	print("I got $date from my child\n");
	print(" status of waitpid is $procid\n");
}
else {
	#child
	close(INPUT);
	alarm(6);
	$date = `rsh nice date`;
	print OUTPUT  ($date);
}


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


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

Date: 7 May 1998 11:23:01 -0700
From: "Elan Kaplan" <Elan_Kaplan@globalcenter.net>
Subject: Problem with taint on perl 5.004_04 Solaris 2.6
Message-Id: <6isu65$svq@nntp02.primenet.com>

Reference an earlier post in this newsgroup titled "Setuid and Solaris"
I am experiencing the same problem using the same versions of Perl & OS.
This behavior was not present under 5.003 / Sol 2.5.1 - I believe this to be
a
bug in Perl.

Elan

Elan Kaplan
UNIX Software Technical Lead
Frontier GlobalVillage, Inc.
Elan_Kaplan@globalcenter.net
www.globalcenter.net





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

Date: Thu, 07 May 1998 14:45:25 -0400
From: comdog@computerdog.com (brian d foy)
Subject: Re: Problem with taint on perl 5.004_04 Solaris 2.6
Message-Id: <comdog-ya02408000R0705981445250001@news.panix.com>
Keywords: from just another new york perl hacker

In article <6isu65$svq@nntp02.primenet.com>, "Elan Kaplan" <Elan_Kaplan@globalcenter.net> posted:

>Reference an earlier post in this newsgroup titled "Setuid and Solaris"
>I am experiencing the same problem using the same versions of Perl & OS.
>This behavior was not present under 5.003 / Sol 2.5.1 - I believe this to be
>a
>bug in Perl.

after reading the original article (and Tom Pheonix's reply to it), i
tried to reproduce the error.  i couldn't:

   sri[25] uname -a
   SunOS sri.net 5.6 Generic sun4m sparc SUNW,SPARCstation-20
   sri[26] ./test.pl
   Perl version 5.00404
   #!/usr/bin/perl -wT

   $ENV{'PATH'} = '/usr/bin';
   $ENV{'HOME'} = '/export/home/tidbit';

   print "Perl version $]\n";

   print `cat $ENV{'HOME'}/test.pl`;

   __END__

seems to work fine.  perhaps you are experiencing another problem?

good luck :)

-- 
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>
cat cat cat cat cat


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

Date: Thu, 07 May 1998 18:45:39 GMT
From: Tom Phoenix <rootbeer@teleport.com>
To: Elan Kaplan <Elan_Kaplan@globalcenter.net>
Subject: Re: Problem with taint on perl 5.004_04 Solaris 2.6
Message-Id: <Pine.GSO.3.96.980507114354.28811O-100000@user2.teleport.com>

On 7 May 1998, Elan Kaplan wrote:

> Reference an earlier post in this newsgroup titled "Setuid and Solaris"
> I am experiencing the same problem using the same versions of Perl & OS.

> This behavior was not present under 5.003 / Sol 2.5.1 - I believe this
> to be a bug in Perl. 

Recent versions of Perl have plugged several security holes. It's
difficult to construe this as a bug! :-)

If you're sure that you've found a bug, please make a short example (say,
half a dozen lines) which will demonstrate it, then post that here.

Cheers!

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



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

Date: Thu, 07 May 1998 13:34:49 -0400
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: removing nested parentheses
Message-Id: <3551F0B9.C1CC6BF0@matrox.com>

Doug E Fresh wrote:

> Is it possible to create a search string that will find the most nested
> parentheses in a string or do I have to use index, substr etc. etc.
>
> i.e.
>
> $string = "2*(3+(4+5))"
> $string =~ s/somthing/&process($1)/e
> # where $1 = "4+5"
>
> thanks a bunch,
>
> Doug

 Hmmm  ... I suggest you take a closer look at the greediness of matching
operators!
After you do that, you can try something like this:
$string =~ s/.*\((.*)\)?/&process($1)/e;

Enjoy,

--
Ala Qumsieh             | "How much wood would a woodchuck
ASIC Design Engineer    |  chuck if a woodchuck could
Matrox Graphics Inc.    |  chuck wood?"
Montreal, Quebec        |             - Trivial ... 5!





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

Date: 7 May 1998 16:50:21 GMT
From: zbrown@lynx.neu.edu
Subject: returning a list from a recursive function
Message-Id: <6isood$nfj$1@isn.dac.neu.edu>

Someone gave me a very interesting function (see code below) that I have
tried to modify to suit my purposes, with no luck. The function is very
time-efficient (which I need), and that is part of the problem: I don't know
how to modify it in such a way that the efficiency (which is over my head)
is not lost.

Basically, the function takes a string of letters and outputs to the screen
all the ways in which the string can be broken into words, without changing
the order of the letters. So, for example,

itsnotitsnot

would give the following output:

it snot it snot
it snot its not
its not it snot
its not its not

What I would like is to have the function return an array of all answers
when it exits for the final time, rather than print each answer as it finds
it. But try as I might, I have not been able to get it to work. All I
succeed in doing is breaking the code in many and varied ways.

Here is the code:

sub breakwords {
    my ($frag, $words) = @_;

    if (! $frag) {
        print join(" ", @$words), "\n";
        return;
    }
    for (my $length = 1; $length <= length $frag; $length++) {
        # &hash('word', 'w') returns true if 'word' is in the dictionary
        if (&hash(substr($frag, 0, $length), 'w')) {
            push @$words, substr($frag, 0, $length);
            breakwords(substr($frag, $length), $words);
            pop @$words;
        }
    }
}

Zack


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

Date: Thu, 07 May 1998 17:26:28 GMT
From: Tom Phoenix <rootbeer@teleport.com>
To: Mark Austin <mark@tmsnet.co.uk>
Subject: Re: stat function
Message-Id: <Pine.GSO.3.96.980507102025.28811G-100000@user2.teleport.com>

On Thu, 7 May 1998, Mark Austin wrote:

>   if ($FileName cmp "." && $FileName cmp "..")

Are you sure that you want cmp there? It's not the usual choice. But it
may be doing what you want anyway.

>    print "<tr>\n";
>    print "<td>\n";
>    print "<a href=\"/modelsdownload/",$FileName,"\"","
> target=DISPLAY",">","[",$FileName,"]","</a>","\n";
>    print "</td>\n";

That would be clearer if it were a here document. As it is, it's hard to
read and maintain, and I'm sure it was hard to write. Let's see...

     print <<"END_MARK";
<tr>
<td>
<a href= "/modelsdownload/$FileName" target=DISPLAY>[$FileName]</a>
<td>
END_MARK

Is that it?

> ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,$ctime,$blksize,
> $blocks) = stat($FileName);

If this isn't working, you should check that the stat succeeded. Maybe
like this:

    unless (defined $size) {
	warn "Couldn't stat $FileName: $!";
	next;	# or whatever
    }

A frequent reason for the stat to fail would be that you're checking for
the file in the wrong directory. (Hint! Hint!) Hope this helps!

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



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

Date: Thu, 07 May 1998 17:38:04 GMT
From: Tom Phoenix <rootbeer@teleport.com>
To: xuming wang <"xuming "@email.unc.edu>
Subject: Re: tr/[\000-\177]/[\200-\377]/ doesn't work for '['
Message-Id: <Pine.GSO.3.96.980507103706.28811J-100000@user2.teleport.com>

On Thu, 7 May 1998, xuming wang wrote:

> tr/[\000-\177]/[\200-\377]/;

Have you seen how tr/// is documented in perlop? Hope this helps!

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




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

Date: Thu, 7 May 1998 17:43:03 GMT
From: adelton@fi.muni.cz (Honza Pazdziora)
Subject: Re: tr/[\000-\177]/[\200-\377]/ doesn't work for '['
Message-Id: <adelton.894562983@nemesis>

xuming wang <"xuming "@ email.unc.edu> writes:

> I also tried using hex (tr/[\x20-\7e]/[\xa1-\xfe]/ ), they can't change
> character [ to 8-bit.
> 
> $_ ='[';
> tr/[\000-\177]/[\200-\377]/;
> print;
> 
> [

Try
	tr[\000-\177][\200-\377];
or
	tr/\000-\177/\200-\377/;

Your code said to convert [ to [, which is exactly what it did.

Hope this helps,

--
------------------------------------------------------------------------
 Honza Pazdziora | adelton@fi.muni.cz | http://www.fi.muni.cz/~adelton/
                   I can take or leave it if I please
------------------------------------------------------------------------


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

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

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