[8414] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 2031 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Mar 5 11:16:50 1998

Date: Thu, 5 Mar 98 08:00:38 -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           Thu, 5 Mar 1998     Volume: 8 Number: 2031

Today's topics:
    Re: "Learning Perl" or "Programming Perl" (Greg Bacon)
    Re: $0: which OSes? (Michael Kelly)
    Re: A perl question <Jonathan.larouche@enter-net.com>
    Re: ANNOUNCE: Perl site from The Mining Company ralanfox@hotmail.com
        Another way to invoke the perl interpreter (Robert Fenk)
    Re: Are perl $SIG{} handlers inherently unsafe? (Gabor)
        Capturing STDERR in CGI script on Website Pro serstad@acc.jc.edu
    Re: Clearing the screen (Gabor)
    Re: Clearing the screen (Andrew M. Langmead)
        context-sensitive user defined functions? <David.Boyce@fmr.com>
    Re: Displaying subdirectories and not filenames <tchrist@mox.perl.com>
    Re: Example for use Win32::NetResource::AddConnection <burkhard.kiesel@med.siemens.de>
    Re: HELP!  exec doesn't work properly! (Joe Hass)
    Re: HELP!?!?!!?!?!  How to use $| <barnett@houston.Geco-Prakla.slb.com>
    Re: how do I import subs from another file? <quentin@jihad.amd.com>
    Re: Is there a cron written in perl for Win32? <Sebastian_Probst@hp.com>
        Newbie's question about package xrfang@technologist.com
    Re: Perl Editor <quentin@jihad.amd.com>
        perl Net:DNS module <dcox@lexmark.com>
    Re: Perl performs a second miracle.  Prepare for canoni <barnett@houston.Geco-Prakla.slb.com>
    Re: Perl script from Unix to Win32 [FAQ] (Robert F. Harrison)
    Re: safe file modification strategy (w/flock, new_tmpfi <merlyn@stonehenge.com>
        Script for RTrimming Fields <byron_lee@prenhall.com>
    Re: Sorting array by a computable field <jdporter@min.net>
    Re: Sorting array by a computable field (Andrew M. Langmead)
    Re: Sorting array by a computable field <steve@prilnari.com>
    Re: Special Characters <quentin@jihad.amd.com>
    Re: Special Characters <jdporter@min.net>
    Re: Stripping (Most) HTML tags <jdporter@min.net>
    Re: Summing Up Array Values - How Do I? <jdporter@min.net>
    Re: Summing Up Array Values - How Do I? <dmeyers@panix.com>
        Sybase <etmgero@etm.ericsson.se>
    Re: What is PERL? Learn JAVA instead? <jdporter@min.net>
    Re: What is PERL? Learn JAVA instead? <jdporter@min.net>
    Re: What is PERL? Learn JAVA instead? <wd@uebemc.siemens.de>
    Re: What is PERL? Learn JAVA instead? <joeo@enigmastation.com>
    Re: Win32 Perl and ODBC New User Problems (Brian Sawert)
        YES! there is a cron written in perl for Win32? scott@softbase.com
        Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: 5 Mar 1998 15:02:20 GMT
From: gbacon@cs.uah.edu (Greg Bacon)
Subject: Re: "Learning Perl" or "Programming Perl"
Message-Id: <6dmeps$7mv$1@info.uah.edu>

In article <6dki8u$ra9@dfw-ixnews10.ix.netcom.com>,
	jeff@yoak.com (Jeff Yoak) writes:
: Recently I attempted to send to Tom's valid
: email address a "Thank you" note for something he posted that I
: personally found interesting and my mail bounced because it was sent
: from a Netcom account.

Certain people reject all mail from providers that harbor spammers.

: I don't
: know whether to Tom notes like mine are baby or bathwater, given his
: feelings about unrepliable addresses it did strike me as rather
: ironic.

An address isn't unreplyable just because mail to it from you bounces.

: (And Greg... while Tom's bounced mail was definately intentional, I'm
: not 100% sure that the following, part of a bounced cc of a Usenet
: post,  was equally so, but it looks like it.)
[snip] 
:    ----- Transcript of session follows -----
: Message rejected: Mail from unauthorized host
  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Here's what my log has to say about that message:

    1998/03/03 20:51:24 [9116]: Message from jeff@yoak.com (Re: Controlling TWO input files (merging))
    1998/03/03 20:51:24 [9116]: Spamchecker caught \bnetcom\.com\b

Quit giving money to spam harborers.

BTW, The filter I use is based on the one Tom uses. :-)

Greg
-- 
open(G,"|gzip -dc");$_=<<EOF;s/[0-9a-f]+/print G pack("h*",$&)/eg
f1b88000b620f22320303fa2d2e21584ccbcf29c84d2258084
d2ac158c84c4ece4d22d1000118a8d5491000000
EOF


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

Date: Thu, 05 Mar 1998 08:58:40 -0500
From: mkelly99@NOSPAMgate.net (Michael Kelly)
Subject: Re: $0: which OSes?
Message-Id: <34ffaf37.41141913@news.gate.net>

On Wed, 04 Mar 1998 11:58:08 GMT, Bill Jones <webmaster@fccjmail.fccj.cc.fl.us> wrote:

>Very interesting.
>Maybe on Solaris the $0 become a local assignment
>and does not propagate?

Perhaps the /proc filesystem Linux uses is the link between the
app, $0 and ps?  Just a wild guess as I believe /proc is unique
to Linux.

>
>Bill
>
>
>
>Gautam Srikanth wrote:
>
>> Excerpts from netnews.comp.lang.perl.misc: 4-Mar-98
>> Re: $0: which OSes? by Bill Jones@fccjmail.fccj.cc.fl.us
>>
>> > Hmmm, that's funny, on my Solaris 2.5.1 $0 reflects the ENTIRE name of the
>> > program as invoked...
>>
>> That's consistent with Solaris' behavior here: the initial value of $0
>> reflects the pathname of the program invoked.  The trouble is that
>> assigning to $0 does not change its entry in a 'ps' at all.
>>
>> Linux is the only system I tried where a program's ps entry matched
>> changes in $0.
>>
>> Gautam
>>
>> -=-=-
>> Gautam Srikanth  -  morpheus@andrew.cmu.edu  -  www.andrew.cmu.edu/~morpheus
>> "If opera is entertainment, then falling off a roof is transportation" (MAD)
>
>


Mike

"Genius gives birth, talent delivers."

                - Jack Kerouac

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


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

Date: 5 Mar 1998 16:01:13 GMT
From: "Jonathan Larouche" <Jonathan.larouche@enter-net.com>
Subject: Re: A perl question
Message-Id: <01bd484e$a53980a0$87e0a8c0@larouchejonatha.lactel.com>

There is the solution:

sub space_replacing {
        @PAIRS = split(' ',$StringToReplace);
        $NewString="";
        $PairsNumber=@PAIRS;
        for($i=0;$i<$PairsNumber;$i++)
                {
                       
if($i=0){$NewString=sprintf("%s",$NewString).sprintf("%s",$PAIRS[$i]);}
                        else{
                       
$NewString=sprintf("%s",$NewString)."+".sprintf("%s",$PAIRS[$i]);
                }
      return $NewString;
}


Jonathan Larouche
Twisted-Minds Dev. & Concept.
http://www.twisted-minds.com
info at: webmaster@twisted-minds.com

demarcao@sysadm.suny.edu a icrit dans l'article
<6dkctf$sno$1@nnrp1.dejanews.com>...
> I have aproblem that I need some help on.
> 
> I have a variable that I need to check for a space and replace the space
with
> %20, Can anyone give me an example on how to do this??
> 
> Thanks,
> 
> Alex
> 
> -----== Posted via Deja News, The Leader in Internet Discussion ==-----
> http://www.dejanews.com/   Now offering spam-free web-based newsreading
> 


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

Date: Thu, 05 Mar 1998 09:45:25 -0600
From: ralanfox@hotmail.com
Subject: Re: ANNOUNCE: Perl site from The Mining Company
Message-Id: <6dmh98$rtv$1@nnrp1.dejanews.com>

Russ (and others):

I must admit that this is the first I am hearing of such allegations.  I am
new to TMC, and can only give you my word that Features in the Perl site will
consist of ORIGINAL content written by me, or properly permissioned.

There is a 'hotlist' area of all TMC sites where Guides are asked to point
out the best web sites within their disciplines.  These sites may appear in
the TMC framework, but have never appeared (to me, at any rate) to be
positioned as original content.

I would invite all Perl content people to contact me
(perl.guide@miningco.com) if they feel that there is something that has been
used without proper permission, or if there is something that they would want
added to the list.

I would also like to know (for my own personal and pressional knowledge) if
others have had problems with The Mining Company repurposing their content
(in any subject area).

Thanks for bringing this to my attention.

RA Fox
Perl Guide
perl.guide@miningco.com

In article <m3ogzxr4hw.fsf@windlord.Stanford.EDU>,
  Russ Allbery <rra@stanford.edu> wrote:
>
> ralanfox <ralanfox@hotmail.com> writes:
>
> > This is to announce the newest addition to the Mining Company web guide
> > collection:
>
> > http://perl.miningco.com
>
> > This site features ORIGINAL content, Perl tutorials, and links to
> > various Perl resources.
>
> According to recent traffic on list-managers, this site has something of a
> reputation for stealing content, taking other people's pages and putting
> them up on miningco.com as if they were written locally (and adding ad
> banners).
>
> People who have written web pages about Perl may want to look over this
> site and make sure that's not what's happening here.
>
> I have no information to indicate that that is the case in this instance.
> I am simply passing along complaints I have heard from others.


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


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

Date: 5 Mar 1998 15:34:52 GMT
From: fenk@informatik.tu-muenchen.de (Robert Fenk)
Subject: Another way to invoke the perl interpreter
Message-Id: <6dmgms$rr1@sunsystem5.informatik.tu-muenchen.de>


Hi *,

I've just started to learn perl and now I know what I've miss
pretending TCL/TK and C/C++ is all I need. ;c)

There was just one problem, I use my scripts on various platform
(Linux, SUN, HP, Iris, ...) and every admin places the perl
interpreter in another directory. So I hade the problem, that without
editing the shebang line, I couldn't get the scripts working with the
shebang mechanism on all platforms

What I needed was a way to start perl without using a absolute path!

Well I found the following in the documentation:
    
#!/bin/sh -- # -*- perl -*- -p
eval 'exec perl $0 -S ${1+"$@"}'
    if 0;

but my bash (GNU bash, version 1.14.7(1)) complains with "sh: --: bad
option". Then I tryed several variants, e.g. the ugly one:

eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}'
    & eval 'exec perl -S $argv:q'
    if 0;

It works, but it's really ugly and finally I worked out the following:

#!/bin/sh
# -*- perl -*- this is for emacs
eval 'exec perl -x -S $0 ${1+"$@"}'
    if 0;

#!/usr/anydir/bin/perl -w

It should work with any /bin/sh, starts emacs in perl-mode and you
still can invoke the script explicitly with the perl interpreter.

I don't know if someone else already thought about this variation or
if I misused something or forgot some problems, but to me it seems
pretty nice and worth to be known by others!


bye Robert.

--
KISS (Keep it simple, stupid)


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

Date: 5 Mar 1998 15:29:26 GMT
From: gabor@vmunix.com (Gabor)
Subject: Re: Are perl $SIG{} handlers inherently unsafe?
Message-Id: <slrn6fthpt.cfo.gabor@vnode.vmunix.com>

In comp.lang.perl.misc, Randal Schwartz <merlyn@stonehenge.com> wrote :
# >>>>> "Ilya" == Ilya Zakharevich <ilya@math.ohio-state.edu> writes:
# 
# >> Is it unsafe to even just do this in a server
# >> 
# >> $SIG{CHLD} = sub { wait; };
# >> 
# >> ?
# 
# Ilya> You have seen the answer already.  (Though I would think that 
# 
# Ilya>   $SIG{CHLD} = sub { wait; return; };
# 
# Ilya> is safe in my OS/2 binary release, which contains a voodoo patch which
# Ilya> is not allowed into the main distribution.)
# 
# Of course, even if it *was* safe, it's dangerous code.
# 
# Two SIGCHLDs could come in before it's your turn for CPU (like when
# two kids croaked while you were out of the run queue).  So the
# "SIGCHLD pending" bit gets set.  Yes.  A bit.  So when your CPU slice
# comes up, you take *one* trip through the handler.  You've waited for
# *one* child, but two were actually waiting.  Now you've got a zombie.
# 
# Dangerous Code.  Don't do this.

Is this only true for Perl?  In C I can use sigaction and block
signals, the kernel queues them, while I am in the handler.

Is there no way for me to wait for my children?


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

Date: Thu, 05 Mar 1998 08:25:43 -0600
From: serstad@acc.jc.edu
Subject: Capturing STDERR in CGI script on Website Pro
Message-Id: <6dmcjq$nne$1@nnrp1.dejanews.com>

Hi,

First of all, please excuse this message if it's not entirely appropriate for
this newsgroup -- I'm trying to figure out the best place to ask this
question but I'm kind of running into brick walls.

Basically I'm having problems trying to shell to a program from within a CGI
script and capture both the standard error and standard output from that
program.  It works splendidly on NT 3.51 but fails on 4.0.  If you're
interested in a challenge, please read on.

Thanks a lot,
Sped
serstad@acc.jc.edu


=====================

I'm trying to figure out why Website Pro running on NT 4.0 doesn't allow the
capturing of Standard Error in Perl scripts the same way it does on NT 3.51.
I am trying to shell from a perl CGI script to a dos program (actually a
command-line program compiled on my NT box) and then capture the Standard
Output AND Standard Error results of that program.

Basically, I am testing our programs on an experimental server in planning our
migration to WSP 2.1 on Windows NT 4.0.  We are currently running WSP 1.1 on
NT 3.51.  I have exactly mirrored my production server on the test machine,
with the only difference being NT 4.0 instead of NT 3.51.

I've written a small C program that prints out one line to each Standard
Output and Standard Error.  Here is the snippet of Perl code that I am using
to call that program:

open RESULT, "tmp 2>&1 |" or die "Can't Fork: $!";
while (<RESULT>) {
	print "output: $_";
}

close RESULT;


Now, when I run this from a dos prompt, I get the results that I expect:
  output: Hello, Standard Error!
  output: Hello Standard Output.


Ok -- this means that the perl script is properly shelling out to the tmp.exe
and capturing both the Standard Error and Standard Output.

Now, when I attempt to run this as a CGI script, I get nothing -- the tmp.exe
program does not get executed at all.

To make things more interesting, I take out the 2>&1 (which pipes the Standard
Error to the Standard Output) and I get this (as expected):
   output: Hello Standard Output.

Now, I've also set up this shell with backticks, a SYSTEM call, and even
trying to pipe Standard Error to a file:

1.  @result = `tmp 1> tmpout.txt 2>&1 `;
2.  $exres = system("tmp > tmpout.txt 2> tmperr.txt ")

All of these work fine on the 3.51 production machine.  But it would appear on
the 4.0 machine, the 2>&1 causes the shell program not to execute.

So what is the key to getting Standard Error through WSP on an NT 4.0 machine?
Can anyone figure out why this works on 3.51 and not 4.0?  Is anyone out there
using Perl to shell out to other programs under WSP?

For the record, I am trying all of this with WSP 1.1h (although 2.0 also
fails) and Activeware Perl Build 306 (although Activestate build 315 also
fails).  Like I said, the only difference I can see is between 3.51 and 4.0.



Thanks a lot,
Sped
serstad@acc.jc.edu


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


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

Date: 5 Mar 1998 13:37:13 GMT
From: gabor@vmunix.com (Gabor)
Subject: Re: Clearing the screen
Message-Id: <slrn6ftb7f.c49.gabor@vnode.vmunix.com>

In comp.lang.perl.misc, Joshua Frank <joshua@midwest.net> wrote :
# Is there a simple way to clear the screen in perl 4? Without using tk or
# anything like that.
# -joshua@midwest.net

You have a number of options.
1.  use a rag and clear it yourself
2.  wait for the janitor to do it
3.  if you want all the characters from your terminal to be gone, just
    turn it off
there might be other options ;)


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

Date: Thu, 5 Mar 1998 14:50:20 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: Clearing the screen
Message-Id: <EpCp7x.1Lv@world.std.com>

"Joshua Frank" <joshua@midwest.net> writes:

>Is there a simple way to clear the screen in perl 4? Without using tk or
>anything like that.

>From what I recall, in perl 4 you have the choices of running another
process that will clear the screen for you ("system('clear')"),
Outputting the appropriate escape codes yourself (if you can be
guarenteed the type of terminal the code will be running with.) or
using the special "curseperl" program that is in the distribution as
an example on how to extend perl.

But its hard to remember five year old software.

In perl 5, you can still do the system() or escape code method, but
you also have the Curses module
<URL:htttp://reference.perl.com/module.cgi?Curses>


-- 
Andrew Langmead


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

Date: Thu, 05 Mar 1998 10:31:37 -0500
From: David Boyce <David.Boyce@fmr.com>
Subject: context-sensitive user defined functions?
Message-Id: <34FEC559.C72C3A1E@fmr.com>

You know how lots of perl built-in functions are context sensitive, i.e.
they return one thing in a scalar context and another in a list
context?  I'm wondering if/how it's possible to write your own functions
which do the same thing.  This feels like a FAQ but does not appear to
be one.  To elaborate, imagine a function which generates textual
output; in some cases the user wants the output dumped to stdout/stderr
and only cares to check  the return status:

    $status = command(...);

and in other cases he wants to capture that output and do some
post-processing on it:

    %results = command(...);

Where $results{stdout} and $results{stderr} will be arrays of output
lines and $results{status} is a scalar as above.  I've written separate
functions to do both of these successfully, but it would be graceful (at
least by my aesthetics) to have one function which could determine the
LHS type and "do the right thing".  Is this possible?

Thanks,
David B



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

Date: 5 Mar 1998 14:37:30 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Displaying subdirectories and not filenames
Message-Id: <6dmdba$nk5$1@csnews.cs.colorado.edu>

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

In comp.lang.perl.misc, Koos Pol <koos_pol@nl.compuware.com> writes:

:Watch the linewrapping by the newsreader.

What you're calling a newsreader, "Mozilla 4.02 [en] (X11; I; SunOS
5.5.1 sun4m)", only qualifies in a sick and perverse sense.

:Have fun.

How do you expect us to have fun with code like this:

:# This program is free software; you can redistribute it
:and/or              #
:# modify it under the terms of the GNU General Public
:License                #
:# as published by the Free Software Foundation; either version
:2             #
:# of the License, or (at your option) any later
:version.                     #

That kind of code posting verges on the useless, and is
deeply annoying.  Please get a Real Newsreader (tm).

--tom
-- 
	Tom Christiansen	tchrist@jhereg.perl.com
    Perl is designed to give you several ways to do anything, so
    consider picking the most readable one.
            --Larry Wall in the perl man page


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

Date: Thu, 5 Mar 1998 15:42:53 +0100
From: "Burkhard Kiesel" <burkhard.kiesel@med.siemens.de>
Subject: Re: Example for use Win32::NetResource::AddConnection
Message-Id: <6dmdgm$pln$1@med-iss3.med.siemens.de>

Hi there,

I uses a german NT4.0, then the following example works

use Win32::NetResource;
my ($error,%resource);
# Note: for Netware resources, change Provider to 'Netware Services'
%resource = (
   'Scope' => RESOURCE_CONNECTED,
   'Type' => RESOURCETYPE_DISK,
   'DisplayType' => RESOURCEDISPLAYTYPE_SERVER,
   'Usage' => RESOURCEUSAGE_CONNECTABLE,
   'LocalName' => "W:",
   'RemoteName' => "\\\\Server\\Home",
   'Comment' => "Oy gee wow!",
   'Provider' => "Microsoft Windows-Netzwerk"             #
<========================
);
unless (Win32::NetResource::AddConnection(\%resource,'passwd','user',0))
{
   Win32::NetResource::GetError($error);
   print "Couldn\'t connect to $resource{'RemoteName'}. Error # $error\n";
   print "Type NET HELPMSG $error for the failure reason, since\n";
   print "WNetGetLastError() seems to be broken.\n";
}



Burkhard Kiesel schrieb in Nachricht
<6djt1h$1ov$1@med-iss3.med.siemens.de>...
>Hi there,
>
>is there anyone who has experience with the Win32::NetResource module.
>May be it is possible that I can get some examples how to use this.
>I just want to connect to a shared drive on a other host.
>
>Thanks in advance
>
>
>Burkhard
>
>
>




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

Date: 5 Mar 1998 15:31:49 GMT
From: jhass@mrc.unm.edu (Joe Hass)
Subject: Re: HELP!  exec doesn't work properly!
Message-Id: <6dmgh5$13f8$1@lynx.unm.edu>

In article <6ckj0m$jkl$1@sun20.ccd.bnl.gov>, "Lance" <lsj@bnl.gov> writes:
|>     open(jj,">junk") || die "Couldn't open junk: $!\n";
|>     print jj <<EOF;                # line A
|> 1
|> 1
|> 0
|> 4
|> 0
|> 5
|> 0
|> 0
|> EOF
|> exec "trans.x < junk";        # line B
|> 
|> But it just doesn't work! line A does generate the file "junk", but line B
|> not only doesn't recognize "junk" but also makes it null.

I'm not sure about this, but I would try closing junk before using it
in the exec statement.

Joe
---------------------------------------------------------------------------
== K. Joseph Hass                ==  Microelectronics Research Center    ==
== http://www.mrc.unm.edu/~jhass ==  801 University Blvd SE, Suite 206   ==
== (505) 272-7055                ==  Albuquerque, NM 87106-4340   USA    ==


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

Date: Thu, 05 Mar 1998 09:17:16 -0600
From: Dave Barnett <barnett@houston.Geco-Prakla.slb.com>
To: pjohnson@wcu.edu
Subject: Re: HELP!?!?!!?!?!  How to use $|
Message-Id: <34FEC1FC.5FC6B47A@houston.Geco-Prakla.slb.com>

Patti Johnson wrote:
> 
> Hi
> I've got a Perl script that writes form data to a file, no frills.  But, it
> seems to take a notion to insert carriage returns whenever it wills.  I see that
> the $| thingy is supposed to cause Perl to flush after every write "on the
> currently selected output channel."  Well, how do I tell it to flush on a a file
> handle?
>
1.  Have a look at the select() function.  IE:
select(OUT); # select OUT as the default file handle
$| = 1;      # disable buffering of output (or force flush after each
write) on select()'ed file handle
print "Hi";  # write Hi to default handle (OUT) without a new line

2.  I suspect the "carriage returns whenever it wills" may be entirely
due to your input data.  Try printing the stuff to STDOUT (your screen
if run interactively), as:
print STDOUT $variable;

Notice no "\n" (newline).  If you do this, and all of you data prints on
seperate lines, your variables have newlines appended already.

> Please answer via email as well as the group, considering the traffic herein.
> 
Done.

> tia
HTH.

> pj
> 
>   ------------------------------------------------------------------------
> 
<sig. card snipped>
3.  I suggest removing the signature card for news postings.  Many
people in this newsgroup have non-html news readers, so this prints as
useless gibberish, causing some flamage, some killfilage, and other
non-wanted activity.  FYI.  


-- 
"Security through obscurity is no security at all."
		-comp.lang.perl.misc newsgroup posting

------------------------------------------------------------------------
* Dave Barnett               U.S.: barnett@houston.Geco-Prakla.slb.com *
* DAPD Software Support Eng  U.K.: barnett@gatwick.Geco-Prakla.slb.com *
------------------------------------------------------------------------


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

Date: 05 Mar 1998 07:51:13 -0600
From: Quentin  Fennessy <quentin@jihad.amd.com>
Subject: Re: how do I import subs from another file?
Message-Id: <ximd8g15jqm.fsf@jihad.amd.com>


  perldoc -f require
  perldoc -f use

  perldoc perlfaq8

	"How do I add a directory to my include path at runtime?"

-- 
Quentin Fennessy			AMD, Austin Texas


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

Date: Thu, 05 Mar 1998 07:46:16 -0600
From: Sebastian Probst <Sebastian_Probst@hp.com>
To: Kevin Hawley <cchkxh@ARCO.com>
Subject: Re: Is there a cron written in perl for Win32?
Message-Id: <34FEACA8.5DC12768@hp.com>

Hi Kevin,

a slightly different answer. I f you are using an NT system, you can use
the "at" command. Start the service schedule and use the "at" command in
the command prompt. It works like the UNIX "at".

Sebastian Probst
WLD Marketing
Hewlett Packard

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


Kevin Hawley wrote:
> 
> Hi, I'm looking for cron/crontab functionality for Win32.  I have used
> perl quite a bit for UNIX system administration, and now I am going to
> manage
> some Windows 95/NT systems. I have checked the CPAN, but I did not
> see what I was looking for, any suggestions?
> 
> TIA
>    -Kevin
>      (s/nospam/cchkxh/)
> 
> p.s.Sorry for posting to this group; Should there be a
> ...perl....Win32.. group?


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

Date: Thu, 05 Mar 1998 09:20:00 -0600
From: xrfang@technologist.com
Subject: Newbie's question about package
Message-Id: <6dmfpj$qho$1@nnrp1.dejanews.com>

Hi there:

I'm new to perl, and I begin to love it first time I saw a perl program :-)
I've got a question about perl module or package:

At first, I think perl modules are quiet similar to Turbo pascal's unit (As
far as I don't use oop).  But there're still some thing that I got confused:

1. Is @ISA used only in oop or not? I wrote a simple module and if I do not
write @ISA=qw(Exporter) all my fuctions are not usable. Why?

2. Why should I use "qw"? can I use @EXPORT=(suba,subb,subc...)???

3. Many other questions (may be silly ones), the most important is, where to
find document for such things as @ISA, @EXPORT, @EXPORT_OK etc. Especially
that I read from the perltoot or other man pages that there's a "Exporter" man
page and a "AutoLoader" man page, but when I typed man Exporter, the system
said no such man pages.  Where to find them???

Thanks a lot!
Shannon

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


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

Date: 05 Mar 1998 08:01:25 -0600
From: Quentin  Fennessy <quentin@jihad.amd.com>
Subject: Re: Perl Editor
Message-Id: <ximbtvl5j9m.fsf@jihad.amd.com>

>>>>> "BDR" == Bavo De Ridder <bavo@ace.ulyssis.student.kuleuven.ac.be> writes:

    BDR> Is it possible to write such an editor using Perl as the
    BDR> extention language?  This would be very interesting, since
    BDR> all of us know Perl but not necessarily Lisp or a dialect.

nvi (one current version of vi from Keith Bostic and others)
can have perl linked in.  Cool.  Long time ago I thought awk
was _the_ macro language for vi--I've seen the light.

Check out:

	http://mongoose.bostic.com/vi/

-- 
Quentin Fennessy			AMD, Austin Texas


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

Date: 5 Mar 98 14:58:32 GMT
From: "Dan Cox" <dcox@lexmark.com>
Subject: perl Net:DNS module
Message-Id: <01bd4847$3dea8720$7757b89d@dancox.lexmark.com>

when you do a nslookup in interactive mode you can do a 
ls <domain> and list all the IN A records in a domain.  I want to do this
from perl Net:DNS.  I played with it some and cannot figure out
how to do this.  Can this be done?  I also tried to just do it all
from the command prompt with nslookup and can not figure that out 
either.  I am sure someone has done it.  If you do know how please
send a email to dcox@lexmark.com. 


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

Date: Thu, 05 Mar 1998 08:06:31 -0600
From: Dave Barnett <barnett@houston.Geco-Prakla.slb.com>
Subject: Re: Perl performs a second miracle.  Prepare for canonizaton!
Message-Id: <34FEB167.5468D287@houston.Geco-Prakla.slb.com>

Robert F. Harrison wrote:
> 
> On Wed, 04 Mar 1998 14:52:16 -0500, Joe Lannom <jlannom@ford.com> wrote:
> > William Denton wrote:
> >
> > > I left it overnight, and, as before, the next morning
> > > it worked.
> >
> > Beware of such programs... especially of they spent the night
> > sleeping next to a .pod.
> 
> ROTFL
> 
<snip>
> =begin rant
> I'm beginning to think we could we could eliminate the bugs from
> some large well known company's software by putting their staff
> to sleep.
> =end rant
> 
<$US0.02>
Many could (reasonably?) argue that a lot of large company software
company staffers are already asleep, thus the root of the problem.
</$US0.02>

;-)
> :-)
> 
> --
> rfh harrison@pixi.com

-- 
"Security through obscurity is no security at all."
		-comp.lang.perl.misc newsgroup posting

------------------------------------------------------------------------
* Dave Barnett               U.S.: barnett@houston.Geco-Prakla.slb.com *
* DAPD Software Support Eng  U.K.: barnett@gatwick.Geco-Prakla.slb.com *
------------------------------------------------------------------------


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

Date: 5 Mar 98 13:17:52 GMT
From: harrison@pixi.com (Robert F. Harrison)
Subject: Re: Perl script from Unix to Win32 [FAQ]
Message-Id: <slrn6ft9fu.4r7.harrison@localhost.localdomain>


On Thu, 5 Mar 1998 09:44:29 +0800, DaveZhu 
at <davezhu@notes.gcmail.com> wrote and said:
> Dear Gentlemen,

You know sir, Abigail is one of the best of us here at
comp.lang.perl.misc. I don't know for sure, but I doubt she is a
gentleman. To be precise, neither am I. That is, I am not a landowner
nor have I been made an officer in the U.S. military.

> I found some Unix-base scripts but I'd like to run those scripts on Win32
> system like NT4.0, can this be done ?

Yes. Go immediately to http://www.perl.com/ and start reading the
documentation.  You will find out to get Perl if you do not already
have it (and if you do not have the documentation, you do not have
Perl). You will find out the differences between running scripts on
different platforms. In short, you find everything you need to know.

Good luck, and don't hesitate to read the FAQs if you have more
questions. :-)

Sincerely not a gentleman, rfh

-- 
rfh harrison@pixi.com




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

Date: 05 Mar 1998 08:33:58 -0700
From: Randal Schwartz <merlyn@stonehenge.com>
To: Uri Guttman <uri@sysarch.com>
Subject: Re: safe file modification strategy (w/flock, new_tmpfile, and syscopy?)
Message-Id: <8c1zwh40ex.fsf@gadget.cscaper.com>

>>>>> "Uri" == Uri Guttman <uri@sysarch.com> writes:

Uri> 	lock current file (prevent modifications)
Uri> 	open current file

You cannot lock a file that you don't have open!

Uri> 	read current file
Uri> 	close current file
Uri> 	open temp
Uri> 	process current file
Uri> 	write to temp
Uri> 	close temp
Uri> 	rename temp to current

The safest way I can think of this morning to *update* a file is like this:

	open file for read/write
	flock file exclusive
	read data
	rewind file
	write processed data
	truncate file to end of data
	close file (which unflocks)

If you start playing games with rename, you can end up having the other
users that are waiting for the flock looking at the wrong file.  For
example... THIS DOESN'T WORK:

	open file for read/write
	flock file exclusive
	read from file, writing to file2
	rename file2 to file (deleting file)
	close handle (releasing the flock)

because now the others that also opened the file and were blocking on
the second step are now looking at the *old* data, not the *new* data.
And there's no steps to get it right with this rename that I can see.
I suppose you could stat file and stat the handle to see if they're
the same file after you get the flock, and if not, restart from the open.
Hey... wait... that'd work:

	open file for read/write
	flock file exclusive
	compare dev/ino of file to dev/ino of handle, if not same, loop back
	read from file, writing to file2
	rename file2 to file (deleting file)
	close handle (releasing the flock)

Hmm. There's your answer.  Just don't forget that all-important third
step.

print "Just another Perl hacker," # but not what the media calls "hacker!" :-)
## legal fund: $20,990.69 collected, $186,159.85 spent; just 180 more days
## before I go to *prison* for 90 days; email fund@stonehenge.com for details

-- 
Name: Randal L. Schwartz / Stonehenge Consulting Services (503)777-0095
Keywords: Perl training, UNIX[tm] consulting, video production, skiing, flying
Email: <merlyn@stonehenge.com> Snail: (Call) PGP-Key: (finger merlyn@teleport.com)
Web: <A HREF="http://www.stonehenge.com/merlyn/">My Home Page!</A>
Quote: "I'm telling you, if I could have five lines in my .sig, I would!" -- me


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

Date: Thu, 05 Mar 1998 10:26:31 -0500
From: Byron Lee <byron_lee@prenhall.com>
Subject: Script for RTrimming Fields
Message-Id: <34FEC427.43C5@prenhall.com>

Hello,

Does anyone out there have a script for trimming spaces from
the end of a string?  I suppose I could write one, but I'm 
taking the lazy approach today. :)

Thanks for any responses.

Byron Lee


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

Date: Thu, 05 Mar 1998 09:46:47 -0500
From: John Porter <jdporter@min.net>
Subject: Re: Sorting array by a computable field
Message-Id: <34FEBAD7.35DD@min.net>

Obiajulu Odu wrote:
> 
> Hi all,
> 
> I have a file with the following info that I would like to sort  by
> "name":
> 
> key|name|phone|email|notes
> 
> I wrote a perl script but it does not work.  Can anyone on the group
> help me out
> with a perl script that can sort the array?

You lied.  That is not sorting by a computable field.

Now show us what you have so far, and someone can point
out where you're going wrong.

John Porter


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

Date: Thu, 5 Mar 1998 14:59:58 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: Sorting array by a computable field
Message-Id: <EpCpny.9Br@world.std.com>

Obiajulu Odu <obi@ub.uit.no> writes:

>I have a file with the following info that I would like to sort  by
>"name":

>key|name|phone|email|notes

This question comes up a lot in the newsgroup. So frequently, in fact,
that there is an entry for it in the Frequently Asked Questions
document. So instead of trying to answer it, why don't you just take a
look at the well researched, and debugged solution that is there.

<URL:http://www.perl.com/CPAN/doc/manual/html/pod/perlfaq4/
How_do_I_sort_an_aray_by_anyth.html>

One thing that the FAQ does not mention however is the new
Sort::Fields module on CPAN, that automates a lot of the details of
sorting on a field.

<URL:http://www.perl.com/CPAN-local/modules/by-module/Sort/
Sort-Fields-0.90.tar.gz>
-- 
Andrew Langmead


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

Date: Thu, 05 Mar 1998 15:09:39 GMT
From: Steve Wells <steve@prilnari.com>
To: obiajulu.odu@ub.uit.no
Subject: Re: Sorting array by a computable field
Message-Id: <34FEC1AE.5C4E1A0@prilnari.com>

Obiajulu Odu wrote:
> 
> Hi all,
> 
> I have a file with the following info that I would like to sort  by
> "name":
> 
> key|name|phone|email|notes
> 
> I wrote a perl script but it does not work.  Can anyone on the group
> help me out
> with a perl script that can sort the array?
> 
> - odu

Of course there are several solutions, with this 
solution I'm displaying laziness as a quality more 
prevelant than hubris.

# open the file and read it into a hash table,
being 
#  sure to hold the name of the hash as the field
you
#  want to sort by.
open (IN, "file") or die ("can't open file:
file:$!");
     while (<IN>) {
           @fields = split (/\|/, $_);
	   $hash{$fields[1]} = $_;
     }
close (IN);

# sort the keys of your newborn hash and spit it
into
#  a new file...
open (OUT, ">file.out") or die ("can't create:
file.out:$!");
     foreach (sort keys %hash) {
             print OUT $hash{$_};
     }
close (OUT);

exit 1;

(to coin a phrase by those more worthy than I)
Hope that helps,
STEVE


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

Date: 05 Mar 1998 08:08:03 -0600
From: Quentin  Fennessy <quentin@jihad.amd.com>
Subject: Re: Special Characters
Message-Id: <ximafb55iyk.fsf@jihad.amd.com>


Check out perldata and perlop, looking for "double-quoted strings" and 
"Quoting".

-- 
Quentin Fennessy			AMD, Austin Texas


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

Date: Thu, 05 Mar 1998 09:44:52 -0500
From: John Porter <jdporter@min.net>
Subject: Re: Special Characters
Message-Id: <34FEBA64.25C1@min.net>

Russell White wrote:
> 
> Can anybody tell me where I can find a list of special characters that must
> be treated with the "\" symbol in print statements? Such as \" Thanks.

"Learning Perl" (the Llama book) has a section on
double-quoted strings.

"Programming Perl" (the Camel book) has a section on
string literals.

Just look in the index.

What? You don't have either of these books?

John Porter


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

Date: Thu, 05 Mar 1998 09:28:07 -0500
From: John Porter <jdporter@min.net>
Subject: Re: Stripping (Most) HTML tags
Message-Id: <34FEB677.699A@min.net>

Jon Drukman wrote:
> 
> $p = myParser->new;
> 
> # this loops through all the files provided on the command line,
> # slurps in their contents in one swell foop and then invokes $p's
> # parse method on the html.
> 
> for (@ARGV) {
>   open(FILE,"<$_") or die "Can't read $_: $!";
>   {
>     local $/=undef;
>     $html=<FILE>;
>   }
>   close(FILE);
>   print "$_";
>   $p->parse($html);
> }

May I gently point out that you are going to a bit of trouble
to do something perl will do for you?  Instead of that "for"
loop, try this:

  local $/;
  $p->parse( <> ); # slurps all files at once

This doesn't verify that each file is readable, but man is it
shorter.

John Porter


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

Date: Thu, 05 Mar 1998 09:20:39 -0500
From: John Porter <jdporter@min.net>
Subject: Re: Summing Up Array Values - How Do I?
Message-Id: <34FEB4B7.480@min.net>

Tom Rokicki wrote:
> 
> #!/usr/local/bin/perl -w
> use strict ;
> print &{
>   &{sub{my $x=$_[0];
>     my $z=sub{my($p)=$_[0];&{$x}(sub{&{&{$p}($p)}(@_)})};
>     &{$z}($z)}}
>   (sub{my $f=$_[0];sub{@_&&(shift @_)+(&{$f}(@_))}})
> } (99, 34, 110, 33) , "\n" ;

Dang! This is exactly the spell I wanted to create!

(now where's that print button...)

John Porter


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

Date: 5 Mar 1998 10:55:34 -0500
From: David Meyers <dmeyers@panix.com>
Subject: Re: Summing Up Array Values - How Do I?
Message-Id: <yoblnupjfnu.fsf@panix.com>

mgscheue@io.com writes:
>   goclimb@azstarnet.com wrote:

> > @yards[1] = 2;
> > @yards[2] = 3;

> No, these are scalars, not arrays.  Use "$" instead of "@".

On the right, actually, you've got scalars.  On the
left, you have single-element arrays - they are _slices_
of the array @yards.  You want $yards[1], which is the
element 1 from the array @yards.

See the first section of Hall and Schwartz book "Effective
Perl Programming" for an extensive discussion of this.

-- 
dmeyers@panix.com

"Any technology distinguishable from magic
 is insufficiently advanced."


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

Date: Thu, 05 Mar 1998 15:38:22 +0100
From: Geert Roovers <etmgero@etm.ericsson.se>
Subject: Sybase
Message-Id: <34FEB8DE.1499@etm.ericsson.se>

Hi,

I want to read from and write to a Sybase database on UNIX (SunOS, dunno
what version, but 5.5.1 or later anyway). I know there are modules for
this, and probably DBD::Sybase or Sybase::DBlib, Sybase::BCP, 
Sybase::Sybperl or Sybase:CTlib will do what I want. But who can tell me
which one is best and easiest to understand, BEFORE I ask my sytem
administrator to install either one of them? I want to query (I take it
that SQL is possible in perl?) the database, create, update and delete
records, but there's no need to create tables or anything.


Who can help?

~Geert Roovers

PS:	Yes, I read the readme's coming with them, but after that I still
didn't know what I wanted to know.


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

Date: Thu, 05 Mar 1998 09:03:40 -0500
From: John Porter <jdporter@min.net>
Subject: Re: What is PERL? Learn JAVA instead?
Message-Id: <34FEB0BC.21@min.net>

Evan Kirshenbaum wrote:
> 
> That being said, two things that are easy to do in Java but
> exceedingly difficult to do in Perl include:
> 
>    - Work with cyclic structures.  (AFAIK, Perl still uses
>      reference counting rather than true garbage collection, and so
>      cannot reclaim them automatically.)

The Camel has a nice section on gc. I suggest you read it.


> There are a number of things that are more convenient in Java but
> doable in Perl

> (reflection,

Ha. Perl has no need of "reflection" (java's hacked API which
enables dynamic introspection) as a distinct capability,
because perl is a dynamic language from the ground up;
perl supports introspection (call it dynamic if you want)
intrinsically.


> exception handling,

The following is semantically equivalent to try/throw/catch.
Have you ever done this in your code?

	eval {  # "try"
		$r = &some_func();
		if ( $r ) {
			die 'yikes'; # "throw"
		}
	}
	if ( $@ eq 'yikes' ) { # "catch"
		# ...
	}


> switch statements,

I -- and I think most perl programmers would agree -- find
no inconvenience whatsoever is perl's multi-way braching
capability.

John Porter


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

Date: Thu, 05 Mar 1998 09:08:48 -0500
From: John Porter <jdporter@min.net>
Subject: Re: What is PERL? Learn JAVA instead?
Message-Id: <34FEB1F0.642C@min.net>

Ian Boys wrote:
> 
> If I fork children, I cannot simply share variables with them,
> I have to set up more complex code to handle communications between
> them.

I guess that depends on what you mean by "simply".
To me, using IPC::Shareable qualifies as simply.

	use IPC::Shareable;
	tie( $scalar, IPC::Shareable, $glue, { %options } );
	tie( %hash,   IPC::Shareable, $glue, { %options } );

John Porter


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

Date: 5 Mar 1998 14:35:15 GMT
From: Wolfgang Denk <wd@uebemc.siemens.de>
Subject: Re: What is PERL? Learn JAVA instead?
Message-Id: <6dmd73$c1a$1@galaxy.mchh.siemens.de>

Evan Kirshenbaum <evan@garrett.hpl.hp.com> writes:

>   - Work with cyclic structures.  (AFAIK, Perl still uses
>     reference counting rather than true garbage collection, and so
>     cannot reclaim them automatically.)

Your knowledge is completely wrong.

Wolfgang Denk

Office:  (+49)-89-722-27328, Fax -36703  Wolfgang.Denk@oen.siemens.de
Private: (+49)-89-95720-110, Fax -112                  wd@denx.muc.de
"355/113 -- Not the famous irrational number PI,  but  an  incredible
simulation!"


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

Date: Thu, 5 Mar 1998 10:40:42 -0500
From: "Joseph Ottinger" <joeo@enigmastation.com>
Subject: Re: What is PERL? Learn JAVA instead?
Message-Id: <34fec813.0@unews.csx.com>

>The biggest plus Perl has going for it is the *source* is transportable
>across platforms. Therefore, if a program doesn't run, you have the
>source and can make it run. Java is the opposite: you have bytecodes
>and are basically SOL unless you have the source too and can recompile
>it. Perl's strength is the just-in-time compile.


What? I send bytecodes across platforms all the time with no problems. (I
also send source, but that's because it's a product still in development and
I may want to fix something in midstream... yes, it's being rewritten from
scratch to conform to a now-much-better-defined specification. Sending the
source back and forth is not the critical issue in this case.)





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

Date: Thu, 05 Mar 1998 15:16:12 GMT
From: bas.nospam@dana.ucc.nau.edu (Brian Sawert)
Subject: Re: Win32 Perl and ODBC New User Problems
Message-Id: <34fec007.54350832@usenet.nau.edu>

On Wed, 04 Mar 1998 05:37:05 GMT, davidg@teleprompt.com (David
Griffis) wrote:

>I'm trying to get Activeware Win32 Perl 5.003 build 315 and Dave
>Roth's ODBC extention working with my NT 4.0 ODBC for Oracle 733 but
>I'm getting a 'parse error'.  What could I have done wrong?

That sounds like a version mismatch between perl and the Win32::ODBC
library. I had similar problems until I installed a newer version of
Win32::ODBC from the web site at <http://www.roth.net/odbc/>. You'll
also find lots of good troubleshooting information there.

Also, make sure you have the most current ODBC drivers for Oracle.

------------------------------------------------------------
Brian Sawert
Information Technology Services
Northern Arizona University


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

Date: 5 Mar 1998 15:04:28 GMT
From: scott@softbase.com
Subject: YES! there is a cron written in perl for Win32?
Message-Id: <6dmets$u3c$3@scully.new-era.net>

> Hi, I'm looking for cron/crontab functionality for Win32. 

I wrote one when I was looking for the same thing. I've made
it freely available.

Go to www.skwc.com/essent, and scroll til you see it.

Scott
--
Look at Softbase Systems' client/server tools, www.softbase.com
Check out the Essential 97 package for Windows 95 www.skwc.com/essent
All my other cool web pages are available from that site too!
My demo tape, artwork, poetry, The Windows 95 Book FAQ, and more. 


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

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

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