[7207] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 832 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Aug 8 19:07:51 1997

Date: Fri, 8 Aug 97 16:00:26 -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           Fri, 8 Aug 1997     Volume: 8 Number: 832

Today's topics:
     Re: ** redirection question. ** <rootbeer@teleport.com>
     Automat FTP <w4vu@unb.ca>
     Can you explain this 'bug'? <matthew.rice@ftlsol.com>
     Re: Can you explain this 'bug'? (Mike Stok)
     Can't match numeric text in m// <Brett.W.Denner@lmtas.lmco.com>
     Re: Can't turn off -w in script <jstern@world.northgrum.com>
     Re: Changing Shipping Options (Clay Irving)
     Re: comparing for a range of number - easiest way to do (Bart Lateur)
     Re: Counting Files (Juergen Heinzl)
     Re: Counting Files <mark@tstonramp.com>
     Formmail and Windmail with "hidden" smtp gateway confus kubi0461@gmi.edu
     Help: perl can't find sub in module Socket (larry paul schrof)
     Re: Help: perl can't find sub in module Socket (Mike Stok)
     Re: How do I save a hash in a file? <brannon@quake.usc.edu>
     Re: How to interpret file mode parameter from stat ? <rootbeer@teleport.com>
     Re: How to make Perl Regular expressions "Rightmost is  <hd@elfie.rhein-neckar.de>
     Re: howto import other perl file into current one?? (Terry Michael Fletcher - PCD ~)
     Re: if $FORM{r2} = problem <mark@tstonramp.com>
     Install Oraperl - help <tle@spso.gsfc.nasa.gov>
     Is there a perl IDE? <KenVogt@rkymtnhi.com>
     Re: Is there a perl IDE? <owl@iki.fi>
     Linux Installation perl5.004_01/02 <volker@halifax.rwth-aachen.de>
     Re: Locking a require <rootbeer@teleport.com>
     Re: New To Perl/Prog.:Please Help (Blue)
     Re: No Perls of wisdom here... <petri.backstrom@icl.fi>
     perl compiler = slow <davidt@riddler.com>
     Perl compiler problem (Dragomir R. Radev)
     Re: Perl daemon program dies while sleeping <rootbeer@teleport.com>
     perl with a dash of gif? <matt@geenite.demon.co.uk>
     Re: Poetry questions (Marek Rouchal)
     Re: printf (Honza Pazdziora)
     Re: Read from growing file - eof problem (Mike Stok)
     Script needed (TJ Anderson)
     Searching for "similar" words <a.cox@rbgkew.org.uk>
     signals and EOF <psrc@corp.airmedia.com>
     Sorting this file is killing me paries@advicom.net
     Re: Sorting this file is killing me <rootbeer@teleport.com>
     Re: Substitution <lilly@fedex.com>
     Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: Fri, 8 Aug 1997 07:25:40 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: "e.joel.hall" <ejhall@frii.com>
Subject: Re: ** redirection question. **
Message-Id: <Pine.GSO.3.96.970808071850.9049I-100000@kelly.teleport.com>

On Fri, 8 Aug 1997, e.joel.hall wrote:

Newsgroups: comp.lang.perl

If your news administrator still carries comp.lang.perl, please let him
or her know that that newsgroup has not existed since 1995. If you
have such an outdated newsgroup listing, you are probably missing out
on many other valid newsgroups as well. You'll be doing yourself and
many others a favor to use only comp.lang.perl.misc (and other valid
Perl newsgroups) instead.

> you cannot have perl output:
> Location: document.html#internal_link
> to make it go to an internal link within that document.  That doesn't
> work at all.

Sure you can have perl output that. 

    print "Location: document.html#internal_link\n\n";

If it doesn't make a browser do what you want, though, that can't possibly
be Perl's fault! If you're trying to get the browser to do something
different, check with the browser's docs, or HTTP/HTML reference, or a
newsgroup about those topics. Good luck! 

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/




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

Date: Thu, 07 Aug 1997 16:00:50 -0400
From: David Tweedie <w4vu@unb.ca>
Subject: Automat FTP
Message-Id: <33EA2972.BA3@unb.ca>

Hi,

I was wondering if there is an easy was to automate ftp'ing files using
perl. I tried using pipes with the ftp command in UNIX, but it will not
work. Any suggestions?

Thanks,
Dave


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

Date: Fri, 08 Aug 1997 17:12:59 -0400
From: Matthew Rice <matthew.rice@ftlsol.com>
Subject: Can you explain this 'bug'?
Message-Id: <33EB8BDB.7204D24F@ftlsol.com>

Hi,

I am trying to create a class which will hold a file handle.
When I try to run the small test (included below) I get the
error (for perl 5.003):

String found where operator expected at BadFD.pm line 24, near "}
"badfd\n""
        (Missing operator before  "badfd\n"?)
syntax error at BadFD.pm line 24, next token ???

I have a work around already but can anyone explain what I am doing
wrong?
-- 
Matthew Rice                             e-mail: matthew.rice@ftlsol.com

FILE: badfd

#!/usr/bin/perl -w

require BadFD;

BadFD->new()->fd(\*STDOUT)->print();


FILE: BadFD.pm

package BadFD;
require 5.000;

sub new {
    my $proto = shift;
    my $class = ref($proto) || $proto;
    my $self  = {
        FD          => undef,
    };
    bless ($self, $class);
    return $self;
}

sub fd {
    my $self = shift;
    $self->{FD} = shift;
    return $self;
}

sub print {
    my $self = shift;

    # Here is the work around.
    my $fd = $self->{FD};
    print $fd "goodfd\n";

    # For some reason using $self->{FD} doesn't work.
    print $self->{FD} "badfd\n";

}

1;


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

Date: 8 Aug 1997 21:29:19 GMT
From: mike@stok.co.uk (Mike Stok)
Subject: Re: Can you explain this 'bug'?
Message-Id: <5sg33f$231@news-central.tiac.net>

In article <33EB8BDB.7204D24F@ftlsol.com>,
Matthew Rice  <matthew.rice@ftlsol.com> wrote:

>String found where operator expected at BadFD.pm line 24, near "}
>"badfd\n""
>        (Missing operator before  "badfd\n"?)
>syntax error at BadFD.pm line 24, next token ???

>    # For some reason using $self->{FD} doesn't work.
>    print $self->{FD} "badfd\n";

the perlfunc manual page says

               Note that if you're storing FILEHANDLES in an
               array or other expression, you will have to use a
               block returning its value instead:

                   print { $files[$i] } "stuff\n";
                   print { $OK ? STDOUT : STDERR } "stuff\n";

in its description of print, so you need an extra set off {} to turn the
expression into a block.

Hope this helps,

Mike

-- 
mike@stok.co.uk                    |           The "`Stok' disclaimers" apply.
http://www.stok.co.uk/~mike/       |   PGP fingerprint FE 56 4D 7D 42 1A 4A 9C
http://www.tiac.net/users/stok/    |                   65 F3 3F 1D 27 22 B7 41
stok@psa.pencom.com                |      Pencom Systems Administration (work)


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

Date: Fri, 08 Aug 1997 16:46:00 -0500
From: Brett Denner <Brett.W.Denner@lmtas.lmco.com>
Subject: Can't match numeric text in m//
Message-Id: <33EB9398.B0064851@lmtas.lmco.com>

I'm trying to perform a pattern match on a text string containing an
exponential-format number like this:

    $text = "num = 1.0E+01";

I would like to see if this text actually contains an exact exponential
number, like "1.0E+01".  Here's my code:

    $text = "num = 1.0E+01";

    $num = "1.0E+01";

    print $text =~ /$num/ ? "match\n" : "no match\n";

When I run this code, it prints out "no match";  I suspect that the $num
variable is being converted to its double-precision representation in the
pattern match before the pattern match is attempted, but I'm not sure.  Or,
the "." and "+" in the $num variable may be causing problems.

Is there a way to force a scalar to retain its text representation of a
number, even though it looks like a double-precision number?

Thanks,
Brett



--
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 Brett W. Denner                                    Lockheed Martin TAS
 Brett.W.Denner@lmtas.lmco.com                      P.O. Box 748
 (817) 935-1144 (voice)                             Fort Worth, TX 76101
 (817) 935-1212 (fax)                               MZ 9333




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

Date: Fri, 8 Aug 1997 21:21:20 GMT
From: Jim Stern <jstern@world.northgrum.com>
Subject: Re: Can't turn off -w in script
Message-Id: <33EB8DD0.7CB2@world.northgrum.com>

Brett Denner wrote:
> 
> If I try to run the following line:
> 
>     perl -w -e '1 if $a = 0'
> 
> I get the following warning:
> 
>     Found = in conditional, should be == at -e line 1.
> 
> When I turn off a local copy of the -w flag as such:
> 
>     perl -w -e 'local ($^W) = 0; 1 if $a = 0;'
> 
> I get the same warning.
> 
> Doesn't setting a local copy of $^W to 0 turn off the -w flag for the
> current block?
> [...]

The assignment to $^W takes place at run time.  The Perl interpreter
prints the warning at compile time.  Turn off the $^W at compile time
to disable the message:

        perl -we 'BEGIN{$^W=0;} 1 if $a = 0;'

-- 
Jim Stern -- Views here are my own, not Northrop Grumman's.   (El
Segundo, CA)


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

Date: 8 Aug 1997 09:26:38 -0400
From: clay@panix.com (Clay Irving)
Subject: Re: Changing Shipping Options
Message-Id: <5sf6qe$14c@panix.com>

In <870804993.26426@dejanews.com> vonline@bellsouth.net writes:

>When I ran the script, I thought it was going to work. When I looked
>at the shipping rates page, UPS ground was the only one listed. When I
>clicked the pull down menu for shipping options on the checkout page,
>I was give only the UPS ground option. Sounds good so far...

>When I submited the check out page, the script comes back with - 'This
>page contains no data' -ERROR. Not an html error message, but a system
>error message.

That's because UPS is on strike. :)

-- 
Clay Irving <clay@panix.com>                   http://www.panix.com/~clay/


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

Date: Fri, 08 Aug 1997 13:12:51 GMT
From: bart.mediamind@tornado.be (Bart Lateur)
Subject: Re: comparing for a range of number - easiest way to do it?
Message-Id: <33ef1a69.17776531@news.tornado.be>

Ronald Fischer <rovf@earthling.net> wrote:

>does someone know an easier way to write
>    die "foo" if ($x <= $a or $x >= $b);
>provided that
>    $a <= $b
>and $a and $b are integers,
>and $b not very much greater as $a

Write a sub?

sub outOfRange {
	my($x,$a,$b) = @_;
	$x<$a || $x>$b;
}

die "foo" if outOfRange($x,$a,$b);

HTH,
Bart.


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

Date: 8 Aug 1997 21:03:07 GMT
From: juergen@unicorn.noris.de (Juergen Heinzl)
Subject: Re: Counting Files
Message-Id: <slrn5un2as.1d2.juergen@unicorn.noris.de>

In article <6oacs5.i4h.ln@gate.imsport.co.uk>, Paul Denman wrote:
 ...
>I have written a small program to count the number of files in a given
>directory
>which have the suffix of '.dat' :
 ...
>Does anyone know of a quicker way? (IE one command which will return the
>number of files in a given directory)

how about (if the matching names are not needed) ...

$directory = "/some/directory"
$suffix    = ".suffix

print scalar @{[glob "$directory/*$suffix"]} . " matches in $directory\n";

Bye, Juergen

-- 
\ Real name     : Juergen Heinzl     \       no flames      /
 \ EMail Private : unicorn@noris.de   \ send money instead /
  \ Phone Private : +49 0911-4501186   \                  /


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

Date: Fri, 08 Aug 1997 03:05:38 -0700
From: "Mark J. Schaal" <mark@tstonramp.com>
Subject: Re: Counting Files
Message-Id: <33EAEF72.12CF@tstonramp.com>

Paul Denman wrote:
>
>  Hello,
>
> I have written a small program to count the number of files in a 
> given directory which have the suffix of '.dat' :

If it doesn't have to be a perl program...
  ls *.dat | wc -l


mark


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

Date: Thu, 07 Aug 1997 08:51:31 -0600
From: kubi0461@gmi.edu
Subject: Formmail and Windmail with "hidden" smtp gateway confusion
Message-Id: <870961766.14@dejanews.com>

For an intranet web help site, I am using Formmail (the Windows NT
version) and WindMail as the mailer. I have tried many programs and that
is one of the few combinations that works consistantly. The problem is
with our smtp gateway. This gateway is actually just what cc:mail uses to
send out and receive internet email. It is not a telnet server, so most
mailing programs fail when they try to connect. WindMail works fine when
Formmail uses it to send the results. However, WindMail does not work when
I try to use it at the command line. It won't even work when I create a
text file (matching the format that formmail uses) and send it to
WindMail.

I'm confused as to what formmail does to allow WindMail to send mail out.
I assume it is still using the same smtp gateway as when I execute
windmail by itself, since the windmail.ini file is the same. This is
frustrating since some programs work and others don't, but no one seems to
have any idea why.

Thanks,
Kk...

-------------------==== Posted via Deja News ====-----------------------
      http://www.dejanews.com/     Search, Read, Post to Usenet


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

Date: 8 Aug 1997 20:54:54 GMT
From: l-schro@students.uiuc.edu (larry paul schrof)
Subject: Help: perl can't find sub in module Socket
Message-Id: <5sg12u$q6l$1@vixen.cso.uiuc.edu>

I recently started using the module stuff under perl, and am having
a difficult problem. At the top of my code, I have a 'use Socket;'
but further down in the code I do a call such as this:

$addr = inet_atom($machine);

and this is what I get...

Undefined subroutine &main::inet_atom called at ./load.pl line 30.

I have checked the O'Reilly Perl5 book and I know inet_atom() is in
the Socket module. 
  Would someone mind offering me an explanation of why Perl is not
finding the sub, and how I can fix it? Much thanks.


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

Date: 8 Aug 1997 21:24:13 GMT
From: mike@stok.co.uk (Mike Stok)
Subject: Re: Help: perl can't find sub in module Socket
Message-Id: <5sg2pt$1ou@news-central.tiac.net>

In article <5sg12u$q6l$1@vixen.cso.uiuc.edu>,
larry paul schrof <l-schro@students.uiuc.edu> wrote:
>I recently started using the module stuff under perl, and am having
>a difficult problem. At the top of my code, I have a 'use Socket;'
>but further down in the code I do a call such as this:
>
>$addr = inet_atom($machine);
>
>and this is what I get...
>
>Undefined subroutine &main::inet_atom called at ./load.pl line 30.
>
>I have checked the O'Reilly Perl5 book and I know inet_atom() is in
>the Socket module. 

Thar should be inet_aton as it is an interface to the C routine

  int inet_aton(const char *cp, struct in_addr *inp);

Hope this helps,

Mike
-- 
mike@stok.co.uk                    |           The "`Stok' disclaimers" apply.
http://www.stok.co.uk/~mike/       |   PGP fingerprint FE 56 4D 7D 42 1A 4A 9C
http://www.tiac.net/users/stok/    |                   65 F3 3F 1D 27 22 B7 41
stok@psa.pencom.com                |      Pencom Systems Administration (work)


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

Date: 08 Aug 1997 08:40:26 -0700
From: Terrence Brannon <brannon@quake.usc.edu>
Subject: Re: How do I save a hash in a file?
Message-Id: <lbhgd0fztg.fsf@surf.usc.edu>

> I can create a hash.  I can manipulate a hash.  I can even print out a hash.
> But short of converting the hash into a list and saving that to a data file
> (which seems ugly to me) there seems to be no way to save a hash to a file
> for later retrieval.
> 

You might look at MLDBM by the author GSAR on CPAN

also look at tie in the Blue Camel.


-- 
o============o  Sending unsolicited commercial e-mail (UCE)  to this address
 Legal Notice   is indication of your consent to pay me $120/hour for 1 hour
o============o  minimum for professional proofreading & technical assessment.
  Terrence Brannon * brannon@quake.usc.edu * http://quake.usc.edu/~brannon
		(213) 740-3397 (o) (310) 829-9818 (h)


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

Date: Fri, 8 Aug 1997 06:51:12 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Mats Larsson <matlar@rsv.se>
Subject: Re: How to interpret file mode parameter from stat ?
Message-Id: <Pine.GSO.3.96.970808064606.9049F-100000@kelly.teleport.com>

On 8 Aug 1997, Mats Larsson wrote:

> How do You interpret the file mode parameter from stat and where
> is it documented ?

It's a collection of bits, so it's usually involved in bitwise operations
like ($mode & 0777) . It should be documented in the stat(2) manpage on
any Unix-like system, since it's part of the system rather than part of
Perl. You may be able to see this documentation with 'man stat' or 'man 2
stat' or some variation. 

Good luck! 

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/



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

Date: 7 Aug 1997 22:59:37 +0200
From: Heinz Diehl <hd@elfie.rhein-neckar.de>
Subject: Re: How to make Perl Regular expressions "Rightmost is greediest"?
Message-Id: <5sdcvp$brr$1@elfie.rhein-neckar.de>

Patrice Boissonneault <Patrice.Boissonneault@nrc.ca> wrote:

: $_ = "a xxx c xxxxxxxx c xxx d";
: /a.*c.*d/;

: In this case, the first ".*" in the regular expression matches all off
: the caracters up to the second c, even though matching only the
: caracters up to the first c would still allow the entire regular
: expression to match.
: How to tell Perl to match the caracters up to the first c.

Just use the "non-greedy operator", the "?" :

 -->        /a.*?c.*d/;

Regards, Heinz.
-- 
# Heinz Diehl, 68259 Mannheim, Germany
# PGP-encrypted mails welcome, key on request [subj: get pgpkey]


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

Date: 7 Aug 1997 16:38:59 GMT
From: tfletche@pcocd2.intel.com (Terry Michael Fletcher - PCD ~)
Subject: Re: howto import other perl file into current one??
Message-Id: <5sctn3$hbb$1@news.fm.intel.com>

jin lu (jlu01@emory.edu) wrote:
: 
: #! /usr/local/bin/perl
: require("test.pl");
: $fun=1;
: list($fun);
: 
: 
: In my test.pl (in the same directory), it contains only:
: sub list{
:     local $fun=@_; 
:     print $fun; 
: }

by the way, this script *appears* to be working (once you place the true
value of "1;" in the test.pl script) because $fun is getting assigned the
number of elements list() was called with.  in this case you are passing
it a value of "1" but really is will return a length of "1" so it appears
to work!  you need to do:

local ($fun)=@_;	# this
local $fun=$_[0];	# or this

try giving $fun a value of 2, and you will see what i mean.

--
               "Give me ambiguity or give me something else."
 ______                       ______ _               _               
(_) |                        (_) |  | |             | |              
    | _   ,_    ,_              _|_ | |  _ _|_  __  | |     _   ,_   
  _ ||/  /  |  /  |  |   |     / | ||/  |/  |  /    |/ \   |/  /  |  
 (_/ |__/   |_/   |_/ \_/|/   (_/   |__/|__/|_/\___/|   |_/|__/   |_/
*+*+*+*+*+*+*+*+*+*+*+* /| *+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+* 
                        \|    tfletche@pcocd2.intel.com
*+*+*+*+*+ Views expressed...not INTeL's...yadda yadda yadda.... *+*+*+*+*+*




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

Date: Fri, 08 Aug 1997 03:34:51 -0700
From: "Mark J. Schaal" <mark@tstonramp.com>
Subject: Re: if $FORM{r2} = problem
Message-Id: <33EAF64B.1530@tstonramp.com>

Eric Hilding wrote:
> 
> Here's what I'm trying to do, but am stuck on the syntax: (clipped
> from the perl script) ... just for info, what I want to do is shown
> in [ ]'s ... which line to print if the value of r2 = (the options)
> 
> print MAIL "  Timetable: NOW\n" if $FORM{'r2'} [=r2a];
> print MAIL "  Timetable: Within 3 Months\n" if $FORM{'r2'} [=r2b];
> print MAIL "  Timetable: Within 6 months\n" if $FORM{'r2'} [=r2c];
> 
> I've tried if ($FORM{'r2'} UMPTEEN COMBINATIONS OF STUFF)

So the following doesn't work for you?
  .... if $FORM{'r2'} eq 'r2a'
Remember numeric comparisons use '==' whereas string comparisons
use 'eq'.

Without a short yet complete sample we are pretty much reduced
to guesswork.  Some suggestions:

  Are you running the script with the '-w' option?
  Did you check the return value when you opened MAIL?
  Have you printed the value of $FORM{'r2'} to verify its contents?

hope this helps,

mark
--
Mark J. Schaal		TST On Ramp Sysadmin	mark@tstonramp.com


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

Date: Fri, 08 Aug 1997 17:40:04 -0400
From: Truong Le <tle@spso.gsfc.nasa.gov>
Subject: Install Oraperl - help
Message-Id: <33EB9234.41C6@spso.gsfc.nasa.gov>

Hi,

I tried to install oraperl v2.4 with perl5.004, oracle v7.1.4
and had a trouble when "make oraperl".  The Makefile asks for
uperl.o (as well as subdirectory usub) in perl5.004/src but
those file/directory don't exist after I installed perl.  Does
anyone know if there is anything that I should do but I didn't?
Thank you in advance.
-- 
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
Truong Le                       |
Hughes STX, Corp.               | Phone: (301) 441-4207
7701 Greenbelt Road, Suite 400  | Fax:   (301) 441-1853
Greenbelt, MD 20770             | Email: tle@spso.gsfc.nasa.gov
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*


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

Date: Fri, 08 Aug 1997 02:48:09 -0600
From: Kenneth Vogt <KenVogt@rkymtnhi.com>
Subject: Is there a perl IDE?
Message-Id: <33EADD49.432F@rkymtnhi.com>

I can't seem to find a perl IDE for Win95 anywhere.  What do you folks
use?  Is perl not worthy of anything more robust that Notepad?
-- 
      O      O      O       O
     O    O         O     O       Kenneth Vogt
    O  O            O   O
   O     O          O O           KenVogt@rkymtnhi.com
  O        O        O


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

Date: Fri, 8 Aug 1997 17:36:29 +0300
From: "Oliver Weinitschke" <owl@iki.fi>
Subject: Re: Is there a perl IDE?
Message-Id: <5sfasf$7dq@nntp.hut.fi>

 >I can't seem to find a perl IDE for Win95 anywhere.  What do you folks
>use?  Is perl not worthy of anything more robust that Notepad?

Ultraedit allows custom coloring. Perl is quite easy to add to it.

The best IDE is probably Emacs, because it has code coloring and automatic
indention (among other automations). Of course you'd need to learn emacs,
which is not that easy.

These are not "real" IDE's, but pretty close.






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

Date: Fri, 08 Aug 1997 21:26:15 +0200
From: Volker Gierenz <volker@halifax.rwth-aachen.de>
Subject: Linux Installation perl5.004_01/02
Message-Id: <33EB72D7.AEEB0215@halifax.rwth-aachen.de>

Hello,

I tried to install the Perl 5.004_01/02 distribution on my Linux system
(SUSE 5.0).

Howerver I get the following error-message:

>maus:/usr/incoming/perl5.004_02 # ./versiontest
>
>perl: warning: Setting locale failed.
>perl: warning: Please check that your locale settings:
>       LC_ALL = (unset),
>        LC_CTYPE = "ISO-8859-1",
>        LANG = (unset)
>    are supported and installed on your system.
>perl: warning: Falling back to the standard locale ("C").
>
>maus:/usr/incoming/perl5.004_02 #

Is there anybody out there who can help me?

Thanks: Volker//.

PS: I also want to install TK4.0.



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

Date: Fri, 8 Aug 1997 07:10:59 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Andrew Williams <andrew@spyder.manor.org>
Subject: Re: Locking a require
Message-Id: <Pine.GSO.3.96.970808065143.9049G-100000@kelly.teleport.com>

On 5 Aug 1997, Andrew Williams wrote:

Newsgroups: comp.lang.perl

If your news administrator still carries comp.lang.perl, please let him
or her know that that newsgroup has not existed since 1995. If you
have such an outdated newsgroup listing, you are probably missing out
on many other valid newsgroups as well. You'll be doing yourself and
many others a favor to use only comp.lang.perl.misc (and other valid
Perl newsgroups) instead.

> We have a program that edits a require file to set some values (ie field
> positions in arrays etc) and we need a way to lock that file while it is
> being updated so that when someone trys to run the program that
> "requires" that file it waits until the update is done. 

Perl's require operator doesn't do any checking or locking, so flock by
itself won't help. But here's an idea: Make the require'd library a
symbolic link. Now you can write a new file, taking your time. When it's
ready, merely update the symlink to point to the new file. Easy!

Hope this helps!

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/




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

Date: Fri, 08 Aug 1997 21:27:02 GMT
From: blueboyd@mis.net (Blue)
Subject: Re: New To Perl/Prog.:Please Help
Message-Id: <33eb8e3d.1042643@netnews.mis.net>

On Fri, 8 Aug 1997 07:37:26 -0700, Tom Phoenix <rootbeer@teleport.com>
wrote:

(snip)

>[ One and one-half large, dense screenfuls of text snipped. I'm sure it
>was wonderful prose, but I couldn't bring myself to read it! If you can
>cut it down to one small, relevant paragraph, I could try again. 

Sorry for the bloat in my first post. Here goes a second try...

I have a file that contains thousands of lines. The first 9 characters
of each line is a user social security number. The next character is a
colon. The rest of each line is info about the user such as phone
number, office location, etc. This list is updated weekly by an
office/department when there is a change in personnel. This means that
there will be duplicate lines scattered throughout the file. The file
is appended to each week with the new info. If a line has a duplicate
(some will, some won't), the last entry will be the most current.  I
want to process the file and write each line to a new file that will
not have any duplicates and will have the most recent info (the last
submission for a particular ss#). 

I hope this is better. Thanks again for your assistance. 


Blue


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

Date: Fri, 08 Aug 1997 10:03:54 +0300
From: Petri Backstrom <petri.backstrom@icl.fi>
Subject: Re: No Perls of wisdom here...
Message-Id: <33EAC4DA.A6B@icl.fi>

Matthew wrote:
> 
> Actually, quite the opposite...
> 
> I've heard that Perl Version 5.00x supports classes (or at least some OO
> stuff). Is this true. If whoever replies would be so kind as to give an
> example, I would be extremely grateful.

See the Perl online documentation, start with the perltoot part
(which is titled "Perl OO Tutorial").

If you don't have the docs, start at

   http://www.perl.com/FAQ/

regards,
 ...petri.backstrom@icl.fi
    ICL Data Oy
    Finland


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

Date: Fri, 08 Aug 1997 17:38:05 -0400
From: David Tiberio <davidt@riddler.com>
Subject: perl compiler = slow
Message-Id: <33EB91BD.7F94@riddler.com>

every program i have compiled with the perl compiler is slower
than the perl interpreter


I have tried bytecode, bperl, perl -Iblib/arch, etc with the
same results


any ides?

dt


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

Date: 8 Aug 1997 15:45:50 -0400
From: radev@news.cs.columbia.edu (Dragomir R. Radev)
Subject: Perl compiler problem
Message-Id: <5sft1e$ehe@age.cs.columbia.edu>

I am trying to use the Perl compiler. It works fine when I load simple
modules such as Cwd.pm. It fails on more complicated ones: e.g., CGI.pm
or DirHandle.pm
Here is one case of failure on Date::Format

% ~/perl/bin/perl -MO=C,-otest1.c,-uDate::Format test1.pl               

test1.pl syntax OK
Can't locate object method "first" via package "B::OP" at
/u/radev/perl/lib/site_perl/B.pm line 95.
END failed--cleanup aborted.

%
-- 
Dragomir R. Radev                           Graduate Research Assistant
Natural Language Processing Group     Columbia University CS Department
H: 212-749-9770  O: 212-939-7121      http://www.cs.columbia.edu/~radev


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

Date: Wed, 6 Aug 1997 07:50:48 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Marcus Engene <marcus@student.adb.gu.se>
Subject: Re: Perl daemon program dies while sleeping
Message-Id: <Pine.GSO.3.96.970806074654.29767P-100000@kelly.teleport.com>

On Wed, 6 Aug 1997, Marcus Engene wrote:

> I've noticed that the daemon receives a INT signal (which the children
> inherits & dies of). If I IGNORE that signal, it gets a SIGKILL (9)
> instead. 

Could somebody (an admin on your system, probably) have installed a
program which tries to kill off long-running processes? Some admins assume
that, if something is running at too high a priority for too long, it's
taking up too much of some system resource.

In any case, if your processes will be sufficiently fast at a reduced
priority, you should probably consider lowering the priorities. Hope this
helps!

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/



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

Date: Fri, 08 Aug 1997 23:12:32 +0000
From: Matthew Knight <matt@geenite.demon.co.uk>
Subject: perl with a dash of gif?
Message-Id: <33EBA7E0.3AEC@geenite.demon.co.uk>

hi

can anyone direct me to a script, or the whereabouts of a tutorial or 
help to create GIF images through a perl script?

for example, when data is entered through a form, a gif file (say a 
graph or chart) is created.

please reply to my email address..
Matt Knight
matt@geenite.demon.co.uk


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

Date: 8 Aug 1997 09:06:11 +0200
From: Marek.Rouchal@-nospam-hl.siemens.de (Marek Rouchal)
Subject: Re: Poetry questions
Message-Id: <5segh3$6g1@buffalo.HL.Siemens.DE>

In article <yeo2046iren.fsf@kudu.ind.tansu.com.au>, Stuart Cooper <stuartc@ind.tansu.com.au> writes:
toutatis@remove.this.toutatis.net (Toutatis) writes:

> $var2 = $var;
> $var2 =~ tr/qwerty/asdfg/;
> 
> Can I do that in a single statement?
> like: $var2 = $var =~ tr/qwerty/asdfg/;
> But then in a way that it does what I want?

($var2 = $var) =~ tr/qwerty/asdfg/;

> Another one:
> $var = $long->{'variable'}->{'name'} ? $long->{'variable'}->{'name'} : "nope";
> Is there a way so I don't have to write that long variable name twice?

$var = $long->{'variable'}->{'name'} || "nope";


Hope this helps,

Marek Rouchal

PS: To reply by EMail, please remove the -nospam- from the addresses. Thank you.


-- 
  Marek Rouchal                   Phone : +49 89/636-25849
     SIEMENS AG, HL CAD SYS       Fax   : +49 89/636-23650
     Balanstr. 73                 mailto:Marek.Rouchal@-nospam-hl.siemens.de
     81541 Muenchen               PCmail:Marek.Rouchal.PC@-nospam-hl.siemens.de


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

Date: Fri, 8 Aug 1997 10:14:32 GMT
From: adelton@fi.muni.cz (Honza Pazdziora)
Subject: Re: printf
Message-Id: <adelton.871035272@aisa.fi.muni.cz>

denis@mathi.uni-heidelberg.de writes:

> hi all,
> 
> i've tryed to format the output of my perl script with printf.
> but printf writes the output on the right end of the field.
> how can i change this.

printf "%-20.20s\n", $string;

Hope this helps.

--
------------------------------------------------------------------------
 Honza Pazdziora | adelton@fi.muni.cz | http://www.fi.muni.cz/~adelton/
                   I can take or leave it if I please
    European RC5 56 bit cracking effort -> http://www.cyberian.org/


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

Date: 8 Aug 1997 21:19:33 GMT
From: mike@stok.co.uk (Mike Stok)
Subject: Re: Read from growing file - eof problem
Message-Id: <5sg2h5$1ih@news-central.tiac.net>

In article <871060001.25477@dejanews.com>,  <howard@wdsec.com> wrote:
>I'm using the
>while <FILE>
>loop to parse data from a growing file.
>At the end of the while loop I sleep and then reset with
>seek
>and start the while <FILE> loop again.
>
>Unfortunately sometimes I read in the last line
>AS it's growing so I get an incomplete line.
>Is there any way around this?
>Somehow detect the invalid line and reset to read in
>the last line again?

If you're essentially doing a "tail -f" then the perlfaq5 man page says:

       How do I do a tail -f in perl?

       First try

           seek(GWFILE, 0, 1);

       The statement seek(GWFILE, 0, 1) doesn't change the
       current position, but it does clear the end-of-file
       condition on the handle, so that the next <GWFILE> makes
       Perl try again to read something.

       If that doesn't work (it relies on features of your stdio
       implementation), then you need something more like this:

               for (;;) {
                 for ($curpos = tell(GWFILE); <GWFILE>; $curpos = tell(GWFILE))  {
                   # search for some stuff and put it into files
                 }
                 # sleep for a while
                 seek(GWFILE, $curpos, 0);  # seek to where we had been
               }

       If this still doesn't work, look into the POSIX module.
       POSIX defines the clearerr() method, which can remove the
       end of file condition on a filehandle.  The method: read
       until end of file, clearerr(), read some more.  Lather,
       rinse, repeat.

and you may need to remember the contents of the last incomplete line
while you're doing it.

Hope this helps,

Mike

-- 
mike@stok.co.uk                    |           The "`Stok' disclaimers" apply.
http://www.stok.co.uk/~mike/       |   PGP fingerprint FE 56 4D 7D 42 1A 4A 9C
http://www.tiac.net/users/stok/    |                   65 F3 3F 1D 27 22 B7 41
stok@psa.pencom.com                |      Pencom Systems Administration (work)


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

Date: Fri, 08 Aug 1997 02:04:07 GMT
From: tja@bga.com (TJ Anderson)
Subject: Script needed
Message-Id: <33ea7b72.536597102@news3.realtime.net>

I have an immediate need for someone to create a program that searches
the main search engines on the net for a specific topic based on a
specific group of key words.  Then, compile the results by topic into
various html pages and dynamically update same daily.  Is there
already such a thing available one of my perl hackers can deal with
easily---they are very busy and don't have time for a new project.  I
seem to remember seeing a script to do this, but I have no memory of
where.    Basically I want a custom exact match "search the search
engines" program for a specific category of information that can be
launched by a CRON job on a daily basis and will also allow a user to
query as well.  We would probably be looking at 100 or so key words
for this topic. I would also want to be able to add to the engines to
search.

We use BSDI, DBM for database and I assume something like this might
need such storage??

If any of you know of something already available, please let me know.
Or, if someone has experience with this type of project and would be
interested in doing this project please email me at tja@bga.com
It is critical that you really have experience specifically with this
type of keyword methodology. I will pay a reasonable fee for this.

TJ Anderson
Internet Media Works!
http://www.inetworks.com


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

Date: Fri, 8 Aug 1997 05:38:25 GMT
From: "Tony Cox" <a.cox@rbgkew.org.uk>
Subject: Searching for "similar" words
Message-Id: <EEKy96.81L@news.rbgkew.org.uk>

 I'm writing a script that takes a keywork supplied by the user and returns
all the antries in a database that contain the word.

However, I'd also like to return "similar" word in case they have misspelled
the word - that way I can present a list of all possible/likely database
records. Is there a way of doing this with Perl other than searching using
regexs that represent many varieties of substrings of the keyword?



thanks


Tony Cox
*******************************************************************
Dr. Tony Cox                         email: a.cox@rbgkew.org.uk
Jodrell Laboratory                  http:  www.rbgkew.org.uk
Royal Botanic Gardens       tel:   (44)-181-332-5360
Kew, U.K.                           fax:   (44)-181-332-5310
*******************************************************************





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

Date: Fri, 08 Aug 1997 16:50:21 -0400
From: Paul S R Chisholm <psrc@corp.airmedia.com>
Subject: signals and EOF
Message-Id: <33EB868D.7B7C@corp.airmedia.com>

I recently needed to write a persistent process with a configuration
file. I tried to write it so it would re-read it's configuration file on
SIGHUP:

# get the original configuration file
if (! read_config()) {
    die "$0: cannot read configuration file(s)\n";
}
# ... and again on SIGHUP
$SIG{"HUP"} = sub { read_config(); };

(I think I have sigaction, so I don't need to re-catch the signal. I
don't set the catch function directly to read_config(), for
compatibility with the final version of the code; see below.)

Well, that seemed fine, except that the program would exit on SIGHUP! It
took me a little while to realize that the main loop of the program:

while (<STDIN>) {
    # process input
}

was terminating, having seen EOF (an undefined value from standard
input) when the read was interrupted by the signal. (Makes sense; the
underlying read(2) returns -1, with errno=EINTR, which would perculate
up through the I/O libraries as an error.)

Okay, so one trick is to distinguish <>-undefined-on-true-EOF from
<>-undefined-on-interrupt-error. The following works:

$SIG{"HUP"} = sub { read_config(); $::saw_signal = 1; };

# look at standard input, send matching lines to e-mail
$::saw_signal = 0;
while (1) {
    $_ = <STDIN>;
    if (! defined($_)) {
        if ($::saw_signal) {
            print "DEBUG: ignoring EOF\n";
            $::saw_signal = 0;
            next;
        } else {
            last;  # true end-of-file
        }
    }
    # process input
}

 ... except that it loses the line after the interrupt. Is there a better
way to read standard input (sysread() blocks and break the blocks into
lines?), or to catch interrupts, to avoid this?
--
Paul S. R. Chisholm, AirMedia, Inc.     (formerly Ex Machina)
mailto:psrc@corp.airmedia.com  http://corp.airmedia.com/~psrc
 I'm not speaking for the company, I'm just speaking my mind


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

Date: Fri, 08 Aug 1997 13:35:17 -0600
From: paries@advicom.net
Subject: Sorting this file is killing me
Message-Id: <871064792.31232@dejanews.com>

Hello,
  THis should be easy and I have seen many sorting example, but can't seem
  to get the handle on this !%$# sorting thing...

  anyways , I have a file that looks like this

  Marge Simpson|100.00
  bart Simpson|1000.00
  joe simth|300.00

  I need to read in this file and the sort the pairs by field 2 and then
  load into either an array of arrays or hash.

  I have been banging my head for a couple hours(i know this should be
  simple)

  Thanks for any help


-------------------==== Posted via Deja News ====-----------------------
      http://www.dejanews.com/     Search, Read, Post to Usenet


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

Date: Fri, 8 Aug 1997 13:47:37 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: paries@advicom.net
Subject: Re: Sorting this file is killing me
Message-Id: <Pine.GSO.3.96.970808134618.15673K-100000@kelly.teleport.com>

On Fri, 8 Aug 1997 paries@advicom.net wrote:

> I have a file that looks like this
> 
> Marge Simpson|100.00
> bart Simpson|1000.00
> joe simth|300.00
> 
> I need to read in this file and the sort the pairs by field 2 and then
> load into either an array of arrays or hash.

How far have you gotten? Can you read in the file, at least? Do you know
how to extract field 2? Let us know where you're stuck, and we can help
with that part. Thanks!

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/



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

Date: Fri, 08 Aug 1997 16:53:00 -0500
From: Dave Lilly <lilly@fedex.com>
Subject: Re: Substitution
Message-Id: <33EB953C.794B@fedex.com>

Mark Schwartz wrote:
> 
> I have a Perl script that contains about 100 instances of the variable
> $zds.
> I wish to replace the letters 'zds' with the letters 'ftc'.
> 
> So:
> 
> #!/usr/bin/perl -w
> 
> open (CNV,"/home/httpd/cgi-bin/ftc1.cgi") || die "cannot open file";
> while (CNV)
> {
>     $_ =~ s/zds/ftc/;
> }
> close (CNV) || die "cannot close file";
> 
> Nothing.  No errors, but no replacement of 'zds' with 'ftc'.

Well, you need while (<CNV>) up there instead of just (CNV), like you
have it down here:

> So I try this:
> 
> #!/usr/bin/perl -w
> 
> open (CNV,"/home/httpd/cgi-bin/ftc1.cgi") || die "cannot open file";
> while (<CNV>)
> {
>     if ($_ =~ /zds/)
>     {
>         print "$_";
>     }
> }
> close (CNV) || die "cannot close file";
> 
> Every line containing zds is promptly displayed on my screen.
> 
> I am running the script as root, and the permissions on ftc1.cgi are
> 755.
> 
> What am I missing?
> 
> Thanks in advance.
> 
> Mark Schwartz
> mcs@in.net

That should do it for you.  Good luck!

-dave


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

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

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