[13395] in Perl-Users-Digest
Perl-Users Digest, Issue: 805 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Sep 15 14:07:42 1999
Date: Wed, 15 Sep 1999 11:05:21 -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, 15 Sep 1999 Volume: 9 Number: 805
Today's topics:
Carrige Returns UNWANTED>. HELP ME <duthler@tebenet.nl>
Re: Carrige Returns UNWANTED>. HELP ME (Abigail)
Re: Carrige Returns UNWANTED>. HELP ME (Kragen Sitaker)
Re: CGI cannot open relative path <rootbeer@redcat.com>
Re: CGI cannot open relative path (Kragen Sitaker)
Re: CGI in PERL <samay1NOciSPAM@hotmail.com>
Re: challenge results <srooij@wins.uva.nl>
command to update the mainloop during longrunning subs? <baal@c2i.net>
Dbm_hash: long value for empty key <tanner@ultra.math.uni-potsdam.de>
Re: Dbm_hash: long value for empty key (Kragen Sitaker)
Re: Forcing Variable interpolation of string read from (Abigail)
Re: Giving names to arrays automatically <tchrist@mox.perl.com>
Re: HELP PARSE EMAIL ADDRESSES PLEASE (Kragen Sitaker)
Hot, Fun S.F Startup Seeks a Gaggle of Perl People harad@my-deja.com
Re: How to validate a URL? <rootbeer@redcat.com>
Re: How to validate a URL? <Mark@Mark.Com>
Re: How to validate a URL? (this.address.is.valid.too)
Re: How to validate a URL? (Abigail)
Re: How to validate a URL? <rootbeer@redcat.com>
Re: is this object a child of this class? <mike@yawp.com>
Re: Perl Apache Win95 (Kragen Sitaker)
Digest Administrivia (Last modified: 1 Jul 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 15 Sep 1999 19:18:42 +0200
From: "jan smit" <duthler@tebenet.nl>
Subject: Carrige Returns UNWANTED>. HELP ME
Message-Id: <7rokd9$72$1@zonnetje.nl.uu.net>
im trying to write a script that can download rawdata from the internet ..
but at the end of each string i have a carrige return (0x0d,0x0a)
and i can use chomp to remove it .. but all i hafta remove = the 0x0d ..
well i removed them both with chomp and tried to add just the char 0x0a ..
but everytime i look at the file (with a hex editor) where i have put the
0x0a i always get an 0x0d also .. and i dont want them.. who can help me???
------------------------------
Date: 15 Sep 1999 12:57:14 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Carrige Returns UNWANTED>. HELP ME
Message-Id: <slrn7tvnke.hj3.abigail@alexandra.delanet.com>
jan smit (duthler@tebenet.nl) wrote on MMCCVI September MCMXCIII in
<URL:news:7rokd9$72$1@zonnetje.nl.uu.net>:
|| im trying to write a script that can download rawdata from the internet ..
|| but at the end of each string i have a carrige return (0x0d,0x0a)
|| and i can use chomp to remove it .. but all i hafta remove = the 0x0d ..
|| well i removed them both with chomp and tried to add just the char 0x0a ..
|| but everytime i look at the file (with a hex editor) where i have put the
|| 0x0a i always get an 0x0d also .. and i dont want them.. who can help me???
Well, if you don't want it, why do you put it there? ;-)
Your question is vague, and it doesn't contain any code. Are you sure
you have removed the 0x0a? Are you sure you don't write 0x0a? I.e.,
if you use "\n", which bytes are generated on your system?
Abigail
--
sub _'_{$_'_=~s/$a/$_/}map{$$_=$Z++}Y,a..z,A..X;*{($_::_=sprintf+q=%X==>"$A$Y".
"$b$r$T$u")=~s~0~O~g;map+_::_,U=>T=>L=>$Z;$_::_}=*_;sub _{print+/.*::(.*)/s}
*_'_=*{chr($b*$e)};*__=*{chr(1<<$e)};
_::_(r(e(k(c(a(H(__(l(r(e(P(__(r(e(h(t(o(n(a(__(t(us(J())))))))))))))))))))))))
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: Wed, 15 Sep 1999 18:00:23 GMT
From: kragen@dnaco.net (Kragen Sitaker)
Subject: Re: Carrige Returns UNWANTED>. HELP ME
Message-Id: <X8RD3.13127$N77.936913@typ11.nn.bcandid.com>
In article <7rokd9$72$1@zonnetje.nl.uu.net>,
jan smit <duthler@tebenet.nl> wrote:
>im trying to write a script that can download rawdata from the internet ..
>but at the end of each string i have a carrige return (0x0d,0x0a)
>and i can use chomp to remove it .. but all i hafta remove = the 0x0d ..
>well i removed them both with chomp and tried to add just the char 0x0a ..
>but everytime i look at the file (with a hex editor) where i have put the
>0x0a i always get an 0x0d also .. and i dont want them.. who can help me???
What platform are you on? Some kludgy platforms, in a failed attempt
to support Unix programs written in C, translate 0x0a to 0x0d 0x0a on
output and 0x0d 0x0a to 0x0a on input, when reading or writing files,
unless you explicitly tell them not to. All Microsoft OSes are among
these kludgy platforms.
If that's the problem, use binmode(OUTPUTFILEHANDLE) before writing out
the file.
(Yes, I know you should do this anyway. I know C says you shouldn't
assume things aren't being translated on input and output. But that
breaks the Unix model of not having to worry about whether you're
manipulating binary or text data, and is unquestionably far less
convenient for the programmer, and for the user of programs whose
programmers forgot to worry about it.)
--
<kragen@pobox.com> Kragen Sitaker <http://www.pobox.com/~kragen/>
Tue Sep 14 1999
55 days until the Internet stock bubble bursts on Monday, 1999-11-08.
<URL:http://www.pobox.com/~kragen/bubble.html>
------------------------------
Date: Wed, 15 Sep 1999 10:43:45 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: CGI cannot open relative path
Message-Id: <Pine.GSO.4.10.9909151028180.25903-100000@user2.teleport.com>
On Wed, 15 Sep 1999, JduPayrat wrote:
> When I try to open a file with a relative path, it fails saying 'No
> such file or directory'.
The CGI spec doesn't specify which directory will be the current working
directory when a CGI program is started.
http://hoohoo.ncsa.uiuc.edu/cgi/
It may be the root directory, the server's working directory, the home
directory for user nobody, the home directory for root, the directory the
program is stored in, the directory the server is stored in, the base
cgi-bin directory, the /tmp directory, a directory you don't have access
to from the shell, a directory named after an annoying character from
Saturday Night Live, a directory chosen at random, or some other
directory.
A CGI program which uses a relative path before chdir()ing to a
non-relative path is in a state of sin.
Cheers!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Wed, 15 Sep 1999 17:54:35 GMT
From: kragen@dnaco.net (Kragen Sitaker)
Subject: Re: CGI cannot open relative path
Message-Id: <v3RD3.13110$N77.949847@typ11.nn.bcandid.com>
In article <7rofjm$9m4$1@minus.oleane.net>,
JduPayrat <jdupayrat@webraska.com> wrote:
>I think that the benefits of being able to move or duplicate my cgi and
>having them work without
>modification worths a little more paintfull debugging process. Of course I
>could modify all my scripts
>but it would be a lot of work . I'd really prefer to avoid that.
You'll probably need to chdir() to get to the right place. (If I
understand David Cassell -- that may not be enough for some reason.)
That means you'll have to modify your CGI scripts anyway, even if only
one line.
You could, of course, say
my $rootdir = "/fubbledy/wubbledy/gubbledy";
open CONFIG, "<$rootdir/$configname" or die "Couldn't open $rootdir/$configname: $!\n";
open BLURBLE, "<$rootdir/$blurble" or die "Couldn't open $rootdir/$blurble: $!\n";
etc. Then you just have to change $rootdir to move the script. Same
as chdir, but guaranteed to work.
--
<kragen@pobox.com> Kragen Sitaker <http://www.pobox.com/~kragen/>
Tue Sep 14 1999
55 days until the Internet stock bubble bursts on Monday, 1999-11-08.
<URL:http://www.pobox.com/~kragen/bubble.html>
------------------------------
Date: Wed, 15 Sep 1999 09:58:11 -0700
From: Samay <samay1NOciSPAM@hotmail.com>
Subject: Re: CGI in PERL
Message-Id: <0237dd28.0027dde1@usw-ex0107-052.remarq.com>
BASIC => Beginners All-purpose Symbolic Insturction Code
* Sent from RemarQ http://www.remarq.com The Internet's Discussion Network *
The fastest and easiest way to search and participate in Usenet - Free!
------------------------------
Date: Wed, 15 Sep 1999 18:58:32 +0200
From: Steven de Rooij <srooij@wins.uva.nl>
Subject: Re: challenge results
Message-Id: <37DFD038.9E09650B@wins.uva.nl>
Hi Neko;
> perl -nle'$a=reverse;$$_&&print$_.-$a;$$a++' [44]
This is pretty cool, one has to admit.
> s# split//#/./g#; # James Wetterau
> s/join""/1/; # me :)
But that actually gets one emotional :-/
> # Everything on a new line.
> perl -ne'$x{1,sort/./g}.=$_}{/.\n./&&print for%x'
Using Abigails latest suggestion we extract even one more byte:
perl -ne'$x{1,sort/./g}.=$_}{/.
./&&print for%x'
> # All anagrams on one line.
> perl -lne'$x{1,sort/./g}.="$_ "}{/ ./&&print for%x'
>
> # All anagrams on one line. Assume words don't include hypens.
> perl -lne'$x{1,sort/./g}.=-$_}{/.-/&&print for%x'
yes.
YES :-)
------------------------------
Date: Wed, 15 Sep 1999 17:14:12 GMT
From: "[L] Vicious!" <baal@c2i.net>
Subject: command to update the mainloop during longrunning subs?
Message-Id: <EtQD3.313$%5.21879@juliett.dax.net>
I was wondering if there is a command which updates the Mainloop (or updates
the topwindow) when using the Tk module. I need it to give some feedback of
the progress of a longrunning sub. I've seen through the faq, but didn't
find anything. After checking with my books I found the command
tkwait("visibility", $toplevelwindow), but I recon the Win32 version of perl
(Activeperl) does not support it, since it didn't work, neither did I find
it in the faqs. I run Win98 and Activeperl.
Thnx!
------------------------------
Date: Wed, 15 Sep 1999 19:21:15 +0200
From: Andreas Tanner <tanner@ultra.math.uni-potsdam.de>
Subject: Dbm_hash: long value for empty key
Message-Id: <37DFD58A.D638A504@ultra.math.uni-potsdam.de>
We are using a hash %x, where $x{''} has quite a long value (9k). When
we store it on disc using dbmopen, we experience problems: we get keys
that are not supposed to be there.
The overall size of the hash is about 1500k, and it has about 1200
entries.
Anyone has any idea where the problem could be?
Thanks for any hints!
Andreas.
------------------------------
Date: Wed, 15 Sep 1999 18:02:51 GMT
From: kragen@dnaco.net (Kragen Sitaker)
Subject: Re: Dbm_hash: long value for empty key
Message-Id: <fbRD3.13136$N77.950954@typ11.nn.bcandid.com>
In article <37DFD58A.D638A504@ultra.math.uni-potsdam.de>,
Andreas Tanner <tanner@ultra.math.uni-potsdam.de> wrote:
>We are using a hash %x, where $x{''} has quite a long value (9k). When
>we store it on disc using dbmopen,
Does your dbm library support such large values?
Kragen
--
<kragen@pobox.com> Kragen Sitaker <http://www.pobox.com/~kragen/>
Tue Sep 14 1999
55 days until the Internet stock bubble bursts on Monday, 1999-11-08.
<URL:http://www.pobox.com/~kragen/bubble.html>
------------------------------
Date: 15 Sep 1999 13:03:50 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Forcing Variable interpolation of string read from a file - How?
Message-Id: <slrn7tvntc.hj3.abigail@alexandra.delanet.com>
Eric Bohlman (ebohlman@netcom.com) wrote on MMCCVI September MCMXCIII in
<URL:news:7rnq9o$ho2@dfw-ixnews19.ix.netcom.com>:
|| Tom Christiansen (tchrist@mox.perl.com) wrote:
|| : [courtesy cc of this posting mailed to cited author]
|| :
|| : In comp.lang.perl.misc,
|| : matthias.schwarze@wiesbaden.netsurf.de writes:
|| : :I don't think that the direct interpolation (if possible at all?!) is
|| : :advisable.
|| :
|| : What I want to understand is why this question *NEVER* comes up amongst
|| : C programmers, but the Perl neophytes seem to ask it as often as rises
|| : the sun. Perhaps it's some issue of mismatched mental models.
||
|| Just a guess; C is rarely someone's first programming language, so by the
|| time they learn it, they've had some exposure to data-structure
|| concepts. OTOH, there are a lot of people using Perl without having
|| learned the sorts of things taught in an introductory programming course;
|| they may never have encountered the notion of an array, either one
|| indexed numerically or one indexed symbolically.
So, are you suggesting this question are common in forums about languages
that are first languages for people? Like in groups about Pascal, or Java?
What about the Python group? Eiffel? Ada?
Abigail
--
%0=map{reverse+chop,$_}ABC,ACB,BAC,BCA,CAB,CBA;$_=shift().AC;1while+s/(\d+)((.)
(.))/($0=$1-1)?"$0$3$0{$2}1$2$0$0{$2}$4":"$3 => $4\n"/xeg;print#Towers of Hanoi
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: 15 Sep 1999 12:00:25 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Giving names to arrays automatically
Message-Id: <37dfdeb9@cs.colorado.edu>
[courtesy cc of this posting mailed to cited author]
In comp.lang.perl.misc,
m.scheferhoff@gmx.de writes:
:I want to create new arrays and give them names automatically in a loop.
:Does anybody know how to realisate this?
No, you don't.
You want to use a hash of arrays. Learn data structures, and all
will be possible. Fail to learn them, and nothing will be.
--tom
=head2 How can I use a variable as a variable name?
Beginners often think they want to have a variable contain the name
of a variable.
$fred = 23;
$varname = "fred";
++$$varname; # $fred now 24
This works I<sometimes>, but it is a very bad idea for two reasons.
The first reason is that they I<only work on global variables>.
That means above that if $fred is a lexical variable created with my(),
that the code won't work at all: you'll accidentally access the global
and skip right over the private lexical altogether. Global variables
are bad because they can easily collide accidentally and in general make
for non-scalable and confusing code.
Symbolic references are forbidden under the C<use strict> pragma.
They are not true references and consequently are not reference counted
or garbage collected.
The other reason why using a variable to hold the name of another
variable a bad idea is that the question often stems from a lack of
understanding of Perl data structures, particularly hashes. By using
symbolic references, you are just using the package's symbol-table hash
(like C<%main::>) instead of a user-defined hash. The solution is to
use your own hash or a real reference instead.
$fred = 23;
$varname = "fred";
$USER_VARS{$varname}++; # not $$varname++
There we're using the %USER_VARS hash instead of symbolic references.
Sometimes this comes up in reading strings from the user with variable
references and wanting to expand them to the values of your perl
program's variables. This is also a bad idea because it conflates the
program-addressable namespace and the user-addressable one. Instead of
reading a string and expanding it to the actual contents of your program's
own variables:
$str = 'this has a $fred and $barney in it';
$str =~ s/(\$\w+)/$1/eeg; # need double eval
Instead, it would be better to keep a hash around like %USER_VARS and have
variable references actually refer to entries in that hash:
$str =~ s/\$(\w+)/$USER_VARS{$1}/g; # no /e here at all
That's faster, cleaner, and safer than the previous approach. Of course,
you don't need to use a dollar sign. You could use your own scheme to
make it less confusing, like bracketed percent symbols, etc.
$str = 'this has a %fred% and %barney% in it';
$str =~ s/%(\w+)%/$USER_VARS{$1}/g; # no /e here at all
Another reason that folks sometimes think they want a variable to contain
the name of a variable is because they don't know how to build proper
data structures using hashes. For example, let's say they wanted two
hashes in their program: %fred and %barney, and to use another scalar
variable to refer to those by name.
$name = "fred";
$$name{WIFE} = "wilma"; # set %fred
$name = "barney";
$$name{WIFE} = "betty"; # set %barney
This is still a symbolic reference, and is still saddled with the
problems enumerated above. It would be far better to write:
$folks{"fred"}{WIFE} = "wilma";
$folks{"barney"}{WIFE} = "betty";
And just use a multilevel hash to start with.
The only times that you absolutely I<must> use symbolic references are
when you really must refer to the symbol table. This may be because it's
something that can't take a real reference to, such as a format name.
Doing so may also be important for method calls, since these always go
through the symbol table for resolution.
In those cases, you would turn off C<strict 'refs'> temporarily so you
can play around with the symbol table. For example:
@colors = qw(red blue green yellow orange purple violet);
for my $name (@colors) {
no strict 'refs'; # renege for the block
*$name = sub { "<FONT COLOR='$name'>@_</FONT>" };
}
All those functions (red(), blue(), green(), etc.) appear to be separate,
but the real code in the closure actually was compiled only once.
So, sometimes you might want to use symbolic references to directly
manipulate the symbol table. This doesn't matter for formats, handles, and
subroutines, because they are always global -- you can't use my() on them.
But for scalars, arrays, and hashes -- and usually for subroutines --
you probably want to use hard references only.
--
That's their goal, remember, a goal that's really contrary to that of
the programmer or administrator. We just want to get our jobs done.
$Bill just wants to become $$Bill. These aren't even marginallly
congruent. --Tom Christiansen in <6jhtqk$qls$1@csnews.cs.colorado.edu>
------------------------------
Date: Wed, 15 Sep 1999 17:32:28 GMT
From: kragen@dnaco.net (Kragen Sitaker)
Subject: Re: HELP PARSE EMAIL ADDRESSES PLEASE
Message-Id: <MKQD3.13009$N77.944663@typ11.nn.bcandid.com>
In article <joesnow-1509990703300001@user-2ivebks.dialup.mindspring.com>,
Joe Snow <joesnow@mindspring.com> wrote:
>#!perl -p
>
>while (<>) {
> if (s/(^.*\s)(\S+\@\S+)(\s.*$)/\2\n/g)
> {
> print "$_";
> }
>}
I think you might mean
#!perl -nw
if (s/(^.*\s)(\S+\@\S+)(\s.*$)/\2\n/g)
{
print "$_";
}
The perl -p puts a loop around your script which will do automatically
what you're doing by hand.
BTW, do you really mean to insert another \n before the \n at the end
of the line, creating a blank line?
You should probably change the \2 to $2.
>#how can I make the next lines operate on my script; line by line while (<>)
>
>s/^(email|e-mail)(:|-|\s)(.*)/\3/gi;
>s/(^\n)//g
Well, it depends on what you mean by "operate on". Presumably you
don't want to pass your script to them as input.
If you want to do them before checking for the email address, just put
them before the if statement.
If you want to do them after checking, but before printing, put them
before the print statement.
If you want something else, you'll have to do something else.
HTH.
Kragen
--
<kragen@pobox.com> Kragen Sitaker <http://www.pobox.com/~kragen/>
Tue Sep 14 1999
55 days until the Internet stock bubble bursts on Monday, 1999-11-08.
<URL:http://www.pobox.com/~kragen/bubble.html>
------------------------------
Date: Wed, 15 Sep 1999 17:44:45 GMT
From: harad@my-deja.com
Subject: Hot, Fun S.F Startup Seeks a Gaggle of Perl People
Message-Id: <7rolu9$ol7$1@nnrp1.deja.com>
GetRelevant is a *HOT* venture funded startup
aiming to be the leading aggregator and
distributor of promotional offers. We've put a
great new twist on a 100 year old business, and
are seeking to add to our All Star team! All
positions are for our great South of Market, San
Francisco location (local applicants only,
please), and offer competitive salary and
significant stock options. To apply, email
resumes (plain text only) to
mitchel@getrelevant.com and include the position
you are applying for in the subject line. We
currently have the following positions available:
1) PERL Programmer & Project Manager
2) Web Programmer (3 openings)
3) Web Programmer Intern (2 openings)
1) Perl Programmer & Project Manager
We're looking for a take-no-prisoner, conquer any
mountain, Perl slingin' all star to help with our
product launch and beyond. You'll help build,
manage, and train a team of entry level
programmers, developers, and interns. Don't you
worry, plenty of opportunity to get your hands
dirty programming as well!
What we're looking for:
--At least three years experience as a
professional developer
--Solid knowledge of Perl and CGI
--Experience with SQL, HTML, and PHP
--At least one year's project managment experience
--Tremendous entrepreneurial drive and solid
attention to detail
2) Web Programmer (3)
You will work directly with our VP Technology to
design and develop dozens of vital features for
our new product. Take ownership of major projects
and see your impact on our young, rapidly growing
company. Great learning environment with major
room for advancement!
Requirements:
--Tremendous entrepreneurial spirit and drive
--At least one year experience as a professional
developer
--Solid knowledge and experience of both CGI/HTTP
and PERL
--Experience with SQL, HTML and PHP a plus
3) Web Programmer Intern (2)
You will work directly with our VP Technology to
design and develop dozens of vital features for
our new product. Take ownership of major projects
and see your impact on our young, rapidly growing
company. Great learning environment with major
room for advancement! Good potential for a full
time position following graduation.
Requirements:
--Tremendous entrepreneurial spirit and drive
--Solid knowledge and experience of both CGI/HTTP
and PERL
--Experience with SQL, HTML and PHP a plus
--Able to consistently work 20 to 40 flexible
hours per week
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Wed, 15 Sep 1999 09:10:30 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: How to validate a URL?
Message-Id: <Pine.GSO.4.10.9909150758110.25903-100000@user2.teleport.com>
On Wed, 15 Sep 1999, Paul Carter wrote:
> I found out that to validate an e-mail address I can use
> if ($user_email =~ /(@.*@)|(\.\.)|(@\.)|(\.@)|(^\.)|(,)/ ) { #invalid
> character entered }
My friends Fred and Barney would like you to write to them at this
(valid) address:
<"fred and barney"(.@..@,,)@redcat.com>
> But, I am not 100% sure what it is doing
> So, can somebody please point me in the direction of "=~" and "!~"????
perldoc perlop
> The main problem is that I am unable to validate a URL
Use LWP, from CPAN.
> As far as I can see, the requirements for a WWW URL would be a "http://" and
> a "." (period)
See the RFCs if you really want to know the rules for these things.
Cheers!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Wed, 15 Sep 1999 17:45:42 +0100
From: Mark <Mark@Mark.Com>
Subject: Re: How to validate a URL?
Message-Id: <37DFCD36.558B466F@Mark.Com>
Tom Phoenix wrote:
> On Wed, 15 Sep 1999, Paul Carter wrote:
>
> > I found out that to validate an e-mail address I can use
> > if ($user_email =~ /(@.*@)|(\.\.)|(@\.)|(\.@)|(^\.)|(,)/ ) { #invalid
> > character entered }
>
> My friends Fred and Barney would like you to write to them at this
> (valid) address:
>
> <"fred and barney"(.@..@,,)@redcat.com>
Bad and all as the check is, it does look for double @'s so this address would
fail. Note, if the addr matches the above RE, it is invalid, not 'tother way
round.
>
>
> > But, I am not 100% sure what it is doing
> > So, can somebody please point me in the direction of "=~" and "!~"????
>
Snippety doo dah
------------------------------
Date: Wed, 15 Sep 1999 17:27:33 GMT
From: pacman(this.address.is.valid.too)@cqc.com
Subject: Re: How to validate a URL?
Message-Id: <9GQD3.12988$N77.947490@typ11.nn.bcandid.com>
In article <37DFCD36.558B466F@Mark.Com>, Mark <Mark@Mark.Com> wrote:
>Tom Phoenix wrote:
>> My friends Fred and Barney would like you to write to them at this
>> (valid) address:
>>
>> <"fred and barney"(.@..@,,)@redcat.com>
>
>Bad and all as the check is, it does look for double @'s so this address would
>fail. Note, if the addr matches the above RE, it is invalid, not 'tother way
>round.
I think you need to reread RFC822, section 3.4.3 (Comments).
--
Alan Curry |Declaration of | _../\. ./\.._ ____. ____.
pacman@cqc.com|bigotries (should| [ | | ] / _> / _>
--------------+save some time): | \__/ \__/ \___: \___:
Linux,vim,trn,GPL,zsh,qmail,^H | "Screw you guys, I'm going home" -- Cartman
------------------------------
Date: 15 Sep 1999 12:32:51 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: How to validate a URL?
Message-Id: <slrn7tvm71.hj3.abigail@alexandra.delanet.com>
Paul Carter (couton@bigfoot.com) wrote on MMCCVI September MCMXCIII in
<URL:news:xMND3.25$68.352@news2-hme0>:
&&
&& The main problem is that I am unable to validate a URL
&& As far as I can see, the requirements for a WWW URL would be a "http://" and
&& a "." (period)
Validating URLs isn't that hard. The following regex should work.
It's a tad more complicated than looking for 'http://' and a dot
though.
m<
(?:http://(?:(?:(?:(?:(?:[a-zA-Z\d](?:(?:[a-zA-Z\d]|-)*[a-zA-Z\d])?)\.
)*(?:[a-zA-Z](?:(?:[a-zA-Z\d]|-)*[a-zA-Z\d])?))|(?:(?:\d+)(?:\.(?:\d+)
){3}))(?::(?:\d+))?)(?:/(?:(?:(?:(?:[a-zA-Z\d$\-_.+!*'(),]|(?:%[a-fA-F
\d]{2}))|[;:@&=])*)(?:/(?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##@@####;
c}^^^&&&k}&&&}#=e*****[]}'r####'`=437*{#};::'1[0.9]2@43`"'*#==[[.{{],,,1278@#@);
print+((($llama=prototype'camel')=~y|+{#}$=^*&[0-9]i@:;`"',.| |d)&&$llama."\n");
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: Wed, 15 Sep 1999 10:48:57 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: How to validate a URL?
Message-Id: <Pine.GSO.4.10.9909151045290.25903-100000@user2.teleport.com>
On Wed, 15 Sep 1999, Mark wrote:
> > My friends Fred and Barney would like you to write to them at this
> > (valid) address:
> >
> > <"fred and barney"(.@..@,,)@redcat.com>
>
> Bad and all as the check is, it does look for double @'s so this
> address would fail.
That's my point; the address is valid.
> Note, if the addr matches the above RE, it is
> invalid, not 'tother way round.
One of us is missing something. If an address matches the pattern in the
original message, it may or may not be an invalid address. No?
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Wed, 15 Sep 1999 11:36:00 -0500
From: <mike@yawp.com>
To: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: is this object a child of this class?
Message-Id: <Pine.NEB.3.96.990915112911.14251B-100000@www.yawp.com>
> > sub isa {
>
> Not only unnecessary....
>
> > my $self = shift;
> > my $type = shift;
> >
> > my $isa = (grep {/$type/} @ISA) ? 1 : 0;
>
> ...but also incorrect! Unless you think Tonya ISA Tony....
ugh.. you're right. just goes to show what happens when i try to be
flashy on less than LD50 of caffeine. ;-)
the moral, children: the docs aren't there just for learning.. they're
worth checking again, even if you think you know them. in fact, that's
the *best* time to check them. most seriously boneheaded mistakes (see
above) occur, not because you don't know what to do, but because you think
you know what to do, and are wrong.
--
mike
------------------------------
Date: Wed, 15 Sep 1999 17:22:27 GMT
From: kragen@dnaco.net (Kragen Sitaker)
Subject: Re: Perl Apache Win95
Message-Id: <nBQD3.12971$N77.945846@typ11.nn.bcandid.com>
In article <37DF647D.D7FD24E1@triniti.troitsk.ru>,
tokaev <tokaev@triniti.troitsk.ru> wrote:
>I need perl for win98 under Apache.
Install it then.
--
<kragen@pobox.com> Kragen Sitaker <http://www.pobox.com/~kragen/>
Tue Sep 14 1999
55 days until the Internet stock bubble bursts on Monday, 1999-11-08.
<URL:http://www.pobox.com/~kragen/bubble.html>
------------------------------
Date: 1 Jul 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 1 Jul 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.
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" from
almanac@ruby.oce.orst.edu. The real FAQ, as it appeared last in the
newsgroup, can be retrieved with the request "send perl-users FAQ" from
almanac@ruby.oce.orst.edu. 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" from
almanac@ruby.oce.orst.edu.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V9 Issue 805
*************************************