[15460] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 2870 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Apr 26 14:11:34 2000

Date: Wed, 26 Apr 2000 11:10:23 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <956772623-v9-i2870@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Wed, 26 Apr 2000     Volume: 9 Number: 2870

Today's topics:
    Re: Perl 5.6.0/Solaris: ok to compile with [but not use <rootbeer@redcat.com>
    Re: Perl and SQL <jeff@vpservices.com>
        Posting MIME articles from scripts (CUESTA CUESTA)
        print HTML <todd@mrnoitall.com>
    Re: print HTML <rootbeer@redcat.com>
    Re: print HTML nobull@mail.com
    Re: print HTML <red_orc@my-deja.com>
        Put Variable Initializations In Other File <monty@primenet.com>
    Re: Put Variable Initializations In Other File <rootbeer@redcat.com>
    Re: Put Variable Initializations In Other File nobull@mail.com
    Re: Q: RegExp to parse lastname, first (middle) (jr/sr) (Andreas Ringstad)
    Re: SNMP module examples? <do.not.mail.me@null.net>
    Re: Sort on xx-st piece of array nobull@mail.com
    Re: to print a flat data file with a certain lengths ? r_ramirez@my-deja.com
        Trainer <sjutmp@msn.com>
    Re: Trainer <lauren_smith13@hotmail.com>
    Re: Trainer (Elaine -HFB- Ashton)
        trying to access elements of a scalar variable <matst90@katz.pitt.edu>
    Re: trying to access elements of a scalar variable <tony_curtis32@yahoo.com>
    Re: trying to access elements of a scalar variable <lauren_smith13@hotmail.com>
    Re: trying to access elements of a scalar variable <lr@hpl.hp.com>
    Re: trying to access elements of a scalar variable <godzilla@stomp.stomp.tokyo>
        Weird locale error opening file <frankvw@euronet.nl>
    Re: Weird locale error opening file nobull@mail.com
    Re: Weird locale error opening file <rootbeer@redcat.com>
        Win32 Multi Threading <sjutmp@msn.com>
    Re: Win98 Pipe problem bennyboy00@my-deja.com
        Windows Script Component using PerlScript <steve_woolet@us.ibm.com>
        Yonker <todd@mrnoitall.com>
    Re: Yonker nobull@mail.com
    Re: Yonker <lr@hpl.hp.com>
    Re: Yonker <rootbeer@redcat.com>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Wed, 26 Apr 2000 10:56:00 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: Perl 5.6.0/Solaris: ok to compile with [but not use] 5.005 threads?
Message-Id: <Pine.GSO.4.10.10004261053360.25963-100000@user2.teleport.com>

On Wed, 26 Apr 2000, Eryq wrote:

> I'm running Perl 5.6.0 on Solaris, which I've built with 5.005-style
> thread support.  I know that we're not supposed to deploy such a
> Perl in a production environment, but I'd like a little clarification:
> 
> Suppose that none of my production scripts *use* threads; I just
> want the Thread support in there for a few non-production scripts.
> Will this setup be okay, or does compiling with 5.005 support 
> somehow comprimise unrelated parts of Perl?

As I understand it, it shouldn't. But (as with any program) there may be a
bug which could cause a problem here.

You could, if you have the disk space, compile a threading version and
install it as, say, /usr/local/bin/perl-5.6.0T alongside the normal
(bugfree :-) installation.

Good luck with it!

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



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

Date: Wed, 26 Apr 2000 08:45:32 -0700
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: Perl and SQL
Message-Id: <39070F1C.A9FE41B8@vpservices.com>

Gordon.Haverland@agric.gov.ab.ca wrote:
> 
> Hi!
> 
>   I've been using perl for quite a while, and like using perldb in
> emacs when debugging stuff.  Just recently I started working on a
> program which makes use of a SQL dbase (PostgreSQL in particular), and
> trying to find out what's wrong is becoming quite a chore.  Are there
> any modules which should be use'd or require'd to help in tracking
> down why the SQL calls fail?  Like perl, sometimes an error message is
> caused by something missing or extra previously, and so things aren't
> always as  simple as the seem.  Advice on using large objects also
> welcomed.  :-)  Thanks,


I assume you are using DBI and DBD::pg, if not, those are *really* the
way to go.  If you are, are you taking advantage of RaiseError and
PrintError and Trace?  If those don't address your needs, perhaps you
could be a bit more specific about what kinds of errors you are talking
about.

-- 
Jeff


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

Date: 26 Apr 2000 16:47:45 GMT
From: jcuesta@tid.es (CUESTA CUESTA)
Subject: Posting MIME articles from scripts
Message-Id: <8e76jh$nhp9@tid.tid.es>


   I want to post an article with MIME format (containing the article in text
mode and in HTML format from a perl script. I've tryed with News::NNTPClient
and Net::NNTP but the don't seem to allow this.

  Thanks

    J. C. Cuesta




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

Date: Wed, 26 Apr 2000 11:23:09 -0600
From: Todd Anderson <todd@mrnoitall.com>
Subject: print HTML
Message-Id: <39072394.2B563694@mrnoitall.com>

Hi There,
I have used the code below to write/create an html page. Any one know how
to do it with a "here document" so I don't have to escape(\").
Thanks for your help.

open(HTML, ">$pagedirpath/index.html") || &file_open_error
 ("$username", "MakePage",  __FILE__, __LINE__);

print HTML "<html><head>\n";
print HTML "<title>My Page</title>\n";
print HTML "</head>\n";
print HTML "<body>\"Hello World\"</body>\n";
print HTML "</html>\n";

close(HTML);



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

Date: Wed, 26 Apr 2000 10:57:47 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: print HTML
Message-Id: <Pine.GSO.4.10.10004261057190.25963-100000@user2.teleport.com>

On Wed, 26 Apr 2000, Todd Anderson wrote:

> Any one know how to do it with a "here document" so I don't have to
> escape(\").

Have you seen the perlop manpage? Cheers!

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



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

Date: 26 Apr 2000 18:47:06 +0100
From: nobull@mail.com
Subject: Re: print HTML
Message-Id: <u9vh14rbz9.fsf@wcl-l.bham.ac.uk>

Todd Anderson <todd@mrnoitall.com> writes:

> I have used the code below to write/create an html page. Any one know how
> to do it with a "here document" so I don't have to escape(\").

Could you explain what went wrong when you tried?  There's not much
point posting to the newsgroup until you've tried just doing it.

-- 
     \\   ( )
  .  _\\__[oo
 .__/  \\ /\@
 .  l___\\
  # ll  l\\
 ###LL  LL\\


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

Date: Wed, 26 Apr 2000 17:54:23 GMT
From: Rodney Engdahl <red_orc@my-deja.com>
Subject: Re: print HTML
Message-Id: <8e7ag6$hg2$1@nnrp1.deja.com>

In article <39072394.2B563694@mrnoitall.com>,
  Todd Anderson <todd@mrnoitall.com> wrote:
> Hi There,
> I have used the code below to write/create an html page. Any one know
how
> to do it with a "here document" so I don't have to escape(\").
> Thanks for your help.
>
> open(HTML, ">$pagedirpath/index.html") || &file_open_error
>  ("$username", "MakePage",  __FILE__, __LINE__);
>
> print HTML "<html><head>\n";
> print HTML "<title>My Page</title>\n";
> print HTML "</head>\n";
> print HTML "<body>\"Hello World\"</body>\n";
> print HTML "</html>\n";
>
> close(HTML);
>
>

Perl Cookbook;1. Strings: 1.0 Introduction

print HTML "<<STOP";
<html><head>\n
<title>My Page</title>\n
</head>\n
<body>"Hello World"</body>\n
</html>\n
STOP

Of course, you really don't need the double-quotes around Hello World,
unless you want to see them on the HTMP page.



Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: 26 Apr 2000 16:29:50 GMT
From: Jim Monty <monty@primenet.com>
Subject: Put Variable Initializations In Other File
Message-Id: <8e75hu$rau$1@nnrp03.primenet.com>

All I want to do is move several lengthy hash initializations
out of my script into a separate file. How can I do this simply,
easily, and quickly?

I'm using 'use strict;' in my script. I've read about use, require,
package, do, etc. in both Programming Perl and Perl Cookbook. I
still don't understand why my script won't compile while I have
'use strict' in effect, and I don't really care. This cannot POSSIBLY
be as hard as it seems!

What's the short answer?

-- 
Jim Monty
monty@primenet.com
Tempe, Arizona USA


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

Date: Wed, 26 Apr 2000 10:53:11 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: Put Variable Initializations In Other File
Message-Id: <Pine.GSO.4.10.10004261052100.25963-100000@user2.teleport.com>

On 26 Apr 2000, Jim Monty wrote:

> What's the short answer?

perlmod. (I'd tell you more, but then it wouldn't be a short answer. :-)

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



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

Date: 26 Apr 2000 18:40:06 +0100
From: nobull@mail.com
Subject: Re: Put Variable Initializations In Other File
Message-Id: <u9wvlkrcax.fsf@wcl-l.bham.ac.uk>

Jim Monty <monty@primenet.com> writes:

> All I want to do is move several lengthy hash initializations
> out of my script into a separate file. How can I do this simply,
> easily, and quickly?
> 
> I'm using 'use strict;' in my script. I've read about use, require,
> package, do, etc. in both Programming Perl and Perl Cookbook. I
> still don't understand why my script won't compile while I have
> 'use strict' in effect, and I don't really care. This cannot POSSIBLY
> be as hard as it seems!
> 
> What's the short answer?

Please see the thread on this exact same question earlier this week.

(That's the short answer - the long answer would be to repeat the
answers given in the other thread - but you asked for the short
answer).

-- 
     \\   ( )
  .  _\\__[oo
 .__/  \\ /\@
 .  l___\\
  # ll  l\\
 ###LL  LL\\


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

Date: 26 Apr 2000 12:15:18 -0400
From: aringsta@panix.com (Andreas Ringstad)
Subject: Re: Q: RegExp to parse lastname, first (middle) (jr/sr) - need optional matches without overlap - how?
Message-Id: <8e74mm$64g$1@panix.com>

In article <4YrN4.190$1%5.13232065@news2.news.adelphia.net>,
mnip <nospam@goaway.com> wrote:
>I have a large series of names, which will appear in cases from simple to
>complex:
>
>Simple:        Lastname, First
>Comples:    Van Der Lastname, Firstname J Bob Jr.
>I'm trying to write a pattern that will match
>
>Any Ideas?

something like:

	(.*),(.*)( (Jr.|Sr.|[IVX]+))?

where $1 is last name, $2 is first name, and $3 is trailer,
if present.  obviously, this assumes that a comma will occur
only once in the `record'.

d
-- 
_______________________________________________________________________
"Detroit 4:53 A.M."                                  aringsta@panix.com
                                                www.panix.com/~aringsta


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

Date: Wed, 26 Apr 2000 10:44:02 -0700
From: Mike Ayers <do.not.mail.me@null.net>
Subject: Re: SNMP module examples?
Message-Id: <39072AE1.13E360AC@null.net>



Hans J Jakobsen wrote:
> 
> Mike Ayers <do.not.mail.me@null.net> writes:
> 
> >       I have UCD-SNMP installed, and the SNMP module for it as well.  However
> >'perldoc SNMP' is a bit obtuse.  Can anyone point me to some elementary
> >code that uses the SNMP module?  I just need to see some sets typed out,
> >etc. so that I can grasp the format, since I couldn't quite interpret
> >what the doc said.
> 
> Is it the SNMP-1.8.2 module you have installed?
> Have you read the README that is part of the module?
> There are some examples in the examples directory.

	The README is the same as 'perldoc SNMP'.  Like I said, it's obtuse.

	I had missed the examples dir.  They're not very good, but did help me
find the problem.  The thing which was not made clear was that when
splitting the OID into two parts, if you have a named leaf, it must be
the only thing in the first part (enterprises.442.2.1.2.0 ->
'enterprises', '442.2.1.2.0').  Don't know why it's set up this way.

> I have with succes used the pingmib.pl script as starting point.
> (but now my problem is that I want to it all in parrallel)

	SNMP in parallel?  Do you realize that master agents inevitably
serialize most requests?  The best thing to do is to use multivarbind
requests and let the master agent handle it as efficiently as it can.


/|/|ike

> /hjj
> --
> Hans Jørgen Jakobsen


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

Date: 26 Apr 2000 18:06:20 +0100
From: nobull@mail.com
Subject: Re: Sort on xx-st piece of array
Message-Id: <u94s8ossfn.fsf@wcl-l.bham.ac.uk>

Please quote only relevant text in the message you are replying to and
quote it before your reply.

Penpal International <ppi@searchy.net> writes:

> nobull@mail.com wrote:
> > 
> > See FAQ: "How do I sort an array by (anything)?"

> I had already a script myself. But somehow it just failed when trying to
> sort my attached file.
> I also tried various others, but without success...

If you have tried to follow the advice in the FAQ and your code
doesn't work as you expect then show us the code.  Simply asking a
question taken directly from the FAQ is going to result either in the
answer "see FAQ" or an answer which is functionally equivalent to (but
often inferior to) the answer you will find in the FAQ.

-- 
     \\   ( )
  .  _\\__[oo
 .__/  \\ /\@
 .  l___\\   
  # ll  l\\  
 ###LL  LL\\ 


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

Date: Wed, 26 Apr 2000 17:38:03 GMT
From: r_ramirez@my-deja.com
Subject: Re: to print a flat data file with a certain lengths ?
Message-Id: <8e79hp$gkn$1@nnrp1.deja.com>

In article <MPG.136e18748e81da7f98a963@nntp.hpl.hp.com>,
  Larry Rosler <lr@hpl.hp.com> wrote:
>
> sprintf "%-60s|%s|%s\n" => $a1, $a2, $a3; # left-adjusted
>
> sprintf  "%60s|%s|%s\n" => $a1, $a2, $a3; # right-adjusted

     Reading the original post, I think he's just trying to
print the varibles to the filehandle FILE.  If that's true,
then just doing...

printf FILE "%-60s|%s|%s\n", $a1, $a2, $a3; # left-justified

  -or-

printf FILE "%60s|%s|%s\n", $a1, $a2, $a3; # right-justified

     would also work, correct?  Or is there an advantage to
using sprintf instead.

TIA, rr



Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Wed, 26 Apr 2000 11:16:25 -0400
From: "Steven Ulbrich" <sjutmp@msn.com>
Subject: Trainer
Message-Id: <sge1jnq8qgc149@news.supernews.com>

A North Carolina Company is looking for Training in Perl 5.

    We are developing a program that utilities IIS, VB, ASP and COM. We are
new to Perl and want to use the text parsing abilities of Perl to append the
information to a SQL 7.0 database.


Any and All Advice would be appreciated


Steven Ulbrich




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

Date: Wed, 26 Apr 2000 09:29:45 -0700
From: "Lauren Smith" <lauren_smith13@hotmail.com>
Subject: Re: Trainer
Message-Id: <8e75ig$a85$1@brokaw.wa.com>


Steven Ulbrich <sjutmp@msn.com> wrote in message
news:sge1jnq8qgc149@news.supernews.com...
> A North Carolina Company is looking for Training in Perl 5.
>
>
> Any and All Advice would be appreciated

A search on Deja for 'Perl training' will turn up the names of a few
luminaries, I'm sure.

Lauren




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

Date: 26 Apr 2000 16:43:12 GMT
From: elaine@chaos.wustl.edu (Elaine -HFB- Ashton)
Subject: Re: Trainer
Message-Id: <slrn8ge73p.re8.elaine@chaos.wustl.edu>

In article <8e75ig$a85$1@brokaw.wa.com>, Lauren Smith wrote:
>> Any and All Advice would be appreciated
>
>A search on Deja for 'Perl training' will turn up the names of a few
>luminaries, I'm sure.

Or even http://www.perltraining.com/

e.


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

Date: Wed, 26 Apr 2000 12:17:53 -0400
From: "Martin Trautmann" <matst90@katz.pitt.edu>
Subject: trying to access elements of a scalar variable
Message-Id: <8e74on$rpt$1@usenet01.srv.cis.pitt.edu>

hi,
i'm trying to access a specific character (the first one) of a scalar
variable.
i don't really want to use chop several times till i have it...

does anybody have an idea of how to access the characters?

mt




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

Date: 26 Apr 2000 11:21:16 -0500
From: Tony Curtis <tony_curtis32@yahoo.com>
Subject: Re: trying to access elements of a scalar variable
Message-Id: <87itx4kf43.fsf@shleppie.uh.edu>

>> On Wed, 26 Apr 2000 12:17:53 -0400,
>> "Martin Trautmann" <matst90@katz.pitt.edu> said:

> hi, i'm trying to access a specific character (the first
> one) of a scalar variable.  i don't really want to use
> chop several times till i have it...

perldoc -f substr
perldoc perlre

(perldoc is your friend)

hth
t


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

Date: Wed, 26 Apr 2000 09:21:31 -0700
From: "Lauren Smith" <lauren_smith13@hotmail.com>
Subject: Re: trying to access elements of a scalar variable
Message-Id: <8e7533$glp$1@brokaw.wa.com>


Martin Trautmann <matst90@katz.pitt.edu> wrote in message
news:8e74on$rpt$1@usenet01.srv.cis.pitt.edu...
> hi,
> i'm trying to access a specific character (the first one) of a scalar
> variable.
> i don't really want to use chop several times till i have it...
>
> does anybody have an idea of how to access the characters?

perldoc -f substr

Lauren




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

Date: Wed, 26 Apr 2000 10:14:37 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: trying to access elements of a scalar variable
Message-Id: <MPG.1370c3dbb4d9765298a986@nntp.hpl.hp.com>

In article <87itx4kf43.fsf@shleppie.uh.edu> on 26 Apr 2000 11:21:16 -
0500, Tony Curtis <tony_curtis32@yahoo.com> says...
> >> On Wed, 26 Apr 2000 12:17:53 -0400,
> >> "Martin Trautmann" <matst90@katz.pitt.edu> said:
> 
> > hi, i'm trying to access a specific character (the first
> > one) of a scalar variable.  i don't really want to use
> > chop several times till i have it...
> 
> perldoc -f substr
> perldoc perlre

But he could also do 'chop reverse $scalar', as he doesn't seem to mind 
using 'chop several times'.  One chop will do it.  :-)

I recall from some benchmarks posted here a while ago that that was the 
fastest approach of all, believe it or not!

-- 
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: Wed, 26 Apr 2000 10:58:19 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: trying to access elements of a scalar variable
Message-Id: <39072E3B.5A237FB8@stomp.stomp.tokyo>

Martin Trautmann wrote:

> i'm trying to access a specific character (the first one) 
> of a scalar variable. i don't really want to use chop 
> several times till i have it...

Reverse your string and chop. You will find
this to be quite efficient. Protect your original
string by creating a new variable, if needed.

$my_new_string = $my_old_string;
$my_new_string = reverse ($my_new_string);
$my_new_string = chop ($my_new_string);

This will quickly and efficiently pull
your first character of your string.

You can combine my last two example
code snippets into one line if you
want to do this more eloquently.

Godzilla!



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

Date: Wed, 26 Apr 2000 17:18:22 +0200
From: Frank van Wensveen <frankvw@euronet.nl>
Subject: Weird locale error opening file
Message-Id: <3f1egs4poa31e34decok4abb1i9pvsgedv@4ax.com>

Dear Perlologists,

I have a weird problems that seems to be related to locale files being
not present. It looks like my program tries to open some locale libc
file that isn't there, but I have no idea why my program tries to open
it, and why the resulting $! mumbles about an invalid argument. If
anyone knows what's going on here, a response would be appreciated.


I'm trying to open a tied hash using the DB_File module for reading
with the following call:

$DB_BTREE->{'flags'} = R_DUP ;
$dictfile = "/searchdata/search.idx";
$x = tie (%dict, "DB_File", "$dictfile", O_RDONLY, 0644, $DB_BTREE) ||
  die ("Error opening $dictfile: $!\n");

This works well, except while another Perl program is running in the
background which updates the same file, i.e. has it open for writing,
with the following call:

$DB_BTREE->{'flags'} = R_DUP;        # Enable duplicate keys 
tie (%dict, "DB_File", "$dictfile", O_RDWR|O_CREAT, 0644, $DB_BTREE)
  || die ("Error writing $dictfile: $!\n");

This happens in Perl 5.004 under Slackware Linux 2.0.36, but not in
Perl 5.005 under Solaris 2.7.
I did an I/O trace (using 'strace') which shows the following:

open("searchdata/search.idx", O_RDONLY) = 3
fcntl(3, F_SETFD, FD_CLOEXEC)           = 0
fstat(3, {st_mode=S_IFREG|0644, st_size=1048576, ...}) = 0
read(3, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 24) = 24
close(3)                                = 0
stat("/etc/locale/C/libc.cat", 0xbffff734) = -1 ENOENT (No such file
or directory)
stat("/usr/share/locale/C/libc.cat", 0xbffff734) = -1 ENOENT (No such
file or directory)
stat("/usr/share/locale/libc/C", 0xbffff734) = -1 ENOENT (No such file
or directory)
stat("/usr/share/locale/C/libc.cat", 0xbffff734) = -1 ENOENT (No such
file or directory)
stat("/usr/local/share/locale/C/libc.cat", 0xbffff734) = -1 ENOENT (No
such file or directory)
write(2, "Error opening searchdata/search."..., 54Error opening
searchdata/search.idx: Invalid argument) = 54
sigprocmask(SIG_SETMASK, [], NULL)      = 0
_exit(22)                               = ?

Can anyone enlighten me? Thanks in advance!



Regards,
    Frank

============================================
Email: frankvw@euronet.nl
Homepage: http://www.euronet.nl/~frankvw
ICQ #: 13800170
============================================


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

Date: 26 Apr 2000 18:34:37 +0100
From: nobull@mail.com
Subject: Re: Weird locale error opening file
Message-Id: <u9ya60rck2.fsf@wcl-l.bham.ac.uk>

Frank van Wensveen <frankvw@euronet.nl> writes:

> Dear Perlologists,
> 
> I have a weird problems that seems to be related to locale files being
> not present.

I doubt it.

> It looks like my program tries to open some locale libc
> file that isn't there, but I have no idea why my program tries to open
> it,

Probably because your perl executable is linked against a C run-time
library that supports locale dependant text for OS error descriptions.

> and why the resulting $! mumbles about an invalid argument.

> $x = tie (%dict, "DB_File", "$dictfile", O_RDONLY, 0644, $DB_BTREE) ||
>   die ("Error opening $dictfile: $!\n");
> 
> This works well, except while another Perl program is running in the
> background which updates the same file, i.e. has it open for writing,

What error would you like to see in this case?

-- 
     \\   ( )
  .  _\\__[oo
 .__/  \\ /\@
 .  l___\\   
  # ll  l\\  
 ###LL  LL\\ 


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

Date: Wed, 26 Apr 2000 10:51:49 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: Weird locale error opening file
Message-Id: <Pine.GSO.4.10.10004261049520.25963-100000@user2.teleport.com>

On Wed, 26 Apr 2000, Frank van Wensveen wrote:

> I have a weird problems that seems to be related to locale files being
> not present.

Did 'make test' report no errors when you installed Perl? Do you have any
of the locale-related environment variables (mis-)set?

> This happens in Perl 5.004 under Slackware Linux 2.0.36, but not in
> Perl 5.005 under Solaris 2.7.

Perhaps you should try a test installation of 5.005 (or even 5.6.0) to see
whether you still observe the problem there.

Good luck with it!

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



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

Date: Wed, 26 Apr 2000 12:43:53 -0400
From: "Steven Ulbrich" <sjutmp@msn.com>
Subject: Win32 Multi Threading
Message-Id: <sge6nnk4qtj145@news.supernews.com>

I am looking for enlightenment.  What is the multiple threading characterics
of Perl 5.6.

I am developing a program that will be converting text files into a MS SQL
7.0 database.  The program is a real time system and will be converting a
lot of very small files (<8k).

I am looking a 10 basic conversion types and creating a DLL for each.

Thanks in advance for your advice


Steven Ulbrich




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

Date: Wed, 26 Apr 2000 17:54:48 GMT
From: bennyboy00@my-deja.com
Subject: Re: Win98 Pipe problem
Message-Id: <8e7ah0$hg9$1@nnrp1.deja.com>

Ok, so I ran the following 2 programs on win98.

#!/usr/local/bin/perl -w
use strict;
open(Reader, 'dir|') or die "Cannot open pipe";
while(<Reader>) {
  print $_;
}

This programs hangs forever on win98 when it gets to the $_.

#!/usr/local/bin/perl -w
use strict;
open(Reader, 'dir|') or die "Cannot open pipe";
while(<Reader>) {
  print <Reader>;
}

While this second program runs, it does not produce the desired result.
The loop only get's executed once.  while(<Reader>) reads up to the
first \n character defined by $/.  But the print <Reader> then prints
the rest of the input from the pipe, and the first line never gets
printed.  This is not the results that we are looking for because of the
way that we will actually be implementing pipes in our program.

Check out this program:

  #!/usr/local/bin/perl -w
  open (Reader, "dir|") or die "Can't open pipe";
  $i = 0;
  while (<Reader>) {
      $i++;
      print "Line $i\n";
      if($i > 1){
          #print $_;
      }
  }

This program will read from the pipe line-by-line, and print out each
line number, and it never hangs.  But if you try to print $_ out for
any of the lines, the program hangs at the $_.

This is plain weird.  BTW, if I run any of these programs on NT instead
of win98, then they work fine.

It looks like in win98 the input that the while (<Reader) reads, is not
getting correctly assigned to $_.

Any Suggestions?

Thanks,
~Ben


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Wed, 26 Apr 2000 11:05:11 -0400
From: "Steven P. Woolet" <steve_woolet@us.ibm.com>
Subject: Windows Script Component using PerlScript
Message-Id: <390705A7.141F4F1E@us.ibm.com>

I'm trying to implement a Windows Script component using PerlScript. 
When I attempt to register the component, I get a runtime error from
regsvr32.exe of:  abnormal program termination.  This happens even when
I try the "SayHello" example in the ActiveState documentation.  If I
remove the part having to do with PerlScript, it will register
successfully.  

Does anyone know if regsvr32 on Windows2000 can actually register a
PerlScript?

Steve Woolet


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

Date: Wed, 26 Apr 2000 10:06:33 -0600
From: Todd Anderson <todd@mrnoitall.com>
Subject: Yonker
Message-Id: <390711A5.AA6355D0@mrnoitall.com>

Dear Sirs,
When using the code below,  $fields[0] and $yonker[6] should print the same. But
they don't. $fields[0] is right and $yonker[6] is from the last entry in the
database. Why?
Thanks so much for your help.
>>>>>>>
open (USERS, "$file") || &file_open_error
("$file", "Check account status",  __FILE__, __LINE__);
            flock(USERS, 2);
 while (<USERS>)
    {
    $line = $_;
    chop $line;
    @yonker = split (/\|/, $line);
 if ($username eq "$yonker[1]")
      {
$member_line = "$line\n";
     @member_line = $member_line;
if($member_line ne ""){
foreach $member (@member_line){
$fields[0] = $yonker[6];
print qq~$fields[0] $yonker[6]~;
>>>>>>>



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

Date: 26 Apr 2000 18:06:39 +0100
From: nobull@mail.com
Subject: Re: Yonker
Message-Id: <u93do8ssf4.fsf@wcl-l.bham.ac.uk>

Todd Anderson <todd@mrnoitall.com> writes:

> Subject: Re: Yonker

Please check out this helpful information on choosing good subject
lines. It will be a big help to you in making it more likely that your
requests will be answered.

    http://www.perl.com/CPAN/authors/Dean_Roehrich/subjects.post

> When using the code below,

The code is incomplete.  I figure the problem is probably not in the
bit of code you've shown us.  Always post code that we can actually
run to see the problem you are having.

-- 
     \\   ( )
  .  _\\__[oo
 .__/  \\ /\@
 .  l___\\   
  # ll  l\\  
 ###LL  LL\\ 


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

Date: Wed, 26 Apr 2000 10:10:37 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: Yonker
Message-Id: <MPG.1370c2e75b72d4dc98a985@nntp.hpl.hp.com>

In article <390711A5.AA6355D0@mrnoitall.com> on Wed, 26 Apr 2000 
10:06:33 -0600, Todd Anderson <todd@mrnoitall.com> says...
> When using the code below,  $fields[0] and $yonker[6] should print the same. But
> they don't. $fields[0] is right and $yonker[6] is from the last entry in the
> database. Why?

Please set your lines to wrap at 72 characters in the future.

> Thanks so much for your help.

It would be pleasing to help you if you showed common courtesy to the 
newsgroup.  Specifically, by supplying a Subject of relevance (yours is 
about as absurd as I've ever seen), reasonably formatted Perl code 
(yours is almost illegible), and code that is syntactically correct 
(yours doesn't compile for lack of closing braces).

Because some of your work looks like you have given it a little effort, 
I've taken a crack at reformatting the code and will point out some 
obvious problems.  But you have a lot more to do.

> open (USERS, "$file") || &file_open_error
> ("$file", "Check account status",  __FILE__, __LINE__);
>             flock(USERS, 2);
>  while (<USERS>)
>     {
>     $line = $_;
>     chop $line;
>     @yonker = split (/\|/, $line);
>  if ($username eq "$yonker[1]")
>       {
> $member_line = "$line\n";
>      @member_line = $member_line;
> if($member_line ne ""){
> foreach $member (@member_line){
> $fields[0] = $yonker[6];
> print qq~$fields[0] $yonker[6]~;

 open (USERS, "$file") || &file_open_error
     ("$file", "Check account status",  __FILE__, __LINE__);

Assuming that file_open_error outputs $! in its diagnostic, this is a 
good start.  The double-quotes around the string $file are superfluous 
and misleading.  The file and line information can be derived by the 
called function (see `perldoc -f caller`).

 flock(USERS, 2);

Why is this line indented at all, let alone so much?  This should be 
error-checked also.

 while (<USERS>) {
     $line = $_;

Copying $_ into $line is wasted effort.  All the operations can be done 
on $_ directly, with less clutter.

If you prefer to use a variable like this, you should declare it with 
'my' (`perldoc -f my`):

  while (my $line = <USERS>) {

You should be using the 'use strict;' pragma, which makes this 
declaration mandatory (`perldoc strict`).

     chop $line;

chomp is better.  But I don't know why you bother, as you put the 
newline back later anyhow.

     @yonker = split (/\|/, $line);

Again, a 'my' delaration is needed.

     if ($username eq "$yonker[1]") {

Superfluous quotes again.

         $member_line = "$line\n";

'my; again.  Here goes the newline back on.

         @member_line = $member_line;

Here you undoubtedly don't want to create a new one-element array.  What 
you probably want to do is to push this datum onto an array declared 
outside the while loop (`perldoc -f push`).  See how useful it is to 
require declaration of variables?

         if ($member_line ne "") {

As $member_line has been assigned at least a newline, this test cannot 
fail.  What are you trying to do?

             foreach $member (@member_line) {

Now you are looping over that one-element array, in the midst of another 
loop.  Or did you forget a closing brace on that loop?

                 $fields[0] = $yonker[6];
                 print qq~$fields[0] $yonker[6]~;

And now we are missing three closing braces.  Do you see why 
syntactically correct code is required?

Come back when you have overcome there essential defects and can proceed 
no further.  I'll wager your problem will reveal itself during the 
cleanup process.

-- 
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: Wed, 26 Apr 2000 10:33:37 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: Yonker
Message-Id: <Pine.GSO.4.10.10004261026371.25963-100000@user2.teleport.com>

On Wed, 26 Apr 2000, Todd Anderson wrote:

> Subject: Yonker

Please check out this helpful information on choosing good subject
lines. It will be a big help to you in making it more likely that your
requests will be answered.

    http://www.perl.com/CPAN/authors/Dean_Roehrich/subjects.post

> When using the code below,  $fields[0] and $yonker[6] should print the same. But
> they don't. $fields[0] is right and $yonker[6] is from the last entry in the
> database. Why?

> open (USERS, "$file") || &file_open_error
> ("$file", "Check account status",  __FILE__, __LINE__);

You don't need those quote marks around $file - they merely confuse the
reader.

>             flock(USERS, 2);

Unless you've opened the file with write permissions, you probably won't
get an exclusive lock on it.

>  while (<USERS>)
>     {
>     $line = $_;
>     chop $line;

Most programs written in the last five years use chomp in preference to
chop. See the docs for why.

>     @yonker = split (/\|/, $line);
>  if ($username eq "$yonker[1]")

Properly indenting your code, even though perl itself doesn't require it,
will make your programs easier to read, write, debug, and maintain. And
again with the extra quote marks.

>       {
> $member_line = "$line\n";
>      @member_line = $member_line;

That's not _wrong_ wrong, but it assigns just one element to the array...

> if($member_line ne ""){
> foreach $member (@member_line){

So, this loop loops only once. Is that what you wanted?

> $fields[0] = $yonker[6];
> print qq~$fields[0] $yonker[6]~;

And you're claiming that $fields[0] and $yonker[6] print differently in
this line of code? I'd like to say you're mistaken. In fact, I will:
You're mistaken.

If you'd like more help on your code, please cut it down to one or two
lines which aren't doing what you want, then double-check what the docs
say about those lines. Make sure that you can get them to work with
warnings turned on and under 'use strict'. If you're still stuck, post
those lines here, with perhaps a few other lines to give them context.
That will let others try your code to see whether they can reproduce what
you're seeing.

Good luck with it!

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



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

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

| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.

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.

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 V9 Issue 2870
**************************************


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