[10931] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4532 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Jan 2 13:07:11 1999

Date: Sat, 2 Jan 99 10:00:18 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Sat, 2 Jan 1999     Volume: 8 Number: 4532

Today's topics:
    Re: @INC, doesn't seem to work <gellyfish@btinternet.com>
    Re: Absolute Yuck <gellyfish@btinternet.com>
    Re: DB_File.pm <gellyfish@btinternet.com>
        Looking for a news post cgi script??? (Spawn)
    Re: Make Gif/jpeg file <meint.post@tref.nl>
    Re: Never seen this error before? (Tad McClellan)
    Re: Never seen this error before? <gellyfish@btinternet.com>
    Re: New to perl <gellyfish@btinternet.com>
    Re: News scripts <gellyfish@btinternet.com>
    Re: Pacman anyone? (Rachel J King)
    Re: Path under windows <gellyfish@btinternet.com>
    Re: Perl Install on NT (Jeffrey Drumm)
    Re: perl on NT <gellyfish@btinternet.com>
    Re: Perl OO question <gellyfish@btinternet.com>
    Re: Perl upgrade on sunos 4.1.3C <gellyfish@btinternet.com>
        Perl Win32 -- Locking Up machine. <jcollard@tenaska-marketing.com>
    Re: Perl, Netscape and Internet Explorer...:( <gellyfish@btinternet.com>
        Regexp <john.wood@diamond.co.uk>
        Regexp <john.wood@diamond.co.uk>
    Re: regexp imchat@ionet.net
    Re: regexp <gellyfish@btinternet.com>
    Re: Regexp (Stephen Clouse)
    Re: Splitting Input File W/$INPUT_RECORD_SELECTOR <rick.delaney@home.com>
    Re: Splitting Input File W/$INPUT_RECORD_SELECTOR (UMD Vikram)
    Re: Thanks! and happy new year! ()
        Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)

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

Date: 2 Jan 1999 15:28:08 -0000
From: Jonathan Stowe <gellyfish@btinternet.com>
Subject: Re: @INC, doesn't seem to work
Message-Id: <76ldu8$109$1@gellyfish.btinternet.com>

On Sat, 02 Jan 1999 07:00:37 GMT Justin wrote:
> this is what i tried
> 
> use lib '/data1/hypermart.net/mydir/lib'; 
> use GD;
> 
> of course, GD.pm is in lib dir
> 
> and the error log says
> Can't locate loadable object for module GD in @INC (@INC contains:
> /data1/hypermart.net/mydir/lib ....)
> 

It appears that your module is incorrectly installed and the XS component
require cannot be found where Perl is looking for it.

Did you install the module using the method described in perlfaq8:

   =head2 How do I keep my own module/library directory?

   When you build modules, use the PREFIX option when generating
   Makefiles:

       perl Makefile.PL PREFIX=/u/mydir/perl

   then either set the PERL5LIB environment variable before you run
   scripts that use the modules/libraries (see L<perlrun>) or say

       use lib '/u/mydir/perl';

   See Perl's L<lib> for more information.

If you didnt then you should properly reinstall the module and see what
 happens.

/J\

-- 
Jonathan Stowe <jns@btinternet.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>


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

Date: 2 Jan 1999 13:58:50 -0000
From: Jonathan Stowe <gellyfish@btinternet.com>
Subject: Re: Absolute Yuck
Message-Id: <76l8mq$oh$1@gellyfish.btinternet.com>

On Fri, 1 Jan 1999 15:55:58 -0600 AJ wrote:
> Perl probably  doesn't like $1.  Use something that doesn't start with a
> number, $one, for example.  Also, when you assign an array to a scalar
> variable, like $one = @inputData the value of $one will be the number of
> elements of @inputData, say if you have 5 lines that created five elements
> of @inputData,  then $one will = 5.
> 
> Hope this helps,
> 
Only a little - as others have pointed out $1 is the contents of the first
capturing parentheses in a regular expression and thus it is effectively
read-only.  If it is required to manipulate the value of this variable
it will be neccessary to copy it to another variable.

See the perlre manpage.

/J\
-- 
Jonathan Stowe <jns@btinternet.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>


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

Date: 2 Jan 1999 15:48:39 -0000
From: Jonathan Stowe <gellyfish@btinternet.com>
Subject: Re: DB_File.pm
Message-Id: <76lf4n$11m$1@gellyfish.btinternet.com>

On 2 Jan 1999 10:15:09 GMT poke@oly.silverlink.net wrote:
> Was doing some work with dmbopen and came across some odd behaviour. 
> First of all, I tried a "use DBM_File;" and I keep getting the following:
> 
> Can't locate loadable object for module DB_File in @INC (@INC contains: 
> /usr/local/lib/perl5/5.00502/i386-bsdos /usr/local/lib/perl5/5.00502 
> /usr/local/lib/perl5/site_perl/5.005/i386-bsdos /usr/local/lib/perl5/site_perl/5.005 .) i
> at ./test.pl line 3
> BEGIN failed--compilation aborted at ./test.pl line 3.
> 

This is almost certainly due to module bing incorrectly installed and not
being able to load some XS component required for it to work.

You will almost certainly have to reinstall the module correctly.

> Ok, so I look in DB_File.pm and I see the line:
> 
> require 5.003 ;
> 
> 
> Can someone explain what that is all about...
> 

This is unrelated to your problem - it just means that the script will
abort if it is attempted to be run by a Perl whose version is less than
the one stated.  See the 'require' entry in the perlfunc manpage.

<snip code>

> 
> And I get the following:
> 
> % ./test.pl
> Use of uninitialized value at /usr/local/lib/perl5/5.00502/i386-bsdos/DB_File.pm line 248.
> Deep recursion on subroutine "DB_File::AUTOLOAD" at /usr/local/lib/perl5/5.00502/i386-bsdos/DB_File.pm line 197.
> Out of memory!
> Segmentation fault (core dumped)
> 

Nasty, I guess that a reinstall might do the trick though.

> 
> Please respond directly and then I will post a summary of the results.
> 
> Thank You,
> 
> chuckw___REMOVE_THE_CAPITOL_LETTERS___AND_THE_UNDERSCORES@___NOSPAM___.silverlink.net
> 

That looks like far too much work for me in my current adled state I guess 
you will have to read the newsgroup.

/J\
-- 
Jonathan Stowe <jns@btinternet.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>


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

Date: Sat, 2 Jan 1999 08:35:33 -0800
From: spawn90@my-dejanews.com (Spawn)
Subject: Looking for a news post cgi script???
Message-Id: <MPG.10f7eab2832915e7989684@news.slip.net>

Can anybody tell me a decent CGI news script that is highly customizable 
and works really well? I need a script that can post time, date, updater 
name, and news of course. I like to use it to post ufo sighting news. 

Thanks in advance






-- 
UFO Phenomena Page
http://www.csoft.net/~cage


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

Date: Sat, 2 Jan 1999 17:45:16 +0100
From: "M.E. Post" <meint.post@tref.nl>
Subject: Re: Make Gif/jpeg file
Message-Id: <76lihh$ii2$1@rubens.telebyte.nl>

Use the GD module and read the documentation. It's very clear and it gives
some insightful examples of the possibilities of the module. I used it
myself to create an on the fly thermometer from a template picture and a
calculated rectangular-filling based on a texture.

hth

Meint

--
Hilta Goatfounder was all lace and shawls and colours
and earrings and so many bangles that a mere movement
of her arms sounded like a percussion section falling off a cliff.






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

Date: Sat, 2 Jan 1999 07:13:30 -0600
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Never seen this error before?
Message-Id: <q16l67.3nd.ln@magna.metronet.com>

Mike (support@counter.w-dt.com) wrote:
: What does this error mean? I've never seen it before. It only occurs
: when I use use strict. Otherwise the program runs fine. What does it
: mean and how would I go about resolving it?

: Variable "$ads_dir" is not imported at /cgi-bin/admin.cgi line 310.
: Global symbol "ads_dir" requires explicit package name at
: /cgi-bin/admin.cgi line 310.


   The messages that perl might issue are all documented in the
   'perldiag.pod' man page.

   For your message it says:

---------------------
=item Variable "%s" is not imported%s

(F) While "use strict" in effect, you referred to a global variable
that you apparently thought was imported from another module, because
something else of the same name (usually a subroutine) is exported
by that module.  It usually means you put the wrong funny character
on the front of your variable.
---------------------


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


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

Date: 2 Jan 1999 15:38:26 -0000
From: Jonathan Stowe <gellyfish@btinternet.com>
Subject: Re: Never seen this error before?
Message-Id: <76lehi$11h$1@gellyfish.btinternet.com>

On Sat, 02 Jan 1999 02:42:13 -0600 Mike wrote:
> What does this error mean? I've never seen it before. It only occurs
> when I use use strict. Otherwise the program runs fine. What does it
> mean and how would I go about resolving it?
> 
> Variable "$ads_dir" is not imported at /cgi-bin/admin.cgi line 310.
> Global symbol "ads_dir" requires explicit package name at
> /cgi-bin/admin.cgi line 310.
> 

Hmm what doe the perldiag manpage have to say about this:

       Variable """"%s"""" is not imported%s
           (F) While "use strict" in effect, you referred to a
           global variable that you apparently thought was
           imported from another module, because something else
           of the same name (usually a subroutine) is exported by
           that module.  It usually means you put the wrong funny
           character on the front of your variable.

What does this mean for your code ?  You might have to give the variable
an explicit package name just as the message says - thats is to say you
must qualify it like this:

   $PACKAGE::ads_dir

where PACKAGE is the name of the package where the varibale is defined.

A useful tip when you are getting messages that you dont understand is to
use the diagnostics module i.e.

   use diagnostics -verbose;

this will cause the full perldiag entry to be emitted as well as the usual
message.  There is some anecdotal evidence that this might not work with
ActivePerl but I havent tried it so I cant comment.

/J\

-- 
Jonathan Stowe <jns@btinternet.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>


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

Date: 2 Jan 1999 14:18:55 -0000
From: Jonathan Stowe <gellyfish@btinternet.com>
Subject: Re: New to perl
Message-Id: <76l9sf$qs$1@gellyfish.btinternet.com>

On Fri, 01 Jan 1999 16:39:11 GMT dbeallie@cyberus.ca wrote:
> What are the top 10 (or more) features of perl? 
> 

The documentation.

/J\
-- 
Jonathan Stowe <jns@btinternet.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>


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

Date: 2 Jan 1999 14:13:07 -0000
From: Jonathan Stowe <gellyfish@btinternet.com>
Subject: Re: News scripts
Message-Id: <76l9hj$qp$1@gellyfish.btinternet.com>

On Fri, 1 Jan 1999 08:37:36 -0800 Spawn wrote:
> In article <76i0h7$e41$1@news.NERO.NET>, stanley@skyking.OCE.ORST.EDU 
> says...
>> In article <MPG.10f5cb251407b257989682@news.slip.net>,
>> Spawn <spawn90@my-dejanews.com> wrote:
>> >Can anybody tell me a decent CGI news script that is highly customizable 
>> >and works really well? 
>> 
>> Do you want CGI or news? CGI is HTTP, news is NNTP, and although the
>> acronyms look alike, they are very different. Many web clients will do
>> NNTP all by themselves.
> 
> I looking for cgi where I can post news articles on my homepage. Do you 
> have the url for cgi,http, nntp? 
> 

If you mean that you want to achive something similar to DejaNews then you 
will probably need to look at the modules Net:NNTP and News::NNTPClient - 
I dont know of any pre-made scripts but you will probably be able to
locate some through a search of AltaVista or whatever.

/J\
-- 
Jonathan Stowe <jns@btinternet.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>


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

Date: 2 Jan 1999 07:50:26 GMT
From: rjking@blue.seas.upenn.edu (Rachel J King)
Subject: Re: Pacman anyone?
Message-Id: <76kj42$gsc$1@netnews.upenn.edu>

Scott Allen Zsori (zsoris@post.uwstout.edu) wrote:
: expressions. Does "chomp" remind anyone else of this wonderful little
: character? :)  Does anyone else dream in whatever language their current
: projects are in? Has anyone else ever actually used a programming
: command in a non-programming sentence (I greped a friend's last sentence
: by accident once :)?  Or am I the only crazy one? Just checking and
: trying to make everyone's day a little more cheery. :)

Don't worry.  You're certainly not the only one.  I've also been known to 
take notes in class using mathematical notations instead of words for 
phrases such as "there exists" and "for all" just to name a couple.  :)

-Rachel


--
Rachel J. King
University of Pennsylvania, B.S.E. Computer Science & Engineering '99
Society of Women Engineers   *   Hexagon Senior Society   *   Ayalah
http://www.seas.upenn.edu/~rjking


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

Date: 2 Jan 1999 15:04:58 -0000
From: Jonathan Stowe <gellyfish@btinternet.com>
Subject: Re: Path under windows
Message-Id: <76lciq$vi$1@gellyfish.btinternet.com>

On Sat, 02 Jan 1999 08:13:30 GMT Ethan H. Poole wrote:
> 
<snip>

> My suggestion: write a thorough and universal parsing function and use it in 
> all your projects.  The use of a consistent and well proven function will 
> save you a lot of development and debugging time down the road.  In the 
> meantime, use the CGI.pm module available until you learn how to write these 
> functions for yourself.
> 

Purely out of interest, given that we have CGI.pm why , unless motivated
by curiosity or hubris, would anyone need to write their own Request
parsing functions (of course I can see that there might arise a special
need but I mean a general purpose routine here) ?

Of course some object that CGI.pm is a little oversized for some purposes
but there are alternatives in the various CGI::* modules available.
I thought that the purpose of CPAN was to promote code reuse on the
grand scale.

/J\
-- 
Jonathan Stowe <jns@btinternet.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>


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

Date: Sat, 02 Jan 1999 15:04:18 GMT
From: drummj@mail.mmc.org (Jeffrey Drumm)
Subject: Re: Perl Install on NT
Message-Id: <368f3240.176358651@news.mmc.org>

On Sat, 02 Jan 1999 01:50:05 GMT, imchat@ionet.net wrote:

>	Gotta agree here.  I've installed the Activestate package,
>which comes lacking any modules, and ended up getting the binary from;
>http://www.perl.com/CPAN-local/ports/index.html#win32
>	This package comes with most of the good modules already so
>you don't have to go through the crap of trying to install them with
>the activestate package. Much better IMO.

But that distribution is based on 5.004_02, and the current release is
5.005_02.

For those that want Perl and the modules included in the standard
distribution (the one provided in latest.tar.gz), the current ActiveState
port is a painless install. Since it provides the Perl Package Manager
(ppm), installing the modules that ActiveState has ported is nearly as
painless (and I'm sure that most of the "good" modules you're referring to
are already in ppm format at ActiveState). The ported modules include a
number that can't be built on the Win32 platform without a C compiler, and
are more current than precompiled binary versions available at CPAN.

So if you're looking for the most current Perl and the widest variety of
ready-to-run modules, ActiveState is the way to go. Configuring ActivePerl
to be able to install non-XS CPAN modules requires a small amount of effort
(the acquisition of WinZip or GUNZIP.EXE/TAR.EXE, DMAKE.EXE and a simple
modification to Config.pm).

My $.02 . . .

-- 
                           Jeffrey R. Drumm, Systems Integration Specialist
                                  Maine Medical Center Information Services
                                     420 Cumberland Ave, Portland, ME 04101
                                                        drummj@mail.mmc.org
"Broken? Hell no! Uniquely implemented." -me


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

Date: 2 Jan 1999 15:20:26 -0000
From: Jonathan Stowe <gellyfish@btinternet.com>
Subject: Re: perl on NT
Message-Id: <76ldfq$vn$1@gellyfish.btinternet.com>

On Sat, 02 Jan 1999 05:23:36 GMT imchat@ionet.net wrote:
> On Fri, 01 Jan 1999 23:40:17 -0500, "Ronnie D. Jewell"
> <jewell@OnlineRAGE.com> wrote:
> 
>>
>>I am trying to get a script to run on NT..  the script works fine on
>>unix...
>>seems like this line is causing all the problems
>>
>>use CGI qw(:standard);
>>
> 
> 	This sript requires the cgi.pm module be installed. If you're
> using the activestate package you can use the package installer to add
> this. If you have trouble with ppm.pl, you can just get the perl
> binary from http://www.perl.com/CPAN-local/ports/index.html#win32

Except of course the ActivePerl distribution includes, as do all recent
distributions, the CGI module as standard (or should anyhow).

Without seeing any errors I dont think it is possible to diagnose the
problem with any certainty.   A missing module is one possibility but
it is also possible that something is going wrong when the module is
initialised for instance.

> 	I think this binary is much better than the activestate
> package.

I think that some people would disagree with that in respect of the
newer ActiveState releases.  I think it was almost certainly true of
pre-ActivePerl releases but now that it is at the same revision level as
the stable source distribution and is effectively the same as you would
get if you compiled the source for Win32 then I cant see any reason to
avoid it.

I would suggest that most people would rather have a version of Perl
that is based on the latest stable version of the source code if only
so that they have the features and documentation that people here will
undoubtedly refer to.

/J\
-- 
Jonathan Stowe <jns@btinternet.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>


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

Date: 2 Jan 1999 15:50:59 -0000
From: Jonathan Stowe <gellyfish@btinternet.com>
Subject: Re: Perl OO question
Message-Id: <76lf93$126$1@gellyfish.btinternet.com>

On Sat, 02 Jan 1999 09:09:47 GMT marvela.com wrote:
> Hi All,
> 
> I have a question about object oriented programming in perl.  I
> want to do some polymorphism in perl like virtual function in C++.  Can
> someone help me with any resources?
> Your help is greatly appreciated.
> Thanks.
> 

I would suggest starting with the perltoot and perlbot manpages.

/J\
-- 
Jonathan Stowe <jns@btinternet.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>


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

Date: 2 Jan 1999 14:03:45 -0000
From: Jonathan Stowe <gellyfish@btinternet.com>
Subject: Re: Perl upgrade on sunos 4.1.3C
Message-Id: <76l901$om$1@gellyfish.btinternet.com>

On 1 Jan 1999 21:26:23 GMT M.J.T. Guy wrote:
> Christopher Adams  <cadams@teleport.com> wrote:
>>I had some problems upgrading Perl 5.000 to the latest version. I was
>>told that the operating system (SunOS 4.1.3C) should be upgraded if I
>>expect to be able to get a good Perl upgrade. During the upgrade, I get
>>to the "make install" and it has a problem with toke.c. I also
>>experienced problems with upgrading a new gcc compiler.
>>
> 

<snip>

> There is one restriction  -  version 5.005 and later of Perl require
> an ANSI C compiler, which the Sun supplied cc is not.    So you should
> either stick with Perl version 5.004_04 or you'll need to install gcc.
> 

I have managed to compile Perl on *Solaris* using the c89 compiler that I
believe is part of the Sun Workshop package - Trying to compile 5.005+ with
the standard cc indeed does nto work.  Check out /opt/SunWS*/bin for 'c89'.

/J\
-- 
Jonathan Stowe <jns@btinternet.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>


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

Date: Sat, 2 Jan 1999 11:48:48 -0600
From: "John Collard" <jcollard@tenaska-marketing.com>
Subject: Perl Win32 -- Locking Up machine.
Message-Id: <76lm5q$jmn$1@ffx2nh2.uu.net>

I have a perl routine running every minute, 22 hours a day on a Windows 95
box.   It intermittantly locks up the machine giving a BLUE SCREEN...
'<program name> eception OE VxD VMM(01) ... Press ENTER to return
CTRL-ALT-DEL to reboot...'   It will also, at times cause the machine to
spontaneously reboot.

The machine may works for days at a time or hours at a time without
problems.  It is a GW2K - PII 400 - with plenty of RAM and hard disk space.
We manually reboot (warm boot) the machine every morning.

The perl program uses the following win32 functions:

use Win32::Registry  0.04 '/./';
use Win32::Semaphore 1.01 '/./';

Other than loading values from the registry and setting the semaphore... it
runs straight/simple perl.

Any ideas why we are having these problems?

--
John Collard
c/o Tenaska Marketing Ventures, Omaha




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

Date: 2 Jan 1999 13:52:32 -0000
From: Jonathan Stowe <gellyfish@btinternet.com>
Subject: Re: Perl, Netscape and Internet Explorer...:(
Message-Id: <76l8b0$o6$1@gellyfish.btinternet.com>

On Fri, 1 Jan 1999 19:22:52 +0100 Thomas Turn Jensen wrote:
> How come it should be a server problem when it works fine with some (in this
> case IE) clients? I recon that it is the file extension - probably .cgi or
> .pl - that the client (Netscape (sucks)) don't know what to do with(?)
> 

Thats as maybe but it is the servers (or some CGI application) responsibility
to set the correct Content-type header possibly based on the file extension
thus it *is* a problem with the server if this is what is happening.  

Further if this is the case then it is probably non-standard behaviour on the
part of the IE browser that is causing it to work there.

Whatever the problem actually is it is still an problem with software other
than Perl and thus I have set the followups accordingly.

/J\
-- 
Jonathan Stowe <jns@btinternet.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>


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

Date: Sat, 2 Jan 1999 16:13:34 -0000
From: "Paul Wood" <john.wood@diamond.co.uk>
Subject: Regexp
Message-Id: <76lgro$rue$1@nclient3-gui.server.ntli.net>

For some reason (probably obvious, but not to me) this regexp isn't doing
what i'd like it to:

s/(http:\/\/[\w\-.]+\.[a-zA-Z]{2,3}([\w\-.\/~]+)?)/<a href="$1"
target="_top">$1<\/a>/gi;

It should find any http:// urls and turn them into links. That it does fine,
but it's also allowing urls like this:

http://www.domain.illegalsuffix

Which the \.[a-zA-Z]{2,3} is there to prevent. Any ideas on where i'm going
wrong?

Thanks,

-Paul.




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

Date: Sat, 2 Jan 1999 16:13:34 -0000
From: "Paul Wood" <john.wood@diamond.co.uk>
Subject: Regexp
Message-Id: <76lh21$rv7$1@nclient3-gui.server.ntli.net>

For some reason (probably obvious, but not to me) this regexp isn't doing
what i'd like it to:

s/(http:\/\/[\w\-.]+\.[a-zA-Z]{2,3}([\w\-.\/~]+)?)/<a href="$1"
target="_top">$1<\/a>/gi;

It should find any http:// urls and turn them into links. That it does fine,
but it's also allowing urls like this:

http://www.domain.illegalsuffix

Which the \.[a-zA-Z]{2,3} is there to prevent. Any ideas on where i'm going
wrong?

Thanks,

-Paul.




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

Date: Sat, 02 Jan 1999 15:22:06 GMT
From: imchat@ionet.net
Subject: Re: regexp
Message-Id: <368e3950.76596750@news.ionet.net>

	Its incredible just how many ways there are to do things with
Perl! Thanks to everyone that helped! 

On Sat, 02 Jan 1999 09:40:54 GMT, bart.lateur@skynet.be (Bart Lateur)
wrote:

>
>Dead easy. The next will delete everything up to (including) the last
>backslash, forward slash (the alternative) or colon (the protocol or
>drive prefix):
>
>	s/.*[\\\/:]//;
>
>   HTH,
>   Bart.



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

Date: 2 Jan 1999 14:52:13 -0000
From: Jonathan Stowe <gellyfish@btinternet.com>
Subject: Re: regexp
Message-Id: <76lbqt$v5$1@gellyfish.btinternet.com>

On Sat, 02 Jan 1999 01:34:07 GMT imchat@ionet.net wrote:
> 	I'm really new to regexps and even though I've been studying
> them, I can't seem to formulate one that will turn something like
> this;
> c:\whatever\whatever\whatever\image.gif 
> TO 
> image.gif
> 

Whilst others have posted working regex it might be opportune to point you
in the direction of the module File::Basename which provides a relatively
platform independent way of doing this kind of thing.  Generally it might
be considered overkill for a problem of this sort however as I say it is
fairly clever about dealing with the different pathname syntaz on various
platforms and can return you various bits of the pathname as required.

/J\
-- 
Jonathan Stowe <jns@btinternet.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>


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

Date: Sat, 02 Jan 1999 17:26:43 GMT
From: see.sig@for.address (Stephen Clouse)
Subject: Re: Regexp
Message-Id: <368f525c.74093443@news.kc.net>

On Sat, 2 Jan 1999 16:13:34 -0000 in message
<<76lgro$rue$1@nclient3-gui.server.ntli.net> comp.lang.perl.misc>, "Paul Wood"
<john.wood@diamond.co.uk> wrote:

>s/(http:\/\/[\w\-.]+\.[a-zA-Z]{2,3}([\w\-.\/~]+)?)/<a href="$1"
>target="_top">$1<\/a>/gi;
>
>It should find any http:// urls and turn them into links. That it does fine,
>but it's also allowing urls like this:
>
>http://www.domain.illegalsuffix
>
>Which the \.[a-zA-Z]{2,3} is there to prevent. Any ideas on where i'm going
>wrong?

The ([\w\-.\/~]+)?) afterwards negates it, because it matches everything after
the three characters, as this little debug session shows:

DB<1> $blah = 'http://www.domain.illegalsuffix'
DB<2> @blah = ($blah =~ /http:\/\/([\w\-.]+)\.([a-zA-Z]{2,3})([\w\-.\/~]+)?/)
DB<3> p $blah[0]
www.domain
DB<4> p $blah[1]
ill
DB<5> p $blah[2]
egalsuffix

I think I know what you were trying to do with that last bit, but it's not quite
right, since you're trying to force a word boundary right after the {2,3}
element.

This should work better:

s|(http://[\w\-.]+\.[a-zA-Z]{2,3}(?!\w))|<A HREF="$1" TARGET="_top">$1</A>|gi;

The (?!\w) ensures that what follows is a nonword character, so if another
letter follows (such as the e in illegal) it will not match, but it should pick
up URLs encased in quotes (which is Probably What You Want (TM)).

-- 
Stephen Clouse -- steve at acme-labs.com
Acme Labs Resident Megalomaniac (http://www.acme-labs.com)


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

Date: Sat, 02 Jan 1999 17:16:53 GMT
From: Rick Delaney <rick.delaney@home.com>
Subject: Re: Splitting Input File W/$INPUT_RECORD_SELECTOR
Message-Id: <368E5650.C6150CF3@home.com>

Bart Lateur wrote:
> 
>         @records = split /\*\*\*\*\*\n/, $wholefile;

Or with fewer backslashes:

    @records = split /\Q*****\E\n/, $wholefile;

-- 
Rick Delaney
rick.delaney@shaw.wave.ca


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

Date: 2 Jan 1999 17:57:18 GMT
From: umdvikram@aol.com (UMD Vikram)
Subject: Re: Splitting Input File W/$INPUT_RECORD_SELECTOR
Message-Id: <19990102125718.25117.00004832@ng127.aol.com>

I just want to thank all three of you guys for your help.

It cleared everything up with SEPARATOR and not SELECTOR.

Then the snip of code cleared it up.

Thanks and Happy New Year,
Vikram Pant
http://VikramPant.Com


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

Date: Sat, 02 Jan 1999 15:25:40 GMT
From: dcjames@cc390563-a.brndmll1.va.home.com ()
Subject: Re: Thanks! and happy new year!
Message-Id: <slrn78sekl.as.dcjames@cc390563-a.brndmll1.va.home.com>

On Fri, 01 Jan 1999 21:31:02 -0500, Matthew O. Persico wrote:
>Quiz time.
>
>Q: Describe the quote below:
>
>1) Sarcasm
>2) Drunken Stupor.
>3) Truth - in which case, I've been mising it.
>
>Gregg Silk wrote:
>> 
>> Thanks to everyone so far. I am amazed at what a helpful and polite 
>> group this is.

Truth. You find what you look for, you get what you give.
Obviously, Gregg politely asked for help. ;)
He probably did his homework first, too.

--
Doug


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

Date: 12 Dec 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Special: Digest Administrivia (Last modified: 12 Dec 98)
Message-Id: <null>


Administrivia:

Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing. 

]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body.  Majordomo will then send you instructions on how to confirm your
]subscription.  This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.

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.misc (and this Digest), send your
article to perl-users@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.

The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.

The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.

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 V8 Issue 4532
**************************************

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