[23175] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 5396 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Aug 20 09:10:34 2003

Date: Wed, 20 Aug 2003 06:10:12 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Wed, 20 Aug 2003     Volume: 10 Number: 5396

Today's topics:
        Regular Expression <aerts_frederik@hotmail.com>
    Re: Regular Expression <peter@semantico.com>
        Replace words into a string with a space before or afte (Francesco Moi)
    Re: Replace words into a string with a space before or  <no@email.com>
    Re: Replace words into a string with a space before or  <PapaBear@Filternet.nl>
    Re: Send Message over UNIX Socket (Didatus)
        Strange INC error when using perl 5.8.0 as a cgi script (Tony)
    Re: Tad/Randal Schwatz/Stonehenge Consulting...you all  (James Willmore)
    Re: Tad/Randal Schwatz/Stonehenge Consulting...you all  (Randal L. Schwartz)
    Re: Tad/Randal Schwatz/Stonehenge Consulting...you all  <ellem52@mac.com>
    Re:  <bwalton@rochester.rr.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Wed, 20 Aug 2003 11:12:53 +0200
From: Frederik Aerts <aerts_frederik@hotmail.com>
Subject: Regular Expression
Message-Id: <3F433B95.3060901@hotmail.com>

Hi all,

I want to do a find-replace method using VBScripts Regular Expressions. 
Here is what I want to do:
replace a certain word in a string with another word, but the word can 
NOT be within double quotes!
For example: if I would want to replace the word "desktop" with "laptop" 
I would want to get the
following:

Before = My desktop is "old": I want a new desktop with more power, like 
  my "father's desktop".
After = My laptop is "old": I want a new laptop with more power, like my 
"father's desktop".

Does someone has an idea on what pattern I should use?

Kind regards,
Frederik

-------------------------------------------------
* Frederik Aerts - Belgium                      *
* http://www.frederikaerts.be                   *
* http://users.skynet.be/am044448/Programmeren/ *
-------------------------------------------------



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

Date: Wed, 20 Aug 2003 10:19:17 +0100
From: Peter Hickman <peter@semantico.com>
Subject: Re: Regular Expression
Message-Id: <3f433d15$0$12649$afc38c87@news.easynet.co.uk>

Frederik Aerts wrote:
> Hi all,
> 
> I want to do a find-replace method using VBScripts Regular Expressions. 
> Here is what I want to do:
> replace a certain word in a string with another word, but the word can 
> NOT be within double quotes!
> For example: if I would want to replace the word "desktop" with "laptop" 
> I would want to get the
> following:
> 
> Before = My desktop is "old": I want a new desktop with more power, like 
>  my "father's desktop".
> After = My laptop is "old": I want a new laptop with more power, like my 
> "father's desktop".
> 
> Does someone has an idea on what pattern I should use?
> 
> Kind regards,
> Frederik
> 
> -------------------------------------------------
> * Frederik Aerts - Belgium                      *
> * http://www.frederikaerts.be                   *
> * http://users.skynet.be/am044448/Programmeren/ *
> -------------------------------------------------
> 

Your question is about VBScript. You should look for a newsgroup about 
VBScript or VBA or VB itself, there you will find knowledgeable people who 
could answer your question.

This is a newsgroup about the Perl programming language and many people here 
have no skills in VBScript nor any interest.



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

Date: 20 Aug 2003 04:10:42 -0700
From: francescomoi@europe.com (Francesco Moi)
Subject: Replace words into a string with a space before or after
Message-Id: <5b829932.0308200310.228d2d6b@posting.google.com>

Hello.

I've got a string with some words inside, and I'm trying to replace 
'select' to 'choose'.

---------------------------------------------
$mytext = "select push enter selected";
$mytext =~ s/select/choose/g;
print $mytext;
-----------------------------------------------

But sometimes, my string can content 'selected' and it's replace
to 'choosed'.

I would like to replace only the words 'select ' or ' selected' (note
the space after and before 'select'), but I'm not able to find the
way using regexps.

Does anybody have any experience? Thank you very much, and best regards.


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

Date: Wed, 20 Aug 2003 12:15:20 +0100
From: "Brian Wakem" <no@email.com>
Subject: Re: Replace words into a string with a space before or after
Message-Id: <bhvl8b$3mfu2$1@ID-112158.news.uni-berlin.de>


"Francesco Moi" <francescomoi@europe.com> wrote in message
news:5b829932.0308200310.228d2d6b@posting.google.com...
> Hello.
>
> I've got a string with some words inside, and I'm trying to replace
> 'select' to 'choose'.
>
> ---------------------------------------------
> $mytext = "select push enter selected";
> $mytext =~ s/select/choose/g;
> print $mytext;
> -----------------------------------------------
>
> But sometimes, my string can content 'selected' and it's replace
> to 'choosed'.
>
> I would like to replace only the words 'select ' or ' selected' (note
> the space after and before 'select'), but I'm not able to find the
> way using regexps.
>
> Does anybody have any experience? Thank you very much, and best regards.


The question makes no sense and you contradict yourself, but I think you
need to be using word boundaries.

$mytext =~ s/\bselect\b/choose/g;

-- 
Brian Wakem




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

Date: Wed, 20 Aug 2003 14:22:12 +0200
From: "PapaBear" <PapaBear@Filternet.nl>
Subject: Re: Replace words into a string with a space before or after
Message-Id: <bhvpal$fml$1@news>


Brian Wakem <no@email.com> schreef in berichtnieuws
bhvl8b$3mfu2$1@ID-112158.news.uni-berlin.de...
>
>
> The question makes no sense and you contradict yourself, but I think you
> need to be using word boundaries.
>
> $mytext =~ s/\bselect\b/choose/g;
>
> --
> Brian Wakem
>

And perhaps, using the same word boundaries, you might consider replacing
selected by chosen first if you want to maintain proper syntax ;>)

$mytext =~ s/\bselected\b/chosen/g;
 ...

___________________________________
Never mind the Bear, beware of papa...

-----BEGIN GEEK CODE BLOCK-----
Version: 3.1
GAT/CS/CM/O d+(--) s++:+>: a? C++(+++)$ UL++(+++) P++>+++ L++>+++ E- W+++$
N++ !o !K w !O M- V? PS->$ PE+(-) Y+ PGP t+ 5? !X R- tv b+(+++) DI? !D G(-)
!e h---- r+++ y?
------END GEEK CODE BLOCK------
http://www.geekcode.com






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

Date: 20 Aug 2003 04:00:43 -0700
From: christian.hammer@dynarize.de (Didatus)
Subject: Re: Send Message over UNIX Socket
Message-Id: <a948a960.0308200300.13f274dc@posting.google.com>

#!/usr/bin/perl -w
use strict;
use Getopt::Long;
use IO::Handle;
use IO::Select;
use IO::Socket::UNIX;

my $unix_sock_addr = "";
Getopt::Long::Configure("bundling");
GetOptions ('socket|s=s' => \$unix_sock_addr);
print "Connecting $unix_sock_addr\n";
my $sockout = IO::Socket::UNIX->new(
	PeerAddr	=> $unix_sock_addr,
	Type		=> SOCK_STREAM,
	Timeout		=> 10,
) or die "Error connecting to unix domain socket: $@";

$sockout->autoflush(1);

my $select = IO::Select->new(\*STDIN);
while($select->can_read(200) ) {
	my ($data, $n);
	if( $n = sysread( STDIN, $data, 4096 ) ) {
		print $sockout $data or die "Error sending data: $!";
	} elsif( defined($n) ) {
	print "EOF on stdin\n";
	exit;
	} else {
		die "Error in sysread: $!";
	}
}
print "Timeout on stdin\n";
exit;


this is my program now, i have to change the use part, otherwise i got
an error like this "Bareword "SOCK_STREAM" not allowed while "strict
subs" in use at connect.pl line 10.".
now the problem is in the line with print command (printing to the
socket) in this case i got an error like this "Error sending data:
Transport endpoint is not connected at connect.pl line 25."


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

Date: 20 Aug 2003 05:53:25 -0700
From: ts@relson.net (Tony)
Subject: Strange INC error when using perl 5.8.0 as a cgi script
Message-Id: <63073ce9.0308200453.44653390@posting.google.com>

Hi All, 

	I have just compiled perl 5.8.0 on aix 4.3.3. I got the stable.tar
from cpan. It complied fine without any errors.  The trouble starts
when I try to use it to write cgi scripts.

Here's the really basic test  cgi script I tried

#!/usr/local/bin/perl 

use CGI qw(:standard);
print header;
print "<h1> Hello World<h1>\n";


When I run it from a web browser I get the following in the apache
error log and a "Internal Sever Error" error on the browser.

Can't locate CGI.pm in @INC (@INC contains:
/usr/local/lib/perl5/5.8.0/aix /usr/local/lib/perl5/5.8.0
/usr/local/lib/perl5/site_perl/5.8.0/aix
/usr/local/lib/perl5/site_perl/5.8.0 /usr/local/lib/perl5/site_perl .)
at test.cgi line 3.
BEGIN failed--compilation aborted at  test.cgi line 3.

Now if I run it from a unix shell  as ./test.cgi  I get this 

ts> ./test.cgi
Content-Type: text/html; charset=ISO-8859-1

<h1> Hello</h1>
ts>


I don't understand why this is happening when it works from the
command line but not when it is used by the web server.

The error that is in the apache logs shows the correct @INC 

If I do a "which perl" from the command line it's the right one 

ts> which perl
/usr/local/bin/perl
ts>

Here's the out put from perl -V

ts> perl -V
Summary of my perl5 (revision 5.0 version 8 subversion 0)
configuration:
  Platform:
    osname=aix, osvers=4.3.3.0, archname=aix
    uname='aix tonysbox 3 4 004079284c00 '
    config_args=''
    hint=recommended, useposix=true, d_sigaction=define
    usethreads=undef use5005threads=undef useithreads=undef
usemultiplicity=unde
f
    useperlio=define d_sfio=undef uselargefiles=define usesocks=undef
    use64bitint=undef use64bitall=undef uselongdouble=undef
    usemymalloc=n, bincompat5005=undef
  Compiler:
    cc='gcc', ccflags ='-D_ALL_SOURCE -D_ANSI_C_SOURCE -D_POSIX_SOURCE
-DUSE_NAT
IVE_DLOPEN -fno-strict-aliasing -D_LARGE_FILES',
    optimize='-O',
    cppflags='-D_ALL_SOURCE -D_ANSI_C_SOURCE -D_POSIX_SOURCE
-DUSE_NATIVE_DLOPEN
 -fno-strict-aliasing'
    ccversion='', gccversion='3.2.3', gccosandvers='aix4.3.2.0'
    intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=4321
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=8
    ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t',
lseeksize
=8
    alignbytes=8, prototype=define
  Linker and Libraries:
    ld='gcc', ldflags =' -Wl,-brtl -L/usr/local/lib -Wl,-b32'
    libpth=/usr/local/lib /lib /usr/lib /usr/ccs/lib
    libs=-lbind -lnsl -ldbm -ldl -lld -lm -lc -lcrypt -lbsd -lPW
    perllibs=-lbind -lnsl -ldl -lld -lm -lc -lcrypt -lbsd -lPW
    libc=/lib/libc.a, so=a, useshrplib=false, libperl=libperl.a
    gnulibc_version=''
  Dynamic Linking:
    dlsrc=dl_aix.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Xlinker
-bE:/usr/loc
al/lib/perl5/5.8.0/aix/CORE/perl.exp'
    cccdlflags=' ', lddlflags='  -Wl,-bhalt:4 -Wl,-bM:SRE
-Wl,-bI:$(PERL_INC)/pe
rl.exp -Wl,-bE:$(BASEEXT).exp -Wl,-bnoentry -lc -L/usr/local/lib'


Characteristics of this binary (from libperl): 
  Compile-time options: USE_LARGE_FILES
  Built under aix
  Compiled at Aug 19 2003 17:49:03
  @INC:
    /usr/local/lib/perl5/5.8.0/aix
    /usr/local/lib/perl5/5.8.0
    /usr/local/lib/perl5/site_perl/5.8.0/aix
    /usr/local/lib/perl5/site_perl/5.8.0
    /usr/local/lib/perl5/site_perl/5.6.1
    /usr/local/lib/perl5/site_perl
    .
ts> 




Any suggestions on where I have gone wrong or what i can change would
be appreciated.

Thanks

Tony


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

Date: 20 Aug 2003 01:28:16 -0700
From: jwillmore@cyberia.com (James Willmore)
Subject: Re: Tad/Randal Schwatz/Stonehenge Consulting...you all suck
Message-Id: <e0160815.0308200028.1882cbb2@posting.google.com>

hudson <scripts_you_know_the_drill_@hudsonscripting.com> wrote in message news:<8mf6kv4kqkn3t1em86carjuaao3ee4s28m@4ax.com>...
> you guys suck...that's all I got to say (for now)

Curious ... did you write an article for a magazine (SysAdmin) read by
thousands of people?  Randal does.  Although, I do take issue with
something he wrote, but that's private - as should have been this and
the previous post.

Jim


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

Date: Wed, 20 Aug 2003 10:18:34 GMT
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: Tad/Randal Schwatz/Stonehenge Consulting...you all suck
Message-Id: <f346d2bbcd322e7155cd9fa55929b37b@news.teranews.com>

>>>>> "James" == James Willmore <jwillmore@cyberia.com> writes:

James> Curious ... did you write an article for a magazine (SysAdmin) read by
James> thousands of people?  Randal does.  Although, I do take issue with
James> something he wrote, but that's private - as should have been this and
James> the previous post.

Actually, I've written 176 articles at last count, all for magazines
with 100K+ circulation.  That means my name has been in print as in
"by Randal Schwartz" at least 18 million times.

And I've probably made that many mistakes in my life as well.  The
important thing is to learn and move on.  Steve Foley is learning a
lesson here (I hope), and quickly (I hope).  I can only hope his
clients will learn to google for his name in Usenet before hiring him,
and see the way he responds in a not-yet-professional manner.

He's digging his own grave.  Sad, actually.

print "Just another Perl hacker,"

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!


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

Date: Wed, 20 Aug 2003 09:03:05 -0400
From: Lou Moran <ellem52@mac.com>
Subject: Re: Tad/Randal Schwatz/Stonehenge Consulting...you all suck
Message-Id: <tas6kvsccp6m8p0u7roi4o1pe4q7opqeop@4ax.com>

On Wed, 20 Aug 2003 02:28:26 -0700, hudson
<scripts_you_know_the_drill_@hudsonscripting.com> wrote wonderful
things about me:

>you guys suck...that's all I got to say (for now)


Wow, I actually just bothered to learn how to plonk with my NewsReader

--
Mac OS X: Because it was easier to make UNIX user friendly than fix Windows.


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

Date: Sat, 19 Jul 2003 01:59:56 GMT
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: 
Message-Id: <3F18A600.3040306@rochester.rr.com>

Ron wrote:

> Tried this code get a server 500 error.
> 
> Anyone know what's wrong with it?
> 
> if $DayName eq "Select a Day" or $RouteName eq "Select A Route") {

(---^


>     dienice("Please use the back button on your browser to fill out the Day
> & Route fields.");
> }
 ...
> Ron

 ...
-- 
Bob Walton



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

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


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