[24375] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 6564 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri May 14 14:10:45 2004

Date: Fri, 14 May 2004 11:10:09 -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           Fri, 14 May 2004     Volume: 10 Number: 6564

Today's topics:
    Re: Perldoc versus Man <blah@blah.com>
    Re: Perldoc versus Man <jwillmore@remove.adelphia.net>
    Re: Perldoc versus Man <jwillmore@remove.adelphia.net>
    Re: Perldoc versus Man <blah@blah.com>
    Re: Perldoc versus Man <uri@stemsystems.com>
    Re: Perldoc versus Man <jwillmore@remove.adelphia.net>
    Re: Perldoc versus Man <blah@blah.com>
    Re: Perldoc versus Man <jwillmore@remove.adelphia.net>
    Re: Perldoc versus Man (Kevin Collins)
    Re: Perldoc versus Man <uri@stemsystems.com>
        PPM 3.1 hanging on install, search (Stephen)
    Re: Random Integer <kkeller-usenet@wombat.san-francisco.ca.us>
    Re: Random Integer <notvalid@email.com>
    Re: Random Integer (Walter Roberson)
    Re: RegEx to delete // comments NOT in quotes: ( ' ) OR <NewsGroups@US-Webmasters.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Fri, 14 May 2004 10:27:36 -0400
From: Sherif Zaroubi <blah@blah.com>
Subject: Re: Perldoc versus Man
Message-Id: <opr7zugauxcx74rp@news.videotron.ca>

On Thu, 13 May 2004 23:51:34 -0500, Tad McClellan <tadmc@augustmail.com> 
wrote:

> Edward Wijaya <ewijaya@singnet.com.sg> wrote:
>
>> I have only "man perl" at my Linux toolbox.
>
>
> Why don't you have perldoc installed?
>
> It is part of a normal install of perl itself.
>
> Do you have some kind of custom installation?
>
> Maybe it _is_ installed but you just don't know where...
>
>


On some rpm based system, The perl rpm and perldoc rpm are 2 diffrent 
packages.
I had that problem with: Suse, RedHat and Mandrake. (Don't remember which 
version).


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

Date: Fri, 14 May 2004 10:55:46 -0400
From: James Willmore <jwillmore@remove.adelphia.net>
Subject: Re: Perldoc versus Man
Message-Id: <pan.2004.05.14.14.55.44.32915@remove.adelphia.net>

On Fri, 14 May 2004 10:27:36 -0400, Sherif Zaroubi wrote:

> On Thu, 13 May 2004 23:51:34 -0500, Tad McClellan <tadmc@augustmail.com>
> wrote:
> 
>> Edward Wijaya <ewijaya@singnet.com.sg> wrote:
>>
>>> I have only "man perl" at my Linux toolbox.
>>
>>
>> Why don't you have perldoc installed?
>>
>> It is part of a normal install of perl itself.
>>
>> Do you have some kind of custom installation?
>>
>> Maybe it _is_ installed but you just don't know where...
>>
>>
>>
> 
> On some rpm based system, The perl rpm and perldoc rpm are 2 diffrent
> packages.
> I had that problem with: Suse, RedHat and Mandrake. (Don't remember
> which version).

Bull.  I have run SuSE since version 6.4 (running version 9 now) and have
*always* had perldoc on the system.  Have been running RedHat ver. 8 at
work and have *never* had to install a separate RPM for perldoc.

There's a separate RPM for the reference documentation, but that
documentation is *not* the same as using perldoc.

-- 
Jim

Copyright notice: all code written by the author in this post is
 released under the GPL. http://www.gnu.org/licenses/gpl.txt 
for more information.

a fortune quote ...
 Always borrow money from a pessimist; he doesn't expect to be
 paid back. 
 


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

Date: Fri, 14 May 2004 11:04:41 -0400
From: James Willmore <jwillmore@remove.adelphia.net>
Subject: Re: Perldoc versus Man
Message-Id: <pan.2004.05.14.15.04.38.838911@remove.adelphia.net>

On Fri, 14 May 2004 05:22:49 +0000, Uri Guttman wrote:

>>>>>> "JW" == James Willmore <jwillmore@remove.adelphia.net> writes:
> 
>   JW> On Fri, 14 May 2004 04:56:30 +0000, Ala Qumsieh wrote:
>   >> Uri Guttman wrote:
>   >>> and there are many man reader programs (i like tkman (if only
>   >>> it were written in perl!))
>   >> 
>   >> Shouldn't be too hard to duplicate using Tk. But, I seem to recall that 
>   >> it has already been done. A quick search on CPAN comes up with Tk::Pod, 
>   >> but that's not a standalone program.
> 
>   JW> Huh?  tkpod works for me :-)  It's part of the Tk::Pod install.
> 
>   JW> It's not quite as functional as perldoc, but it's a pretty good tool.
> 
> well that only does pod (i assume). tkman uses a program called rosetta
> to handle many man formats and texinfo. lots of features including
> integration with glimpse, a full text search engine. i have to redo it
> one day but i used to have it setup with glimpse. you could update the
> index from the tool itself.

True, it only does pod.  On the plus side, it can search the FAQs (perldoc
-q) - which can be a real plus :-)

-- 
Jim

Copyright notice: all code written by the author in this post is
 released under the GPL. http://www.gnu.org/licenses/gpl.txt 
for more information.

a fortune quote ...
 In Tulsa, Oklahoma, it is against the law to open a soda bottle 
 without the supervision of a licensed engineer. 
 


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

Date: Fri, 14 May 2004 11:03:43 -0400
From: Sherif Zaroubi <blah@blah.com>
Subject: Re: Perldoc versus Man
Message-Id: <opr7zv4hnvcx74rp@news.videotron.ca>

On Fri, 14 May 2004 10:55:46 -0400, James Willmore 
<jwillmore@remove.adelphia.net> wrote:

> On Fri, 14 May 2004 10:27:36 -0400, Sherif Zaroubi wrote:
>
>> On Thu, 13 May 2004 23:51:34 -0500, Tad McClellan <tadmc@augustmail.com>
>> wrote:
>>
>>> Edward Wijaya <ewijaya@singnet.com.sg> wrote:
>>>
>>>> I have only "man perl" at my Linux toolbox.
>>>
>>>
>>> Why don't you have perldoc installed?
>>>
>>> It is part of a normal install of perl itself.
>>>
>>> Do you have some kind of custom installation?
>>>
>>> Maybe it _is_ installed but you just don't know where...
>>>
>>>
>>>
>>
>> On some rpm based system, The perl rpm and perldoc rpm are 2 diffrent
>> packages.
>> I had that problem with: Suse, RedHat and Mandrake. (Don't remember
>> which version).
>
> Bull.  I have run SuSE since version 6.4 (running version 9 now) and have
> *always* had perldoc on the system.  Have been running RedHat ver. 8 at
> work and have *never* had to install a separate RPM for perldoc.
>
> There's a separate RPM for the reference documentation, but that
> documentation is *not* the same as using perldoc.
>

All I was saying is that: "I had that problem with many distributions, and 
had to install a seperate package, the perldoc binary was not installed 
with the perl rpm".
I was very surprised with I found what the problem was. And I can 
understand your surprise as well.


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

Date: Fri, 14 May 2004 15:25:01 GMT
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: Perldoc versus Man
Message-Id: <x7u0yj820j.fsf@mail.sysarch.com>

>>>>> "TM" == Tad McClellan <tadmc@augustmail.com> writes:

  TM> Uri Guttman <uri@stemsystems.com> wrote:
  >>>>>>> "EW" == Edward Wijaya <ewijaya@singnet.com.sg> writes:
  >> 
  EW> Is there any content and usability difference between
  EW> perldoc and man.


  >> for basic printing of a perl doc page they are equivilent.


  >> but perldoc does know about various parts of the docs that man doesn't
  >> and that is what those extra options do.


  TM> And perldoc knows even more than all that.

  TM> It knows how to display the docs for core modules.

  TM> It knows how to display the docs for modules installed from CPAN.

  TM> It knows how to display the docs for your own modules (provided you
  TM> are clever enough to write documentation for your modules :-)

and are those things plain man can't do? if you have normal pod, normal
installation manify's the pod and man can print it. i can use man (or
man readers like tkman) on all those things. i was pointing out things
perldoc can do that man can't. those things mostly involve knowing more
about the docs than man can (stuff like searching or indexing).

uri

-- 
Uri Guttman  ------  uri@stemsystems.com  -------- http://www.stemsystems.com
--Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
Search or Offer Perl Jobs  ----------------------------  http://jobs.perl.org


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

Date: Fri, 14 May 2004 11:40:26 -0400
From: James Willmore <jwillmore@remove.adelphia.net>
Subject: Re: Perldoc versus Man
Message-Id: <pan.2004.05.14.15.40.24.576739@remove.adelphia.net>

On Fri, 14 May 2004 11:03:43 -0400, Sherif Zaroubi wrote:

> On Fri, 14 May 2004 10:55:46 -0400, James Willmore
> <jwillmore@remove.adelphia.net> wrote:
>> On Fri, 14 May 2004 10:27:36 -0400, Sherif Zaroubi wrote:
>>> On Thu, 13 May 2004 23:51:34 -0500, Tad McClellan
>>> <tadmc@augustmail.com> wrote:
>>>> Edward Wijaya <ewijaya@singnet.com.sg> wrote:

[ ... ]

>>> On some rpm based system, The perl rpm and perldoc rpm are 2 diffrent
>>> packages.
>>> I had that problem with: Suse, RedHat and Mandrake. (Don't remember
>>> which version).
>>
>> Bull.  I have run SuSE since version 6.4 (running version 9 now) and
>> have *always* had perldoc on the system.  Have been running RedHat ver.
>> 8 at work and have *never* had to install a separate RPM for perldoc.
>>
>> There's a separate RPM for the reference documentation, but that
>> documentation is *not* the same as using perldoc.
>>
>>
> All I was saying is that: "I had that problem with many distributions,
> and had to install a seperate package, the perldoc binary was not
> installed with the perl rpm".
> I was very surprised with I found what the problem was. And I can
> understand your surprise as well.

What surprise?  I execute the following and get ....

jim@maxine:~> rpm -q -l perl-5.8.1-81 | grep perldoc 
/usr/bin/perldoc
/usr/lib/perl5/5.8.1/pod/perldoc.pod
/usr/share/man/man1/perldoc.1.gz
jim@maxine:~>

and there it is ... /usr/bin/perldoc :-)  This is SuSE, version 9.  And,
if I still had 8.1 available, or 8.0 or 7.1 or 6.4, I bet I'd get the same
results.  So, I don't know what you mean by a separate rpm - `perldoc` is
part of the core of Perl :-)

The reference documentation is *not* required to use `perldoc`.  `perldoc`
reads the POD mark up in a module -or- the POD file that's part of a
module's distribution.  So, using `perldoc` has *nothing* to do with
separate documentation.

I'm posting to clarify that, what you state, appears to be very wrong to
me.  And I have yet to hear of a similar situation from others.  No sense
in letting some noob hang himself thinking there's a separate package for
`perldoc` when, from my experience, *all* the current distros of Linux,
FreeBSD, SunOS, etc. don't have this issue you speak of.

-- 
Jim

Copyright notice: all code written by the author in this post is
 released under the GPL. http://www.gnu.org/licenses/gpl.txt 
for more information.

a fortune quote ...
 "I don't have to take this abuse from you -- I've got hundreds
 of people waiting to abuse me."   -- Bill Murray, "Ghostbusters"
 


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

Date: Fri, 14 May 2004 11:53:35 -0400
From: Sherif Zaroubi <blah@blah.com>
Subject: Re: Perldoc versus Man
Message-Id: <opr7zyflnrcx74rp@news.videotron.ca>

On Fri, 14 May 2004 11:40:26 -0400, James Willmore 
<jwillmore@remove.adelphia.net> wrote:

> On Fri, 14 May 2004 11:03:43 -0400, Sherif Zaroubi wrote:
>
>> On Fri, 14 May 2004 10:55:46 -0400, James Willmore
>> <jwillmore@remove.adelphia.net> wrote:
>>> On Fri, 14 May 2004 10:27:36 -0400, Sherif Zaroubi wrote:
>>>> On Thu, 13 May 2004 23:51:34 -0500, Tad McClellan
>>>> <tadmc@augustmail.com> wrote:
>>>>> Edward Wijaya <ewijaya@singnet.com.sg> wrote:
>
> [ ... ]
>
>>>> On some rpm based system, The perl rpm and perldoc rpm are 2 diffrent
>>>> packages.
>>>> I had that problem with: Suse, RedHat and Mandrake. (Don't remember
>>>> which version).
>>>
>>> Bull.  I have run SuSE since version 6.4 (running version 9 now) and
>>> have *always* had perldoc on the system.  Have been running RedHat ver.
>>> 8 at work and have *never* had to install a separate RPM for perldoc.
>>>
>>> There's a separate RPM for the reference documentation, but that
>>> documentation is *not* the same as using perldoc.
>>>
>>>
>> All I was saying is that: "I had that problem with many distributions,
>> and had to install a seperate package, the perldoc binary was not
>> installed with the perl rpm".
>> I was very surprised with I found what the problem was. And I can
>> understand your surprise as well.
>
> What surprise?  I execute the following and get ....
>
> jim@maxine:~> rpm -q -l perl-5.8.1-81 | grep perldoc
> /usr/bin/perldoc
> /usr/lib/perl5/5.8.1/pod/perldoc.pod
> /usr/share/man/man1/perldoc.1.gz
> jim@maxine:~>
>
> and there it is ... /usr/bin/perldoc :-)  This is SuSE, version 9.  And,
> if I still had 8.1 available, or 8.0 or 7.1 or 6.4, I bet I'd get the 
> same
> results.  So, I don't know what you mean by a separate rpm - `perldoc` is
> part of the core of Perl :-)
>
> The reference documentation is *not* required to use `perldoc`.  
> `perldoc`
> reads the POD mark up in a module -or- the POD file that's part of a
> module's distribution.  So, using `perldoc` has *nothing* to do with
> separate documentation.
>
> I'm posting to clarify that, what you state, appears to be very wrong to
> me.  And I have yet to hear of a similar situation from others.  No sense
> in letting some noob hang himself thinking there's a separate package for
> `perldoc` when, from my experience, *all* the current distros of Linux,
> FreeBSD, SunOS, etc. don't have this issue you speak of.
>

Ok .. Maybe suse should not have been in my list. But For Mandrake:
[szaroubi@backup music]$ cat /proc/version
Linux version 2.4.21-0.13mdk (flepied@bi.mandrakesoft.com) (gcc version 
3.2.2 (Mandrake Linux 9.1 3.2.2-3mdk)) #1 Fri Mar 14 15:08:06 EST 2003
[szaroubi@backup music]$ rpm -q -l perl-5.8.0-19mdk | grep perldoc
[szaroubi@backup music]$ rpm -q -l perl-doc-5.8.0-19mdk | grep perldoc
/usr/bin/perldoc
/usr/share/man/man1/perldoc.1.bz2
[szaroubi@backup music]$






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

Date: Fri, 14 May 2004 12:17:38 -0400
From: James Willmore <jwillmore@remove.adelphia.net>
Subject: Re: Perldoc versus Man
Message-Id: <pan.2004.05.14.16.17.37.64250@remove.adelphia.net>

On Fri, 14 May 2004 11:53:35 -0400, Sherif Zaroubi wrote:
[ ... ]

> Ok .. Maybe suse should not have been in my list. But For Mandrake:
> [szaroubi@backup music]$ cat /proc/version
> Linux version 2.4.21-0.13mdk (flepied@bi.mandrakesoft.com) (gcc version 
> 3.2.2 (Mandrake Linux 9.1 3.2.2-3mdk)) #1 Fri Mar 14 15:08:06 EST 2003
> [szaroubi@backup music]$ rpm -q -l perl-5.8.0-19mdk | grep perldoc
> [szaroubi@backup music]$ rpm -q -l perl-doc-5.8.0-19mdk | grep perldoc
> /usr/bin/perldoc
> /usr/share/man/man1/perldoc.1.bz2
> [szaroubi@backup music]$

I stand (or sit, in this case :-) ) corrected.

-- 
Jim

Copyright notice: all code written by the author in this post is
 released under the GPL. http://www.gnu.org/licenses/gpl.txt 
for more information.

a fortune quote ...
 PL/1, "the fatal disease", belongs more to the problem set than 
 to the solution set.   -- E. W. Dijkstra 
 


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

Date: Fri, 14 May 2004 16:32:07 GMT
From: spamtotrash@toomuchfiction.com (Kevin Collins)
Subject: Re: Perldoc versus Man
Message-Id: <slrnca9t42.ht0.spamtotrash@doom.unix-guy.com>

In article <x7u0yj820j.fsf@mail.sysarch.com>, Uri Guttman wrote:

-snip-

>  TM> And perldoc knows even more than all that.
> 
>  TM> It knows how to display the docs for core modules.
> 
>  TM> It knows how to display the docs for modules installed from CPAN.
> 
>  TM> It knows how to display the docs for your own modules (provided you
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>  TM> are clever enough to write documentation for your modules :-)
> 
> and are those things plain man can't do? if you have normal pod, normal
> installation manify's the pod and man can print it. i can use man (or
> man readers like tkman) on all those things. i was pointing out things
> perldoc can do that man can't. those things mostly involve knowing more
> about the docs than man can (stuff like searching or indexing).

Can you tell me how man can do that WITHOUT perldoc or pod2man? I think the
point was that I can do:

$ perldoc MyModule.pm

without any prep or other work assuming there is POD in MyModule.pm. However, I
can't do:

$ man MyModule.pm

without 1st making some other effort to translate POD.

Kevin


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

Date: Fri, 14 May 2004 16:43:21 GMT
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: Perldoc versus Man
Message-Id: <x7hduj7ydy.fsf@mail.sysarch.com>

>>>>> "KC" == Kevin Collins <spamtotrash@toomuchfiction.com> writes:

  KC> In article <x7u0yj820j.fsf@mail.sysarch.com>, Uri Guttman wrote:

  KC> -snip-

  TM> And perldoc knows even more than all that.
  >> 
  TM> It knows how to display the docs for core modules.
  >> 
  TM> It knows how to display the docs for modules installed from CPAN.
  >> 
  TM> It knows how to display the docs for your own modules (provided you
  KC>                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  TM> are clever enough to write documentation for your modules :-)
  >> 
  >> and are those things plain man can't do? if you have normal pod, normal
  >> installation manify's the pod and man can print it. i can use man (or
  >> man readers like tkman) on all those things. i was pointing out things
  >> perldoc can do that man can't. those things mostly involve knowing more
  >> about the docs than man can (stuff like searching or indexing).

  KC> Can you tell me how man can do that WITHOUT perldoc or pod2man? I
  KC> think the point was that I can do:

you are missin the whole point. the question is which is better for
reading pod, man or some podtool? this ASSUMES a man version of the doc
has been made. if you write normal pod and do a normal Makefile.PL (or
Module::Build), all your pod is manified. so that is what i was assuming.

  KC> $ perldoc MyModule.pm

  KC> without any prep or other work assuming there is POD in
  KC> MyModule.pm. However, I can't do:

  KC> $ man MyModule.pm

  KC> without 1st making some other effort to translate POD.

but that was in the base assumption. oh well. can't argue when the the
two sides have different assumptions.

uri

-- 
Uri Guttman  ------  uri@stemsystems.com  -------- http://www.stemsystems.com
--Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
Search or Offer Perl Jobs  ----------------------------  http://jobs.perl.org


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

Date: 14 May 2004 08:21:10 -0700
From: photochop@comcast.net (Stephen)
Subject: PPM 3.1 hanging on install, search
Message-Id: <6a32f4e7.0405140721.218b296d@posting.google.com>

Hey everyone,

Just installed ActivePerl v5.8.3 on a Windows 2000 Server. I need to
install the DBI and ODBC modules, however, when I try searching or
downloading them, PPM just hangs. All the other features [query,
repository, etc] work for me, at least I think they all do.

How come this isn't working? It's a fresh install, everything went
fine. I have ActivePerl v5.8.3 installed on my XP box as well, and it
hangs too. I did manage, however, to somehow get the DBI and ODBC
modules via PPM on my XP box, but now I no longer can. In case you're
wondering, I remote into the Windows 2000 server.

Any ideas to get this fixed? I appreciate the help all,
-Steve


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

Date: Fri, 14 May 2004 09:37:22 -0700
From: Keith Keller <kkeller-usenet@wombat.san-francisco.ca.us>
Subject: Re: Random Integer
Message-Id: <2ks28c.ckh.ln@goaway.wombat.san-francisco.ca.us>

-----BEGIN xxx SIGNED MESSAGE-----
Hash: SHA1

In article <slrnca8kgs.a0k.tadmc@magna.augustmail.com>, Tad McClellan wrote:
> Mike Lepore <lepor5e@bestweb.net> wrote:
> 
>> Does someone have a subroutine I can use to generate a
>> random integer between 0 and integer n, inclusive?
> 
>    perldoc -q random
> 
>         How do I get a random number between X and Y?
> 
> 
> I hope you are suitably embarrassed.

He may not need to feel completely embarassed: that perldoc entry
is not in my perldocs for perl 5.6, only in my perl 5.8.

- --keith

- -- 
kkeller-usenet@wombat.san-francisco.ca.us
(try just my userid to email me)
AOLSFAQ=http://wombat.san-francisco.ca.us/cgi-bin/fom

-----BEGIN xxx SIGNATURE-----
Version: GnuPG v1.2.2 (Darwin)

iD8DBQFApPW/hVcNCxZ5ID8RAhwPAJ9kcmJYFgTItvsqD2Ql8EFXsJtJfQCeKdxU
K2w1hKMz1eonla5zDp+VxGA=
=K3r3
-----END PGP SIGNATURE-----


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

Date: Fri, 14 May 2004 17:43:50 GMT
From: Ala Qumsieh <notvalid@email.com>
Subject: Re: Random Integer
Message-Id: <qz7pc.67201$P35.13308@newssvr25.news.prodigy.com>

Iain Chalmers wrote:

> how about 
> 
> $num=sprintf "%u",rand($n+1);

Hmmm .. what's wrong with int()?

--Ala


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

Date: 14 May 2004 17:59:28 GMT
From: roberson@ibd.nrc-cnrc.gc.ca (Walter Roberson)
Subject: Re: Random Integer
Message-Id: <c831e0$ggl$1@canopus.cc.umanitoba.ca>

In article <qz7pc.67201$P35.13308@newssvr25.news.prodigy.com>,
Ala Qumsieh  <notvalid@email.com> wrote:
:Iain Chalmers wrote:

:> $num=sprintf "%u",rand($n+1);

:Hmmm .. what's wrong with int()?

int() truncates. sprintf rounds. See the perl documentation for int,
which suggests "usually" sprintf over int.

If you use int(), you will never get the maximum parameter value
and 0 will occur with frequency equal to the other numbers.

If you use rounding, 0 and the maximum parameter value will each occur
at 1/2 the frequency of the other numbers.

So... it depends which behaviour you want.
-- 
If a troll and a half can hook a reader and a half in a posting and a half, 
how many readers can six trolls hook in six postings?


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

Date: Fri, 14 May 2004 10:49:19 -0500
From: "W. D." <NewsGroups@US-Webmasters.com>
Subject: Re: RegEx to delete // comments NOT in quotes: ( ' ) OR (")???
Message-Id: <40A4EA7F.4059@US-Webmasters.com>

Thanks, Bill!

I am going to have to chew on this a while so I understand it
better--it seems fairly complicated.

Bill wrote:
> 
> W. D. wrote:
>>Hi Folks,
>>
>>I am about to ship myself to a mental hospital!  Can't figure
>>out a regular expression to strip out comments that begin 
>>with double slashes "//" but are not contained in quotation 
>>marks, either single (') or double (").
>>
>>Here is a bunch of sample text that I've been working on:
>>===================== Code Start ==========================
>>// Some comments that should be trashed
>>
>>Code goes here;
>>
>>$SomeVar = '// These comments should be left alone!';
>>
>>/* Some more comments that will remain */
>>
>>" // These comments should also be left alone "
>>
>># Hash/Pound sign comments should remain for now
>>
>>More Code goes here
>>
>>       { This code should stay // This comment should go
>>       }
>>=========================== Code End ===========================
>>
>>This is one of my PHP regexs that DOESN'T work:
>>
>>   $TheCode = preg_replace('#([^\n\r\'\"]|.*)//.*[\n\r]#', '',
>>$TheCode);
>>
>>Does anyone know how to create a RegEx to do this????!
>>
>>Thank you for saving my sanity if you can help!!!!!
>>
> 
> Derived from perlfaq on regex:
> 
> #!/usr/bin/perl
> 
>   my $lines = <<ENDTEXT;
>      // Some comments that should be trashed
>      Code goes here;
>      \$SomeVar = '// These comments should be left alone!';
>      /* Some more comments that will remain */
>      \" // These comments should also be left alone \"
>      # Hash/Pound sign comments should remain for now
>      More Code goes here
>      { This code should stay // This comment should go
>         }
> ENDTEXT
> 
> print $lines, "\n\n\n";
> 
> # this needs whitespace reformatting, but you're using PHP :{
> $lines =~
> s#/\*[^*]*\*+([^/*][^*]*\*+)*/|//[^\n]*|("(\\.|[^"\\])*"|'(\\.|[^'\\])*'|.[^/"'\\]*)#$2#gs;
> print $lines, "\n";

-- 
Start Here to Find It Fast!™ ->
http://www.US-Webmasters.com/best-start-page/
$8.77 Domain Names -> http://domains.us-webmasters.com/


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

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.  

NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice. 

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


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