[16260] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 3672 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Jul 14 18:10:42 2000

Date: Fri, 14 Jul 2000 15:10:30 -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: <963612629-v9-i3672@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Fri, 14 Jul 2000     Volume: 9 Number: 3672

Today's topics:
        CGI problem, newbie, code follows.... (Russell Smallwood)
        clear query string sethipra@wellsfargo.com
    Re: DBI - DBD:Sybase installation problem (Nobody)
    Re: detecting commonly misspelled words (Tad McClellan)
    Re: detecting commonly misspelled words (Clinton A. Pierce)
    Re: detecting promiscuous mode <sp00fD@yahoo.com>
        error in script-why? mwkohout@hotmail.com
    Re: error in script-why? <care227@attglobal.net>
    Re: error in script-why? mwkohout@hotmail.com
    Re: Flock unsupported on which systems? (Michel Dalle)
    Re: Flock unsupported on which systems? <toddg@linux45.ma.utexas.edu>
    Re: Flock unsupported on which systems? (Clinton A. Pierce)
    Re: Help with database access via DBI... (Anthony DeLorenzo)
    Re: Help with database access via DBI... <agarian@my-deja.com>
    Re: Help with file concatination <lr@hpl.hp.com>
    Re: how to convert "1.2.3.10" to "01020310"? (Craig Berry)
    Re: how to convert "1.2.3.10" to "01020310"? (Craig Berry)
    Re: looking for ntp example please (Eric Bohlman)
        lynx and Expect.pm <jboes@eoexchange.com>
    Re: lynx and Expect.pm <uri@sysarch.com>
        Memory Leak jvirgil0624@my-deja.com
        modify source file <jmarsan@my-deja.com>
    Re: modify source file <sariq@texas.net>
    Re: modify source file (Craig Berry)
    Re: msgsnd/msgrcv problem timhood@bigfoot.com
        Need advice on converting excel files. <znanie@shell5.ba.best.com>
        Need advice on converting excel files. <znanie@shell5.ba.best.com>
    Re: NEt::POP3 difficulties (Jeremy Cope)
    Re: New book on web dev with Perl <lauren_smith13@hotmail.com>
    Re: Perl CGI and browser timeout <jsmoriss@jsm-mv.dyndns.org>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Fri, 14 Jul 2000 17:53:21 -0500
From: rsmallwood@mindspring.com (Russell Smallwood)
Subject: CGI problem, newbie, code follows....
Message-Id: <MPG.13d963e7fdf61aaf989760@news.giganews.com>

My question is very simple, when I run this:


use CGI;

$wp=new CGI;

$name=$wp->param ('name');
$organization=$wp->param ('organization');
$workphone=$wp->param ('workphone');
$fax=$wp->param ('fax');
$URL=$wp->param ('URL');
$email=$wp->param ('email');
$title=$wp->param ('titile');

	print >>EOF;

<html>

<head>

<title>Whoops</title>
</head>

<body topmargin='0' leftmargin='0'>

<p><img border='0' src='images/smallheader.JPG' width='527' height='61'>
</p>
<p><b><font face='Arial' size='5'>&nbsp; Whoops..</font></b></p>
<p><font face='Arial'>&nbsp;&nbsp;&nbsp;&nbsp; Please fill out the form 
entirely
before hitting the submit button.<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; You 
may use
your browser\'s <b>&quot;back&quot;</b> button to continue without 
loosing your
work.</font></p>
<p>&nbsp;</p>

</body>

</html>

EOF

I get this

CGI Error
The specified CGI application misbehaved by not returning a complete set 
of HTTP headers. The headers it did return are:


Bareword found where operator expected at D:\Maple\wwwroot\scripts
\webimportdemo.pl line 22, near "


Line 22 is 

<title>Whoops</title>

If this is a dumb question, please point me in the right direction, 
perhaps some recommended reading. I've read the official guide to 
Programming with CGI.pm but as I am not an HTML programmer I was hoping 
to create some mockups in Front Page, and cut and paste them into my 
scripts using print >>.  Perhaps this is a bad idea?  Weird thing is 
that I did this on a couple of other pages and they work fine.  I've 
compared them to this and they seem to be identical.

Russell

Russell


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

Date: Fri, 14 Jul 2000 20:52:26 GMT
From: sethipra@wellsfargo.com
Subject: clear query string
Message-Id: <8knui2$vv8$1@nnrp1.deja.com>

Hi,

I can delete my query string sent through POST method by saying :
CGI::delete_all() ;

can you pls tell me a way to clear my query string in GET method so
that it is not shown in address bar always

thanks in advance

Prad


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


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

Date: 14 Jul 2000 19:32:10 GMT
From: nobody@contract.Sun.COM (Nobody)
Subject: Re: DBI - DBD:Sybase installation problem
Message-Id: <8knprq$b39$1@eastnews1.east.sun.com>

In article <slrn8mr6dg.rhj.andy@monk.ford.saint-louis.mo.us>,
Andy Ford <andyford@brick.net> wrote:
>On Tue, 11 Jul 2000 20:52:31 GMT, vpanicker@my-deja.com <vpanicker@my-deja.com> wrote:
>>Hi All,
>>
>>I have a situation in which i need to connect to and access an SQL
>>Server 7.0 (serv pack 2) thru a perl application residing on a
>>different server. I have tried installing DBD:sybase for this, which
>>led me to install CT Lib. which is a pre-requisit for DBD:Sybase. Now
>>CT Lib installation requires sybase server to be available on the
>>server which is running the perl application. This sounds a little
>>weired(not feasible too). Does anybody know any other option for
>>achiving this task?
>>

You can use DBI::Proxy on the machine running the Perl application
and on the Windoze box.  Then you can install the DBD of your choice
on the Windoze side (but you still need the libraries - does DBD::Sybase
talk to MS SQL Server libs?).  You can always use ODBC (or ADO?) if the 
libraries are incompatible.

Anita





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

Date: Fri, 14 Jul 2000 13:17:16 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: detecting commonly misspelled words
Message-Id: <slrn8muios.e4e.tadmc@magna.metronet.com>

On Fri, 14 Jul 2000 17:05:55 GMT, Brian <brian@my-deja.com> wrote:
>Does anyone know if there are any packages out there that will suggest
>a correction for a misspelled word. I.e. return 'coffee' for 'cofee' or
>'coffe'?
>
>Does anyone have any experience in writing one?


I posted a crude one here 4 days ago.


   Subject: Re: Experienced PERL / CGI programmers needed
   Message-Id: <slrn8mjumv.v3.tadmc@magna.metronet.com>


-- 
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


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

Date: Fri, 14 Jul 2000 18:25:05 GMT
From: clintp@geeksalad.org (Clinton A. Pierce)
Subject: Re: detecting commonly misspelled words
Message-Id: <5WIb5.36903$fR2.339089@news1.rdc1.mi.home.com>

[Posted and mailed]

In article <8knh96$lbc$1@nnrp1.deja.com>,
	Brian <brian@my-deja.com> writes:
> Does anyone know if there are any packages out there that will suggest
> a correction for a misspelled word. I.e. return 'coffee' for 'cofee' or
> 'coffe'?
> 
> Does anyone have any experience in writing one?
> 
> I searched CPAN but came up with nothing.

http://language.perl.com/ppt  and look for spell


-- 
    Clinton A. Pierce              Teach Yourself Perl in 24 Hours! 
  clintp@geeksalad.org         for details see http://www.geeksalad.org
"If you rush a Miracle Man, 
	you get rotten Miracles." --Miracle Max, The Princess Bride


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

Date: Fri, 14 Jul 2000 20:53:46 GMT
From: sp00fD <sp00fD@yahoo.com>
Subject: Re: detecting promiscuous mode
Message-Id: <8knuki$vvj$1@nnrp1.deja.com>

In article <x9qb5.35515$fR2.325812@news1.rdc1.mi.home.com>,
  clintp@geeksalad.org (Clinton A. Pierce) wrote:
> [Posted and mailed]
>
> In article <8kkrgn$ljf$1@nnrp1.deja.com>,
> 	sp00fD <sp00fD@yahoo.com> writes:
> > Can anyone tell me how I might go about using perl to discover if
any
> > ethernet interfaces are in promiscuous mode (Solaris), without using
> > external programs (i.e. ifstatus and the like)??
>
> The only hope you would have would be to open the ethernet device
> and find an ioctl query that could tell you this.
>
> This is very, very device and operating system dependant.
>
> A good starting point to read about this would be the ioctl(2)
manpage,
> sys/ioctl.h and ioctl_list(2).
>
> --
>     Clinton A. Pierce              Teach Yourself Perl in 24 Hours!
>   clintp@geeksalad.org         for details see
http://www.geeksalad.org
> "If you rush a Miracle Man,
> 	you get rotten Miracles." --Miracle Max, The Princess Bride
>

Thanks, I read a bit of the ifstatus source, and it seems to do a lot
of kvm stuff (i.e. kvm_read to get the status and whatnot).  This is
rough stuff.  I can't figure out what function the ioctl would need.


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


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

Date: Fri, 14 Jul 2000 18:28:33 GMT
From: mwkohout@hotmail.com
Subject: error in script-why?
Message-Id: <8knm3r$p4l$1@nnrp1.deja.com>

I'm getting an error message when I run this line in one of my
scripts-does anyone have an idea on the problem?

while ($doagain)
	{
line of error:if ((($line=~/\\/ )
!=0)||($line=~/^\n/)) 			                  $doagain=0;
	    my(@fields)=split /\s/, $line;

I'm getting this error message:

# perl parser2.pl
Scalar found where operator expected at parser2.pl line 23, at end of
line
        (Missing operator before ?)
syntax error at parser2.pl line 23, near ") $doagain"
Execution of parser2.pl aborted due to compilation errors.
mkohout@jazz# perl parser2.pl
Scalar found where operator expected at parser2.pl line 23, at end of
line
        (Missing operator before ?)
syntax error at parser2.pl line 23, near ") $doagain"
Execution of parser2.pl aborted due to compilation errors.

any ideas would be appreciated

mike kohout


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


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

Date: Fri, 14 Jul 2000 14:43:22 -0400
From: Drew Simonis <care227@attglobal.net>
Subject: Re: error in script-why?
Message-Id: <396F5F4A.CB55977E@attglobal.net>

mwkohout@hotmail.com wrote:
> 
> I'm getting an error message when I run this line in one of my
> scripts-does anyone have an idea on the problem?
> 
> while ($doagain)
>         {
> line of error:if ((($line=~/\\/ )
> !=0)||($line=~/^\n/))                                     $doagain=0;
>             my(@fields)=split /\s/, $line;
> 

This post is very hard to read, but let me see if i can 
put some order into it:

while ($doagain)
{
	if ((($line=~/\\/ )
!=0)||($line=~/^\n/))                                     
		$doagain=0;
             	my(@fields)=split /\s/, $line;
 

So...  the code is badly incomplete, but I think I can see your 
problem.

	if ((($line=~/\\/ ) !=0)||($line=~/^\n/)) 
		$doagain=0;

You are missing the opening brace for that if statment.


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

Date: Fri, 14 Jul 2000 21:41:45 GMT
From: mwkohout@hotmail.com
Subject: Re: error in script-why?
Message-Id: <8ko1el$27g$1@nnrp1.deja.com>

doh.  you're right....somehow, I had a brain fart and forgot them.

thanks
mike kohout

In article <396F5F4A.CB55977E@attglobal.net>,
  Drew Simonis <care227@attglobal.net> wrote:
> mwkohout@hotmail.com wrote:
> >
> > I'm getting an error message when I run this line in one of my
> > scripts-does anyone have an idea on the problem?
> >
> > while ($doagain)
> >         {
> > line of error:if ((($line=~/\\/ )
> > !=0)||($line=~/^\n/))
$doagain=0;
> >             my(@fields)=split /\s/, $line;
> >
>
> This post is very hard to read, but let me see if i can
> put some order into it:
>
> while ($doagain)
> {
> 	if ((($line=~/\\/ )
> !=0)||($line=~/^\n/))
> 		$doagain=0;
>              	my(@fields)=split /\s/, $line;
>
> So...  the code is badly incomplete, but I think I can see your
> problem.
>
> 	if ((($line=~/\\/ ) !=0)||($line=~/^\n/))
> 		$doagain=0;
>
> You are missing the opening brace for that if statment.
>


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


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

Date: Fri, 14 Jul 2000 18:07:06 GMT
From: michel.dalle@usa.net (Michel Dalle)
Subject: Re: Flock unsupported on which systems?
Message-Id: <8knl2c$hhn$1@news.mch.sbs.de>

In article <396F4E5A.29A6B256@hotmail.com>, "Alex T." <samara_biz@hotmail.com> wrote:
>"perldoc perlport" doesn't say flock() is not supported on Windows systems...
> So would it be safe to
>assume that it IS supported?

You must have a more recent version than I have, then. For 5.005_03,
it still says :

flock FILEHANDLE,OPERATION
Not implemented (Mac OS, VMS, RISC OS, VOS). 

Available only on Windows NT (not on Windows 95). (Win32) 


>Thanks!
>
>Alex

You're welcome,

Michel.


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

Date: 14 Jul 2000 18:07:07 GMT
From: Todd Gillespie <toddg@linux45.ma.utexas.edu>
Subject: Re: Flock unsupported on which systems?
Message-Id: <8knksb$gbp$1@geraldo.cc.utexas.edu>

Alex T. <samara_biz@hotmail.com> wrote:
: "perldoc perlport" doesn't say flock() is not supported on Windows systems... So would it be safe to
: assume that it IS supported?

It says that it's only supported on NT, not 95.  It also says that it's not supported on MacOS, VMS,
and RiscOS.

I was hoping for a bit more granularity, like, 'is it supported on Solaris 2.3'?


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

Date: Fri, 14 Jul 2000 19:44:34 GMT
From: clintp@geeksalad.org (Clinton A. Pierce)
Subject: Re: Flock unsupported on which systems?
Message-Id: <C4Kb5.36942$fR2.339482@news1.rdc1.mi.home.com>

[Posted and mailed]

In article <396F4E5A.29A6B256@hotmail.com>,
	"Alex T." <samara_biz@hotmail.com> writes:
> "perldoc perlport" doesn't say flock() is not supported on Windows systems... So would it be safe to
> assume that it IS supported?

Systems which don't have flock() generally don't need it.  (Win95/Win98)
The existance of flock can be tested for with eval.

-- 
    Clinton A. Pierce              Teach Yourself Perl in 24 Hours! 
  clintp@geeksalad.org         for details see http://www.geeksalad.org
"If you rush a Miracle Man, 
	you get rotten Miracles." --Miracle Max, The Princess Bride


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

Date: 14 Jul 2000 18:31:23 GMT
From: gonzo@vex.net (Anthony DeLorenzo)
Subject: Re: Help with database access via DBI...
Message-Id: <8knm9r$2p2p$1@news.tht.net>

This may be considered off-topic for this newsgroup...  

When you run the script from the command line you are running it
as yourself, whereas apache is usually running it as unpriveledged
user 'nobody'.  It it more than likely something you need to work
out with your logins and table permissions in the database engine.

Alternatively, you could try to run the script using POSIX::setuid
or some other method of making the script run as a different user, 
although there are some significant security issues involved in 
doing this with a CGI script.

Whatever you do, do NOT setuid to root.

Regards, 
Tony

-- 
# Anthony DeLorenzo <drgonzo@canada.com>
# http://www.vex.net/~gonzo/
# mojo wire: 209-391-8932


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

Date: Fri, 14 Jul 2000 19:48:35 GMT
From: Agarian <agarian@my-deja.com>
Subject: Re: Help with database access via DBI...
Message-Id: <8knqqc$ssp$1@nnrp1.deja.com>

Thanks for the reply but maybe I did not describe the situation well
enough...

I execute the script from the command shell as user www group www,
my webserver also runs as www group www.

From the command shell all is well - from the web server it chokes.


Agarian


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


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

Date: Fri, 14 Jul 2000 14:06:27 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: Help with file concatination
Message-Id: <MPG.13d920ac4c86fc2398abc9@nntp.hpl.hp.com>

In article <8klb84$2p6$1@nnrp1.deja.com> on Thu, 13 Jul 2000 21:10:44 
GMT, my_deja_v@my-deja.com <my_deja_v@my-deja.com> says...
> Using print OTHERFILE $_ does not work correctly.
> If I use cat then the files remain with the same
> formating (or lack of) while print in Perl
> formats them and when we send them to the mainframe
> they appear as formatted files..

That would be remarkable!  The Perl print() function does nothing except 
send the characters in its list of argument strings sequentially to the 
C library's output function, which writes to an output device handler.  
Except for transforming "\n" for text files on Windows/DOS systems to 
"\r\n", no formatting should take place.

Can you provide a small complete program that demonstrates your 
assertion that cat'ted files and Perl-printed files end up different?

<Jeopardectomy>

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


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

Date: Fri, 14 Jul 2000 19:35:37 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: how to convert "1.2.3.10" to "01020310"?
Message-Id: <smuqs9bmnd656@corp.supernews.com>

Bernard El-Hagin (bernard.el-hagin@lido-tech.net) wrote:
: On Fri, 14 Jul 2000 02:09:20 GMT, ethan <woowk@my-deja.com> wrote:
: >Hi,
: >Hope there someone who can help me with this. I am new to PERL and am
: >facing the problem of convert a string of "2.1.3.14" format
: >to "02010314" format.
: >Do I have to use regression expression?
: 
: This brings up an interesting question. Can this be done in a single
: substitution?

  s/\.?(\d+)/sprintf '%02d', $1/eg;

I actually like this better than my earlier split-map-join solution, and
it's much better golf-wise as well.

--
   |   Craig Berry - http://www.cinenet.net/users/cberry/home.html
 --*--  "Beauty and strength, leaping laughter and delicious
   |   languor, force and fire, are of us." - Liber AL II:20


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

Date: Fri, 14 Jul 2000 19:38:19 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: how to convert "1.2.3.10" to "01020310"?
Message-Id: <smur1b1und6122@corp.supernews.com>

Keith Calvert Ivey (kcivey@cpcug.org) wrote:
: >  $newForm = join '', map { sprintf '%02d', $_ } split /\./, $oldForm;
: 
: Well, you may not have to use a regex (you could do something
: with index(), for example), but your solution did use one (as
: mine would have), right after the word "split".

Little teeny single-character regexes don't count. :)

-- 
   |   Craig Berry - http://www.cinenet.net/users/cberry/home.html
 --*--  "Beauty and strength, leaping laughter and delicious
   |   languor, force and fire, are of us." - Liber AL II:20


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

Date: 14 Jul 2000 21:44:12 GMT
From: ebohlman@netcom.com (Eric Bohlman)
Subject: Re: looking for ntp example please
Message-Id: <8ko1jc$ui6$2@slb3.atl.mindspring.net>

Brandon Metcalf (bmetcalf@nortelnetworks.com) wrote:
: will@mylanders.com writes:
: 
:  > On Thu, 13 Jul 2000 13:32:59 +1000, Robert Chalmers 
:  > <robert@chalmers.com.au> wrote:
:  > >I'm looking for examples of using ntp to fetch the time from servers. Or
:  > >indeed is this possible?
:  > 
:  > 1) yes.
:  > 
:  > 2) comp.protocols.ntp is --> that-a-way.
: 
: [snip]
: 
:  > Once you get things figured out, post back with samples.  I
:  > bet more that just you have wondered about this.
: 
: Interesting.  You tell Robert to go to another newsgroup, but then turn
: around and tell him to post examples in c.l.p.m once he has it figured
: out.
: 
: Lame.

Not lame at all.  The general details of how NTP works aren't
Perl-specific, and hence aren't on topic for c.l.p.m.  The details of a
Perl implementation of NTP, such as Robert might write, *are*
Perl-specific and hence are at least potentially on-topic for c.l.p.m. 



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

Date: Fri, 14 Jul 2000 15:27:15 -0400
From: Jeff Boes <jboes@eoexchange.com>
Subject: lynx and Expect.pm
Message-Id: <396f6a39$0$1503$44a10c7e@news.net-link.net>

I'm looking for anyone who's had experience using Expect.pm to access
lynx. My application is to run lynx as a subprocess and feed it a long
stream of URLs to be translated to text. (I need them in the specific
format output by lynx, for historical reasons, so parsing the HTML isn't
an option.)

I don't have a lot of expertise with Expect.pm, so my first few attempts
at this have resulted in confusion as Expect doesn't find the pattern I
anticipated that lynx would return.

-- 
Jeff Boes        |Computer science is no more   |jboes@eoexchange.com
Sr. S/W Engineer |about computers than astronomy|616-381-9889 ext 18
Change Technology|is about telescopes.          |616-381-4823 fax
EoExchange, Inc. |   --E. W. Dijkstra           |www.eoexchange.com


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

Date: Fri, 14 Jul 2000 19:39:35 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: lynx and Expect.pm
Message-Id: <x7em4wijrd.fsf@home.sysarch.com>

>>>>> "JB" == Jeff Boes <jboes@eoexchange.com> writes:

  JB> I'm looking for anyone who's had experience using Expect.pm to access
  JB> lynx. My application is to run lynx as a subprocess and feed it a long
  JB> stream of URLs to be translated to text. (I need them in the specific
  JB> format output by lynx, for historical reasons, so parsing the HTML isn't
  JB> an option.)

  JB> I don't have a lot of expertise with Expect.pm, so my first few attempts
  JB> at this have resulted in confusion as Expect doesn't find the pattern I
  JB> anticipated that lynx would return.

lynx when interactive is screen oriented. expect expects a line oriented
protocol. so you have a conflict there. it would be simpler to just run
a new lynx for every file you want to download. since lynx is compiled
c, it is fast and your perl code will be easy. lynx has a command line
interface that you can use to control much of its behavior.

uri

-- 
Uri Guttman  ---------  uri@sysarch.com  ----------  http://www.sysarch.com
SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX Consulting
The Perl Books Page  -----------  http://www.sysarch.com/cgi-bin/perl_books
The Best Search Engine on the Net  ----------  http://www.northernlight.com


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

Date: Fri, 14 Jul 2000 18:21:05 GMT
From: jvirgil0624@my-deja.com
Subject: Memory Leak
Message-Id: <8knllu$oul$1@nnrp1.deja.com>

Hello All,
    I was wondering if anyone has encountered any memory leak problems
when accessing secure web pages using LWP?  I have a script that
accesses several hundred web pages that are on a secure web server and
the memory usage of the script slowly grows.  This seems to be
happening everytime I get back a response from the server.  I'd love to
hear any thoughts as to what you think could possibly be the problem.
Thanks!

-John Virgil


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


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

Date: Fri, 14 Jul 2000 18:40:58 GMT
From: JMarsan <jmarsan@my-deja.com>
Subject: modify source file
Message-Id: <8knmrn$pu5$1@nnrp1.deja.com>

Hi,

I would like to know if Perl allows to locate a word in a text file and
replace this word by another directly in the text file without having
to create a new file or overwrite the initial file.

Thanks in advance.

--
J. Marsan
Technician, IT
N.S.D.


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


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

Date: Fri, 14 Jul 2000 13:59:21 -0500
From: Tom Briles <sariq@texas.net>
Subject: Re: modify source file
Message-Id: <396F6309.8F319E1B@texas.net>

JMarsan wrote:
> 
> Hi,
> 
> I would like to know if Perl allows to locate a word in a text file and
> replace this word by another directly in the text file without having
> to create a new file or overwrite the initial file.

The answers to 99% of your Perl questions are as close as your
harddrive.

perldoc perlrun # for the -i switch
perldoc perlop # for the s/// operator

Then, learn to fish:

perldoc perldoc
perldoc perl

- Tom


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

Date: Fri, 14 Jul 2000 21:56:48 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: modify source file
Message-Id: <smv350lgnd626@corp.supernews.com>

JMarsan (jmarsan@my-deja.com) wrote:
: I would like to know if Perl allows to locate a word in a text file and
: replace this word by another directly in the text file without having
: to create a new file or overwrite the initial file.

The most convenient way is to use the -i command-line option.  See
perlrun.  (This renames your original file out of the way and writes the
mods to a new file with the same name as the original.  Works out to be
both safe and efficient for many common purposes.)

-- 
   |   Craig Berry - http://www.cinenet.net/users/cberry/home.html
 --*--  "Beauty and strength, leaping laughter and delicious
   |   languor, force and fire, are of us." - Liber AL II:20


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

Date: Fri, 14 Jul 2000 19:20:49 GMT
From: timhood@bigfoot.com
Subject: Re: msgsnd/msgrcv problem
Message-Id: <8knp5u$rp2$1@nnrp1.deja.com>

I found my own solution, but I thought it might be helpful for others if
I posted it here.

It seems that despite the example shown in the woefully out-of-date
"Programming Perl" book, using pack "L a*" will not work correctly. As
of perl 5.6.0, there is a new option ("!") that specifies numeric values
to be in the machine's native format (shorts, ints and longs). I haven't
tested my fix on other platforms, but on this platform, replacing pack
"L a*" with "L! a*" solves the problem.

Tim

In article <8kif9s$veu$1@nnrp1.deja.com>,
  timhood@bigfoot.com wrote:
> I am trying to pass messages between processes using msgsnd and
msgrcv.
> In one particular case, I wish to use the type value to designate a
> unique type so that only one particular client will listen for and
> respond to the message. The problem seems to be that msgrcv blocks
> indefinitely whenever type is not zero. Anyone have any ideas? Is this
a
> bug?
>
> Details: perl 5.6.0 on Digital Unix 4.0
>
> code snippet:
>
> our $msg_id = msgget(200, 0666);
>
> if (defined $msg_id)
>     {
>     msgrcv($msg_id, $msg_text, $msg_size, $PID, 0);
>     }
>
> Here I'm using the client's PID at the message type to receive. This
is
> being sent using either:
>
>     if (msgsnd($id, pack("L a*", $type, $sent), 0)) # or
>
>     if (msgsnd($id, $sent, 0))
>         {
>          print "Cool, the message was sent to queue $id.\n";
>         }
>
> The message is sent to the queue and the queue shows there are bytes
> waiting to be received, yet msgrcv won't pick up the message unless I
> use type 0 (which is to listen for all message types).
>
> Hopefully, someone can point me in the right direction here.
>
> Tim
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
>


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


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

Date: Fri, 14 Jul 2000 18:33:33 GMT
From: Kirill Sapelkin  <znanie@shell5.ba.best.com>
Subject: Need advice on converting excel files.
Message-Id: <12Jb5.9$cK2.774@sjc-read>


Hello !

I am faced withe the task of converting MS Excel files written in the
Russian Language in unicode (utf-8) encoding into ascii files. Or
failing that converting the unicode xls files to ones encoded in koi-8
or windows encoding or iso-8859-5. 

I have been able to use a utility called xlsHtml which can translate
xls files to html or tab delimited ascii, and a uitility called lv
that converts unicode to other encoding schemes.

The problem is that xlsHtml fails sometimes on large xls files with a
lot of text.  Just the sort of thing that I am dealing with.

Can perl help in this regard?  Do I have to upgrade to 5.6?   I have found a
package called ole storage. 

Has anybody used it for similar problems?  Grateful for any help.

Kirill

-- 

Kirill Sapelkin
znanie@best.com


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

Date: Fri, 14 Jul 2000 20:51:39 GMT
From: Kirill Sapelkin  <znanie@shell5.ba.best.com>
Subject: Need advice on converting excel files.
Message-Id: <v3Lb5.15$cK2.780@sjc-read>
Keywords: excel converting


Hello !

I am faced with the task of converting MS Excel files written in the
Russian Language in unicode (utf-8) encoding into ascii files. Or
failing that converting the unicode xls files to ones encoded in koi-8
or windows encoding or iso-8859-5. 

I have been able to use a utility called xlsHtml which can translate
xls files to html or tab delimited ascii, and a uitility called lv
that converts unicode to other encoding schemes.

The problem is that xlsHtml fails sometimes on large xls files with a
lot of text.  Just the sort of thing that I am dealing with.

Can perl help in this regard?  Do I have to upgrade to 5.6?   I have found a
package called ole storage. 

Has anybody used it for similar problems?  Grateful for any help.

Kirill

-- 

Kirill Sapelkin
znanie@best.com


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

Date: 14 Jul 2000 18:36:33 GMT
From: jezcope@localhost.localdomain (Jeremy Cope)
Subject: Re: NEt::POP3 difficulties
Message-Id: <slrn8munce.mr.jezcope@localhost.localdomain>

>I cannot access the has table -- the documentation says that this is a
>reference to a hash table...

I don't know about this particular module, but if you are trying to use a
reference to a hash instead of a plain hash you need to dereference it, similar
to dereferencing a pointer in C/C++/Pascal:
Where you would say

	print $hash{'element'};

to print the hash element 'element', you should use:

	print $hash->{'element'};

Hope this helps,
Jez

-- 
It's not where you are that counts, it's which way you're facing
Jeremy Cope, UK
Email: jezcope@bigfoot.com
ICQ#: 33490230


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

Date: Fri, 14 Jul 2000 13:06:20 -0700
From: "Lauren Smith" <lauren_smith13@hotmail.com>
Subject: Re: New book on web dev with Perl
Message-Id: <8knrte$1aq$1@brokaw.wa.com>


Ted Kennedy <tedken@optonline.net> wrote in message
news:1PEb5.15307$t66.38559@news02...
> We are evaluating a new book on web development with Apache and Perl and
are
> looking for a few qualified people to read and comment on the manuscript.
If
> interested, please send a brief description of your credentials to me at
> mailto:tedken@manning.com and I will send you more information.

It is unfortunate that a company that is held in esteem by quite a few for
its exceptional Perl-related books finds it necessary to spam this newsgroup
with a Help Wanted post.

I hope this next Manning book will be as good in quality as Andrew Johnson's
and Damian Conway's books, and I also hope that you find good people to
comment on the content.  That said, though, it wouldn't have been right to
let you off the hook for this job posting.

Lauren





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

Date: Fri, 14 Jul 2000 18:43:53 GMT
From: Jean-Sebastien Morisset <jsmoriss@jsm-mv.dyndns.org>
Subject: Re: Perl CGI and browser timeout
Message-Id: <8knn14$pvf$1@nnrp1.deja.com>

Thanks, but I already do this. I used "$| = 1;" in my script to
flush stdout every character and my header looks like this:

$server_protocol 200 OK
Server: $server_software
Content-type: text/html

Perhaps I'm missing something in my header?

Thanks,
js.

In article <MPG.13d900d6ac8fa8af98969d@news>,
  elephant@squirrelgroup.com (jason) wrote:
> Jean-Sebastien Morisset wrote ..
> >I've written a CGI perl script which does a system call to run an
> >executable. While this is running, the browser can time-out waiting
for
> >the CGI to update the screen. Can anyone suggest a way to prevent
this?
>
> you can try setting autoflush on STDOUT then outputting the HTTP
headers
> to the browser .. that should make it wait for the output .. not sure
> how long - could be indefinitely - it's browser dependant
>

--
Jean-Sebastien Morisset, Sr. UNIX Administrator
<http://www.jsmoriss.dyndns.org/>;
UNIX, the Internet, Homebrewing, Cigars, PCS, and other Fun Stuff...


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


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

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


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