[6270] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 892 Volume: 7

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Feb 4 12:27:20 1997

Date: Tue, 4 Feb 97 09:00:20 -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, 4 Feb 1997     Volume: 7 Number: 892

Today's topics:
     Re: Anyone got a base64 encoder? (John L. Allen)
     Re: Best locking method for NFS - buffered IO safe? <tchrist@mox.perl.com>
     Re: Changing Default Perl Module Path (Tim Goodwin)
     chdir question... <rdarnese@nortel.ca>
     Re: chdir question... (Nathan V. Patwardhan)
     Re: chdir question... (Kerry Schwab)
     Re: chdir question... (Dave Thomas)
     Re: Creation time and date of file <tchrist@mox.perl.com>
     DNS lookups in perl <kmm96jog@mds.mdh.se>
     Re: fork() and SysV Process Groups in perl question (Tim Goodwin)
     HELP!!!!! <FreezerBurn@my.email.address>
     HELP: Can't locate any .pm modules in @INC <jonesaa@worldnet.att.net>
     Re: Here document.. here... Good boy (Tad McClellan)
     Re: How do I update @INC so I can use my module? (Tim Goodwin)
     Interfacing existing C library to OO perl module <fawcett@nynexst.com>
     Re: New Group ideas: Splitting clpm (Charlie Stross)
     Newbie questions (Chris Raettig ['Scooby'])
     Re: nt perl question (Nathan V. Patwardhan)
     Re: NT perl, system() and html output (Nathan V. Patwardhan)
     Re: opening files vs. directories (Tim Goodwin)
     Perl 5.003 causes segmentation fault on SGI Irix <jeff@alexr.com>
     Re: Perl regexes are *not* greedy (was Pattern Matching <tchrist@mox.perl.com>
     Problems with mirror.pl <savo@matrix.it>
     Re: Q: opening a file RW without deleting it. <tchrist@mox.perl.com>
     Send OK message, then process other stuff w/perl? <x@apocalypse.org>
     Re: Storing objects into a tied hash (Tim Goodwin)
     Trimming Dollar Value <support@inklineglobal.com>
     Re: UNIX-based perl: backgrounding and file descriptors (cp76)
     Re: Using Perl module installed in personal area <jfarrow@teir.com>
     Re: Where to search for all newsgroup <mkruse@shamu.netexpress.net>
     Digest Administrivia (Last modified: 8 Jan 97) (Perl-Users-Digest Admin)

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

Date: 4 Feb 1997 08:56:40 -0500
From: allen@gateway.grumman.com (John L. Allen)
Subject: Re: Anyone got a base64 encoder?
Message-Id: <5d7f6o$ib6@gateway.grumman.com>

In article <01bc1248$910c77f0$1f7fe484@mlbweb>,
Rick Osborne <osborri@mail.northgrum.com> wrote:
>I need the algorithm for base64 encoding in perl.  Anyone got?  I'd also
>like to find some perl for BinHex4, if anyone's got it, but I've got the
>C++ for that and can always convert if no one does...

Check CPAN.  But for a cryptic and minimalist implementation try

Encoding:

#!/bin/perl
$_=pack(u,$_),y|!-`|B-Za-z0-9+/A|,
$e=2-ord()%3,s/.{$e}$/'='x$e/e,
s/.//,print while read STDIN,$_,45

Decoding:

#!/bin/perl -p
s/=*\n//,$_=y|B-Za-z0-9+/A|!-`|<y///c
?"":unpack u,chr(32+.75*y///c).$_

-------
Enjoy.

John.


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

Date: 4 Feb 1997 15:19:41 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Best locking method for NFS - buffered IO safe?
Message-Id: <5d7k2d$quq$1@csnews.cs.colorado.edu>

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

In comp.lang.perl.misc, 
    "Geoff Mottram" <minaret@sprynet.com> writes:
:Someone told me about a bug in NFS that prevents the use of the EXCL flag
:in creating lock files.  

I'd call it a design flaw rather than a bug.  

:Their solution was to "stat" the file to determine
:if it existed.

That's always wrong.  Anytime you take two steps to do something
(look to do it, then do it), you always open yourself up to 
a race condition.   Atomicity has its place.

--tom
-- 
Tom Christiansen      Perl Consultant, Gamer, Hiker      tchrist@mox.perl.com

    In general, they do what you want, unless you want consistency.
            --Larry Wall in the perl man page


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

Date: 4 Feb 1997 15:11:57 GMT
From: tim@pipex.net (Tim Goodwin)
Subject: Re: Changing Default Perl Module Path
Message-Id: <5d7jjt$7nf@join.news.pipex.net>

In article <01bc0eca$d7212eb0$7eac15a5@cafe>,
Bok Nan Lo <support@inklineglobal.com> wrote:
>My question is, how can I tell my perl scripts that this module resides
>under my directory rather than the standard directory mentioned above?

    use lib '/path/to/directory';

Type `perldoc lib' for more information.

Tim.
-- 
Tim Goodwin   | "A language needs both intestines and guts." -- Larry Wall


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

Date: 4 Feb 1997 16:11:27 GMT
From: Richard Arnesen <rdarnese@nortel.ca>
Subject: chdir question...
Message-Id: <5d7n3f$iet@nrtphc11.bnr.ca>

No matter WHAT I do I cannot make chdir behave properly.
Lets say i have a directory in a normal $a type variable
and I want to change directories to that variables contents.
How do you do this.

I have trie dseveral things and keep coming up empty.

TIA
-- 
########################################################
# Richard D. Arnesen Jr.      # The opinions stated do # 
# Unix DCA Support            # not necessarily reflect#             
# Nortel, RTP                 # those of my employers  #                   
# rdarnese@nortel.ca          ##########################
###############################


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

Date: 4 Feb 1997 16:33:41 GMT
From: nvp@shore.net (Nathan V. Patwardhan)
Subject: Re: chdir question...
Message-Id: <5d7od5$cr0@fridge-nf0.shore.net>

Richard Arnesen (rdarnese@nortel.ca) wrote:
: No matter WHAT I do I cannot make chdir behave properly.
: Lets say i have a directory in a normal $a type variable
: and I want to change directories to that variables contents.
: How do you do this.

Are you using absolute paths?  If this script is being executed from
a different area, or as a CGI script, you'll have to use absolute paths.

Are you error checking?  Is perl -w enabled?  I'm certain with both of
the former, you'll be able to figure out why chdir() isn't working.

chdir($a) || print("Cannot chdir!");

--
N Patwardhan
nvp@shore.net
send me mail
	--Jamie Zawinski


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

Date: 4 Feb 1997 09:38:04 -0700
From: kschwab@nyx10.cs.du.edu (Kerry Schwab)
Subject: Re: chdir question...
Message-Id: <5d7olc$76i@nyx10.cs.du.edu>

In article <5d7n3f$iet@nrtphc11.bnr.ca>,
Richard Arnesen  <rdarnese@nortel.ca> wrote:
>No matter WHAT I do I cannot make chdir behave properly.
>Lets say i have a directory in a normal $a type variable
>and I want to change directories to that variables contents.
>How do you do this.
>
>I have trie dseveral things and keep coming up empty.
>
>TIA
>-- 
>########################################################
># Richard D. Arnesen Jr.      # The opinions stated do # 
># Unix DCA Support            # not necessarily reflect#             
># Nortel, RTP                 # those of my employers  #                   
># rdarnese@nortel.ca          ##########################
>###############################

My best guess here is that you have a newline embedded in $a.
Perhaps you are reading $a from STDIN ?
If so, have a look at chomp().

Have you tried setting $a in the script as a test ?
Also try using the -w switch, check the return code of
chdir, and print errno ($!) if chdir fails....

#!/usr/bin/perl -w 
$a="/some/dir";
chdir($a) or die("ack: $!\n");


--
Kerry


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

Date: 4 Feb 1997 16:49:10 GMT
From: dave@fast.thomases.com (Dave Thomas)
Subject: Re: chdir question...
Message-Id: <slrn5fepvm.jea.dave@fast.thomases.com>

On 4 Feb 1997 16:11:27 GMT, Richard Arnesen <rdarnese@nortel.ca> wrote:
> No matter WHAT I do I cannot make chdir behave properly.
> Lets say i have a directory in a normal $a type variable
> and I want to change directories to that variables contents.
> How do you do this.

#!/usr/bin/perl -w

use Cwd;

print "Start off in ", cwd(), "\n";

my $newDir = "/tmp";

chdir $newDir || die "Can't chdir to $newDir: $!";

print "End up in ", cwd(), "\n";
__END__

However, if you're talking about running as a CGI scriptm you probably have
a problem with permissions.

What error are you getting? What environment are you running in? What are
the two or three lines of code that exhibit the problem?

Dave



-- 

 _________________________________________________________________________
| Dave Thomas - Dave@Thomases.com - Unix and systems consultancy - Dallas |
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


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

Date: 4 Feb 1997 16:24:59 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Creation time and date of file
Message-Id: <5d7nsr$sbm$1@csnews.cs.colorado.edu>

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

In comp.lang.perl.misc, lewis@thereel.com writes:
:> >>the following format.  Can someone help me with this?
:I have tried to access the modification date in the same way:
:
:$info=(stat($file))[9];
:
: but revtrieve   
: a 9-digit integer. How do I go about converting this into something
:useful of human-readable?

Well, why don't you first tell us which man pages you checked
and failed to grep out anything related to time?  I can't believe
that you missed all the examples in perlfunc.

--tom
-- 
Tom Christiansen      Perl Consultant, Gamer, Hiker      tchrist@mox.perl.com
:        And it goes against the grain of building small tools.
Innocent, Your Honor.  Perl users build small tools all day long.
		--Larry Wall in <1992Aug26.184221.29627@netlabs.com>


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

Date: Tue, 4 Feb 1997 16:13:32 +0100
From: Jonas Oberg <kmm96jog@mds.mdh.se>
Subject: DNS lookups in perl
Message-Id: <Pine.GSO.3.95.970204161004.25222A-100000@legolas.mdh.se>

Hi!

Is it possible to do a DNS lookup from inside a perl script?
I've got a program which is piped a message and picks out the bare bone
sender address (Such as jonas@coyote.eu.org) in $sender. I now want to
lookup the primary mail exchanger for coyote.eu.org.  I'd like something
like
$mx = lookupprimarymx($sender);

Is this possible, and if so, how?  I was thinking about opening a pipe to
nslookup but I'm not sure how you do both reads and writes.

------[ Jonas - Just another intelligent shade of blue ]------
http://www.mds.mdh.se/~kmm96jog - PGP key available via finger
--------------------------------------------------------------



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

Date: 4 Feb 1997 15:10:41 GMT
From: tim@pipex.net (Tim Goodwin)
Subject: Re: fork() and SysV Process Groups in perl question
Message-Id: <5d7jhh$7lq@join.news.pipex.net>

In article <5cos6r$a2j@nntp1.best.com>, Zenin  <byron@omix.com> wrote:
>Is there a way to have a Perl program declare itself as a process
>group leader?

See `setpgrp' in the perlfunc(1) man page.

>               If so, is there a way I can make sure that any children
>or grand/great-grand children that my program starts are also in that
>process group?

Not in general.  If it's your code, then of course you can simply ensure
that the children don't call setpgrp themselves.

Tim.
-- 
Tim Goodwin   | "A language needs both intestines and guts." -- Larry Wall


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

Date: 4 Feb 1997 14:33:52 GMT
From: "No One" <FreezerBurn@my.email.address>
Subject: HELP!!!!!
Message-Id: <01bc12a8$70f5e4a0$1ec2e126@jesse.GoSTC.com>

Please help me. .. . 

I'm trying to take some data passed in through a CGI program into PERL and
all I need it to do is dump the data as a text file. PLEASE HELP


-- 


    ____            .    _  .
   /# /_\_          |\_|/__/|
  |  |/o\o\        / / \/ \  \
  |  \\_/_/       /__|O||O|__ \		
 / |_   |        |/_ \_/\_/ _\ |	
|  ||\_ ~|       | | (____) | ||	Jesse Retchko
|  ||| \/        \/\___/\__/  //	JesseR@GoSTC.Com
|  |||_          (_/         ||	
 \//  |           |          ||
  ||  |           |          ||\
  ||_  \           \        //_/
  \_|  o|           \______//
  /\___/          __ || __||
 /  ||||__       (____(____)
    (___)_) 
 "We are the people our parents warned us about!"  -Jesse




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

Date: Tue, 04 Feb 1997 08:14:57 -0600
From: Anthony Jones <jonesaa@worldnet.att.net>
Subject: HELP: Can't locate any .pm modules in @INC
Message-Id: <32F74461.4752@worldnet.att.net>

I have installed perl 5.003 with all of the defaults, however when I try 
to use any module ( ENV.pm, lib.pm, etc...) I get the error "Can't 
locate *.pm in @INC".  The libpath variable is correct in the config.sh 
file at /usr/local/lib/perl.  What in the installation do I need to 
change in order to get all the modules in the @INC path.  

Thanks in advance,
Anthony Jones
Thorn Americas, jonesaa@worldnet.att.net


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

Date: Tue, 4 Feb 1997 07:48:44 -0600
From: tadmc@flash.net (Tad McClellan)
Subject: Re: Here document.. here... Good boy
Message-Id: <sne7d5.8n.ln@localhost>

root (root@alex.alex.net) wrote:

: Get rid of the quotes. It should work
  ^^^^^^^^^^^^^^^^^^^^^

How come? The quotes are definitely not the problem...


: >    # Print out thank you to user
: >    print STDOUT <<'EndOfHtml';
:                     ^         ^
: >
: ><html>
: ><head>
: ><title>SurfWatch Register</title>
: ></head>
: ></html>
: >
: >EndOfHtml
: >

: If it doesn't work, let me know!


--
    Tad McClellan                          SGML Consulting
    Tag And Document Consulting            Perl programming
    tadmc@flash.net


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

Date: 4 Feb 1997 15:16:44 GMT
From: tim@pipex.net (Tim Goodwin)
Subject: Re: How do I update @INC so I can use my module?
Message-Id: <5d7jss$7ts@join.news.pipex.net>

In article <5d5j4v$hr4@vixen.cso.uiuc.edu>,
Ming-Hwa Torng  - csc <torng@ux2.cso.uiuc.edu> wrote:
>I want to install my own module so I can do "use my_module" from the pm file 
>in my local directory.
>
>I suppose I have to update @INC (or %INC). How DO I do that?

    use lib '/path/to/your/directory';

Type `perldoc lib' for more information.

Tim.
-- 
Tim Goodwin   | "A language needs both intestines and guts." -- Larry Wall


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

Date: 03 Feb 1997 11:38:29 -0500
From: Tom Fawcett <fawcett@nynexst.com>
Subject: Interfacing existing C library to OO perl module
Message-Id: <8ju3ntrgje.fsf@nynexst.com>


I'm working with a C library that is implicitly object oriented.  Every
function takes a CONTEXT argument which is a pointer to a large C structure
containing contextual data.  I'm writing an XS interface module for the
library.

Instead of a translating the function interface literally, I'd prefer
to make the Perl module object-oriented.  I've gone through perlxs,
perlxstut, perlapi and perlguts, and unless I missed something there's
no discussion of this.  Can someone point me to an example of a
Perl<->C object-oriented interface?

Thanks,
-Tom


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

Date: Tue, 4 Feb 1997 14:18:14 GMT
From: charlie@k9.tardis.ed.ac.uk (Charlie Stross)
Subject: Re: New Group ideas: Splitting clpm
Message-Id: <slrn5feh93.aqi.charlie@k9.tardis.ed.ac.uk>

In article <qumpvyn5do4.fsf@cyclone.stanford.edu>, Russ Allbery wrote:
>
>We've already split off CGI into another group.  That group is called
>comp.infosystems.www.authoring.cgi.  If people won't use it now, I'm
>rather pessimistic about the chances of them using a new clp.* group on
>CGI.

Far as I can tell, the problem is that they _do_ use it ... at least,
those who have the wits to think "duh, I want to know how to get a cgi
thingy to work, that something to do with the web, isn't it?"

Unfortunately a lot of the noise on c.l.p.m seems to be coming from
people so apallingly ignorant that they don't simply conflate
'perl' and 'cgi' as if they're the same thing -- they don't even know
what CGI _is_. They want H1T C0UNTERZ for their K00L PAGES, and they've
heard the way to do it is something called 'pearl' or 'perl'.

Maybe what we really need is something like:

comp.lang.perl.www.hit.counters.that.look.good.in.microsoft.internet.exploder?


-- Charlie Stross
   (posting from an unusual account and thus resigned to receiving yet
    another copy of the c.l.p.m. newbie-annoyer FAQ)




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

Date: Tue, 04 Feb 1997 13:28:23 GMT
From: chrisr@cheese.org (Chris Raettig ['Scooby'])
Subject: Newbie questions
Message-Id: <32f83888.2618546@newnews.demon.co.uk>

Hi all,

Many thanks to the people who helped me with my previous question.  I have been
really playing around with Perl and a few more questions have come to mind.
Please bear with me :)

1) How can I make the output of my Perl program appear at the bottom of a HTML
file. I have written a counter program which outputs text. I don't think this is
classed actually as a CGI script, or is it?

2) Is there a function that would return the number of lines in a text file?

3) What is the best way of seeding the random number generator? Doing it via
time seems to lead to similar results if the numbers are taken in a very short
time period.

Thanks for your tolerance,
Regards,
Chris Raettig ('Scooby')
chrisr@cheese.org  www.cheese.org/fluffy
'Don't Die Wondering'


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

Date: 4 Feb 1997 14:51:52 GMT
From: nvp@shore.net (Nathan V. Patwardhan)
Subject: Re: nt perl question
Message-Id: <5d7ie8$5g6@fridge-nf0.shore.net>

Hieu Bui (hbui@hmc.edu) wrote:
: 	$file = ".\\data\\file.txt";
: 	open (HANDLE, ">>$file")

Slightly off-topic, but:

I'd suggest that you don't use the DOS "\" conventions, as it seems that
you're going well out of your way by escaping all the "\".  NT Perl will
work with "Unix-style" path delimiters "/".  For example, to open the
file C:\WINDOWS\SYSTEM.INI, you can do:

$file = '/windows/system.ini';
open(FILE, ">>$file") || die("Hey!: $!\n");
etc etc etc

To add/append to strings, try:
$string .= "something to append";

--
N Patwardhan
nvp@shore.net
send me mail
	--Jamie Zawinski


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

Date: 4 Feb 1997 14:47:39 GMT
From: nvp@shore.net (Nathan V. Patwardhan)
Subject: Re: NT perl, system() and html output
Message-Id: <5d7i6b$5g6@fridge-nf0.shore.net>

Daniel Donghoon Paik (uctt@uclink.berkeley.edu) wrote:

: i wrote a perl script for a form in html.  i am using the system()
: function to call dos exe programs.  my problem is that that output of
: these system calls shows up on the screen.  for example, if i do
: system("copy myfile.doc myfile2.doc"); then on my html page i will get a

Don't use system() when you don't have to.  There are a couple of "neat"
File modules that you might be interested in, including File::Copy.  These
might be included with the most recent NT Perl port, but are definitely
available from a CPAN near you!

--
N Patwardhan
nvp@shore.net
send me mail
	--Jamie Zawinski


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

Date: 4 Feb 1997 15:15:14 GMT
From: tim@pipex.net (Tim Goodwin)
Subject: Re: opening files vs. directories
Message-Id: <5d7jq2$7qt@join.news.pipex.net>

In article <32F1157E.75D91B59@oregon.uoregon.edu>,
Michael Stearns  <mstearns@oregon.uoregon.edu> wrote:
>How can I make this script iterate over nested directories, too?

That's exactly what the File::Find module is for.  It's a standard part
of the Perl distribution, so just type `perldoc File::Find' for details.

Tim.
-- 
Tim Goodwin   | "A language needs both intestines and guts." -- Larry Wall


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

Date: Tue, 04 Feb 1997 08:50:18 -0400
From: Jeff Ferguson <jeff@alexr.com>
Subject: Perl 5.003 causes segmentation fault on SGI Irix
Message-Id: <32F7308A.1B79@alexr.com>

Hello: I have been running perl 5.001 for some time now on my SGI Irix
machine without any problems. I recently upgraded (compiling the source
distribution) to 5.003 and since have had strange things happen to
existing programs. Certain scripts written some time ago, which operated
without a problem, are now causing segmentation faults on the system and
dumping core. The strange thing about it is that sometimes they run
fine, and sometimes they crash. There doesn't seem to be any rhyme or
reason to it. Anyone have any thoughts?


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

Date: 4 Feb 1997 14:58:19 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Perl regexes are *not* greedy (was Pattern Matching Question)
Message-Id: <5d7iqb$qh0$1@csnews.cs.colorado.edu>

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

In comp.lang.perl.misc, 
    jfriedl@wg.omron.co.jp writes:
:|> Perl does greedy expression matching by default, which means it tries to
:|> match as much as possible with your pattern.
:
:This is a common misconception, but it's not really true.

Jeffrey, now be nice to the poor poster.

It *is* true that perl REs are greedy -- for certain commonly employed
laymen's definitions of the term "greedy".  You are thinking of a
very different definition of greedy than most of us employ.  Perl's greed,
like all pre-broken^H^H^H^H^HPOSIX NFAs, is one in which immediate
gratification is more important than delayed (overall) satisfaction.

For example, suppose you've got these stock options that are about to
vest.  Now, it's true that you might make more if you left your stock
options cook a while longer, but you take them out right away.  This is
not an abnormal definition of greed, and it is this definition that
Perl's REs employ, as well you know.  

For the rest of the audience: in Perl REs, eagerness applied to direct,
predictable, LEFT-TO-RIGHT fulfillment is far more important than 
a potentially bigger return later down the line.  DFAs are not easy 
to write, nor are they easy to explain.  Simple left-to-right
processing is much easier to explain and understand for beginners,
amongst others.

And modifiers are certainly greedy by anyone's book.

--tom
-- 
Tom Christiansen      Perl Consultant, Gamer, Hiker      tchrist@mox.perl.com

    "They'll get my perl when they pry it from my cold, dead /usr/local/bin."
	    Randy Futor in  <1992Sep13.175035.5623@tc.fluke.COM>


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

Date: Tue, 04 Feb 1997 15:15:15 +0100
From: Alberto Savoldelli <savo@matrix.it>
Subject: Problems with mirror.pl
Message-Id: <32F74473.2430@matrix.it>

I try to use the mirror.pl package on my solaris 5.5.1 but I have
the message 

	Pausing between retries
	Cannot connect, skipping package

	but the same package on my linux box runs well.

	Does anybody know the reason of this?

Thanks, Alberto.


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

Date: 4 Feb 1997 14:48:07 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Q: opening a file RW without deleting it.
Message-Id: <5d7i77$qb2$1@csnews.cs.colorado.edu>

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

In comp.lang.perl.misc, mike@stok.co.uk writes:
:In article <8clo96hlup.fsf@gadget.cscaper.com>,
:Randal Schwartz  <merlyn@stonehenge.com> wrote:
:>Mike> scalar <FILE>;
:
:>What are those "scalars" doing in there?
:>Works just fine without them.  It's misleading this way.

:In what way is it misleading, not necessary, ugly, verbose, untidy I can
:live with, but misleading?

I suspect that Randal considers them misleading because
they do not change the behaviour of the <FH> read there,
since it's already in a scalar context.

I'm siding with Mike on this one.  He's just trying to protect himself
from the Black Beast of Perl Programming: deceptful, misleading, silent,
and often catastrophic auto-conversion between the scalar/list senses of
too damn much in this language.  It is the single most evil and wrong
thing about Perl, and we must not judge Mike too harshly for it.  It's
strange magic at a distance.

Here, Randal, what do these do:

    sub revit { return reverse $_[0] }

    sub countit { return @_ }

    sub grabone { my $fh = shift; return <$fh> }

Answer: YOU DON'T KNOW!  You can't know without looking at the
surrounding context of each and every call!  What a crock!

I am very happy so see people write

    $line = scalar <FH>;

So that they don't get confused about why this doesn't work:

    dosumthun(<FH>);

unless of course it happens to be prototyped 

    sub dosumthun($);

Do you want to explain that?  Do you want to explain why it is
that you need to deal with the follow idiocy?

    print reverse <FH>;
    print reverse scalar <FH>;
    print scalar reverse <FH>;
    print scalar reverse scalar <FH>;

If you enjoy such tedious monologues, then do feel free, but realize that
mere mortals and even demi-mortals of a less programatically cavalier bent
will continue to write self-defensive code peppered with "unnecessary" (but
in no way misleading) calls to scalar.  It's called safe programming.

Scalar-list context magic sucks.

--tom
-- 
Tom Christiansen      Perl Consultant, Gamer, Hiker      tchrist@mox.perl.com

MAGIC*  xmg_magic;  /* linked list of magicalness */
    --Larry Wall, from sv.h in the v5.0 perl distribution


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

Date: Tue, 4 Feb 1997 09:43:23 -0500 (EST)
From: "x.z." <x@apocalypse.org>
Subject: Send OK message, then process other stuff w/perl?
Message-Id: <199702041443.JAA28194@asylum.apocalypse.org>


I'm working on a perl script where I want to send an OK message to the user,
(basically just telling the user the script is running, so she can split)
then have the script do its processing (it uses a lot of "sleep" commands,
and can take 10 minutes to finish the processing). Even though the output
to the browser precedes the heavy processing, the OK message doesn't get
delivered until all the processing is done... leaving the user to stare at
a spinning netscape icon for 10 minutes. 

I can't just have the script invoke *another* script to do the processing,
because I'm using data supplied by the user. Unless, I suppose, I write that
data to a temp file, and have the other script read data from it. Seems
too kludgy that way. Any ideas? 

CC:ed replies are appreciated, as news is down indefinitely at my site.
Thanks.

  - Xochi





-- 
|                 |"The Way that can be spoken of is not the constant Way"  | 
| Xochi Zen       |                                - Lao Tzu                |
| x@apocalypse.org|"The Way that can be spoken of is involved in the        |
|                 | production of cheese"          - Xochi Zen              |



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

Date: 4 Feb 1997 15:20:13 GMT
From: tim@pipex.net (Tim Goodwin)
Subject: Re: Storing objects into a tied hash
Message-Id: <5d7k3d$839@join.news.pipex.net>

In article <32EBACFD.28AFAD0F@dna.fi>, Dado Colussi  <gdc@dna.fi> wrote:
>Is it possible to store objects into a tied hash?

A Berkeley DB holds arbitrary data strings, so what you need is a way to
turn your objects into strings, and back again.

There are a couple of modules that purport to do this; FreezeThaw and
Data::Dumper look promising.  See the module list at

    ftp://ftp.metronet.com/pub/perl/modules/00modlist.long.html

Tim.
-- 
Tim Goodwin   | "A language needs both intestines and guts." -- Larry Wall


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

Date: 4 Feb 1997 16:42:04 GMT
From: "Bok Nan Lo" <support@inklineglobal.com>
Subject: Trimming Dollar Value
Message-Id: <01bc12ba$5595f800$61a915a5@cafe>

I'm having hard time with formatting and trimming an amount in a variable.

e.g. $3.4405

I just wanted it to be $3.44 rather than four decimal places. How can I get
it solved?!

P/S: I want to actually trim it rather than formatting to STDOUT using
printf().



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

Date: 4 Feb 1997 13:58:08 GMT
From: cp76@csie.nctu.edu.tw (cp76)
Subject: Re: UNIX-based perl: backgrounding and file descriptors
Message-Id: <5d7f9g$dte@news.csie.nctu.edu.tw>

Christopher M Wolff (christopher.wolff@nb.rockwell.com) 4#(l:
: Two UNIX-based perl questions:
: 1) Can a background process be launched from within perl?
: I tried using fork,exec,and system, but at best they spawn a child
: process which dies when the parent does. In order to get a true
: background process, I call a C-shell that launches the background
: process for me and then exits. I hope to eliminate such ugliness
: if possible.

Did you use 'nohup' ?
Some shells like 'ksh' will kill child process before exiting.  


: 2) How can I write to a file descriptor specified by number alone?
: I tried using syswrite, but it doesn't seem to work like the C "write"
: function. I need to do this because a parent process has setup the
: file descriptors 3 and 4 for communication. At the moment I am
: stuck using C for the "write," and I'd like to get rid of this
: platform dependence by doing it all in perl if possible.
: Thanks,
: -- 
: Christopher M. Wolff			Rockwell Semiconductor Systems	
: christopher.wolff@nb.rockwell.com
: 	Design Automation


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

Date: Tue, 04 Feb 1997 08:09:18 -0500
From: Jim Farrow <jfarrow@teir.com>
Subject: Re: Using Perl module installed in personal area
Message-Id: <32F734FE.44F6@teir.com>

lhollman@nicom.com wrote:
> 
> I'm attempting to utilize the LWP module, and have installed it in my
> personal area since I do not have access to the /usr/local/lib area.  In
> order to use this module in a test script, I've tried using each of the 2
> following lines to point 'use' directives at my local copy of LWP to no
> avail:
> 
> 1)  push (@INC, $ENV{'HOME'}."/lib");  #c/o Tom Hukins
> 2) use lib "/home/lhollman/LWP";  #c/o Randal Scwartz in Web Techniques
> 
> Both lead to the following error messages:
> 
> Can't locate LWP/UserAgent.pm in @INC at test.pl line 8.
> BEGIN failed--compilation aborted at test.pl line 8.
> 
> Any help is greatly appreciated.
> 
> Lance Hollman
> 
> -------------------==== Posted via Deja News ====-----------------------
>       http://www.dejanews.com/     Search, Read, Post to Usenet
Try setting the environment variable PERLLIB.


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

Date: 4 Feb 1997 16:15:34 GMT
From: Matt Kruse <mkruse@shamu.netexpress.net>
Subject: Re: Where to search for all newsgroup
Message-Id: <5d7nb6$649@news1-alterdial.uu.net>

On Mon, 3 Feb 1997, Kevin E. wrote:
: My question for the experienced newsgroup users are where can you go to
: find a whole host of newsgroup channels?

newsgroups, not newsgroup channels.  Channels = IRC.

: Is there a newsgroup listing of all newsgroup sites?
: As you can tell, I'm new to the newsgroup world.

You don't need a listing of 'sites', you want a listing of groups.  And 
there are WAY too many to list.

If you're new to usenet, dejanews (www.dejanews.com) is the answer to your 
prayers.  One of the most useful sites on the internet.  Check out my 
improved interface to their usenet database, which will help you find 
newsgroups that talk about a certain topic:

http://www.netexpress.net/~mkruse/search/search.html

[And 90% of the perl questions people have could be answered MUCH faster 
by searching dejanews for the answers.  Chances are, someone has already 
asked and had your question answered.  Yet another reason to NEVER reply 
to a question only by email if others may be interested.  It's annoying 
to see lots of questions, but no answers because the answers were 
emailed!] 

-- 
Matt Kruse
mkruse@netexpress.net
http://www.netexpress.net/~mkruse/                  http://www.mkstats.com/
---------------------------------------------------------------------------
Unsolicited advertising of any type to this addresss will not be tolerated.


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

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

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 V7 Issue 892
*************************************

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