[16267] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 3679 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Jul 15 21:05:24 2000

Date: Sat, 15 Jul 2000 18:05:11 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <963709510-v9-i3679@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Sat, 15 Jul 2000     Volume: 9 Number: 3679

Today's topics:
        Anyone working on any XS books? <care227@attglobal.net>
    Re: ATTENTION PERL MACHOES!!!!!!!!!!!!!!!!!!! <care227@attglobal.net>
    Re: ATTENTION PERL MACHOES!!!!!!!!!!!!!!!!!!! <care227@attglobal.net>
    Re: ATTENTION PERL MACHOES!!!!!!!!!!!!!!!!!!! (NP)
    Re: Beyond perl? Need advice... (Alan Barclay)
        CGI email on NT server <patty@xidd.com>
    Re: detecting promiscuous mode (Clinton A. Pierce)
        E-mail processor (Screndib)
    Re: GD module, displaying an image in a browser krakle@my-deja.com
        Help with Regular Expression <bscheller@[nospam]mmcable.com>
    Re: Help with Regular Expression (Tad McClellan)
    Re: Help with Regular Expression <godzilla@stomp.stomp.tokyo>
    Re: how to convert "1.2.3.10" to "01020310"? <mauldin@netstorm.net>
    Re: Interchage the role of key and value in a hash <snowhare@long-lake.nihongo.org>
    Re: Net/Config.pm problem <slavelle@concentus-tech.com>
        Net::Smtp problems <jdNOjdSPAM@syncon.ie.invalid>
    Re: Net::Smtp problems <tony_curtis32@yahoo.com>
    Re: Net::Smtp problems (jason)
    Re: NET::SMTP sanity check please <postmaster@rask.nospam.kampsax.k-net.dk>
        OO Perl question kdmasary@my-deja.com
    Re: OO Perl question (Damian Conway)
    Re: PERL IDES <jraff@home.com>
    Re: Please criticise this text extraction script (Decklin Foster)
    Re: Simple IP/Domain validation???? (Decklin Foster)
    Re: Simple IP/Domain validation???? <coy@coystoys.com>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Sat, 15 Jul 2000 19:06:41 -0400
From: Drew Simonis <care227@attglobal.net>
Subject: Anyone working on any XS books?
Message-Id: <3970EE81.AFF26CC5@attglobal.net>

I've been reading over perlxstut and perlguts, but I must say that
I think they are a bit sparse.  (and hard to understand, for me, 
anyway)  I wonder:

1. Is anyone working on a Perl XS book?
2. How common is it to use XS, meaning, will learning about
   them benefit me in a real way, or will my brain just expand?


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

Date: Sat, 15 Jul 2000 19:00:27 -0400
From: Drew Simonis <care227@attglobal.net>
Subject: Re: ATTENTION PERL MACHOES!!!!!!!!!!!!!!!!!!!
Message-Id: <3970ED0B.6CFAE94F@attglobal.net>



"Randal L. Schwartz" wrote:
> 
> Right.  Genuflecting in front of me only makes me more embarassed.  I
> appreciate people appreciating me, but that's not why I do what I do.

I would genuflect if you'd write a book on XS.  I'd pay you money 
if you offered a class on XS.  I'd worship you if, after reading
said book or taking said class, I clearly understood XS  =)


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

Date: Sat, 15 Jul 2000 19:02:17 -0400
From: Drew Simonis <care227@attglobal.net>
Subject: Re: ATTENTION PERL MACHOES!!!!!!!!!!!!!!!!!!!
Message-Id: <3970ED79.D872AD60@attglobal.net>

Nnickee wrote:
> 
> Seriously, I do get a bit star-struck at times, but not over the
> Backstreet Boys or Blue Oyster Cult (the Beach Boys, OTOH... :).  It's
> just because I've always put programmers up on a pedestal; always seen
> them as better (or at least more intelligent) than normal folks.
> Y'all think I was bad earlier... shoulda seen my reaction a few years
> ago when Nico emailed me a little note along with my very own winzip
> key :)
> 

I got excited when Kibo sent me email.  But I was far more excitable
then.


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

Date: Sun, 16 Jul 2000 01:01:28 GMT
From: nvp@spamnothanks.speakeasy.org (NP)
Subject: Re: ATTENTION PERL MACHOES!!!!!!!!!!!!!!!!!!!
Message-Id: <IP7c5.321470$MB.5324881@news6.giganews.com>

On Sat, 15 Jul 2000 19:00:27 -0400, Drew Simonis <care227@attglobal.net> wrote:
: 
: 
: I would genuflect if you'd write a book on XS.  I'd pay you money 
: if you offered a class on XS.  I'd worship you if, after reading
: said book or taking said class, I clearly understood XS  =)

IMO, there's not a huge market for XS.  The usually quiet perl-xs
mailing list and the (small) number of questions about XS on USENET is
proof of this.  It IS possible that there are a million of Perl folks
who are interested in learning XS but I just don't think so.  Every
time that I've talked about documenting XS in some large form (book
chapter, magazine article, etc), I've been greeted with the same
response: NFW.

Besides, I prefer SWiG and you should try it too: www.swig.org.  :-)

-- 
Nate II



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

Date: 16 Jul 2000 00:16:56 GMT
From: gorilla@elaine.furryape.com (Alan Barclay)
Subject: Re: Beyond perl? Need advice...
Message-Id: <963706611.38662@elaine.furryape.com>

In article <smnfbduend685@corp.supernews.com>,
Craig Berry <cberry@cinenet.net> wrote:
>Larry Rosler (lr@hpl.hp.com) wrote:
>: How about code that extracts substrings using regexes, rather than 
>: character-by-character analysis?
>
>It is a tautology that sufficiently well-written C code will always be
>equally or more efficient than equivalent Perl code.  After all, the Perl
>compiler and interpreter are themselves written in C.
>

One important question is how well is typically written C code, versus
the equvilant typically written Perl program.

I have seen programmers who only knew how to use C's arrays and sometimes
a linked list. They'd use these for any storage, even if a hash would be
more efficent because they didn't know how to program a hash in C.

I've also seen programmers who used a fixed size array, when they should
be using dynamic storage, again because they didn't know how to program
the dynamic storage.

By definition, there is nothing you can do in Perl which cannot be done
in C. However, there are many programmers who can do stuff in Perl which
they cannot do in C.


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

Date: Sat, 15 Jul 2000 21:30:07 GMT
From: Patrick <patty@xidd.com>
Subject: CGI email on NT server
Message-Id: <sn1luv5lnd657@corp.supernews.com>

I've moved my site over from a UNIX platform to an NT platform and I'm 
experiencing some difficulties with the cgi scripts. I've worked out all 
of the bugs with the exception that the sendMail function is not working. 
After researching I now know that this function does not work on NT and 
I've tried the BLAT.EXE command but it isn't working for me.

If someone could direct me to a location for where I could obtain 
information/demos on how to send email through a CGI Script on an NT 
server I would be very thankful!

Thanks in advanced!
Patrick

P.S.: Below is the source I'm using for the sendMail function.

sub send_email
{
 $to = "info\@xidd.com";
 open(MAIL, "|/usr/sbin/sendmail -t -n -oi");
 print MAIL "From: $Variable{'email'}\n";
 print MAIL "To: $to\n";
 print MAIL "Subject: Reply to XIDD INTERACTIVE\n\n";

 # print out the form results
 print MAIL "REPLY FOR XIDD INTERACTIVE\n";
 print MAIL "\n";
 print MAIL "Name: $Variable{'name'}\n";
 print MAIL "Title: $Variable{'title'}\n";
 print MAIL "Company: $Variable{'company'}\n";
 print MAIL "Phone#: $Variable{'phone'}\n";
 print MAIL "Fax#: $Variable{'fax'}\n";
 print MAIL "E-mail: $Variable{'email'}\n";
 print MAIL "\n";
 print MAIL "Message for XIDD INTERACTIVE:\n";
 print MAIL "$Variable{'comments'}\n";
 close(MAIL);
}

--
Posted via CNET Help.com
http://www.help.com/


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

Date: Sat, 15 Jul 2000 18:10:13 GMT
From: clintp@geeksalad.org (Clinton A. Pierce)
Subject: Re: detecting promiscuous mode
Message-Id: <9O1c5.39081$fR2.351746@news1.rdc1.mi.home.com>

[Posted and mailed]

In article <8knuki$vvj$1@nnrp1.deja.com>,
	sp00fD <sp00fD@yahoo.com> writes:
> In article <x9qb5.35515$fR2.325812@news1.rdc1.mi.home.com>,
>   clintp@geeksalad.org (Clinton A. Pierce) wrote:
>> The only hope you would have would be to open the ethernet device
>> and find an ioctl query that could tell you this.
> 
> Thanks, I read a bit of the ifstatus source, and it seems to do a lot
> of kvm stuff (i.e. kvm_read to get the status and whatnot).  This is
> rough stuff.  I can't figure out what function the ioctl would need.

Nobody said Real Programming was easy.  But if you figure this one out,
it's a real feather in your cap.  Unlike other 3l337 W3B W4R3Z D00DZ you 
will have done a piece of real coding.

-- 
    Clinton A. Pierce              Teach Yourself Perl in 24 Hours! 
  clintp@geeksalad.org         for details see http://www.geeksalad.org
"If you rush a Miracle Man, 
	you get rotten Miracles." --Miracle Max, The Princess Bride


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

Date: 15 Jul 2000 23:13:01 GMT
From: screndib@aol.com (Screndib)
Subject: E-mail processor
Message-Id: <20000715191301.18156.00000372@ng-mb1.aol.com>

I need a way to analyze e-mail that is in this form:

--------------------------------------------------
Fill in an 'x' in the box next to your choice.

A[]
B[]
C[]
D[]
E[]

Num: 2498
--------------------------------------------------

It needs to record the marks in some way so they can be displayed and edited in
another program.  It must also be able to handle screwed up input.  I've seen
mails like this before, so I would think that there would be the code out there
somewhere.  Can someone point me in the right direction?

If there isn't something I can use, can someone give me some tips on how I
would start on this?


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

Date: Sun, 16 Jul 2000 00:07:48 GMT
From: krakle@my-deja.com
Subject: Re: GD module, displaying an image in a browser
Message-Id: <8kqucl$83c$1@nnrp2.deja.com>

In article <yDAb5.35885
$7D2.642919@news.chello.at>,
  "Chello" <stephane@siw.ch> wrote:
> Hi all,
>
> I'm trying to display an image with GD module:
>
> use GD;
>
>     # create a new image
>     $im = new GD::Image(100,100);
>
>     # allocate some colors
>     $white = $im->colorAllocate(255,255,255);
>     $black = $im->colorAllocate(0,0,0);
>     $red = $im->colorAllocate(255,0,0);
>     $blue = $im->colorAllocate(0,0,255);
>
>     # make the background transparent and
interlaced
>     $im->transparent($white);
>     $im->interlaced('true');
>
>     # Put a black frame around the picture
>     $im->rectangle(0,0,99,99,$black);
>
>     # Draw a blue oval
>     $im->arc(50,50,95,75,0,360,$blue);
>
>     # And fill it with red
>     $im->fill(50,50,$red);
>
> binmode STDOUT;
> print "Content-type: image/jpeg\n";
> print "Pragma: no-cache\n";
> print "Expires: now\n\n";
>
> print $im->jpeg(100);
>
> But it doesnt work... I only have as a result:
>
>
S~V:``E7ͳg
s$?LXlYqE0{~{
> "<2k.}]Pso"2 ).-_T-5g1Z
grm"1cmmz#
> Gr95s'O9Sv4L$A#02Bqd\I+?
"z=M<>/coKk/?j8
> we^?>mBV#Ph,.Ǧ6A|]
DԷ
> "rVed?!?M{M>Qtk
> <|Ts0?^ejb6- P%
"QQcxc>wT\*˵V
> ";fVK4sUz?8:-"Vѩ3jL?
m2wHmD_-T@?AK
> ^}ϼ>:I<I5R1sz",J+
[dStES&_ޝ~"
> "Fy)"]mL][U'j?+KqKAg] Y
\SUڭF.U"۸V]AM}?)K
> "Y_woV[3"d
> `q"@C>"$3"C111O.#mTjjSYwo9%:-
JS.榤zGe-2)S5t
> 1M?d/aȨJh)g"S}
\{"gX?}.G?
> "_м-(Nu=Y\<ӯX,L/V'S_WK
&V<ǧYʸ~55T-W,z
> x5'}&]?"v=g}UԥF趲.)вsT*ػrԨ?
YOZP'6)ڝ.'
> "_-j1j2yK^ &ʳk "ܯ3Sb$'!]mp]
HPIKFAg!q?O*
> oc3ۤyUfPIK'|>fsɺ۸i
|>fsɺ۸i |>fsɺ۸G\
> HEkeN-*HP'.^@)1R!
(sO,^,.HD,kJC"2X
> "O6NѼ%[5('ެu=bKs-1
> <?c
> ,1,HSÞ%~PͩreP2_d"edTaTcB
=uW?4/)
> #w,zTN^u
B~\oo>m69iVEP`O"`R"FP$%
(N9s
> 7Z,2t%b"
> M޳+4UEq᧸oӵ3d10`O>,Kg-
yUs9t1s2."
> Tec3<JJHf5 2~sg#W.{oM
> 0$~S3
> J32G-
> UqFfe8&cO8)
g^sF^٪IOTbbBsdXd.O3O#5o]t,
-
> =~췮Ὼ
> k4'~/\$2TT#+%:57n7 /VEj'
> +'T?e+`PSvz]IeYAܾ
> E?yz5JDh(c<[!ubua>[ߩs#H%
TfYLIdY1sFw:zM:;
> sjv׫3
> '.ZA>\fbl3Y>|E$ͳ63(?
v.Wc&*]f_R1PħOb,
> `&<aBPh@wpiOT+a\i^?0~h
"6"9T/0~>c@OKo
> f~.fo/R?]R?b<۾) Ly
> b U1PXad
>
> What's the problem and how to solve it??? Does
someone have the solution??
>
> Thanks in advance.
>
> Stphane
>
>


---GD is a graphics library that generates images
in the GIF format not jpeg format...

Change print "Content-type:image/jpeg\n\n";
to
print "Content-type:image/gif\n\n";

Also the new version of GD generates PNG...

GD is minimal i reccomend using GIMP on a unix
maching... Or atleast GD&TTF (freetype AND gd)
from the-labs.com

---krakle



Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Sat, 15 Jul 2000 21:28:35 GMT
From: "Brian Scheller" <bscheller@[nospam]mmcable.com>
Subject: Help with Regular Expression
Message-Id: <7I4c5.444$F5.14788@typhoon.kc.rr.com>

Hello All,

I need some help developing a regular expression and was hoping that one of
the perl experts here could help me out.  I am attempting to utilize the
split function to parse a string into an array.  However, the character used
as the field separator also sometimes occurs within the string without being
a field separator.

I am attempting to parse an XML attribute value in which semicolons have
been used to separate several terms.  However, because the document is in
Spanish, there are several character entities that also occur within the
text.  So, the string that I am attempting to parse looks like:

"Enga&ntilde;os (Quackery);Fraude en el campo de la salud (Health fraud)"

This string has two different terms

Enga&ntilde;os (Quackery)
Fraude en el campo de la salud (Health fraud)

My initial attempt to use just a semicolon fails because the  character is
reprented as &ntilde;.  Can anyone offer a suggestion of a regular
expression that would ignore the constructs of &[^;]*;, i.e. character
entities, but still be able to find the other semicolon?

Thanks in advance.

Brian Scheller




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

Date: Sat, 15 Jul 2000 17:14:59 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Help with Regular Expression
Message-Id: <slrn8n1l2j.hjd.tadmc@magna.metronet.com>

On Sat, 15 Jul 2000 21:28:35 GMT, Brian Scheller <bscheller@[nospam]mmcable.com> wrote:

>I am attempting to utilize the
>split function to parse a string into an array.  However, the character used
>as the field separator also sometimes occurs within the string without being
>a field separator.


If you can identify these non-separator separator characters, then
you can change them to something else, split, then change them
back.


>I am attempting to parse an XML attribute value in which semicolons have
>been used to separate several terms.  However, because the document is in
>Spanish, there are several character entities that also occur within the
>text.  


Oh good.

You can identify the non-separator separator characters
(because XML defines what an "entity" is allowed to contain).


>Can anyone offer a suggestion of a regular
>expression that would ignore the constructs of &[^;]*;, i.e. character
>entities, but still be able to find the other semicolon?


You can write a much tighter pattern than that for an 
XML entity reference:


----------------------------------
#!/usr/bin/perl -w
use strict;

$_ = 'Enga&ntilde;os (Quackery);Fraude en el campo de la salud (Health fraud)';

my @fields = special_split($_);

foreach ( @fields ) {
   print "'$_'\n";
}


sub special_split {
   my($str) = @_;
   die "delimiter found in string! ($str)" if $str =~ /:::/;

   # semicolons marking end of entity become 3 colons
   $str =~ s/(&[a-zA-Z][a-zA-Z0-9._-]*);/$1:::/g;

   my @fields = split /;/, $str;

   s/:::/;/g foreach @fields;   # patch up the entity ends

   return @fields;
}
----------------------------------


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


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

Date: Sat, 15 Jul 2000 16:57:10 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: Help with Regular Expression
Message-Id: <3970FA56.1DE1280C@stomp.stomp.tokyo>

Brian Scheller wrote:
 
> I need some help developing a regular expression....

> ...the string that I am attempting to parse looks like:
 
> "Enga&ntilde;os (Quackery);Fraude en el campo de la salud (Health fraud)"
 
> This string has two different terms....
 
> Enga&ntilde;os (Quackery)
> Fraude en el campo de la salud (Health fraud)
 
> My initial attempt to use just a semicolon fails because the  character is
> reprented as &ntilde;.  Can anyone offer a suggestion of a regular
> expression that would ignore the constructs of &[^;]*;, i.e. character
> entities, but still be able to find the other semicolon? ....


In closing you will find a test script and printed results.
You will read four no-brainer methods to attain your goal.

First method locates " ;F  " in your string and replaces
the semi-colon with a split vertical bar, then splits
your string into two variables, as you request. This
method relies on your dictionary being standardized
with a capital letter always following a semi-colon,
which it should if a commercial dictionary or correctly
written dictionary if privately created.

My second method locates " ); " and replaces the
semi-colon with a  as in my first method and
subsequent methods. This one relies on your
parenthetical topic term being there.

Next to last method, third method, is a simple
split on semi-colon then glue it back together
into two variables as you intend.

Final method, my favorite, removes your problem
entity, splits, then replaces the entity.




TEST SCRIPT:
____________


#!/usr/local/bin/perl

print "Content-Type: text/plain\n\n";


## Method 1


$string = "Enga &ntilde;os (Quackery);Fraude en el campo de la salud
(Health fraud)";

$string =~ s/;([A-Z])/$1/;

($var1, $var2) = split (//, $string);

print "Semi-Colon / Capital Letter Method: \n\n";

print "  Variable One: $var1 \n\n  Variable Two: $var2";


## Method 2


$string = "Enga &ntilde;os (Quackery);Fraude en el campo de la salud
(Health fraud)";

$string =~ s/(\));/$1/;

($var1, $var2) = split (//, $string);

print "\n\n\nRight Parenthesis / Semi-Colon Method: \n\n";

print "  Variable One: $var1 \n\n  Variable Two: $var2";


## Method 3


$string = "Enga &ntilde;os (Quackery);Fraude en el campo de la salud
(Health fraud)";

($var1, $var1a, $var2) = split (/;/, $string, 3);

$var1 = join (";", $var1, $var1a);

print "\n\n\nSplit And Join Method: \n\n";

print "  Variable One: $var1 \n\n  Variable Two: $var2";


## Method 4


$string = "Enga &ntilde;os (Quackery);Fraude en el campo de la salud
(Health fraud)";

$string =~ s/(&[a-zA-Z]+;)//;

$temp = $1;

($var1, $var2) = split (/;/, $string);

$var1 =~ s//$temp/;

print "\n\n\nRemove / Replace Entity Method: \n\n";

print "  Variable One: $var1 \n\n  Variable Two: $var2";


print "

\n\n\n\nGodzilla Rocks!";

exit;



PRINTED RESULTS:
________________

Semi-colon / Capital Letter Method: 

  Variable One: Enga &ntilde;os (Quackery) 

  Variable Two: Fraude en el campo de la salud (Health fraud)


Right Parenthesis / Semi-Colon Method: 

  Variable One: Enga &ntilde;os (Quackery) 

  Variable Two: Fraude en el campo de la salud (Health fraud)


Split And Join Method: 

  Variable One: Enga &ntilde;os (Quackery) 

  Variable Two: Fraude en el campo de la salud (Health fraud)


Remove / Replace Entity Method: 

  Variable One: Enga &ntilde;os (Quackery) 

  Variable Two: Fraude en el campo de la salud (Health fraud)





Godzilla Rocks!


-- 
$godzilla = "godzilla rocks!";
srand(time() ^ ($$ + ($$ << 15))); 
sub randcase
 { rand(40) < 20 ? "\u$1" : "\l$1" ; }
$godzilla =~  s/([a-z])/randcase($1)/gie;
print $godzilla; exit;


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

Date: Sat, 15 Jul 2000 23:37:48 GMT
From: Jim Mauldin <mauldin@netstorm.net>
Subject: Re: how to convert "1.2.3.10" to "01020310"?
Message-Id: <3970F51A.CC6CFCA4@netstorm.net>

jason wrote:

> ethan wrote ..
> >Hope there someone who can help me with this. I am new to PERL and am
> >facing the problem of convert a string of "2.1.3.14" format
> >to "02010314" format.
>
>   printf '%02d%02d%02d%02d' => split /\./ => '2.1.3.14';

Or even
printf '%02d' x 4 , split /\./ , '2.1.3.14';

(for my edification, really)

- Jim





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

Date: Sun, 16 Jul 2000 00:33:59 GMT
From: Benjamin Franz <snowhare@long-lake.nihongo.org>
Subject: Re: Interchage the role of key and value in a hash
Message-Id: <Xp7c5.33$xr1.106856@news.pacbell.net>

multiplexor <abuse@localhost> wrote:
: I have a hash:

: %entity = ('&' , '&amp;' , '>' , '&gt;');
: What is the best way to make a hash like the followings?
: %code =  ('&amp;' , '&' , '&gt;' , '>');
: That is, interchange the role of the keys and values of %entity.

%code = reverse %entity;

-- 
Benjamin Franz

        "Magic is real, unless declared integer."
                               -- Wiz Zumwalt


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

Date: Sat, 15 Jul 2000 14:06:57 -0400
From: Sean Lavelle <slavelle@concentus-tech.com>
Subject: Re: Net/Config.pm problem
Message-Id: <3970A840.42EE2918@concentus-tech.com>

    Thanks, that did correct it. I'm glad you should me that to, because I'd
rather use CPAN for mods then ActiveState.

    Thanks again,
        Sean
--
Sean Lavelle
  Concentus Technology Corporation
  5115 Parkcenter Ave, Suite 150
  Dublin, Ohio 43017
Phone (614) 799-4317
slavelle@concentus-tech.com




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

Date: Sat, 15 Jul 2000 17:34:15 -0700
From: deno <jdNOjdSPAM@syncon.ie.invalid>
Subject: Net::Smtp problems
Message-Id: <0e990fca.4de9b34e@usw-ex0105-036.remarq.com>



Any1 had any problems with net::smtp ?

the following only works 25% of the time

use Net::SMTP;

    $smtp = Net::SMTP->new('192.168.0.99', Timeout => 30);

    print $smtp->banner,"\n";
    $smtp->quit;


when it fails it returns the following error

"Can't call method "banner" on an undefined value at banner.txt
line 8."

Using win98 connecting to serveral mail hosts.

Thanks,





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

Got questions?  Get answers over the phone at Keen.com.
Up to 100 minutes free!
http://www.keen.com



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

Date: 15 Jul 2000 19:42:54 -0500
From: Tony Curtis <tony_curtis32@yahoo.com>
Subject: Re: Net::Smtp problems
Message-Id: <87k8em3nxt.fsf@limey.hpcc.uh.edu>

>> On Sat, 15 Jul 2000 17:34:15 -0700,
>> deno <jdNOjdSPAM@syncon.ie.invalid> said:

> Any1 had any problems with net::smtp ?

That's "anyone".

> use Net::SMTP;
>     $smtp = Net::SMTP->new('192.168.0.99', Timeout => 30);
>     print $smtp->banner,"\n";

> when it fails it returns the following error

> "Can't call method "banner" on an undefined value at banner.txt line 8."
                                    ^^^^^^^^^

You're not checking whether the creation of the Net::SMTP
object succeeded.  Check $smtp to see if it is defined()
before trying to use it.

> Using win98 connecting to serveral mail hosts.

I'll refrain from the obvious comment :-)

hth
t
-- 
"With $10,000, we'd be millionaires!"
                                           Homer Simpson


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

Date: Sun, 16 Jul 2000 00:47:02 GMT
From: elephant@squirrelgroup.com (jason)
Subject: Re: Net::Smtp problems
Message-Id: <MPG.13dba35513ab81ac9896c2@news>

deno wrote ..
>Any1 had any problems with net::smtp ?
>
>the following only works 25% of the time
>
>use Net::SMTP;
>
>    $smtp = Net::SMTP->new('192.168.0.99', Timeout => 30);
>
>    print $smtp->banner,"\n";
>    $smtp->quit;
>
>
>when it fails it returns the following error
>
>"Can't call method "banner" on an undefined value at banner.txt
>line 8."

what do you think $smtp will contain if the timeout period expires 
before a connection is established ? .. why aren't you testing for that 
before using $smtp ?

-- 
  jason -- elephant@squirrelgroup.com --


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

Date: 16 Jul 2000 0:27:31 +0200
From: "Rask Ingemann Lambertsen" <postmaster@rask.nospam.kampsax.k-net.dk>
Subject: Re: NET::SMTP sanity check please
Message-Id: <1268.232T1550T274950postmaster@rask.nospam.kampsax.k-net.dk>

On 14-Jul-00 03:18:57, Russell Smallwood wrote the following about "NET::SMTP sanity check please":

> I have a stand-alone NT server that I'm hosting a company site on and 
> the only smtp server that it has access to is mail.mindspring.com.  I'm 
> guessing that, once correctly identified, I should be able to send a 
> message to that server using net::smtp..right?  How do i send a 
> password?

   Password? What password? You just said your server has access to
mail.mindspring.com, didn't you? Besides, mail.mindspring.com does not
appear to support password authentication at all (according to the EHLO
response). They might be using POP-before-SMTP for authentication, but then
you should look at the Net::POP3 module.

> Am I missing the point,

   Yes, by a country mile. It would be good for you to read the RFCs
defining the SMTP protocol. As a minimum, read RFC 821.

Regards,

/T\
| Rask Ingemann Lambertsen     | postmaster@rask.nospam.kampsax.k-net.dk |
| A4000, 896 kkeys/s (RC5-64)  | "ThrustMe" on XPilot and EFnet IRC      |
|                   03h:42m SLEEP?  I'm a programmer!                    |



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

Date: Sat, 15 Jul 2000 22:37:02 GMT
From: kdmasary@my-deja.com
Subject: OO Perl question
Message-Id: <8kqp2d$s17$1@nnrp1.deja.com>

How do I check that a variable contains a ref to an object which is a
child of a specific class?

I have a class: foo.
I have another class: bar.
bar is a child of foo.

I have a variable $thing.
I want to check that $thing contains a ref to a foo obj or a child of a
foo obj. If $thing contains a ref to a bar obj and I use ref($thing) I
get bar back. How do I find out, from this perspective, if bar is a
child class of foo?


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: 15 Jul 2000 23:01:03 GMT
From: damian@cs.monash.edu.au (Damian Conway)
Subject: Re: OO Perl question
Message-Id: <8kqqff$3id$1@towncrier.cc.monash.edu.au>

kdmasary@my-deja.com writes:

>How do I check that a variable contains a ref to an object which is a
>child of a specific class?

>I have a class: foo.
>I have another class: bar.
>bar is a child of foo.

>I have a variable $thing.
>I want to check that $thing contains a ref to a foo obj or a child of a
>foo obj. If $thing contains a ref to a bar obj and I use ref($thing) I
>get bar back. How do I find out, from this perspective, if bar is a
>child class of foo?

if ( $thing->isa('foo') ) { ... }

Damian


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

Date: Sat, 15 Jul 2000 18:49:14 GMT
From: "jraff" <jraff@home.com>
Subject: Re: PERL IDES
Message-Id: <Km2c5.67183$lU5.454969@news1.rdc1.nj.home.com>

SuperIDE is FREEWARE
http://protostar.hypermart.net/
-----------------------------------
"Robin Bank" <rbank@csf.edu> wrote in message
news:8knutk$116q$1@reader.nmix.net...
> Anyone know any good PERL IDEs for Win98, I'm sick of notepad, and I need
to
> be able to rapidly develop perl.





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

Date: 15 Jul 2000 18:27:15 GMT
From: decklin@red-bean.com (Decklin Foster)
Subject: Re: Please criticise this text extraction script
Message-Id: <8kqae3$34654$1@ID-10059.news.cis.dfn.de>

rhys <rhys.tucker@dtn.ntl.com> writes:

> The objective is to extract email addresses from html pages - I have
> already used it to email British members of parliament!. 

Well, spamming is generally frowned upon.

> $infile = shift;
> 
> 	open(INFILE,"<$infile") or die "Unable to open \$infile $infile :
> $!\n";
> 	@lines = <INFILE>;
> 	close (INFILE);
> 	
> 	
> 	foreach $line(@lines)

Yuck. I initially ran this with 'perl test.pl < input', before i
realized it wouldn't do the right thing. Replace the entire portion
quoted above with this:

while (<>) {

as written, the current line will be placed in $_, not $line, which I
find to be more readable. You can change that if desired.

There a two reasons for this: one is acting like a proper filter
(input from all named files || stdin, output to stdout) and two is
that reading the entire file into memory before processessing it is
wasteful and unnecessary.

> 		@split = split(/(\"|:|\<|\>)/,$line);

You can't parse HTML with regular expressions. I suggest:

lynx -dump foo.html | yourscript

And then take all the code that deals with HTML out.

> 		$prev_match = "";

This is once again useless. If you want to check the last element in
the array, do so -- it's in $emails[-1]. However, this doesn't do
anything to prevent duplicate emails except when they appear together.
You could (a) use a hash, (b) push the addresses now, and look at
perlfaq4 for ways to unique elements out of an array.

> 			if (/(\w+\.)*\w+@\w+(\.\w+)*/) 

You can't parse email adress with a regular expression either (well,
not this one, anyway). I suggest RFC:RFC822:Address from CPAN.

> $outfile = shift;
> 	open(OUTFILE,">$outfile") or die "Unable to open \$outfile $outfile :
> $!\n";

Once again, bad; print to stdout. I want to be able to redirect or
pipe the output and name multiple input files.

>	# use join?

TMTOWTDI.

-- 
There is no TRUTH. There is no REALITY. There is no CONSISTENCY. There
are no ABSOLUTE STATEMENTS. I'm very probably wrong. -- BSD fortune(6)


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

Date: 15 Jul 2000 19:04:15 GMT
From: decklin@red-bean.com (Decklin Foster)
Subject: Re: Simple IP/Domain validation????
Message-Id: <8kqcje$34654$2@ID-10059.news.cis.dfn.de>

Coy <coy@coystoys.com> writes:

> Output should be basically simple:
> NO  or YES  the domain/address is valid.

Sure. (since you have not specified a definition of a hostname, I will
grab RFC2396, as it's handy:)

#!/usr/bin/perl -w

use strict;
my $domainlabel = qr/[a-zA-Z\d]([-a-zA-Z\d]*[a-zA-Z\d])?/;
my $toplabel    = qr/[a-zA-Z]([-a-zA-Z\d]*[a-zA-Z\d])?/;

die "usage: $0 hostname" unless @ARGV;
print $ARGV[0] =~ /^\d(\.\d+){3}$/ ||
      $ARGV[0] =~ /^($domainlabel\.)*($toplabel)\.?$/ ? "YES" : "NO", "\n";

-- 
There is no TRUTH. There is no REALITY. There is no CONSISTENCY. There
are no ABSOLUTE STATEMENTS. I'm very probably wrong. -- BSD fortune(6)


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

Date: Sat, 15 Jul 2000 19:42:37 GMT
From: "Coy" <coy@coystoys.com>
Subject: Re: Simple IP/Domain validation????
Message-Id: <N83c5.3162$Mt.14824@nnrp1.ptd.net>


"Decklin Foster" <decklin@red-bean.com> wrote in message
news:8kqcje$34654$2@ID-10059.news.cis.dfn.de...
: Coy <coy@coystoys.com> writes:
:
: > Output should be basically simple:
: > NO  or YES  the domain/address is valid.
:
: Sure. (since you have not specified a definition of a hostname, I will
: grab RFC2396, as it's handy:)


:)  sorry, i thought by my mentioning of :
 ./netcheck <domain.com> || <ip.addr>

that 'hostname' would have been explained.
The syntax would be
 ./netcheck host.domain.com    #  YES if real active domain
 ./netcheck 204.186.22.1            # YES if real active IP
etc..

I have a webbased form, and users submit IP addresses
and domain names..  I want to validate that these
address/domains are real and answer before processing them.

: #!/usr/bin/perl -w
:
: use strict;
: my $domainlabel = qr/[a-zA-Z\d]([-a-zA-Z\d]*[a-zA-Z\d])?/;
: my $toplabel    = qr/[a-zA-Z]([-a-zA-Z\d]*[a-zA-Z\d])?/;
:
: die "usage: $0 hostname" unless @ARGV;
: print $ARGV[0] =~ /^\d(\.\d+){3}$/ ||
:       $ARGV[0] =~ /^($domainlabel\.)*($toplabel)\.?$/ ? "YES" : "NO", "\n






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

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 V9 Issue 3679
**************************************


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