[19116] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1311 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Jul 16 11:05:36 2001

Date: Mon, 16 Jul 2001 08:05:11 -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: <995295910-v10-i1311@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Mon, 16 Jul 2001     Volume: 10 Number: 1311

Today's topics:
        Advice REQ for newbie <bloke6789@hotmail.com>
    Re: Advice REQ for newbie <krahnj@acm.org>
    Re: Advice REQ for newbie (Tad McClellan)
    Re: Advice REQ for newbie <bloke6789@hotmail.com>
        Any method to create stable threads in Perl on win 9x p <shashanka.sj@in.bosch.com>
    Re: Can I <!--include files ??? <dcs@ntlworld.com>
    Re: Check for Dups! <millettNOSPAM@lblueyonder.co.uk>
    Re: Check for Dups! (Anno Siegel)
        Checking for changed or missing links in perl (Grod)
    Re: Checking for changed or missing links in perl <tore@extend.no>
    Re: chomp (Garry)
        CPAN NNTP Module recommendations? (Alex SC)
    Re: CVS like script (Anno Siegel)
        epoch time to date <dcs@ntlworld.com>
    Re: epoch time to date <dcs@ntlworld.com>
    Re: epoch time to date <tony_curtis32@yahoo.com>
    Re: epoch time to date <dcs@ntlworld.com>
    Re: Finding size of HTML page via HTTP <mjcarman@home.com>
        Format problems (oren blum)
    Re: Hard DBI question <cpryce@pryce.net>
    Re: How to resolve multi process issue??? (Gururaj Upadhye)
    Re: Installing DBD on AIX 4.3.3 <h.m.brand@hccnet.nl>
    Re: Locale error when starting Perl (Karl Orbell)
    Re: Looking for the right direction <mjcarman@home.com>
        Need assistance with a RE <butch@sheltonbusinessmachines.com>
    Re: Need assistance with a RE (Tad McClellan)
    Re: perl debugger <mjcarman@home.com>
    Re: please help urgent <gnarinn@hotmail.com>
    Re: Replacing a word in a file (Anno Siegel)
    Re: Why is socket timeout not working? <haim.lichaa@intel.com>
        Yet another Perl Web Server (John Holdsworth)
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Mon, 16 Jul 2001 12:14:01 +0100
From: "Pete" <bloke6789@hotmail.com>
Subject: Advice REQ for newbie
Message-Id: <X4A47.36383$WS4.5779987@news6-win.server.ntlworld.com>

Please can you advise me? I am at the "hello world" stage with perl and I
cannot get this script to work.

I have a html file with lists of numbers from 1 to 100 that I want to get
rid of (90 lists and no, I didn't write it)

When I use this script
while(<>){
print if /^\s*\d{1,2}$/;
}

It prints the correct lines. But when I use this

while(<>){
s/^\s*\d{1,2}$//;
}
The substitution does not take place.
I know this is painful for you experts but I can't work it out at all!

Pete





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

Date: Mon, 16 Jul 2001 11:41:11 GMT
From: "John W. Krahn" <krahnj@acm.org>
Subject: Re: Advice REQ for newbie
Message-Id: <3B52D31F.AE9F2224@acm.org>

Pete wrote:
> 
> Please can you advise me? I am at the "hello world" stage with perl and I
> cannot get this script to work.
> 
> I have a html file with lists of numbers from 1 to 100 that I want to get
> rid of (90 lists and no, I didn't write it)
> 
> When I use this script
> while(<>){
> print if /^\s*\d{1,2}$/;
> }
> 
> It prints the correct lines. But when I use this
> 
> while(<>){
> s/^\s*\d{1,2}$//;
> }
> The substitution does not take place.

You need to print it out somewhere once you make the changes. Actually
your first example was closer, just change the "if" to "unless".

while ( <> ) {
    print unless /^\s*\d{1,2}$/;
    }

Or from the command line

perl -ne 'print unless /^\s*\d{1,2}$/' your_file.html



John
-- 
use Perl;
program
fulfillment


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

Date: Mon, 16 Jul 2001 09:42:58 -0400
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: Advice REQ for newbie
Message-Id: <slrn9l5rr2.5c2.tadmc@tadmc26.august.net>

Pete <bloke6789@hotmail.com> wrote:

>Please can you advise me? 


Yes. I advise that you post a short and complete program that we
can run that illustrates your problem when asking questions.


>I have a html file with lists of numbers from 1 to 100 that I want to get
>rid of
>
>When I use this script
>while(<>){
>print if /^\s*\d{1,2}$/;
>}
>
>It prints the correct lines. But when I use this
>
>while(<>){
>s/^\s*\d{1,2}$//;
>}
>The substitution does not take place.


How do you know that the substitution does not take place?

I do not see your second piece of code making any output at all.

How do you know that the value in $_ is if you never output it?


>I know this is painful for you experts but I can't work it out at all!


Here is a short and complete program that you can run:
----------------------------
#!/usr/bin/perl -w
use strict;

$_ = "    99\n";
print if /^\s*\d{1,2}$/;

s/^\s*\d{1,2}$//;
print "'$_'\n";
----------------------------


Looks to me like the substitution *does* take place.

There is something that you are not telling us. If you gave us
real and complete code, then we could answer your question
directly. But you didn't so we can't.


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


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

Date: Mon, 16 Jul 2001 15:37:09 +0100
From: "Pete" <bloke6789@hotmail.com>
Subject: Re: Advice REQ for newbie
Message-Id: <k3D47.36938$WS4.5854476@news6-win.server.ntlworld.com>

> Yes. I advise that you post a short and complete program that we
> can run that illustrates your problem when asking questions.

Tad,
Maybe I should have stuck at "hello world". That was my complete script!

> How do you know that the substitution does not take place?

Because my file remains unchanged.

> I do not see your second piece of code making any output at all.

It didn't, I kinda thought it would just change the existing file.

> Here is a short and complete program that you can run:
> ----------------------------
> #!/usr/bin/perl -w
> use strict;
>
> $_ = "    99\n";
> print if /^\s*\d{1,2}$/;
>
> s/^\s*\d{1,2}$//;
> print "'$_'\n";

Thanks, I'll try it and I'll learn from it.
Pete





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

Date: Mon, 16 Jul 2001 10:24:30 +0530
From: Emmanuel E <shashanka.sj@in.bosch.com>
Subject: Any method to create stable threads in Perl on win 9x platforms?
Message-Id: <3B527386.DB9613F7@in.bosch.com>

hi all,

i want to know whether there is a stable way of runnung multithreaded
programs in perl on win 9x. the fork command is very crash prone. is
there any way to acess underlying win 32 dlls to create threads that can
communicate with each other?

Emmanuel


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

Date: Mon, 16 Jul 2001 11:13:43 +0100
From: "Terry" <dcs@ntlworld.com>
Subject: Re: Can I <!--include files ???
Message-Id: <G5z47.48266$B56.10298261@news2-win.server.ntlworld.com>

Hi 'el'

"el" <el@wilmington.net> wrote in message
news:58929d2c.0107152356.616f377e@posting.google.com...
> "Terry" <dcs@ntlworld.com> wrote in message
news:<Lo%37.39930$B56.8361138@news2-win.server.ntlworld.com>...
> > Hi,
> >
> > All of my 'standard' webpages are *.shtml using SSI. This is great in
that I
> > can have a standard template file for header, navigation menu and footer
of
> > my pages by using the
> >
> > <!--include file="template.html"-->
> > directive.
> > I wanted to use the same templates for my cgi pages. Is there any way of
> > doing this?
> >
> > TIA
> >
> > Terry
>
>
> Terry,
> Just call your script with
> <!--#include virtual="pathto/myscript.pl?key=value&key2=value"-->
> and make sure the script can parse the information through 'GET'.

Thanks for that el. It's probably the way I'll have to go, although I hate
that 'mess' that GET makes of the address bar as opposed to POST, but since
I can GET to a *.shtml and can't POST it looks like I'll have to put up with
it LOL

cheers

Terry

> No biggie, I do it all over my site.
> el




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

Date: Mon, 16 Jul 2001 11:23:05 GMT
From: "millside" <millettNOSPAM@lblueyonder.co.uk>
Subject: Re: Check for Dups!
Message-Id: <t8A47.987$g95.116034@news1.cableinet.net>

> > [ snip }
>
> use a tied hash instead of a flat file for your e-mail addresses.
>
> perldoc -f tie
> perldoc DB_File
> perldoc AnyDBM_File
>
>
I need to use a flat file as it's shared with other programs.

--
millside
_____________




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

Date: 16 Jul 2001 11:31:25 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Check for Dups!
Message-Id: <9iujad$eh8$1@mamenchi.zrz.TU-Berlin.DE>

According to millside <millettNOSPAM@lblueyonder.co.uk>:
> > > [ snip }
> >
> > use a tied hash instead of a flat file for your e-mail addresses.
> >
> > perldoc -f tie
> > perldoc DB_File
> > perldoc AnyDBM_File
> >
> >
> I need to use a flat file as it's shared with other programs.

That's not a compelling reason, you can lock a database as well.

However, if I remember your setup right, the email address is
not the key, so switching to a (tied) hash wouldn't immediately
eliminate duplicates.

Anno


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

Date: 16 Jul 2001 05:24:35 -0700
From: ggrothendieck@volcanomail.com (Grod)
Subject: Checking for changed or missing links in perl
Message-Id: <ffd662ea.0107160424.3ea21ae8@posting.google.com>

I would like to check all the links on a web site
to see if they point to missing or *changed* web
pages.  The Perl scripts I have found so far don't
check for changed web pages -- just missing ones.

By changed web pages I mean this.
Many of my links are to foreign web sites
for which I have no control.   Sometimes they change
the content of a page so that they are still valid
web pages but they no longer have the expected content.  
I currently must manually check every page on foreign
sites that I link to in order to ensure that they still
have what I expect.  If I knew which pages had changed, 
I could restrict my manual review just those saving 
some time.

I have found quite a few link checkers but none of
the ones I found seem to find changed links.

Perl seems to have the appropriate facilities to
write this but I was hoping that this might exist
already.  I am particularly looking for a free 
script written in Perl.

Thanks.


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

Date: Mon, 16 Jul 2001 16:44:54 +0200
From: Tore Aursand <tore@extend.no>
Subject: Re: Checking for changed or missing links in perl
Message-Id: <MPG.15bd1c4f845ea807989697@news.online.no>

In article <ffd662ea.0107160424.3ea21ae8@posting.google.com>, 
ggrothendieck@volcanomail.com says...
> I would like to check all the links on a web site
> to see if they point to missing or *changed* web
> pages.

This is very hard to do, as there could have been only a minor 
update on the page if my "dirty" example shows;  Collect the 
'md5sum' of the HTML output and compare it with older values 
for the same site(s):

  my $md5sum = qx/lynx -dump -source $url | md5sum/;

As I said, it's dirty.  It works, however... :-)


-- 
Tore Aursand - tore@extend.no - www.aursand.no


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

Date: 16 Jul 2001 04:02:49 -0700
From: garry_short@hotmail.com (Garry)
Subject: Re: chomp
Message-Id: <bdcefd33.0107160302.271aaca3@posting.google.com>

> I've already tried - $/="\r\n"; but it doesn't chomp as well.
> Is there a way I could identify what character is actually used to
> terminate line in my text file?
> I'm using UNIX and reading the text file also from UNIX.
> 
> Thank you very much for your help.
> 
> Regards.

Something like this will do it ...

$filename = "whatever";
open (FILENAME, $filename);
@filestuff = <FILENAME>;
close (FILENAME);
{  
  $firstline = shift(@filestuff);
  @list_of_chars = split(//,$firstline);
  $eof_char = $list_of_chars[-1];
  $eof_code = ord($eof_char);
  print "$eof_code\t$eof_char\n";
}

I actually put this in a while loop to test it; on this system, it
works perfectly. Just run it to get the ord value of your newline
character, then add

$/ = chr($eof_code);  # $/ = chr(10) on this PC.

Regards,

Garry

P.S. It wouldn't be hard to modify this and include it in your script,
should you want to.


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

Date: 16 Jul 2001 07:46:08 -0700
From: hkmp5@spray.se (Alex SC)
Subject: CPAN NNTP Module recommendations?
Message-Id: <18d79944.0107160646.6dc4c948@posting.google.com>

I'm in the process of writing a perl program
that accesses our news server. Having taken
a look at CPAN I see there are a lot of different
modules available for NNTP access. Has anybody
tried them or does somebody have something 
good to say about any particular choise?

TIA,
asc


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

Date: 16 Jul 2001 13:50:47 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: CVS like script
Message-Id: <9iurfn$i90$1@mamenchi.zrz.TU-Berlin.DE>

According to Enrico Ng <mail@enricong.com>:
> I have a website that I would like several people to beable to work on.
> I can make them ftp accounts, but I cant make it so they can have a
> shared access area.
> I can make one account and put the files there, but I want separate
> users so I know who does what.
> I was thinking of making a cvs repository, but my host doesnt have a cvs
> server installed.

You should be able to install it privately.

> so I figured I could make or find and install a cvs like script.
> something that will allow users to download specific files and upload
> files. (after asking for a username and password.)

Concurrent version control is not easy and I wouldn't trust a casually
written script to get it right.  If at all possible, install a tested-
and-tried system for your application and use that.  Not only will
you be sure that it works, and works in a way people are finding useful,
but you will also be able to access your repository with standard
methods.  Do a CPAN search under VCS:: to see which ones are supported,
but in a pinch calling commands via system() is always a possibility.

Anno


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

Date: Mon, 16 Jul 2001 14:04:20 +0100
From: "Terry" <dcs@ntlworld.com>
Subject: epoch time to date
Message-Id: <wBB47.36701$WS4.5820140@news6-win.server.ntlworld.com>

Hi,

I can get a files 'last modified' time by using

      my @stat_info = stat($filename);

and then accessing $stat_info[9]

This gives me the last modified time in seconds since the epoch (00:00
January 1, 1970 GMT).

Is there a function to convert this to a date?

TIA

Terry





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

Date: Mon, 16 Jul 2001 14:17:59 +0100
From: "Terry" <dcs@ntlworld.com>
Subject: Re: epoch time to date
Message-Id: <kOB47.36762$WS4.5824604@news6-win.server.ntlworld.com>

"Terry" <dcs@ntlworld.com> wrote in message
news:wBB47.36701$WS4.5820140@news6-win.server.ntlworld.com...
> Hi,
>
> I can get a files 'last modified' time by using
>
>       my @stat_info = stat($filename);
>
> and then accessing $stat_info[9]
>
> This gives me the last modified time in seconds since the epoch (00:00
> January 1, 1970 GMT).
>
> Is there a function to convert this to a date?

Yes, and if I'd RTFM a bit closer I would have found that

     my @stat_date = localtime($stat_info[9]);

does it and that $stat_date[3], $stat_date[4] and  $stat_date[5], would have
given me what I wanted :O)

Oh well! Sorry about that :)

Terry




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

Date: 16 Jul 2001 08:50:12 -0500
From: Tony Curtis <tony_curtis32@yahoo.com>
Subject: Re: epoch time to date
Message-Id: <87d771t23v.fsf@limey.hpcc.uh.edu>

>> On Mon, 16 Jul 2001 14:17:59 +0100,
>> "Terry" <dcs@ntlworld.com> said:

> Yes, and if I'd RTFM a bit closer I would have found
> that

>      my @stat_date = localtime($stat_info[9]);

> does it and that $stat_date[3], $stat_date[4] and
> $stat_date[5], would have given me what I wanted :O)

> Oh well! Sorry about that :)

And don't forget the File::stat module.  It has a nicer
interface: subscript [n] is neither descriptive nor
intuitive.

    perldoc File::stat

And for formatting dates, there's also POSIX::strftime()
which saves you the work of pulling the result of
localtime() apart.

    perldoc POSIX

hth
t
-- 
Beep beep!  Out of my way, I'm a motorist!


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

Date: Mon, 16 Jul 2001 15:20:57 +0100
From: "Terry" <dcs@ntlworld.com>
Subject: Re: epoch time to date
Message-Id: <lJC47.36870$WS4.5846324@news6-win.server.ntlworld.com>

"Tony Curtis" <tony_curtis32@yahoo.com> wrote in message
news:87d771t23v.fsf@limey.hpcc.uh.edu...
> >> On Mon, 16 Jul 2001 14:17:59 +0100,
> >> "Terry" <dcs@ntlworld.com> said:
>
> > Yes, and if I'd RTFM a bit closer I would have found
> > that
>
> >      my @stat_date = localtime($stat_info[9]);
>
> > does it and that $stat_date[3], $stat_date[4] and
> > $stat_date[5], would have given me what I wanted :O)
>
> > Oh well! Sorry about that :)
>
> And don't forget the File::stat module.  It has a nicer
> interface: subscript [n] is neither descriptive nor
> intuitive.
>
>     perldoc File::stat
>
> And for formatting dates, there's also POSIX::strftime()
> which saves you the work of pulling the result of
> localtime() apart.
>
>     perldoc POSIX

Thanks for this Tony :)

Terry

>
> hth
> t
> --
> Beep beep!  Out of my way, I'm a motorist!




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

Date: Mon, 16 Jul 2001 08:13:17 -0500
From: Michael Carman <mjcarman@home.com>
Subject: Re: Finding size of HTML page via HTTP
Message-Id: <3B52E86D.DE87FA09@home.com>

Jeremy Smith wrote:
> 
[Attribution lost; 'twas Randal]

> > First, misposting.
> > Second, not "getting it" about being criticized.
> > Third, sending a different message to the group from the 
> > message you sent me.
> >
> > Three strikes.
> 
> This isn't baseball, m8, it's a newsgroup! :-)

Which means that nobody owes you an answer for anything. Any one of
those things *could* have earned you a killfile entry, though most
people wouldn't if you wised up quickly. All three, on the other hand...
 
> Or do you make the rules up as you go along?

The rules here are well established. You just haven't learned them yet.
 
> > Methinks you'll be plonked for a good long time as an
> > untrainable, therefore unhelpable lunkhead.  Enjoy.
> 
> I'm not a pet, you don't have to 'train' me, just give me the
> benefit of the doubt.

Let's see, you asked a CGI question for a C program in a Perl
newsgroup... Yeah, I think you need training. ;)
 
> Methinks I think I'll enjoy being "plonked", it sounds fun.

Not likely:

plonk excl.,vt. 
  The sound a newbie makes as he falls to the bottom of a kill file. 

You've just managed to estrange yourself from one of the most
knowledgable people in this newsgroup. It wouldn't matter much if you
p*ssed me off -- I'm only a mid-level hacker and don't answer all that
many questions anyway. Randal, on the other hand, is the well-respected
author of numerous books and articles, and he gets paid to teach people
Perl. Do you have any idea how much the advice he gives here -- for free
-- would cost if you had to hire him as a consultant? You don't want
people like that systematically ignoring your posts.

-mjc


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

Date: 16 Jul 2001 06:04:51 -0700
From: orenB@CogniTens.com (oren blum)
Subject: Format problems
Message-Id: <405a6b35.0107160504.354f2b19@posting.google.com>

Hi all,
i have 2 problems:
------------------------------------------
1. i wrote this :
format TOP1=
@<<<<<<<<<< @>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
"Params",$params
 .
i got this error :
"Missing right curly or square bracket at "filename" line XX at end of
linsyntax error at "filename" line XX at EOF. "

if i change @<<<<<<<< with @>>>>>>> - its work.
------------------------------------------
2 when i try to use this command "write (TOP1);" - its not working
instead i write "local $~="TOP1";
                 write;	- this work. 
          why the firt syntax not working ?

i am using PerlBuilder 2.0c, perl.exe - 5.6.0


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

Date: Mon, 16 Jul 2001 08:52:24 -0500
From: cp <cpryce@pryce.net>
Subject: Re: Hard DBI question
Message-Id: <B7785BC8.8960%cpryce@pryce.net>

in article 9iq0id$2cuj$1@cti15.citenet.net, Neb at berube@odyssee.net wrote
on 07/14/2001 12:53 PM:

> 
> I'm currently working with the DBI and DBD::ODBC modules to query a MS SQL
> Server database.  I've been able to execute stored proc and play with the
> resultset.  My problem is when my SP actually use the RETURN function to
> return a value (for example, an error code).
> 
> Problem is that I can't find a way to retrieve that value.  The
> $sth->bind_param_inout doesn't work with MS SQL, so I can't get the value
> with an OUTPUT parameter.
> 
> I've search through all the "Perl DBI" book, but no explanation about that
> (neither about SP).  Anyone knows an anwser ?

The book [1] does list a format. Call stored procedures with an ODBC escape
sequence. With a bound out put parameter:

{? = call procedure_name (?,?)}

While the book[1] mentions that DBD::ODBC does not currently support bound
output parameters, I have it from several sources that the most current
version of the driver now does.

YMMV

cp

[1] of course: Programming the Perl DBI; Alligator Descartes & Tim Bunce;
February 2000; p. 296




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

Date: 16 Jul 2001 05:52:30 -0700
From: gururaj@powertec.com (Gururaj Upadhye)
Subject: Re: How to resolve multi process issue???
Message-Id: <23c54ab6.0107160452.6d391606@posting.google.com>

>            This problem can usually be solved by making the inner
>            subroutine anonymous, using the `sub {}' syntax.  When
>            inner anonymous subs that reference variables in outer
>            subroutines are called or referenced, they are
>            automatically rebound to the current values of such
>            variables.

I did not try putting the sub {}. But I reconfigured apache to run
this file as regular cgi executable, using the handler cgi-script. It
worked !!!

Thanks,
Gururaj.


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

Date: Mon, 16 Jul 2001 12:30:12 +0200
From: "H. Merijn Brand" <h.m.brand@hccnet.nl>
To: comp.lang.perl.misc
Subject: Re: Installing DBD on AIX 4.3.3
Message-Id: <Xns90E07F313BB7CMerijn@192.0.1.90>

q_mac@hotmail.com (Y) wrote in 
news:e7bb86d8.0107141014.30515bb@posting.google.com:

> After I installed DBI 1.15, I get this message when I try to make
> DBD-DB2-0.75..

1. Why use 1.15 when 1.18 is out since begin july 2001?

> ld: 0711-851 SEVERE ERROR: Output file: blib/arch/auto/DBD/DB2/DB2.so
>         The file is in use and cannot be overwritten.
> make: The error code from the last command is 12.

2. .../DBI-1.18 > find . -name \*.so | xargs rm -f
   .../DBI-1.18 > make distclean
   .../DBI-1.18 > perl Makefile.PL
   .../DBI-1.18 > make
   .../DBI-1.18 > make test
   .../DBI-1.18 > make install UNINST=1
3. .../DBD-DB2 > find . -name \*.so | xargs rm -f
   .../DBD-DB2 > make distclean
   .../DBD-DB2 > perl Makefile.PL
   .../DBD-DB2 > make
   .../DBD-DB2 > make test
   .../DBD-DB2 > make install UNINST=1

It's somehow AIX specific that .so libs, once used, won't be removed when 
tried so on the first go. The rm will force it so.

> I have been running a script using the DBI functions but have it has
> long been stopped. I have closed and re opened my session and it still
> give this error.
> HELP.

HTH

-- 
H.Merijn Brand    Amsterdam Perl Mongers (http://www.amsterdam.pm.org/)
using perl-5.6.1, 5.7.1 & 628 on HP-UX 10.20 & 11.00, AIX 4.2, AIX 4.3,
     WinNT 4, Win2K pro & WinCE 2.11 often with Tk800.022 &/| DBD-Unify
ftp://ftp.funet.fi/pub/languages/perl/CPAN/authors/id/H/HM/HMBRAND/


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

Date: 16 Jul 2001 10:26:37 GMT
From: kao98@texel02.doc.ic.ac.uk (Karl Orbell)
Subject: Re: Locale error when starting Perl
Message-Id: <slrn9l5gat.g9b.kao98@texel02.doc.ic.ac.uk>

I posted this to another message as an answer for a similar problem, this 
may help.  Note that the code "en" is normally not present on it's own, 
use either en_US or en_GB or otherwise.

Karl.
-----------------------------------------------------------------

I've had this problem myself recently and I traced it down to the fact
that I didn't have the locales I was requesting setup.  I'm a debian user,
so I'm not sure if this is the same as RedHat, but the default install   
only sets up the en_US locale, which is stored in /usr/lib/locale.

To get the others setup, I had to edit a configuration file
/etc/locale.gen and uncomment all of the locales that I required.

I then had to run locale-gen (as root), this generates the required
locales.  After this the locales all worked fine, for everything.

Note that this setups the locales using the strict xx_XX language codes,
so if you want french - french ( as apposed to canadian french fr_CA) you
have to specify fr_FR.  Likewise there is no "en" on it's own, if you want
these two letter versions you'll have to add an entry in
/etc/locale.alias.

Hope that helps.

Karl.
-----------------------------------------------------------------
On Mon, 16 Jul 2001 10:34:48 +0900, jean_christian@hotmail.com 
<jean_christian@hotmail.com> wrote:
>Thanks for the reply! I have been posting to various mailing lists and
>newsgroups for a few days now but no answer. Either this is a very basic
>question and not worthy of an answer (I doubt it) or no one knows.
>
>There is mention of this problem in the perldocs but the solutions offered
>don't work.
>
>I tried what you segguested but it didn't help. Here's the output of what I
>did. If I misunderstood your solution or did it wrong please let me know.
>
>Jc
>
>[root@dev /root]# unset LANG
>[root@dev /root]# echo $LANG
>
>[root@dev /root]# /etc/rc.d/init.d/httpd start
>Starting httpd: perl: warning: Setting locale failed.
>perl: warning: Please check that your locale settings:
> LANGUAGE = (unset),
> LC_ALL = (unset),
> LANG = "en"
>    are supported and installed on your system.
>perl: warning: Falling back to the standard locale ("C").
>perl: warning: Setting locale failed.
>perl: warning: Please check that your locale settings:
> LANGUAGE = (unset),
> LC_ALL = (unset),
> LANG = "en"
>    are supported and installed on your system.
>perl: warning: Falling back to the standard locale ("C").
>                                                           [FAILED]
>[root@dev /root]#
>
>
>
>>From: "Daniel A. Johnson" <ab496@chebucto.ns.ca>
>>To: Jean-Christian Imbeault <jean_christian@hotmail.com>
>>Subject: Re: Locale error when starting Perl
>>Date: Sun, 15 Jul 2001 21:21:35 -0300 (ADT)
>>
>>
>>Hello,
>>
>>I came across your posting in the comp.lang.perl.misc newsgroup. One way
>>to get rid of the error message is to use command (from command line):
>>
>>unset LANG
>>
>>It would be better to fix things with locale yet this technique will get
>>rid of the annoying error message when trying to do some work. Each reboot
>
>>you would have to use the unset again.
>>
>>Sorry I don't have a better fix yet I have not explored locale much deeper
>
>>than that. ;)
>>
>>- Dan
>>
>>----------------------------------------------------------------------------
>
>>email     : booner@tkc.bilby.com
>>Home Page : http://tkc.bilby.com/~booner/
>>
>>Voice Line : (902) 455-9677
>>-----------------------------------------------------------------------------
>
>>
>>On Sun, 15 Jul 2001, Jean-Christian Imbeault wrote:
>>
>> > I'm trying to get my apache web server up and running but everytime I
>> > try I
>> > get a perl error about locale settings. I have tried a few things to
>get
>> > it
>> > to work but none effective.
>> >
>> > I'm using RH7.1, and have setup japanese language support (japanese kb,
>
>> > sometimes I input japanese) with the folowing Apache and Perl versions:
>
>> >
>> > Apache/1.3.19 (Unix)  (Red-Hat/Linux)
>> >
>> > Perl, v5.6.0 built for i386-linux
>> >
>> > This is the error message I get:
>> >
>> > [root@dev /root]# /etc/rc.d/init.d/httpd start
>> > Starting httpd: perl: warning: Setting locale failed.
>> > perl: warning: Please check that your locale settings:
>> > LANGUAGE = (unset),
>> > LC_ALL = (unset),
>> > LANG = "en"
>> >   are supported and installed on your system.
>> > perl: warning: Falling back to the standard locale ("C").
>> > perl: warning: Setting locale failed.
>> > perl: warning: Please check that your locale settings:
>> > LANGUAGE = (unset),
>> > LC_ALL = (unset),
>> > LANG = "en"
>> >   are supported and installed on your system.
>> > perl: warning: Falling back to the standard locale ("C").
>> >                                                          [FAILED]
>> > [root@dev /root]#
>> >
>> >
>> > Thanks for the help!
>> >
>> > Jc
>> >
>> >
>> >
>>
>
>
>> I'm trying to get my apache web server up and running but everytime I
>> try I
>> get a perl error about locale settings. I have tried a few things to get
>> it
>> to work but none effective.
>>
>> I'm using RH7.1, and have setup japanese language support (japanese kb,
>> sometimes I input japanese) with the folowing Apache and Perl versions:
>>
>> Apache/1.3.19 (Unix)  (Red-Hat/Linux)
>>
>> Perl, v5.6.0 built for i386-linux
>>
>> This is the error message I get:
>>
>> [root@dev /root]# /etc/rc.d/init.d/httpd start
>> Starting httpd: perl: warning: Setting locale failed.
>> perl: warning: Please check that your locale settings:
>> LANGUAGE = (unset),
>> LC_ALL = (unset),
>> LANG = "en"
>>   are supported and installed on your system.
>> perl: warning: Falling back to the standard locale ("C").
>> perl: warning: Setting locale failed.
>> perl: warning: Please check that your locale settings:
>> LANGUAGE = (unset),
>> LC_ALL = (unset),
>> LANG = "en"
>>   are supported and installed on your system.
>> perl: warning: Falling back to the standard locale ("C").
>>                                                          [FAILED]
>> [root@dev /root]#
>>
>> Thanks for the help!
>>
>> Jc
>


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

Date: Mon, 16 Jul 2001 08:49:54 -0500
From: Michael Carman <mjcarman@home.com>
Subject: Re: Looking for the right direction
Message-Id: <3B52F102.D7C69E9D@home.com>

Ruth wrote:
> 
> I am new at using Tk

The best place to get help on Perl/Tk matters is in comp.lang.perl.tk.

> [I] feel a little like im trying to reinvent the wheel on some
> issues, like general text editor functions, like opening files
> and such forth.

There are a number of pre-built composite widgets, including text areas
and file selection dialogs. There is a widget demo which is very helpful
in getting started. (Try typing "widget" from a command prompt.)

Take a look at the Perl/Tk FAQ:

http://w4.lns.cornell.edu/~pvhp/ptk/ptkTOC.html

Finally, a trip to your local bookstore may be in order as well. Look
for "Learning Perl/Tk" by Nancy Walsh (O'Reilly).

-mjc


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

Date: Mon, 16 Jul 2001 08:30:57 -0500
From: "SI" <butch@sheltonbusinessmachines.com>
Subject: Need assistance with a RE
Message-Id: <995290259.163614@nntp.accessus.net>

I have a database that looks like the following:


IDDDDDDDLASTNAME,FIRSTNAME      SSN-XX-XXXXADDRESS      DD        (DDD)
XXX-XXXXIDDDDDDDLASTNAME,FIRSTNAME    (etc)

There is an ID number (IDDDDDDD) that is a capital letter followed by 7
digits.  Then (without a space or other delimiter) the lastname field.  The
records all end with the phone number then without any delimiter, there is
the next ID number.  The entire file is one line.  I have experimented with
several expressions in an attempt to insert a CR before each ID number (this
will allow me to import the data).  Can someone lend a hand with a script
(or just the RE) that will accomplish this?

--
Butch Evans
Business Machines
800-339-4803 or 573-276-4803





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

Date: Mon, 16 Jul 2001 09:35:05 -0400
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: Need assistance with a RE
Message-Id: <slrn9l5rc9.5c2.tadmc@tadmc26.august.net>

SI <butch@sheltonbusinessmachines.com> wrote:
>I have a database that looks like the following:
>
>IDDDDDDDLASTNAME,FIRSTNAME      SSN-XX-XXXXADDRESS      DD        (DDD)
>XXX-XXXXIDDDDDDDLASTNAME,FIRSTNAME    (etc)


You really really should disable wordwrapping when posting long
data lines.

Having *exact* data is very important when developing a pattern
to match the data. You're word-wrap messed up the data in the
only area of interest.

I will assume that the area code is butted up against the phone number.


>There is an ID number (IDDDDDDD) that is a capital letter followed by 7
>digits.  Then (without a space or other delimiter) the lastname field.  The
>records all end with the phone number then without any delimiter, there is
>the next ID number.  The entire file is one line.  

>I have experimented with
>several expressions in an attempt to insert a CR before each ID number 
                                             ^^^^

You are on a Mac then?

I assume you meant newline (line feed) instead.


>Can someone lend a hand with a script
>(or just the RE) that will accomplish this?


--------------------------
#!/usr/bin/perl -w
use strict;

$_ = 'A1234567Evans,Butch other_stuff (573)276-4803'
   . 'B1234567Wall,Larry other_stuff (123)456-7890'
   . 'C1234567McClellan,Tad other_stuff (800)555-1212';
print "before:\n$_\n";

s/(\(\d{3}\)\d{3}-\d{4})([A-Z]\d{7})/$1\n$2/g;
print "after:\n$_\n";
--------------------------


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


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

Date: Mon, 16 Jul 2001 08:31:12 -0500
From: Michael Carman <mjcarman@home.com>
Subject: Re: perl debugger
Message-Id: <3B52ECA0.50279EC1@home.com>

James Taylor wrote:
> 
> In article <3b549a35.23305062@enews.newsguy.com>,
> Chad Yoshikawa <m_010@yahoo.com> wrote:
> >
> > I found programming in perl is hard since It don't have a nice
> > debugger.  What do you guys think?

But it does! If you invoke perl with the -d flag your script will be
launched in the standard debugger. See the perldebug manpage (type
"perldoc perldebug" at a command prompt) for info on how to use it.

If text-based debugging frightens you, take a look at ptkdb. It's a GUI
wrapper (written in Tk) around the standard debugger. It's not part of
the standard distro, so you'll probably need to install it yourself.
 
> I think you must have the wrong approach to programming.
> 
> I produce working Perl code, and I don't use a debugger.
> Those two things are not unrelated: I don't use a debugger
> and *therefore* I produce working Perl code.

That may be the silliest argument I've ever heard. Are you really such a
gifted programmer that all of your programs -- no matter how complex --
work perfectly the first time? If so, then I salute you. For us mere
mortals, however, the debugger can be an invaluble tool.

-mjc


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

Date: Mon, 16 Jul 2001 12:33:25 +0000
From: gnari <gnarinn@hotmail.com>
Subject: Re: please help urgent
Message-Id: <995286805.126196279190481.gnarinn@hotmail.com>

In article <p%o47.7040$W6.3662854@news2.rdc1.ab.home.com>,
Ibrahim Hamouda <iham@internode.net> wrote:

(snipped problem about cgi params not working correctly when used as
arguments to shell command)

(snipped overly long script with lots of irrelevant stuff)

>
>open (FAX, "|/usr/local/bin/sendemailfax $email $ADDRESS $MSGS"); # Only the
>first two parameters are passed
>

what you are doing here, is to assemple a long command line, and
asking the operating system to execute it.

apart from the security issues (serious), for this to work,
the resulting command line must be valid, so the variables used must not
contain characters that have special meaning in command lines.
for example: * $ and ;

I do not know this /usr/local/bin/sendemailfax, but I cannot imagine a sane
email of fax program that requires the body of the message on the command
line.

are you sure that you do not need to do something like:
  open (FAX, "|/usr/local/bin/sendemailfax $email $ADDRESS")
    or die "could not open FAX:$!" ;
  print FAX $MSGS;
  close FAX;
this would seem to be a much more natural way to do it.

gnari



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

Date: 16 Jul 2001 11:57:18 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Replacing a word in a file
Message-Id: <9iukqu$eh8$2@mamenchi.zrz.TU-Berlin.DE>

According to Christopher  <cpryce@pryce.net>:
> in article 20054-3B4FEB41-101@storefull-245.iap.bryant.webtv.net, BUCK
> NAKED1 at dennis100@webtv.net wrote on 07/14/2001 1:48 AM:
> 
> > I do wonder why that FAQ about deleting a line, and inserting... uses such a
> > bloated example, though.
> 
> That one liner _is_ in the FAQ.

Moreover, the one-liner is just a shorter way to make Perl do exactly
the "bloated" stuff (read the original, write the modified file, rename
the modified file to the original).  It just looks simpler because it
hides some detail.

Anno


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

Date: Mon, 16 Jul 2001 13:55:22 +0300
From: "Haim Lichaa" <haim.lichaa@intel.com>
Subject: Re: Why is socket timeout not working?
Message-Id: <9iuh71$63s@news.or.intel.com>

It's not the lookup that's timing out.  And I also tried under perl 5.00404.
It seems to be a Solaris 2.51 issue because with perl 5.00404 under Solaris
8 and HP it works.


<nobull@mail.com> wrote in message news:u9elrjisw9.fsf@wcl-l.bham.ac.uk...
> "Haim Lichaa" <haim.lichaa@intel.com> writes:
>
> > I'm using this perl snipit on a Solaris 2.51 box running Perl 5.00403
> >
> > my($s)=IO::Socket::INET->new(
> >   PeerAddr        => $host,
> >   PeerPort        => $port,
> >   Proto           =>'tcp',
> >   Type            => SOCK_STREAM,
> >   Timeout         => $to);
> >
> > and any $to value has no affect on the Timeout. It remains constat @
~4mins.
> > Any body know why and how I can fix it?
>
> I vaguely recall that the version of IO::Socket::INET that shipped
> with 5.00403 didn't implement timouts properly.
>
> Are you sure that it's the socket connect that's timing out not the
> name lookup?
>
> --
>      \\   ( )
>   .  _\\__[oo
>  .__/  \\ /\@
>  .  l___\\
>   # ll  l\\
>  ###LL  LL\\




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

Date: 16 Jul 2001 03:35:02 -0700
From: coldwave@bigfoot.com (John Holdsworth)
Subject: Yet another Perl Web Server
Message-Id: <2a46b11e.0107160235.3e8ab889@posting.google.com>

Hi,

I've developed a perhaps rather excentric
Perl Web Server if it is of interest.

It has some rather unusual features:

No configuration file (c.f. Apache!)
Virtual hosting by creating multiple document directories.
Able to proxy a symbolic link through to another server.
Can run CGI scripts without forking for each request.
Embeddeds perl in a Web page (PSP)
Robust.

Unfortunately documentation has not been my priority
but it is reasonably easy to run. Download the server
from http://www.openpsp.org/download.html, uncompress
and untar the results then run "server.pl" in the
resulting directory and browse to http://<yourhost>:9090/

Any suggestions/bug reports appreciated.

Cheers

John.
coldwave@thunder.it


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

Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 6 Apr 01)
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.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 V10 Issue 1311
***************************************


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