[18166] in Perl-Users-Digest
Perl-Users Digest, Issue: 334 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Feb 22 11:05:31 2001
Date: Thu, 22 Feb 2001 08:05:10 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <982857909-v10-i334@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest           Thu, 22 Feb 2001     Volume: 10 Number: 334
Today's topics:
        Bug ID (20010221.010) (was: Re: \w{1} matches more than <mischief@velma.motion.net>
    Re: Clearing Data on a webpage..... <c_clarkson@hotmail.com>
    Re: Compiling perl sources? <carvdawg@patriot.net>
    Re: Compiling perl sources? <simon.andrews@bbsrc.ac.uk>
        DB_File <livia74@ctimail3.com>
    Re: Difficult Split Question <godzilla@stomp.stomp.tokyo>
    Re: Free debugger suggestions <c_clarkson@hotmail.com>
        Help: CGI Question: Can I display Loading page before t <junzhang@bu.edu>
    Re: How can I detect if program is run by cron? (hymie!)
    Re: How can I detect if program is run by cron? <uri@sysarch.com>
    Re: Integrating Cybercash with S-Mart shopping cart - d (Maggert)
    Re: Is a function/class library for processing of SMTP- (Cameron Laird)
    Re: jeopardy posting (Jon Bell)
    Re: jeopardy posting <godzilla@stomp.stomp.tokyo>
    Re: PERL And ASP (Maggert)
        Perl in UNIX <khleung@cse.cuhk.edu.hk>
    Re: Perl in UNIX <joe+usenet@sunstarsys.com>
    Re: Perl in UNIX (Rafael Garcia-Suarez)
    Re: Perl in UNIX (Abigail)
        POST and / <M.I.Planchant@ncl.ac.uk>
    Re: POST and / <peter.s@tjgroup.dk>
    Re: POST and / <jonni@ifm.liu.se>
    Re: Regexp to match Web urls? <nospam.newton@gmx.li>
        Ripping apart a scalar - Important! <radioliam@charter.net>
    Re: Ripping apart a scalar - Important! (LK)
        script <Per-fredrik.Pollnow@epk.ericsson.se>
    Re: script <real@earthling.net>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Thu, 22 Feb 2001 16:02:31 -0000
From: Chris Stith <mischief@velma.motion.net>
Subject: Bug ID (20010221.010) (was: Re: \w{1} matches more than 1 character)
Message-Id: <t9ae0ng6b2odb@corp.supernews.com>
Keywords: [20010221.010],bug,perl,5.6.0,5.6.1,5.7.0,utf8,match,mulitpliers
[ a complimentary cc of this message has been sent to all recipients
  of the email to which it replies, and it has also been posted
  to comp.lang.perl.misc for public viewing ]
On Thu, 22 Feb 2001, Philip Newton wrote:
> [de-jeopardization]
> 
> On 22 Feb 2001, at 1:02, Benjamin Holzman wrote:
> 
> > On Wed, Feb 21, 2001 at 10:57:19PM -0600, root@velma.motion.net wrote:
> > > When using the utf8 pragma, regex match multipliers do not
> > > work properly under perl 5.6.0 -- or at least act surprisingly.
> > >
> > >     use utf8;
> > >     my $z = 'aaa';
> > >     $z =~ s/(\w{2})/\U$1/; ### interesting line
> > >     print $z ."\n";
> > > 
> > > The code prints 'AAA', as it does when the interesting line
> > > contains 1 in the match multiplier. I downloaded and installed
> >
> > This bug still exists in perl-5.6.1-TRIAL2 and 5.7.0, but is fixed in
> > perl@8585 at least.
> 
> perl@8530 also does not show the bug.
> 
> Any idea which patch fixed that bit?
Personally, I don't know when it was fixed. However, I think it important
to fix such things in whatever version is called "stable" at the moment.
If that means releasing a newer version as stable, then so be it. If not,
then it would be nice if someone found some round tuits who would know how
to fix it in the current stable release.
If neither above option is feasible, then an official statement such as
"Known to be broken, if you need this functionality upgrade to version foo
at the risk of being non-stable or use this suggested work-around: bar".
That would at least keep people from attaching false hope to it being fixed
in the version people are told they should use in production.
Chris
-- 
Christopher E. Stith
If they can get you asking the wrong questions, they don't
have to worry about the answers.
  -- Thomas Pynchon, Gravity's Rainbow
------------------------------
Date: Thu, 22 Feb 2001 09:24:50 -0600
From: "Charles K. Clarkson" <c_clarkson@hotmail.com>
Subject: Re: Clearing Data on a webpage.....
Message-Id: <FB04DAB6401A7320.2C9BE7C0B9A84DC7.18AD6000F455909D@lp.airnews.net>
Phil Shean <philip.shean@uwe.ac.uk> wrote:
: Hi All,
:
: I am doing some processing of files and outputting some data on
: the process as it runs through.
:
: The output of the current state of the process is sent to a webpage.
:
: Would it be possible to clear the generated webpage and create
: a new page in its place.
    Are you refering to a server push? There is some support for it
in CGI.pm. Pushing would allow you to change a page's
information without user interaction.
HTH,
Charles K. Clarkson
------------------------------
Date: Thu, 22 Feb 2001 09:29:46 -0500
From: H C <carvdawg@patriot.net>
Subject: Re: Compiling perl sources?
Message-Id: <3A95225A.BFE9CC1@patriot.net>
> Thanks for your hint, but I use a lot of additional packages, and I am
> not sure whether a binary distribution cotains all my packages (like
> Date::Calc, Tk, Text::wrap, .......(.
You should really take a look at Activestate's distribution.  There are "a
lot of
additional packages" available...I use Tk all the time, and I found the
others you
listed above in the packages directories at the ActiveState site.  They are
very
easy to install...simply type:
ppm install <module name>
at the command prompt.
------------------------------
Date: Thu, 22 Feb 2001 14:07:38 +0000
From: Simon Andrews <simon.andrews@bbsrc.ac.uk>
Subject: Re: Compiling perl sources?
Message-Id: <3A951D2A.C9B38762@bbsrc.ac.uk>
Christian Meisl wrote:
> 
> Beable van Polasm <beable@my-deja.com> writes:
> > I guess the first thing to do would be to look at what error you
> > got. But why would you want to build your own perl on Win95 when
> > you can just download a prebuilt binary?
> 
> Thanks for your hint, but I use a lot of additional packages, and I am
> not sure whether a binary distribution cotains all my packages (like
> Date::Calc, Tk, Text::wrap, .......(.
Many packages are also available ready to go via the ppm utility.  Check
at 
	http://www.activestate.com/Products/ActivePerl/status.html
for the ones you are interested in (I think all those you mention above
are there).  If you want a package that isn't listed, then unless it has
a component which itself needs to be compiled, you can install and use
it in exactly the same way as with Perl on any other platform.  There's
nothing special about Active/Indigo Perl in that respect.
	TTFN
	Simon.
------------------------------
Date: Thu, 22 Feb 2001 23:05:16 +0800
From: TomC <livia74@ctimail3.com>
Subject: DB_File
Message-Id: <3A952AAC.C74C0E2D@ctimail3.com>
Hi all,
I read a script with the follwoing lines:
$masterDb_obj = tie(%masterDb, 'DB_File', undef,O_CREAT|O_RDWR, 0644,
$DB_BTREE);
 $masterDb_obj->sync();
Actually, I don't know the function of sync()?
Thanks
Brian
------------------------------
Date: Thu, 22 Feb 2001 06:34:39 -0800
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: Difficult Split Question
Message-Id: <3A95237F.48DC0828@stomp.stomp.tokyo>
Christopher Burke wrote:
 
> I have input lines of the form :
 
> a,b,c,xyz(p,q,r),d
> a,def(x,y,z),b,pqr(m,n)
 
> I wish to split the line based on all ',' 
> characters that are not between '(' and ')'.
 
Having given all half-dozen or so of you boys a good
thrashing during round one, simply to attain your
dubious attention, during round two I shall score
a quick and decisive TKO against all six of you,
at once.
DING! DING!
WHAM! POW! BLAM! 
* sounds of six boys face planting the ring mat *
* does a double back flip, jumps up and down, prances *
* repeatedly screams like Mohammad Ali *
I AM THE GREATEST! I AM THE GREATEST! I AM THE GREATEST!
You boys should turn off your computers, go outside
and workout each and everyday like I do. You just
don't have what it takes to challenge me, even at
six to one odds.
Godzilla! * Just Astonishing Perl Hacker *
--
TEST SCRIPT:
____________
#!perl
print "Content-type: text/plain\n\n";
use Benchmark;
timethese (100000,
 {
'name1' => 
  '$text = "a,b,c,def(g,h,i),j,k,lmn(o,p,q),r,stu(v,w),xyz";
   do
    {
     $start = index ($text, "(", $start);
     $stop = index ($text, ")", $start);
     $temp1 = substr ($text, $start, $stop - $start);
     $temp1 =~ tr/,/¿/;
     substr ($text, $start, $stop - $start, $temp1);
     $start++;
    }
   until (index ($text, "¿", rindex ($text, "(")) > -1);
   @Array = split (/,/, $text);
   foreach (@Array) { $_ =~ tr/¿/,/; }',
'name2' => 
  '$text = "a,b,c,def(g,h,i),j,k,lmn(o,p,q),r,stu(v,w),xyz";
   push @new, $+ while 
   $text =~ m/([^(,]*\([^\)\\]*(?:\\.[^\)\\]*)*\)),?|([^,]+),?|(),/gx;',
 }
  );
exit;
PRINTED RESULTS:
________________
Benchmark: timing 100000 iterations of name1, name2...
  name1:  9 wallclock secs ( 8.68 usr +  0.00 sys =  8.68 CPU) @ 11520.74/s
  name2: 13 wallclock secs (13.62 usr +  0.00 sys = 13.62 CPU) @ 7342.14/s
------------------------------
Date: Thu, 22 Feb 2001 09:33:20 -0600
From: "Charles K. Clarkson" <c_clarkson@hotmail.com>
Subject: Re: Free debugger suggestions
Message-Id: <7EE993619E86F682.19657A61D5EB2FAB.B04902178A064FA2@lp.airnews.net>
Matt <mshort@usol.com> wrote:
: I am currently using SynEdit for Perl editing, however, I don't like not
: have line numbers, but I like the fact that I can hit F8 and have the
script
: run in dos mode.  Any suggestions on another editing tool?
    I use Ultredit on a windoze PC. You configure the command
line using F( and can repeat it with cntrol-F9. The msdos window
is copied to a window in the editor so you don't have to leave
Ultraedit. You can also customize a 'macro' to use a dos window
directly.
HTH,
Charles K. Clarkson
------------------------------
Date: 22 Feb 2001 15:33:51 GMT
From: jun zhang <junzhang@bu.edu>
Subject: Help: CGI Question: Can I display Loading page before the cgi exports all the data ?
Message-Id: <973bgv$7u0$1@news3.bu.edu>
Hi,
I am using Perl to write cgi to generate report. 
As the data base is quite large the process usually takes about 5 min, 
so the browser will appear frozen untill the cgi exported all the data to the template. 
Sometimes user keeps on pressing "submit" because the report was delyed too long, 
this actually makes things even worse.
My Question:
1. Can I display a "Loading Page" to tell user his request is being processed untill the process's done, 
it will display the report page? 
2. If I can NOT display the loading page, can I set up some kind of script 
to avoid the user sumbmit same request again and again when the first one is being processed ?
Any help will be appreciated,
Jun
------------------------------
Date: Thu, 22 Feb 2001 14:52:00 -0000
From: hymie@lactose.smart.net (hymie!)
Subject: Re: How can I detect if program is run by cron?
Message-Id: <t9a9sg5k55lb44@corp.supernews.com>
In our last episode, the evil Dr. Lacto had captured our hero,
  "John Lin" <johnlin@chttl.com.tw>, who said:
>How to detect whether the program is run by cron?
>Actually my intention is: when the STDOUT is not
>available (like in "cron"), output to a file.
STDOUT is available with cron.
This is probably dependent on which version of Unix you're using.
If you can enable perl's built-in switch parsing (with the -s flag),
then you can run your script from cron with a -cron switch, and test
for the existence of the $cron variable.
hymie!          http://www.smart.net/~hymowitz          hymie@lactose.smart.net
===============================================================================
Sometimes I falter, sometimes I lose. Sometimes I get caught up wallowing in my
blues. So undecided; I hesitate and yet Every once in awhile I just manage to
forget that I think of myself as damaged goods.               --Christine Lavin
===============================================================================
------------------------------
Date: Thu, 22 Feb 2001 15:52:37 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: How can I detect if program is run by cron?
Message-Id: <x7itm2iuka.fsf@home.sysarch.com>
>>>>> "JM" == Josef Moellers <josef.moellers@fujitsu-siemens.com> writes:
  JM> Uri Guttman wrote:
  >> well, since cron will take the output of a program it runs and
  >> sends it=
  >> via email, you would expect that to be open. try testing STDIN instead
  >> as cron has to close that as there is no input.
  JM> Are you sure? I'd rather expect cron to reopen /dev/null as stdin,
  JM> since just closing it might confuse programs more than redirecting
  JM> it to /dev/null.
solaris cron and crontab never mention STDIN anywhere so you can't
assume where it is coming from or if it is open.  if /dev/null is sent
to STDIN it is not documented and i wouldn't rely on that
behaviour. that is why i said that passing a command line arg or env
value would be the safest way to know if a program was called from cron.
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: Thu, 22 Feb 2001 14:50:54 GMT
From: perl@imchat.com (Maggert)
Subject: Re: Integrating Cybercash with S-Mart shopping cart - doable?
Message-Id: <3a9526d7.298240437@news.ionet.net>
On 21 Feb 2001 03:20:07 -0600, webmistress@shreddedheart.com-nospam
(Webmistress) wrote:
>Hello all,
>I hope someone can help me.  I am in charge of a website, 
>http://www.shattercone.com/ that is currently running S-Mart shopping 
>cart.  Even though the site only has 5-6 products that will not be huge 
>sellers, my bosses insist that we have to use Cybercash.  We have our 
>Cybercash ID, etc., and the MCK was installed by the hosting company 
>and the test harness worked.  That's as far as I can get.  I have read 
>the documentation that comes with the MCK, but it hasn't helped me 
>enough.  S-Mart is a very simple but capable script for what we are 
>doing, and I am hoping there is a way to get it to work Cybercash.  I 
>know there are other carts out there that have built in cybercash 
>modules, but we are trying not to have to spend too much nor get such a 
>complicated script for such a simple website.  If anyone has integrated 
>Cybercash with S-Mart I would appreciate knowing about it, for 
>inspiration if nothing else.  I can send the script if anyone can 
>annotate it with where the Cybercash Cash Register modules go.  I know  
>about customizing scripts but this has got me stumped.
>
>Thank you so much,
>Trisha in Nashville
>
>
	You're probably better off getting in touch with the creators
of the software and pay them to integrate it. Someone is going to get
paid to do the job somewhere and it's easier and faster for the
creator to do it.
------------------------------
Date: 22 Feb 2001 09:33:03 -0600
From: claird@starbase.neosoft.com (Cameron Laird)
Subject: Re: Is a function/class library for processing of SMTP-mails available?
Message-Id: <0DE643CCEC3D640C.DCF7B4897718E9DB.08CF17F86DB0C005@lp.airnews.net>
In article <9730v9$584$1@news.messer.de>, Markus Elfring <ELF@Messer.de> wrote:
>I've found the following:
>> man forward
>" ...
>     If the first character of the address is a vertical bar (|),
>     sendmail(1M)  pipes the message to the standard input of the
>     command the bar precedes.
>... "
>
>I want to read this piped message to import it in one of our systems after
>the sender and the subject had been checked.
>Do you know a function or class library for a programming language (e. g.
>PHP, TCL or Perl) that helps me to process this mail?
>
>
>
Yes.
E-mail filtering is a biiiiiiiiiiiiig subject.  I'll do
my best to cut through a lot of the distractions and reach
something that's useful to you.
You appear to receive e-mail on a Unix host running sendmail.
Yes, standard sendmail installations recognize .forward, part
of which is to pipe items to external commands.
Many languages have libraries that parse RFC822-formatted
items, including Perl
<URL: http://cpan.valueclick.com/modules/by-category/19_Mail_and_Usenet_News/Mail/ >
PHP, and Tcl (tcllib's Mime).  However, there's a possibility
you already have everything you need on your system; procmail
<URL: http://starbase.neosoft.com/~claird/comp.mail.misc/procmail.html >
is a widely-used special-purpose filter for just such situations
as yours appears to be.  It has, in particular, the capability
to select messages based on sender and subject.
-- 
Cameron Laird <claird@NeoSoft.com>
Business:  http://www.Phaseit.net
Personal:  http://starbase.neosoft.com/~claird/home.html
------------------------------
Date: Thu, 22 Feb 2001 14:08:26 GMT
From: jtbell@presby.edu (Jon Bell)
Subject: Re: jeopardy posting
Message-Id: <G95wM2.BG1@presby.edu>
In article <9733e9$319$1@mamenchi.zrz.TU-Berlin.DE>,
Anno Siegel <anno4000@lublin.zrz.tu-berlin.de> wrote:
>According to Jonas Nilsson <jonni@ifm.liu.se>:
>> Can someone please explain this term to me?
>
>When a poster puts a reply at the top, leaving the quoted material at
>the bottom we call that "jeopardy posting".
This irritates people not only because it inverts the logical sequence of
the material (as Anno explains), but also because people who "jeopardy
post" usually also quote the *entire* preceding posting, regardless of how
much of it is directly relevant to their own posting.  This wastes network
resources and readers' time.
-- 
Jon Bell <jtbell@presby.edu>                        Presbyterian College
Dept. of Physics and Computer Science        Clinton, South Carolina USA
------------------------------
Date: Thu, 22 Feb 2001 06:43:30 -0800
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: jeopardy posting
Message-Id: <3A952592.FCD192F@stomp.stomp.tokyo>
Jon Bell wrote:
 
> Anno Siegel wrote:
> > Jonas Nilsson wrote:
> > > Can someone please explain this term to me?
> > When a poster puts a reply at the top, leaving the quoted material at
> > the bottom we call that "jeopardy posting".
> This irritates people not only because it inverts the logical sequence of
> the material (as Anno explains), but also because people who "jeopardy
> post" usually also quote the *entire* preceding posting, regardless of how
> much of it is directly relevant to their own posting.  This wastes network
> resources and readers' time.
I tell you what irritates me. You boys constantly spamming this
newsgroup with your childish idiotic rants about jeopardy posts,
this is what really irritates me.
* flat palm smacks her forehead *
jeeesshhh... Neandertals.
Godzilla!
------------------------------
Date: Thu, 22 Feb 2001 14:43:42 GMT
From: perl@imchat.com (Maggert)
Subject: Re: PERL And ASP
Message-Id: <3a9524d8.297729652@news.ionet.net>
On 22 Feb 2001 00:31:39 +0100, execworks@hotmail.com ("Peter
Loraditch") wrote:
>
>
>Hello Perl Guru’s
>
>I am new to PERL, however, I have searched endlessly for two days to be in 
>the know.  My search began when my boss handed me a perl file and asked me 
>to impliment a procedure to unleash its magic on our intranet users.  The 
>procedure requires a data file to be uploaded to the webserver and read by 
>the perl file to write an fpga (field programmable gate array)graphical 
>layout onto an html page.  The perl file runs appropriately from the command 
>line. My question is, how can I programmatically launch the perl file from 
>an active server page after the asp uploads the data file to the webserver.  
>It seems to me that there ought to be a way to achieve the command line 
>result with two or three lines of script.  I  have searched to no avail.  
>Your assistance would be greatly appreciated in this regard.
>
	Setup a batch file to run the script on a schedule and then
just import the file it produces into ASP, however you go about doing
that with ASP. Or just leave it as is and link to "Oh MY God" an html
file which the script produces.
------------------------------
Date: 22 Feb 2001 15:08:35 GMT
From: Ivan Leung <khleung@cse.cuhk.edu.hk>
Subject: Perl in UNIX
Message-Id: <973a1j$abs$1@eng-ser1.erg.cuhk.edu.hk>
I want to ask can I set the permission of a perl script to be executed 
by others but not read by others?
Thanks
-- 
Cheers,
Ivan
------------------------------
Date: 22 Feb 2001 10:29:25 -0500
From: Joe Schaefer <joe+usenet@sunstarsys.com>
Subject: Re: Perl in UNIX
Message-Id: <m3hf1m4tyi.fsf@mumonkan.sunstarsys.com>
Ivan Leung <khleung@cse.cuhk.edu.hk> writes:
> I want to ask can I set the permission of a perl script to be executed 
> by others but not read by others?
Did you read the answer in perlfaq3?
    % perldoc -q hide
-- 
Joe Schaefer    "If you were plowing a field, which would you rather use? Two
                                strong oxen or 1024 chickens?"
                                               -- Seymour Cray
------------------------------
Date: Thu, 22 Feb 2001 15:32:18 GMT
From: rgarciasuarez@free.fr (Rafael Garcia-Suarez)
Subject: Re: Perl in UNIX
Message-Id: <slrn99ac74.tc7.rgarciasuarez@rafael.kazibao.net>
Ivan Leung wrote in comp.lang.perl.misc:
> 
> I want to ask can I set the permission of a perl script to be executed 
> by others but not read by others?
Obviously yes, with "chmod 711 script.pl". But this won't be useful.
Other people won't be able to run your script : the perl interpreter has
to read the perl script to run it.
-- 
Rafael Garcia-Suarez / http://rgarciasuarez.free.fr/
------------------------------
Date: 22 Feb 2001 15:34:10 GMT
From: abigail@foad.org (Abigail)
Subject: Re: Perl in UNIX
Message-Id: <slrn99acbi.u8c.abigail@tsathoggua.rlyeh.net>
Ivan Leung (khleung@cse.cuhk.edu.hk) wrote on MMDCCXXXII September
MCMXCIII in <URL:news:973a1j$abs$1@eng-ser1.erg.cuhk.edu.hk>:
<> 
<> I want to ask can I set the permission of a perl script to be executed 
<> by others but not read by others?
You can't.
HTH. HAND.
Abigail
-- 
perl -Mstrict -we '$_ = "goto _.print chop;\n=rekcaH lreP rehtona tsuJ";_1:eval'
------------------------------
Date: 22 Feb 2001 15:12:14 GMT
From: "M.I. Planchant" <M.I.Planchant@ncl.ac.uk>
Subject: POST and /
Message-Id: <973a8e$18o$1@ucsnew1.ncl.ac.uk>
I've written a perl script which uses a URL which is submitted using POST. The
problem im having is that the / in the submitted URL are replaced with %2F. Ive
want to use the following but it won't work. What do I use?
$data =~s/\%2F///g;
Any help greatly recieved. 
Cheers,
Matt
------------------------------
Date: Thu, 22 Feb 2001 16:39:03 +0100
From: "Peter Søgaard" <peter.s@tjgroup.dk>
Subject: Re: POST and /
Message-Id: <973bka$o2i$1@news.inet.tele.dk>
You forgot to escape the /
use this:
$data =~s/\%2F/\//g;
"M.I. Planchant" <M.I.Planchant@ncl.ac.uk> skrev i en meddelelse
news:973a8e$18o$1@ucsnew1.ncl.ac.uk...
> I've written a perl script which uses a URL which is submitted using POST.
The
> problem im having is that the / in the submitted URL are replaced with
%2F. Ive
> want to use the following but it won't work. What do I use?
>
> $data =~s/\%2F///g;
>
> Any help greatly recieved.
>
> Cheers,
>
> Matt
------------------------------
Date: Thu, 22 Feb 2001 16:49:26 +0100
From: "Jonas Nilsson" <jonni@ifm.liu.se>
Subject: Re: POST and /
Message-Id: <973cc5$h25$1@newsy.ifm.liu.se>
> You forgot to escape the /
> use this:
>
> $data =~s/\%2F/\//g;
>
Or even better
$data =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
Which will change all the %XX type strings to its correct character.
/jN
--
 _____________________     _____________________
|   Jonas Nilsson     |   |                     |
|Linkoping University |   |      Telephone      |
|       IFM           |   |      ---------      |
| Dept. of Chemistry  |   | work: +46-13-285690 |
|  581 83 Linkoping   |   | fax:  +46-13-281399 |
|      Sweden         |   | home: +46-13-130294 |
|_____________________|   |_____________________|
------------------------------
Date: Thu, 22 Feb 2001 15:46:51 +0100
From: "Philip 'Yes, that's my address' Newton" <nospam.newton@gmx.li>
Subject: Re: Regexp to match Web urls?
Message-Id: <fo6a9tkuomaon8d2dd3ridrk5qsoe6tfam@4ax.com>
[F'up set]
On 21 Feb 2001 22:03:09 GMT, Eli the Bearded <elijah@workspot.net>
wrote:
> In comp.lang.perl.misc, Clay Shirky <clays@panix.com> wrote:
> > I need the canonical regexp to match urls beginning with http:// (I
> > don't need to worry about ftp:, telnet: or mailto:, in other words)
> > and though I don't want to roll my own, Google searches of the form 
> 
> Maybe not cannonical, but
> 
>   @parts =
>   m,\b
>    (http)                # scheme
>    ://(?:
> 	(?:
> 	    ([^:@/\s]+)  # username -- if password in URL
> 	:)?
> 	([^:@/\s]+)      # username if no password -- otherwise password
> 	 @
>       )?
[snip]
Definitely not canonical: HTTP URLs have no username:password@ in
them, to my knowledge. Certainly not in RFC 1738 (URLs; see section
3.3) nor in RFC 2616 (HTTP/1.1; see section 3.2.2)[1]. Documentary
evidence to the contrary is gladly accepted at my email address;
followups are set. (Since this has nothing to do with Perl.)
Cheers,
Philip
[1] RFC 2396 (URIs) doesn't count in my book, since even though it has
:    URL schemes that involve the direct use of an IP-based protocol to a
:    specified server on the Internet use a common syntax for the server
:    component of the URI's scheme-specific data:
: 
:       <userinfo>@<host>:<port>
: 
:    where <userinfo> may consist of a user name and, optionally, scheme-
:    specific information about how to gain authorization to access the
:    server.  The parts "<userinfo>@" and ":<port>" may be omitted.
in section 3.2.2, I consider the other two RFCs to be more specific,
and hence to override this general "IP-based protocol" statement. -Ph.
-- 
Philip Newton <nospam.newton@gmx.li>
If you're not part of the solution, you're part of the precipitate
------------------------------
Date: Thu, 22 Feb 2001 09:57:22 -0800
From: "Liam" <radioliam@charter.net>
Subject: Ripping apart a scalar - Important!
Message-Id: <t9aa4jfv4ukebb@corp.supernews.com>
I'm in a desperate bind and need an application built by the end of the day,
so I beg of you all for some help.
How would I take a scalar, say from a text field, and attempt to insert
characters into it.  For example:  I have a phone number field, but I want
to make sure that the area code has parenthesis around it. Any ideas?
Much appreciated, and I would love an e-mail response but I will keep
checking back here.
Liam McCusker
------------------------------
Date: Thu, 22 Feb 2001 16:01:42 GMT
From: lkenny@fisheries.org (LK)
Subject: Re: Ripping apart a scalar - Important!
Message-Id: <3a95351a.10862902@wingate>
On Thu, 22 Feb 2001 09:57:22 -0800, "Liam" <radioliam@charter.net>
wrote:
>How would I take a scalar, say from a text field, and attempt to insert
>characters into it.  For example:  I have a phone number field, but I want
>to make sure that the area code has parenthesis around it. Any ideas?
It sounds like you are using an html form to get the number.  If so,
why not just use javascript to make sure the number is entered the way
you want.
Otherwise, how are the numbers coming in?  Are soem of them going to
have parenthesis and others not?  Or is it just a 10 digit number
coming in?
Something like the following could work to format the number how you
want:
#!/usr/local/bin/perl
$num = "212.555.4444";
if($num !~ /\(/){
	$num =~ s/\D//eg;
	$s = substr($num, "0", "3");
	$n = substr($num, "3", "3");
 	$x = substr($num, "6", "4");
	$s = "(".$s.")";
	$s = $s.$n."-".$x;
}
print "$s\n";
BTW, always good to run into another Liam.
LK
------------------------------
Date: Thu, 22 Feb 2001 15:33:44 +0100
From: "Per- Fredrik Pollnow" <Per-fredrik.Pollnow@epk.ericsson.se>
Subject: script
Message-Id: <9737a8$4uj$1@newstoo.ericsson.se>
Hi,
IF I have a ksh script and want it to be include to my perl script so I can
put my variables in to it, to call the script and then put my variables to
it. like this:
#!perl -w
print "Enter name name: ";chomp($x = <STDIN>);
print "Enter password: ";chomp($z = <STDIN>);
# now the shell script
#!/bin/ksh
SMALLUSAGE=$(cat << EOF
Usage: $0 -a -u $x -p $z -m mailAddress -U fdsUser -P fdsPwd [-s]
 $0 -d -u $x -U $x -P fdsPwd [-s]
EOF
)
function die
{ #prints message $1, and exits with code $2
        echo "$1" >&2
        exit $2
}
and so on.............
------------------------------
Date: Thu, 22 Feb 2001 16:00:02 +0100
From: "Real" <real@earthling.net>
Subject: Re: script
Message-Id: <9739hl$l8q$1@news.surfnet.nl>
"Per- Fredrik Pollnow" <Per-fredrik.Pollnow@epk.ericsson.se> wrote in
message news:9737a8$4uj$1@newstoo.ericsson.se...
> IF I have a ksh script and want it to be include to my perl script so I
can
> put my variables in to it, to call the script and then put my variables to
> it. like this:
[script code moved to end of mail]
Tricky, since both ksh and Perl identify variables using $ characters. Also,
if I look at your script, there's no need to use a ksh script. You can use
the system(), exec(), or even back-ticked commands for that. Or the other
way around; there are no Perl specifics which are impossible in ksh.
Cheers,
Real
> #!perl -w
> print "Enter name name: ";chomp($x = <STDIN>);
> print "Enter password: ";chomp($z = <STDIN>);
> # now the shell script
> #!/bin/ksh
> SMALLUSAGE=$(cat << EOF
> Usage: $0 -a -u $x -p $z -m mailAddress -U fdsUser -P fdsPwd [-s]
>  $0 -d -u $x -U $x -P fdsPwd [-s]
> EOF
> )
>
> function die
> { #prints message $1, and exits with code $2
>         echo "$1" >&2
>         exit $2
> }
>
> and so on.............
>
>
------------------------------
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 V10 Issue 334
**************************************