[24648] in Perl-Users-Digest
Perl-Users Digest, Issue: 6812 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Aug 3 13:31:45 2004
Date: Tue, 3 Aug 2004 10:31:03 -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 Tue, 3 Aug 2004 Volume: 10 Number: 6812
Today's topics:
Is there a PERL compiler? <invalid@invalid.invalid>
Re: Is there a PERL compiler? <mritty@gmail.com>
Re: Is there a PERL compiler? <spamtrap@dot-app.org>
Re: Is there a PERL compiler? <spamtrap@dot-app.org>
Re: Is there a PERL compiler? <abigail@abigail.nl>
Re: Is there a PERL compiler? <mritty@gmail.com>
Re: Is there a PERL compiler? <pilsl@goldfisch.at>
Re: Is there a PERL compiler? <ebohlman@omsdev.com>
Re: Is there a PERL compiler? (Anno Siegel)
Re: Is there a PERL compiler? ctcgag@hotmail.com
Re: Is there a PERL compiler? <uri@stemsystems.com>
Re: Is there a PERL compiler? <corff@cis.fu-berlin.de>
Javascript::MD5 V 1.04 <ron@savage.net.au>
Javascript::SHA1 V 1.01 <ron@savage.net.au>
Lingua::EN::Infinitive V 1.08 <ron@savage.net.au>
Re: Looking for a better shell for windows 2K <remorse@partners.org>
Re: Looking for a better shell for windows 2K <usenet@morrow.me.uk>
LWP::UserAgent & Mechanize <j@j.com>
Re: LWP::UserAgent & Mechanize <j@j.com>
Mail::IMAPClient and Net::SSLeay <josef.moellers@fujitsu-siemens.com>
Mail::Sender and STARTTLS <johnheim@nospam.tds.net>
Re: Mail::Sender and STARTTLS <usenet@vyznev.invalid>
matching the network segment but can't work :-( <artgh@hotmail.com>
Re: matching the network segment but can't work :-( <mritty@gmail.com>
Re: matching the network segment <Joe.Smith@inwap.com>
mod_expires alternative <lee@subtextwhore.co.uk>
Module::MakeDist V 1.08 <ron@savage.net.au>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 27 Jul 2004 18:40:46 GMT
From: "DG" <invalid@invalid.invalid>
Subject: Is there a PERL compiler?
Message-Id: <OkxNc.38363$8_6.33942@attbi_s04>
I'm just curious. Is there a PERL compiler available?
I've got a PERL program that, over the years, has grown fairly large. It
does a lot and does it reliability. So I'd like to keep it. But it's
getting kind of slow. So I was wondering if there was a compiler available
(so I don't have to rewrite it in a compiled language).
If a PERL compiler is not available, is there a PERL to C++ or PERL to JAVA
translator available?
Thanks,
DG
------------------------------
Date: Tue, 27 Jul 2004 14:49:06 -0400
From: Paul Lalli <mritty@gmail.com>
Subject: Re: Is there a PERL compiler?
Message-Id: <20040727144715.V2467@barbara.cs.rpi.edu>
On Tue, 27 Jul 2004, DG wrote:
> I'm just curious. Is there a PERL compiler available?
>
> I've got a PERL program that, over the years, has grown fairly large. It
> does a lot and does it reliability. So I'd like to keep it. But it's
> getting kind of slow. So I was wondering if there was a compiler available
> (so I don't have to rewrite it in a compiled language).
>
> If a PERL compiler is not available, is there a PERL to C++ or PERL to JAVA
> translator available?
(Perl is the language, perl is the interpeter. PERL doesn't exist.
People here are touchy about that. Read perldoc -q difference).
Read the FAQ answer to your question:
perldoc -q compile
Paul Lalli
------------------------------
Date: Tue, 27 Jul 2004 15:42:10 -0400
From: Sherm Pendley <spamtrap@dot-app.org>
Subject: Re: Is there a PERL compiler?
Message-Id: <_PednetH7s2OLZvcRVn-vg@adelphia.com>
DG wrote:
> I'm just curious. Is there a PERL compiler available?
There's something that's usually referred to as a "Perl compiler"
included with recent versions, but it doesn't do what you seem to be after.
It's very rare that a significant part of a script's overall execution
time is spent parsing Perl text and producing byte code from it, so the
performance gain from using Perl's "compiler" is usually nil. It's meant
as more of a packaging and distribution mechanism than as an optimizer.
See 'perldoc -q compile'
> is there a PERL to C++ or PERL to JAVA
> translator available?
Yes - it's called a "programmer". ;-)
sherm--
--
Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org
------------------------------
Date: Tue, 27 Jul 2004 15:50:25 -0400
From: Sherm Pendley <spamtrap@dot-app.org>
Subject: Re: Is there a PERL compiler?
Message-Id: <Saqdnb1AUI2fL5vcRVn-oA@adelphia.com>
Paul Lalli wrote:
> PERL doesn't exist.
Of course it does - although a lot of people confuse it with Perl. One
of my favorite CPAN modules is Inline::PERL, which allows you to embed
this powerful language in your Perl programs. From the Inline::PERL docs:
"PERL is a programming language for writing CGI applications. It's main
strength is that it doesn't have any unnecessary warnings or strictures.
It is a direct descendent of Perl, a programming language which was used
mainly by programmers. However, the original language required too much
reading and thinking and so PERL was developed as a language which was
more in tune with the requirements of the Internet age."
sherm--
--
Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org
------------------------------
Date: 27 Jul 2004 21:00:05 GMT
From: Abigail <abigail@abigail.nl>
Subject: Re: Is there a PERL compiler?
Message-Id: <slrncgdgil.6hs.abigail@alexandra.abigail.nl>
DG (invalid@invalid.invalid) wrote on MMMCMLXXXIII September MCMXCIII in
<URL:news:OkxNc.38363$8_6.33942@attbi_s04>:
<> I'm just curious. Is there a PERL compiler available?
<>
<> I've got a PERL program that, over the years, has grown fairly large. It
<> does a lot and does it reliability. So I'd like to keep it. But it's
<> getting kind of slow. So I was wondering if there was a compiler available
<> (so I don't have to rewrite it in a compiled language).
<>
<> If a PERL compiler is not available, is there a PERL to C++ or PERL to JAVA
<> translator available?
Well, perl *IS* a compiler. Perl code gets compiled before it gets
executed.
The fact that Perl is slower than C has little to do with C having a
separate compilation phase, and Perl not. It all has to do with the
flexibility of Perl. Just the fact that in Perl you can do:
@foo = ("bar", "baz");
$flup = \$foo [1];
$foo [-1] .= "quux";
print $$flup;
and have it print "bazquux" means Perl needs to do a lot of work behind
the scenes. That work is done by C code. Any Perl to C translator would
have to generate similar code - or you would lose the flexibility (and
hence, you can't do everything you can do with Perl). But that leads to
"slow" code....
If you program is getting too slow, you should think about redesigning
your code. An automatic translation from Perl to <whatever> will not
help you.
Abigail
--
@;=split//=>"Joel, Preach sartre knuth\n";$;=chr 65;%;=map{$;++=>$_}
0,22,13,16,5,14,21,1,23,11,2,7,12,6,8,15,3,19,24,14,10,20,18,17,4,25
;print@;[@;{A..Z}];
------------------------------
Date: Tue, 27 Jul 2004 17:04:22 -0400
From: Paul Lalli <mritty@gmail.com>
Subject: Re: Is there a PERL compiler?
Message-Id: <20040727170402.D471@barbara.cs.rpi.edu>
On Tue, 27 Jul 2004, Sherm Pendley wrote:
> Paul Lalli wrote:
>
> > PERL doesn't exist.
>
> Of course it does - although a lot of people confuse it with Perl. One
> of my favorite CPAN modules is Inline::PERL, which allows you to embed
> this powerful language in your Perl programs. From the Inline::PERL docs:
>
> "PERL is a programming language for writing CGI applications. It's main
> strength is that it doesn't have any unnecessary warnings or strictures.
> It is a direct descendent of Perl, a programming language which was used
> mainly by programmers. However, the original language required too much
> reading and thinking and so PERL was developed as a language which was
> more in tune with the requirements of the Internet age."
I stand humbly corrected. :-)
Paul Lalli
------------------------------
Date: Tue, 27 Jul 2004 23:42:12 +0200
From: peter pilsl <pilsl@goldfisch.at>
Subject: Re: Is there a PERL compiler?
Message-Id: <4106cc9e$1@e-post.inode.at>
DG wrote:
> I'm just curious. Is there a PERL compiler available?
>
> I've got a PERL program that, over the years, has grown fairly large. It
> does a lot and does it reliability. So I'd like to keep it. But it's
> getting kind of slow. So I was wondering if there was a compiler available
> (so I don't have to rewrite it in a compiled language).
>
as the other already said everything why a Compiles is not what you are
looking for I want to add some hints what you are actually looking for:
* use a so called "profiler" on your programm. A profiler analyzes your
running programm and tell you how many time it spends in certain
codelines or subroutines. Many times very simple changes in your code
can boost performance of the whole appliction many times.
Profiling helps you to find the piece of code that is worth deeper
examination and thinking. And then ... maybe then .. you can think about
rewriting a few lines of critical code in C++ or a even faster language
(assembler but I dont actually know if really people write assemblercode
for timecritical routines)
* if your program deals with lot of data, you might look on your
data-structure and your underlying data-storage. Tuning a database,
using different methods for plainfile-seek etc. can save lot of resources.
* monitor and tune your system. Buy more memory if this is a bottleneck,
buy a faster harddisk. Turn on udma if you havent already ...
peter
--
http://www2.goldfisch.at/know_list
http://leblogsportif.sportnation.at
------------------------------
Date: 27 Jul 2004 21:51:42 GMT
From: Eric Bohlman <ebohlman@omsdev.com>
Subject: Re: Is there a PERL compiler?
Message-Id: <Xns9533AC4A2A59Febohlmanomsdevcom@130.133.1.4>
"DG" <invalid@invalid.invalid> wrote in
news:OkxNc.38363$8_6.33942@attbi_s04:
> I've got a PERL program that, over the years, has grown fairly large.
> It does a lot and does it reliability. So I'd like to keep it. But
> it's getting kind of slow. So I was wondering if there was a compiler
> available (so I don't have to rewrite it in a compiled language).
As others have pointed out, that's not the way to speed up your code. The
way to speed it up is to profile it in order to find out where most of the
time is being taken, determine how much of that time is actually
attributable to your code as opposed to things like IO that are beyond your
control, and then speed up those parts (first by seeing if you could use
better algorithms or data structures; if not by rewriting them in C or the
like and using XS or Inline::* to integrate them with the rest of your
code).
Note that except in cases where there's a glaringly obvious bad choice of
algorithm or data structure (e.g. a bubble sort used inside a very tight
loop), most programmers' intuitions as to what part of the code is taking
the most time are usually *very* poor. This is particularly the case
in a language like Perl, where one construct that looks "obviously" faster
than another can actually be slower because the first one does most of its
work in behind-the-scenes, highly-optimized code within perl itself whereas
the second one involves a lot of interpretation overhead. Thus the need for
profiling.
------------------------------
Date: 27 Jul 2004 22:03:55 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Is there a PERL compiler?
Message-Id: <ce6jgb$9m2$1@mamenchi.zrz.TU-Berlin.DE>
Abigail <abigail@abigail.nl> wrote in comp.lang.perl.misc:
> @;=split//=>"Joel, Preach sartre knuth\n";$;=chr 65;%;=map{$;++=>$_}
> 0,22,13,16,5,14,21,1,23,11,2,7,12,6,8,15,3,19,24,14,10,20,18,17,4,25
> ;print@;[@;{A..Z}];
Oh, let's see...
my $orig = 'Just another Perl hacker,';
my @permute;
@permute[
map $_->[ 1],
sort { $a->[ 0] cmp $b->[ 0] }
do { my $n = 0; map [ $_, $n++ ], split //, $orig}
] = 0 .. length( $orig) - 1;
print +(sort split //, 'Joel, Preach sartre knuth')[ @permute], "\n";
__END__
Just another Perl hacker,
Yup, everything in place.
Anno
------------------------------
Date: 27 Jul 2004 22:34:24 GMT
From: ctcgag@hotmail.com
Subject: Re: Is there a PERL compiler?
Message-Id: <20040727183424.702$ty@newsreader.com>
"DG" <invalid@invalid.invalid> wrote:
> I'm just curious. Is there a PERL compiler available?
>
> I've got a PERL program that, over the years, has grown fairly large. It
> does a lot and does it reliability. So I'd like to keep it. But it's
> getting kind of slow.
Programs don't just get slower all by themselves. In fact, they generally
get faster, as they are moved to progressively less obsolete hardware. So,
what did you do to it that made it slower? Whatever it was, that's the
thing to look at for speeding it up.
Xho
--
-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service $9.95/Month 30GB
------------------------------
Date: Tue, 27 Jul 2004 23:10:02 GMT
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: Is there a PERL compiler?
Message-Id: <x7isc9gi83.fsf@mail.sysarch.com>
>>>>> "D" == DG <invalid@invalid.invalid> writes:
D> I've got a PERL program that, over the years, has grown fairly
D> large. It does a lot and does it reliability. So I'd like to keep
D> it. But it's getting kind of slow. So I was wondering if there
D> was a compiler available (so I don't have to rewrite it in a
D> compiled language).
profile it and rewrite/redesign the slow stuff. i will wager if you call
it PERL that it isn't written well and can be sped up a fair amount. but
you would need to hire someone who knows Perl and not PERL to do so.
<i am available for refactoring/redesign/speedups>
:)
uri
--
Uri Guttman ------ uri@stemsystems.com -------- http://www.stemsystems.com
--Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
Search or Offer Perl Jobs ---------------------------- http://jobs.perl.org
------------------------------
Date: 29 Jul 2004 16:51:12 GMT
From: <corff@cis.fu-berlin.de>
Subject: Re: Is there a PERL compiler?
Message-Id: <2mso80Fq836vU1@uni-berlin.de>
Abigail <abigail@abigail.nl> wrote:
:
: <> translator available?
: Well, perl *IS* a compiler. Perl code gets compiled before it gets
: executed.
: If you program is getting too slow, you should think about redesigning
: your code. An automatic translation from Perl to <whatever> will not
: help you.
Proper coding makes a huge, huge difference and outweighs ever benefit
(doubtful, though) from any translation to other compilable languages.
Just look at the following example:
#!/usr/bin/perl
# A run time test
for ($i=0; $i<=50000; $i++) {
# 1. Conventional way to concatenate strings
# $string=$string."a"
# 2. Perl idiom to do the same thing
$string.="a"
}
Try the example yourself - save it, e.g. as "runtime.pl", and do
a "$ time ./runtime.pl", once uncommenting the first concatenation
style, then the second. The program itself doesn't produce any
output; just look at the results of "time".
Try again and increase the number of loop iterations. You'll be
flabberghasted after seeing the differences.
In many cases, testing the proper function of a program is done with
a set of sample or test data which are structurally identical to the
real-life problem given without matching the quantities involved.
So, if somebody tests a program with a set of e.g. 100 lines of data
the problem looks fine, but given 10000 lines of input, the time used
is not 100 times, but 100 square times, -> 10000 times, which starts
becoming noticeable.
I've alwas told my students to use real life data, not just "white mice".
Oliver.
--
Dr. Oliver Corff e-mail: corff@zedat.fu-berlin.de
------------------------------
Date: Thu, 29 Jul 2004 06:19:07 GMT
From: Ron Savage <ron@savage.net.au>
Subject: Javascript::MD5 V 1.04
Message-Id: <I1qH83.3Ip@zorch.sf-bay.org>
The pure Perl module Javascript::MD5 V 1.04
is available immediately from CPAN,
and from http://savage.net.au/Perl-modules.html.
On-line docs, and a *.ppd for ActivePerl are also
available from the latter site.
An extract from the docs:
1.04 Tue Jul 20 20:43:00 2004
- Change Makefile.PL to coexist with Module::Build
- Add t/pod.t to test all PODs
--
Cheers
Ron Savage, ron@savage.net.au on 29/07/2004
http://savage.net.au/index.html
------------------------------
Date: Thu, 29 Jul 2004 06:19:22 GMT
From: Ron Savage <ron@savage.net.au>
Subject: Javascript::SHA1 V 1.01
Message-Id: <I1qH85.1q8x@zorch.sf-bay.org>
The pure Perl module Javascript::SHA1 V 1.01
is available immediately from CPAN,
and from http://savage.net.au/Perl-modules.html.
On-line docs, and a *.ppd for ActivePerl are also
available from the latter site.
An extract from the docs:
1.01 Tue Jul 20 20:43:00 2004
- Change Makefile.PL to coexist with Module::Build
- Add t/pod.t to test all PODs
--
Cheers
Ron Savage, ron@savage.net.au on 29/07/2004
http://savage.net.au/index.html
------------------------------
Date: Thu, 29 Jul 2004 06:19:39 GMT
From: Ron Savage <ron@savage.net.au>
Subject: Lingua::EN::Infinitive V 1.08
Message-Id: <I1qH88.1vxw@zorch.sf-bay.org>
The pure Perl module Lingua::EN::Infinitive V 1.08
is available immediately from CPAN,
and from http://savage.net.au/Perl-modules.html.
On-line docs, and a *.ppd for ActivePerl are also
available from the latter site.
An extract from the docs:
1.08 Tue Jul 20 20:43:00 2004
- Change Makefile.PL to coexist with Module::Build
- Add t/pod.t to test all PODs
--
Cheers
Ron Savage, ron@savage.net.au on 29/07/2004
http://savage.net.au/index.html
------------------------------
Date: Fri, 23 Jul 2004 09:08:36 -0400
From: Richard Morse <remorse@partners.org>
Subject: Re: Looking for a better shell for windows 2K
Message-Id: <remorse-48CA5A.09083623072004@plato.harvard.edu>
In article <cbc131f8.0407220132.2e3e9e75@posting.google.com>,
metoudi@gmail.com (Loup Blanc) wrote:
> "Jürgen Exner" <jurgenex@hotmail.com> wrote in message
> news:<cNDLc.40172$lz2.14926@nwrddc03.gnilink.net>...
> > Loup Blanc wrote:
> > > As user friendly as any graphical app is.
> >
> > That's a matter of how _you_ define user friendly for yourself.
>
> put simply : scrollable, mouse enabled
That's not the shell that provides that, that's the terminal emulator.
Ricky
------------------------------
Date: Fri, 23 Jul 2004 00:07:49 +0100
From: Ben Morrow <usenet@morrow.me.uk>
Subject: Re: Looking for a better shell for windows 2K
Message-Id: <5vt5t1-vl5.ln1@mauzo.dyndns.org>
Quoth metoudi@gmail.com (Loup Blanc):
> "Jürgen Exner" <jurgenex@hotmail.com> wrote in message news:<cNDLc.40172$lz2.14926@nwrddc03.gnilink.net>...
> > Loup Blanc wrote:
> > > I'm looking for a smarter shell for windows 2K.
> > > As smart as UN*X shells csh, tcsh etc (that's not a command :).
> >
> > Then why don't you use those? All of them are available for Windows.
>
> I want to avoid Cygwin and I don't know any other win32 port. Maybe
> you can help?
There is a native port of zsh that I use when I'm forced onto windows.
There is mingw/msys (on sf.net) which are native ports of the cygwin stuff.
There's ATT's POSIX.DLL-based system, but I guess you'd avoid that for
the same reasons as cygwin.
> > > As user friendly as any graphical app is.
> >
> > That's a matter of how _you_ define user friendly for yourself.
>
> put simply : scrollable, mouse enabled
This is a question of terminal emulator, not shell; I've yet to find a
decent one.
Ben
--
All persons, living or dead, are entirely coincidental.
ben@morrow.me.uk Kurt Vonnegut
------------------------------
Date: Sun, 1 Aug 2004 04:44:19 -0700
From: "nyana" <j@j.com>
Subject: LWP::UserAgent & Mechanize
Message-Id: <bI4Pc.27541$mg6.25972@fed1read02>
Obviously innefficient code because I am querying server twice:
my $ua = LWP::UserAgent->new;
my $response =
$ua->get("http://www.mlindex.ml.com/GISPublic/bin/SnapShot.asp");
$mech->get("http://www.mlindex.ml.com/GISPublic/bin/SnapShot.asp");
What can I use to store the contents of SnapShot.asp?
I tried:
$mech->get($response) and ...($ua).
$mech = $response and ...($ua).
maybe i should look at the mechanize.pm and see how it wants it ... after I
get so some sleap.
Thanks,
nyana
------------------------------
Date: Sun, 1 Aug 2004 04:48:10 -0700
From: "nyana" <j@j.com>
Subject: Re: LWP::UserAgent & Mechanize
Message-Id: <OL4Pc.27565$mg6.12418@fed1read02>
Some context:
$mech->get("http://www.mlindex.ml.com/GISPublic/bin/SnapShot.asp");
my $ua = LWP::UserAgent->new;
my $response =
$ua->get("http://www.mlindex.ml.com/GISPublic/bin/SnapShot.asp");
my $date = HTML::Form->parse($response->content,$response->base);
my $dvalue = $date->param('txtSSDate');
I need to use LWP to feed into HTML::Form. I know I could do the same thing
with HTML::Form alone, but I would still be calling the .asp twice...
------------------------------
Date: Mon, 26 Jul 2004 09:33:28 +0200
From: Josef Moellers <josef.moellers@fujitsu-siemens.com>
Subject: Mail::IMAPClient and Net::SSLeay
Message-Id: <ce2bvi$o58$1@nntp.fujitsu-siemens.com>
Hi,
I use Mail::IMAPClient version 2.2.9 and perl-Net_SSLeay-1.23-51
I need to combine Mail::IMAPClient and Net::SSLeay to retrieve mail via=20
imaps. I try
socket (S, &AF_INET, &SOCK_STREAM, 0);
connect (S, $dest_serv_params);
select (S); $| =3D 1; select (STDOUT);
$ctx =3D Net::SSLeay::CTX_new();
Net::SSLeay::CTX_set_options($ctx, &Net::SSLeay::OP_ALL);
$ssl =3D Net::SSLeay::new($ctx);
Net::SSLeay::set_fd($ssl, fileno(S));
Net::SSLeay::connect($ssl);
# Then I need to
$resp =3D Net::SSLeay::read($ssl);
Net::SSLeay::write($ssl, "A01 LOGIN $imap_user $imap_pass\r\n");
$resp =3D Net::SSLeay::read($ssl);
$connection =3D Mail::IMAPClient->new(
# User =3D> $imap_user,
# Password =3D> $imap_pass,
);
$connection->Socket(\*S);
$connection->State($connection->Authenticated);
After that, however, every use of any function in Mail::IMAPClient=20
fails, e.g.
$connection->select("INBOX");
What am I missing?
--=20
Josef M=F6llers (Pinguinpfleger bei FSC)
If failure had no penalty success would not be a prize
-- T. Pratchett
------------------------------
Date: Fri, 23 Jul 2004 22:28:37 +0000 (UTC)
From: JGH <johnheim@nospam.tds.net>
Subject: Mail::Sender and STARTTLS
Message-Id: <cds3ek$50m$1@news.doit.wisc.edu>
I'm trying to send an email messave via a server that requires
authentication. I'm using the Mail::Sender module. The error message I'm
getting looks like this (this is acutally the output from the script
below):
Valid protocols: PLAIN,LOGIN
Error: Authentication protocol LOGIN is not accepted by the server,
response: 530 5.7.0 No STARTTLS command has been given.
#!/usr/bin/perl
use Mail::Sender;
my $sender = new Mail::Sender ( {
smtp => 'smtpauth.wiscmail.wisc.edu', from => 'jheim@wisc.edu',
auth => 'LOGIN', authid => 'jheim', authpwd =>
'bogus'});
print ("Valid protocols: " . join (',', $sender->QueryAuthProtocols()) .
"\n");
my $stat = $sender->MailMsg ({
to => 'jheim@wisc.edu',
subject => '33 Here is the file',
msg => "I'm sending you the list you wanted."
});
die "Error: $Mail::Sender::Error\n" unless ref $stat;
------------------------------
Date: Sat, 24 Jul 2004 09:51:18 +0300
From: Ilmari Karonen <usenet@vyznev.invalid>
Subject: Re: Mail::Sender and STARTTLS
Message-Id: <slrncg41n6.16j.usenet@yhteiskone.vyznev.net>
On 2004-07-23, JGH <johnheim@nospam.tds.net> wrote:
> I'm trying to send an email messave via a server that requires
> authentication. I'm using the Mail::Sender module. The error message I'm
> getting looks like this (this is acutally the output from the script
> below):
>
> Valid protocols: PLAIN,LOGIN
> Error: Authentication protocol LOGIN is not accepted by the server,
> response: 530 5.7.0 No STARTTLS command has been given.
From what I can tell, Mail::Sender simply doesn't support TLS.
With a bit of googling for "perl SMTP STARTTLS", I found:
http://www.logix.cz/michal/devel/smtp/smtp-client.pl
Even if that script itself doesn't do what you want, it seems to me
that it wouldn't be too hard to patch Mail::Sender to use TLS based on
the code found in that script. The actual STARTTLS code appears to be
about two dozen lines in total.
--
Ilmari Karonen
If replying by e-mail, please replace ".invalid" with ".net" in address.
------------------------------
Date: Thu, 29 Jul 2004 20:02:13 +0800
From: Facco Eloelo <artgh@hotmail.com>
Subject: matching the network segment but can't work :-(
Message-Id: <4108e655.5321264@news.individual.net>
I have a network segment list in a text file called IPsegment.txt,it looks like
this:
IPsegment.txt
219.111.192.0/18
68.132.0.0/17
67.146.0.0/16
192.162.0.0/16
152.172.0.0/16
34.132.0.0/14
97.208.0.0/13
And I have some IP addresses in another text file called IPlist.txt.It looks
like this:
IPlist.txt
www.yahoo.com,66.94.230.51
www.baidu.com,202.108.250.249
www.sina.com.cn,61.135.152.77
www.sohu.com,61.135.150.75
...
Now,I want to know whether the IP addresses in the IPlist.txt belongs the
network segment writen in the IPsegment.txt.
The mathing IP list is outputed into a new text file called matchinglist.txt.
It looks like this:
matchinglist.txt
www.baidu.com,202.108.250.249
www.sina.com.cn,61.135.152.77
...
This is what I code:
It doesn't work. :-(
can anyone help me fix it?I'm a perl newbie.thanks.
#!/usr/bin/perl
my %ip;
open FH,'<','d:\a\IPSegment.txt';
while (<FH>) {
chomp($_);
$ip{$_}=0;
}
close FH;
open FH,'<','d:\a\IPList.txt';
open FH2,'>>','d:\a\Matchlist.txt';
while (<FH>) {
chomp ($_);
$rec=$_;
($domain, $domip) = split(/,/, $_);
if ($ip{'$domip'} > 0) {
print FH2 $rec,"\n";
$ip{'$domip'}++; #increment a counter here, output from hash
}
}
close FH;
close FH2;
------------------------------
Date: Thu, 29 Jul 2004 08:20:03 -0400
From: Paul Lalli <mritty@gmail.com>
Subject: Re: matching the network segment but can't work :-(
Message-Id: <20040729080714.G3404@barbara.cs.rpi.edu>
On Thu, 29 Jul 2004, Facco Eloelo wrote:
> I have a network segment list in a text file called IPsegment.txt,it looks like
> this:
>
> IPsegment.txt
> 219.111.192.0/18
> 68.132.0.0/17
> 67.146.0.0/16
> 192.162.0.0/16
> 152.172.0.0/16
> 34.132.0.0/14
> 97.208.0.0/13
>
>
> And I have some IP addresses in another text file called IPlist.txt.It looks
> like this:
>
> IPlist.txt
> www.yahoo.com,66.94.230.51
> www.baidu.com,202.108.250.249
> www.sina.com.cn,61.135.152.77
> www.sohu.com,61.135.150.75
> ...
>
> Now,I want to know whether the IP addresses in the IPlist.txt belongs the
> network segment writen in the IPsegment.txt.
> The mathing IP list is outputed into a new text file called matchinglist.txt.
> It looks like this:
>
> matchinglist.txt
> www.baidu.com,202.108.250.249
> www.sina.com.cn,61.135.152.77
> ...
>
>
> This is what I code:
> It doesn't work. :-(
This is not a good problem statement. When posting to this group, you
should always state *how* it doesn't work. What it does or doesn't do
that you didn't expect.
> can anyone help me fix it?I'm a perl newbie.thanks.
>
>
> #!/usr/bin/perl
add the statements
use strict;
use warnings;
to receive the maximal help from this group with the minimal complaining.
> my %ip;
> open FH,'<','d:\a\IPSegment.txt';
Always check the return value of open. In this case, you have no way of
knowing if the file actually opened.
open FH, '<', 'D:\a\IPSegment.txt' or die "Could not open Segments: $!";
> while (<FH>) {
> chomp($_);
> $ip{$_}=0;
> }
> close FH;
>
> open FH,'<','d:\a\IPList.txt';
> open FH2,'>>','d:\a\Matchlist.txt';
see above.
> while (<FH>) {
> chomp ($_);
> $rec=$_;
These three statements could be combined into one:
while (chomp ($rec=<FH>)){
> ($domain, $domip) = split(/,/, $_);
> if ($ip{'$domip'} > 0) {
And here's at least one problem. By putting $domip in single quotes,
you're checking the value of the hash at the literal string '$domip', not
the value of the variable $domip. Remove those quotes.
> print FH2 $rec,"\n";
> $ip{'$domip'}++; #increment a counter here, output from hash
> }
And here's the second problem. (First, again remove the quotes). You're
only incrementing the value of the hash key if it's already greater than
0. This can't happen, since you initially set each position to 0. This
statement needs to be taken out of the if block.
What you really need to check is to see whether or not the IP address
already exists in your hash, and if it does, increment the count and print
it out.
Rewrite the if block as follows:
$ip{$domip}++ if exists $ip{$domip};
if ($ip{$domip} == 1) { #only want to add to the output file once!
print FH2 "$rec\n";
}
> }
> close FH;
> close FH2;
>
HTH,
Paul Lalli
------------------------------
Date: Fri, 30 Jul 2004 12:21:33 GMT
From: Joe Smith <Joe.Smith@inwap.com>
Subject: Re: matching the network segment
Message-Id: <h3rOc.185336$IQ4.27966@attbi_s02>
Facco Eloelo wrote:
> open FH,'<','d:\a\IPSegment.txt';
> while (<FH>) {
> chomp($_);
> $ip{$_}=0;
> }
You are not doing anything with the number after the '/', and you should.
> 219.111.192.0/18
That one specification translates into 16384 individual IP addresses.
$ip{'219.111.192.0'} = 0;
$ip{'219.111.192.1'} = 0;
$ip{'219.111.192.2'} = 0;
$ip{'219.111.192.3'} = 0;
...
$ip{'219.111.223.252'} = 0;
$ip{'219.111.223.253'} = 0;
$ip{'219.111.223.254'} = 0;
$ip{'219.111.223.255'} = 0;
> if ($ip{'$domip'} > 0) {
> print FH2 $rec,"\n";
> $ip{'$domip'}++; #increment a counter here, output from hash
> }
I would use one line for that: [No single quotes around hash keys!]
print FH2 $rec,"\n" if $ip{$domip}++; # Print duplicates after first
####################################################################
As for your segments, this may be helpful:
linux% cat temp.pl
use strict; use warnings;
use Socket;
my @data = qw( 219.111.192.0/18 68.132.0.0/17 67.146.0.0/16 192.162.0.0/16
152.172.0.0/16 34.132.0.0/14 97.208.0.0/13 128.0.0.0/16 );
sub cidr {
my($base,$bits) = split '/',$_[0]; # Assumes that $base really lowest
my $ip4 = sprintf "%u",(unpack "N",inet_aton $base);
( $ip4, $ip4 + 2**(32-$bits)-1 ); # Return low and high
}
foreach my $segment (@data) {
my($lo,$hi) = cidr($segment);
printf "%17s = %10s .. %10s (%8x to %8x)\n", $segment, $lo, $hi, $lo, $hi;
}
linux% perl temp.pl
219.111.192.0/18 = 3681533952 .. 3681550335 (db6fc000 to db6fffff)
68.132.0.0/17 = 1149501440 .. 1149534207 (44840000 to 44847fff)
67.146.0.0/16 = 1133641728 .. 1133707263 (43920000 to 4392ffff)
192.162.0.0/16 = 3231842304 .. 3231907839 (c0a20000 to c0a2ffff)
152.172.0.0/16 = 2561409024 .. 2561474559 (98ac0000 to 98acffff)
34.132.0.0/14 = 579076096 .. 579338239 (22840000 to 2287ffff)
97.208.0.0/13 = 1641021440 .. 1641545727 (61d00000 to 61d7ffff)
128.0.0.0/16 = 2147483648 .. 2147549183 (80000000 to 8000ffff)
------------------------------
Date: Mon, 02 Aug 2004 15:00:09 +0100
From: Subtext Whore <lee@subtextwhore.co.uk>
Subject: mod_expires alternative
Message-Id: <pan.2004.08.02.14.00.09.510000@subtextwhore.co.uk>
Having moved to a new (Apache) server, it no longer has mod_expires
compiled in so I can't use code like the following in .htaccess to ensure
images are cached for specific periods:
ExpiresActive On
### Expire .gif's 1 month from when they're accessed
ExpiresByType image/gif A2592000
I'm just wondering what alternative methods are available. Lots of
information returned by Google went over my head, but did leave me
wondering whether mod_perl (which is available) may be of some use.
--
Subtext Whore
"Where there is a perpetual fast there are very few crumbs
on the floor." - Henry James, The Aspern Papers (1888)
------------------------------
Date: Thu, 29 Jul 2004 06:19:56 GMT
From: Ron Savage <ron@savage.net.au>
Subject: Module::MakeDist V 1.08
Message-Id: <I1qH8B.3JG@zorch.sf-bay.org>
The pure Perl module Module::MakeDist V 1.08
is available immediately from CPAN,
and from http://savage.net.au/Perl-modules.html.
On-line docs, and a *.ppd for ActivePerl are also
available from the latter site.
An extract from the docs:
1.08 Tue Jul 20 20:43:00 2004
- Change Makefile.PL to coexist with Module::Build
- Add t/pod.t to test all PODs
--
Cheers
Ron Savage, ron@savage.net.au on 29/07/2004
http://savage.net.au/index.html
------------------------------
Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>
Administrivia:
#The Perl-Users Digest is a retransmission of the USENET newsgroup
#comp.lang.perl.misc. For subscription or unsubscription requests, send
#the single line:
#
# subscribe perl-users
#or:
# unsubscribe perl-users
#
#to almanac@ruby.oce.orst.edu.
NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
#To request back copies (available for a week or so), send your request
#to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
#where x is the volume number and y is the issue number.
#For other requests pertaining to the digest, send mail to
#perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
#sending perl questions to the -request address, I don't have time to
#answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V10 Issue 6812
***************************************