[22674] in Perl-Users-Digest
Perl-Users Digest, Issue: 4895 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Apr 26 00:06:06 2003
Date: Fri, 25 Apr 2003 21:05:08 -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 Fri, 25 Apr 2003 Volume: 10 Number: 4895
Today's topics:
An Update on my search for a Perl GUI Designer <anthony@nospam.safferconsulting.com>
analyising haskell source for <<loop>> dependencies. (Jason Smith)
Re: call perl from javascript ? or use php instead ? <ericosman@rcn.com>
Re: check if it's an English word <jurgenex@hotmail.com>
Re: check if it's an English word <TruthXayer@yahoo.com>
Re: check if it's an English word (Sara)
Re: check if it's an English word (Sara)
Re: compare two files <No_4@dsl.pipex.com>
Re: Curses and perl5.8 <REMOVEsdnCAPS@comcast.net>
Re: Dumping hash after sort <TruthXayer@yahoo.com>
Re: Getting FULL path+filename from a filehandle <michael.p.broida@boeing.com>
Re: How to find out installed packages on Unix (Tad McClellan)
Re: How to find out installed packages on Unix <barton@applitec.com>
Re: How to find out installed packages on Unix <ericw@nospam.ku.edu>
Re: How to send and receive on IP PORT? <spam@thecouch.homeip.net>
imap client <dalehend@yahoo.com>
Re: imap client <laocoon@fastmail.fm>
Re: Is there a more "perlesque" way of doing this? <bongie@gmx.net>
Re: Is there an array for ($1, $2, $3, ...) (Sara)
Re: Is there an array for ($1, $2, $3, ...) (Malcolm Dew-Jones)
Re: Is there an array for ($1, $2, $3, ...) (Tad McClellan)
Re: Is there an array for ($1, $2, $3, ...) <spam@thecouch.homeip.net>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Fri, 25 Apr 2003 17:36:48 -0500
From: "Anthony Saffer" <anthony@nospam.safferconsulting.com>
Subject: An Update on my search for a Perl GUI Designer
Message-Id: <3ea9b8c9_2@nntp2.nac.net>
Hello Everyone,
As most of you probably remember I have been looking for an easy and quick
way to design GUI based Perl applications. A few weeks ago I started looking
into Perl/Tk and thought that would be the answer. After playing around with
some code I was totally dissatisfied with the results (the 'look and feel'
just was off). Anyway, a few days ago I found wxWindows. wxWindows is a
cross platform GUI development kit who's finished code takes on the look and
feel of whatever platform the code is running on. It's really great and I
was able to be very productive very quickly.
Then, today, I was looking for a RAD GUI development package and found
wxDesigner. wxDesigner is a program similar to Glade or VB and allows you to
visually design your GUI then have it generate the backend wxWindows code in
Perl. I would recommend if anyone is looking for a quick and easy way to
start designing GUI based Perl application that you check out these great
packages. The URL's are below. Have fun!!
REFERRING URL'S:
wxWindows Perl Package
http://www.wxwindows.org
wxDesigner (RAD GUI Designer)
http://www.roebling.de/
Just wanted to share...
Anthony M. Saffer
www.safferconsulting.com
------------------------------
Date: 25 Apr 2003 17:47:59 -0700
From: chastel_pelerin@hotmail.com (Jason Smith)
Subject: analyising haskell source for <<loop>> dependencies.
Message-Id: <623cd325.0304251647.468d04c7@posting.google.com>
Hi All, I have little/no Perl experience and was wondering if anyone
could quickly hash this requirement out for me...
basically given say a haskell source, snippet below.
fvars = TPX.listDiffBy cmpVar nl' pdl
pdl' = fvars `union` pdl
It can identify where this may occur
pdl' = fvars `union` pdl'
i.e. create a <<loop>> during runtime?
so basically I evision a script that will check either side of a '='
operator and determine if we are using a variable in an assignment to
that variable.
Thanks
J.
------------------------------
Date: Fri, 25 Apr 2003 18:16:42 -0400
From: Eric Osman <ericosman@rcn.com>
Subject: Re: call perl from javascript ? or use php instead ?
Message-Id: <3EA9B3CA.2060906@rcn.com>
>
> Use the standard markup for loading client-side scripts from a URL,
>
> <script type='text/javascript' src='/cgi-bin/foo.pl'></script>
>
> then have the server pump out javascript when that URL is requested,
>
> #!perl
> print <<EOF;
> Content-type: text/javascript
>
> var holidaypics = new Array(
> "images_new/tea_party/tp518.jpg",
> "images_new/tea_party/tp520.jpg",
> "images_new/crescent_moon/cm020.jpg"
> );
> EOF
>
Hey Jay ! This looks like just what I need. I'll try it, thanks.
I am really hoping to avoid having to have perl generate my entire html
when only four lines of the html are the "computed" part.
Thanks. /Eric
------------------------------
Date: Fri, 25 Apr 2003 22:13:23 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: check if it's an English word
Message-Id: <7qiqa.1563$B61.1338@nwrddc01.gnilink.net>
Bing Du Test wrote:
> Is there any Perl module that can verify if part of a string is an
> English word? I need to upper case the first letter of English word.
> If it's not an English word, leave it all capitalized. For instance,
> an input title is 'TTI MAMAGER'. The output should be 'TTI Manager'.
How do you define "English word".
Example:
- is "gift" an English word? Well, it may be, at least I can find it in
Webster. But it is also e.g. a German word with a 'slightly' different
meaning
- is "Kindergarten" an English word? No, it is a German word (that
admittedly is used frequently in the USA)
jue
------------------------------
Date: Fri, 25 Apr 2003 17:06:35 -0700
From: TruthXayer <TruthXayer@yahoo.com>
Subject: Re: check if it's an English word
Message-Id: <3EA9CD8B.3CD118D7@yahoo.com>
If you are intending to build something like a spell
checker, you need
to check with a complete dictionary database....
"J=FCrgen Exner" wrote:
> =
> Bing Du Test wrote:
> > Is there any Perl module that can verify if part of a string is an
> > English word? I need to upper case the first letter of English word.=
> > If it's not an English word, leave it all capitalized. For instance,=
> > an input title is 'TTI MAMAGER'. The output should be 'TTI Manager'.=
> =
> How do you define "English word".
> Example:
> - is "gift" an English word? Well, it may be, at least I can find it in=
> Webster. But it is also e.g. a German word with a 'slightly' different
> meaning
> - is "Kindergarten" an English word? No, it is a German word (that
> admittedly is used frequently in the USA)
> =
> jue
------------------------------
Date: 25 Apr 2003 20:37:09 -0700
From: genericax@hotmail.com (Sara)
Subject: Re: check if it's an English word
Message-Id: <776e0325.0304251937.490dc0e2@posting.google.com>
"Jürgen Exner" <jurgenex@hotmail.com> wrote in message news:<7qiqa.1563$B61.1338@nwrddc01.gnilink.net>...
> Bing Du Test wrote:
> > Is there any Perl module that can verify if part of a string is an
> > English word? I need to upper case the first letter of English word.
> > If it's not an English word, leave it all capitalized. For instance,
> > an input title is 'TTI MAMAGER'. The output should be 'TTI Manager'.
>
> How do you define "English word".
> Example:
> - is "gift" an English word? Well, it may be, at least I can find it in
> Webster. But it is also e.g. a German word with a 'slightly' different
> meaning
> - is "Kindergarten" an English word? No, it is a German word (that
> admittedly is used frequently in the USA)
>
> jue
Jue:
He didn't say is it an English word that is NOT a German word. The
intersection between languages is generally not the NULL set.
Well if you've been to Wales, then you realize that perhaps Welsh has
no common members!
By "English word" I presume he meant in a current dictionary.
Gx
------------------------------
Date: 25 Apr 2003 20:39:41 -0700
From: genericax@hotmail.com (Sara)
Subject: Re: check if it's an English word
Message-Id: <776e0325.0304251939.53141b73@posting.google.com>
roberson@ibd.nrc-cnrc.gc.ca (Walter Roberson) wrote in message news:<b8bl3i$7f3$1@canopus.cc.umanitoba.ca>...
> In article <3EA95376.363F6B8C@tamu.edu>,
> Bing Du Test <bing-du@tamu.edu> wrote:
> :Is there any Perl module that can verify if part of a string is an
> :English word? I need to upper case the first letter of English word.
> :If it's not an English word, leave it all capitalized. For instance, an
> :input title is 'TTI MAMAGER'. The output should be 'TTI Manager'.
>
> There is no reliable way to do this in any computer language.
> New English words are invented pretty much every day, and there is
> no central registry of valid English words.
>
> The closest one could come would be to use a word list
> in conjunction with a spelling module that was able to recognize
> common variations. Perhaps CPAN has a 'spell' module.
hi Bing!
Perhaps you should take this up with the makers of "Scrabble"? Your
argument makes their product useless, yet many enjoy it each day.
Perhaps to 99.99% he can be assured its an English word? Let's try to
maintain some notion of realism in our programming pursuits?
-Gx
------------------------------
Date: Fri, 25 Apr 2003 23:52:38 +0100
From: Big and Blue <No_4@dsl.pipex.com>
Subject: Re: compare two files
Message-Id: <3ea9bc35$0$11385$cc9e4d1f@news.dial.pipex.com>
Helgi Briem wrote:
>
>>$size1 = `wc -l $file1 | awk '{print \$1}'`;
>>$size2 = `wc -l $file2 | awk '{print \$1}'`;
>>$diff = ($size1 - $size2);
>
>
> You believe it's an improvement to invoke not
> one, but two external programs (wc and awk)
> and not once, but twice each, plus add two unneeded
> temporary variables in order to get something
> that you can get with a single built-in Perl operator?
It's surprising how many people do...
An bear in mind that the use of awk above is unnecessary even if you
really feall that using an external call to wc in someway adds to the
implicit documentation and redability of the code.
If wc has no filename to work with then it can't print it, so just
redirect the filename onto stdin:
$size1 = `wc -l < $file1`;
Another inefficiency is that wc -l will actually have to read all of
the file to count the newlines, whereas "is" can just look up the byte
size in the inode.
--
-*- Just because I've written it here doesn't -*-
-*- mean that you should, or I do, believe it. -*-
------------------------------
Date: Fri, 25 Apr 2003 17:41:29 -0500
From: "Eric J. Roode" <REMOVEsdnCAPS@comcast.net>
Subject: Re: Curses and perl5.8
Message-Id: <Xns9368BE296986Dsdn.comcast@216.166.71.239>
-----BEGIN xxx SIGNED MESSAGE-----
Hash: SHA1
"David Formosa (aka ? the Platypus)" <dformosa@dformosa.zeta.org.au>
wrote in news:slrnbahp8p.phe.dformosa@dformosa.zeta.org.au:
> I'm trying to install Curses.pm under perl5.8 however when I try
it
> fails to compile. I can't see anything on deja-google about it is
> this a know problem or something I should submit a bug report on.
Let me guess: Perl_sv_isa?
This is a known problem, although I don't know why there isn't more
Net noise about it.
You need to change the above symbol to "sv_isa". The compiler
message tells you where the error is -- some .c file, line 250 or 275
(I forget exactly). Just change that one line and re-run make.
It'll work.
At some point, I gather, the code base used from using the symbol
"Perl_sv_isa" to "sv_isa", and the Curses.pm author made the change
everywhere but one place. I told the author about this bug and its
solution months ago, and he wrote back to me and acknowledged it, but
he has not released a patch -- I don't know why.
I am surprised that there hasn't been more clamor for this bug to be
patched. I have personally talked to at least a dozen perl
programmers who have had this problem, and helped them all to fix it
this same way. There must be thousands of perl installations that
have this problem.
- --
Eric
print scalar reverse sort qw p ekca lre reh
ts uJ p, $/.r, map $_.$", qw e p h tona e;
-----BEGIN xxx SIGNATURE-----
Version: GnuPG v1.2.1 (MingW32) - WinPT 0.5.13
iD8DBQE+qbmXY96i4h5M0egRAtEfAJ0ezjcB7Ov4+Ybj0WGc4y4gS2zjsgCg8J/p
4DkC2fQUtDbFpL2uAKxOFOw=
=eZTX
-----END PGP SIGNATURE-----
------------------------------
Date: Fri, 25 Apr 2003 15:18:32 -0700
From: TruthXayer <TruthXayer@yahoo.com>
Subject: Re: Dumping hash after sort
Message-Id: <3EA9B438.B52067C8@yahoo.com>
Hi All,
Thanks Tassilo, but somehow I can't get it to work even
for a simple sort by value. I could work around by sorting
the hash in normal way but just trying to get the elegant
solution to work. Any help is appreciated...
my %baz = (
"A" => 34,
"B" => 75,
"C" => 21,
);
$Data::Dumper::Sortkeys = \&my_filter2;
sub my_filter2 {
my ($hash) = shift;
# return an array ref containing the hash keys
to dump
# in the order that you want them to be dumped
return [ sort { $$hash{b} <=> $$hash{$a} }
(keys %$hash) ];
}
print Dumper ( \%baz );
Thanks,
"Tassilo v. Parseval" wrote:
>
> Also sprach TruthXayer:
>
> > Is there a way to include a sort routine when dumping a hash
> > through
> > Data::Dumper module.
> >
> > I am currently dumping it thru
> > my $dump = Data::Dumper->new([\%HugeHash], [qw(HugeHash)]);
>
> You mean, dumping a hash in a sorted manner? According to the docs, it
> should be enough to set
>
> $Data::Dumper::Sortkeys = 1;
>
> to force sorted output. If you need a different way of sorting, you have
> to provide a function-reference:
>
> $Data::Dumper::Sortkeys = sub {
> # reverse numerical sort
> my @keys = keys %{ $_[0] };
> [ sort { $b <=> $a } @keys ];
> };
>
> The function-ref thing is quite flexible so you could even sort on
> values etc.
>
> Tassilo
------------------------------
Date: Fri, 25 Apr 2003 23:58:26 GMT
From: "Michael P. Broida" <michael.p.broida@boeing.com>
Subject: Re: Getting FULL path+filename from a filehandle
Message-Id: <3EA9CBA2.3BF33985@boeing.com>
Uri Guttman wrote:
>
> >>>>> "MPB" == Michael P Broida <michael.p.broida@boeing.com> writes:
>
> no, it is because the OS doesn't need it anymore as it can use the
> internal file info. this is the common style on unix. on others, i can't
> say for sure. do you know OS/390? or RT-11?
It's been over 25 years since I worked with RT-11. I did a lot of
work with RSX-11M, and I -think- it may have had this capability.
I did it easily on VAXen. (I really liked DEC systems because they
had a LOT of flexibility and simple ways to get enormous amounts of
data about the filesystem.) I recall it wasn't too hard on Solaris
(which is Unix) though I don't remember how; that was over five
years ago.
> and you can't tell which is the good one. look at the lsof utility and
> see what it does.
I'll look into that. Thanks. But I'm not on Unix and
don't know if "lsof" is on Win2k. <Grin>
> MPB> I never expected to need the full path in that lowest level.
> MPB> Things changed; now I need it.
>
> anticipating future needs is part of architecture and design. and i
> still doubt you need it but i can't know for sure unless i knew your
> project.
Obviously. And the people responsible for setting the goals of
this project have changed them more than a few times. <grin>
Currently, the user enters a filename; I open the file and work on
it. However, in a later step, I have to go WAY UP the directory
tree hunting for a particular starting point and back down, looking
for a whole mess of other, related files. THIS is where I need the
fullpath name of the original file as a starting point to begin the
"climb". I may be able to do it if I can get the Windows "drive
letter" that is the root of this path. At one point, I made the
user GIVE me that drive letter, but that didn't work well with
drag-and-drop or SendTo invocation; I want to avoid prompting them
for info I can get myself.
When I posted the original note, I wasn't sure that the "current
working directory" would be the same as that holding a file that
was dropped on a shortcut to my script (or a file that is given
to my script via "SendTo"). But I've put together enough tests
to know that in THOSE cases, I get a FULL path/filename. Good.
That just leaves the case where the user types in the filename with
possibly NO path info or a partial, relative path. If I can open
the file from that info, I can assume that all of that is (or is
relative to) the current working dir, and build a path string by
carefully removing any ../.. relative stuff. This is not even
really difficult. I had just hoped for a pre-built solution.
> MPB> I'll look into switching to a hash with the filehandle + the
> MPB> filename/path, but I'll still have to build the actual "path+name"
> MPB> from the original (possibly partial) path and current directory.
> MPB> Not impossible, but I had hoped someone may have already built
> MPB> a package to do this.
>
> there are such beasts on cpan that are tied handles. seek and ye shall
> find.
Thanks! I'll look at those. Will a search for "tied handles"
find them or is there a specific package name I should hunt for?
Mike
------------------------------
Date: Fri, 25 Apr 2003 20:34:19 -0500
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: How to find out installed packages on Unix
Message-Id: <slrnbajogr.78i.tadmc@magna.augustmail.com>
Wang, Vincent <viwang@nortelnetworks.com> wrote:
> Do you know how to find out the Perl packages that already installed on
> my UNIX or Linux, like “ppm query” does on win32?
perldoc perllocal
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Sat, 26 Apr 2003 03:03:07 GMT
From: "Barton L. Phillips" <barton@applitec.com>
Subject: Re: How to find out installed packages on Unix
Message-Id: <LFmqa.1305$4F3.46020828@newssvr14.news.prodigy.com>
This is a multi-part message in MIME format.
--------------010507040608010202080602
Content-Type: text/plain; charset=windows-1252; format=flowed
Content-Transfer-Encoding: 8bit
If you are looking for something to show all the packages I wrote a
little script that follows @INC and shows all the modules and their
locations. If you add a query then it only show modules that matche the
query regular expression. Example: findmods 'File::' would show all the
File modules and locations. It's not a great perl program but it is
something.
Tad McClellan wrote:
> Wang, Vincent <viwang@nortelnetworks.com> wrote:
>
>
>>Do you know how to find out the Perl packages that already installed on
>>my UNIX or Linux, like “ppm query” does on win32?
>
>
>
> perldoc perllocal
>
>
--
----------------
Barton L. Phillips
Applied Technology Resources, Inc.
9045 Corbin Ave. Ste B2
Northridge, CA 91324
Tel: (818)341-5595 Fax: (818)775-1395
Web: http://www.applitec.com
--------------010507040608010202080602
Content-Type: text/plain;
name="findmods.pl"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="findmods.pl"
#!/usr/bin/perl -w
use strict;
use File::Find;
my $query = shift;
# look through the directories in @INC
my %found;
my @ar;
my $cnt = 0;
my $len = 0;
my $dir;
for my $x (@INC) {
next if $x =~ /^.$/;
$dir = $x;
find(\&wanted, $dir);
}
while(my ($k, $v) = each %found) {
# my ($modName, $dirx) = $v =~ m!^(.*?)<-->/usr/lib/perl5/(.*)$!;
$ar[$cnt] = $k;
my $x = $len - length($ar[$cnt]);
$ar[$cnt] .= " " x $x . "-- $v";
$cnt++;
}
for my $vv (sort @ar) {
if(defined $query) {
next unless $vv =~ /$query/;
}
print "$vv\n";
}
exit;
sub wanted {
return unless /^.*\.pm\z/s;
my $mod = $File::Find::dir;
$mod =~ s/$dir\/*//;
$mod =~ s!^[^A-Z].*?/!!g while $mod =~ m!^[^A-Z].*?/!;
$mod =~ s!/!::!g;
s/\.pm//;
my $fnd;
if($mod !~ /^[A-Z]/) {
$fnd = $_;
} else {
$fnd = "$mod\:\:$_";
}
unless(defined $found{$fnd}) {
$found{$fnd} = "$File::Find::dir";
$len = length("$_") if $len < length($_);
$File::Find::prune = 1;
}
}
__END__
=head1 NAME
findmods -- Find Perl Modules
=head1 SYNOPSIS
findmods [query]
=head1 DESCRIPTION
Finds all perl modules in the @INC path and displays the first found and location.
'query' is a regular expression.
If 'query' then shows only matches.
For example: 'findmods File::Find' would only show File::Find module.
'findmods Find' would show all modules with 'Find' in the name. 'findmods "^File"' would
show anything starting with 'File'.
--------------010507040608010202080602--
------------------------------
Date: Sat, 26 Apr 2003 03:25:03 GMT
From: Eric Wilhelm <ericw@nospam.ku.edu>
Subject: Re: How to find out installed packages on Unix
Message-Id: <pan.2003.04.25.22.22.11.65706.5659@nospam.ku.edu>
On Fri, 25 Apr 2003 20:34:19 -0500, Tad McClellan wrote:
> perldoc perllocal
No documentation found for "perllocal".
?
I was working on a method of doing this.
Planning to turn it into an directory full of html perldocs.
It's been a while since I've worked on it, but I'm pretty sure it at
least lists all of the modules found in @INC
(Maybe it also needs to recurse (see File::Find)
The main stimulus was that I have an rpm installed version of perl and
don't even know how much stuff is already installed.
If you take this any further, please let me know.
--Eric
-------------Untested, possibly very useless code follows----------
#!/usr/bin/perl
$perlroot = "/usr/lib/perl5/";
$docroot = "$ENV{HOME}/docs/perldocs/modules/";
@files = `find $perlroot -iname "*.pm"`;
foreach $file (@files) {
@return = split(/\n/, `podselect -section NAME $file`);
shift(@return); # always scrap the first line
# need support for sub-module stuff:
$string = join("",@return);
$string =~ s/\s*//;
unless ($string) {
print "nothing for $file";
next;
}
if($return[1]) {
$file =~ s/$perlroot//;
$modules{"$return[2]"} = $file;
}
}
------------------------------
Date: Fri, 25 Apr 2003 22:10:41 -0400
From: Mina Naguib <spam@thecouch.homeip.net>
Subject: Re: How to send and receive on IP PORT?
Message-Id: <IUlqa.14305$_w.273717@wagner.videotron.net>
-----BEGIN xxx SIGNED MESSAGE-----
Hash: SHA1
Brad Walton wrote:
> I am looking for information on how to send information and receive (listen)
> for information on a port. For example, I want to have a perl program
> running on one PC, while another sits on a remote machine and listens for
> incoming data on a specified port. What would this process be called? And
> are their any examples or tutorials of how this is accomplished?
>
> Thanks,
> Sammie
>
>
Hi Sammie, or Brad...
This is simple IP traffic (Internet Protocol). As long as both machines
are on the same IP network (for example, the internet) then you can
easily make them talk to each other.
Start your quest by lots of reading. Here are some resources to get you
started:
http://www.perldoc.com/perl5.8.0/pod/perlipc.html
http://search.cpan.org/author/JHI/perl-5.8.0/ext/IO/lib/IO/Socket/INET.pm
http://search.cpan.org/author/JHI/perl-5.8.0/ext/IO/lib/IO/Socket.pm
http://search.cpan.org/author/JHI/perl-5.8.0/ext/Socket/Socket.pm
http://search.cpan.org/author/JWIED/Net-Daemon-0.37/lib/Net/Daemon.pm
And my own:
http://search.cpan.org/author/MNAGUIB/EasyTCP-0.19/EasyTCP.pm
The above is just a small list of MANY available modules to help you do
what you mentioned.
Best of luck.
-----BEGIN xxx SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQE+qeqoeS99pGMif6wRAtD0AKCHd3drtOK7hZup5YUEXCKjl0a2hQCfVXx2
WpIVeIBC0QoOLIGjSOWb4ns=
=0dSQ
-----END PGP SIGNATURE-----
------------------------------
Date: Sat, 26 Apr 2003 02:11:12 GMT
From: "earthlink" <dalehend@yahoo.com>
Subject: imap client
Message-Id: <4Vlqa.42210$4P1.3858412@newsread2.prod.itd.earthlink.net>
Are there any perl scripts (no cgi) for an imap client with ssl support?
------------------------------
Date: Sat, 26 Apr 2003 04:43:15 +0200
From: Lao Coon <laocoon@fastmail.fm>
Subject: Re: imap client
Message-Id: <Xns9369302F0C4DFlaocoon@62.153.159.134>
"earthlink" <dalehend@yahoo.com> wrote in news:4Vlqa.42210$4P1.3858412
@newsread2.prod.itd.earthlink.net:
>
> Are there any perl scripts (no cgi) for an imap client with ssl support?
>
Look into Net::IMAP or Mail::IMAPClient and IO::Socket::SSL on CPAN.
HTH
Lao
------------------------------
Date: Sat, 26 Apr 2003 01:15:55 +0200
From: "Harald H.-J. Bongartz" <bongie@gmx.net>
Subject: Re: Is there a more "perlesque" way of doing this?
Message-Id: <1068493.dBBv2FSZlK@nyoga.dubu.de>
Eric wrote:
> playing around with these solutions and reading more on the
> subject I discovered Transliteration (tr)
> in my particular case the following seems to work as well.
> $_ = "some_text_patern1";
> tr/patern1patern2/patern2patern1/; #something close to this...
The tr/// operator substitutes by character, not by pattern.
So, as long as you want to convert 'p' to 'p', 'a' to 'a', 't' to 't',
... '2' to '1', this is the way to go. If not, you should stay with
the substitution operator s///.
Ciao,
Harald
--
Harald H.-J. Bongartz <bongie@gmx.net>
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
The only difference between me and a madman is that I am not mad.
-- Salvador Dali
------------------------------
Date: 25 Apr 2003 17:00:24 -0700
From: genericax@hotmail.com (Sara)
Subject: Re: Is there an array for ($1, $2, $3, ...)
Message-Id: <776e0325.0304251600.1e72be65@posting.google.com>
> Ah, but watch out for occasions to use m// in list context. It comes
> more up more often than is apparent, and it's much more stylish to write
>
> my ( $source, $target) = m/.()..()../;
>
> instead of
>
> m/.()..()../;
> my ( $source, $target) = ( $1, $2);
>
> don't you think?
>
> Used in assignments like this it's an alternative to split(), sometimes
> superior. As Randal's Rule has it, "If you know what to throw away, use
> split(). If you know what to keep, use m//."
>
> That's only assignment. There are clever little loops, like
>
> ... for m/.../g;
>
> and similar tricks. You'll find them when you look for them. These
> things make up another of Perl's virtues: Making trivial things trivial.
>
> Anno
Hi Anno-
Yes much more stylish. These constructs come to mind when I'm
"mapping" like
my %h = map /..()..()../, @a;
but you're correct, it looks like it would have broader application.
That's something I like about Perl - just like watching Spinal Tap, no
matter how many times you think you've seen it all something else pops
up you never noticed!
By the way, in like 500,000 lines of Perlcode now I've never used m//,
only //. I never did understand that "m"!
Thanks for the tip again,
Gx
------------------------------
Date: 25 Apr 2003 17:21:24 -0800
From: yf110@vtn1.victoria.tc.ca (Malcolm Dew-Jones)
Subject: Re: Is there an array for ($1, $2, $3, ...)
Message-Id: <3ea9d104@news.victoria.tc.ca>
Anno Siegel (anno4000@lublin.zrz.tu-berlin.de) wrote:
: Ah, but watch out for occasions to use m// in list context. It comes
: more up more often than is apparent, and it's much more stylish to write
: my ( $source, $target) = m/.()..()../;
: instead of
: m/.()..()../;
: my ( $source, $target) = ( $1, $2);
: don't you think?
: Used in assignments like this it's an alternative to split(), sometimes
: superior. As Randal's Rule has it, "If you know what to throw away, use
: split(). If you know what to keep, use m//."
: That's only assignment. There are clever little loops, like
: ... for m/.../g;
*but* be careful of the gotcha of assigning a list in conjunction with
looping using /g because that is just a little too clever
while ( my($one,$two) = m/(some).*?(thing)/g ) # note /g
{ # doesn't work
}
you need to use
while ( m/(some).*?(thing)/g ) # note /g
{ my($one,$two) = ($1,$2);
}
------------------------------
Date: Fri, 25 Apr 2003 20:18:16 -0500
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: Is there an array for ($1, $2, $3, ...)
Message-Id: <slrnbajnio.78i.tadmc@magna.augustmail.com>
Anno Siegel <anno4000@lublin.zrz.tu-berlin.de> wrote:
> Sara <genericax@hotmail.com> wrote in comp.lang.perl.misc:
>> "Janek Schleicher" <bigj@kamelfreund.de> wrote in message
>> news:<pan.2003.04.25.14.02.32.366977@kamelfreund.de>...
>> > Sara wrote at Fri, 25 Apr 2003 06:12:20 -0700:
>> > > Is there an array defined for ($1, $2, $3,...) after a regex defines
>> > > them?
> it's much more stylish to write
>
> my ( $source, $target) = m/.()..()../;
>
> instead of
>
> m/.()..()../;
> my ( $source, $target) = ( $1, $2);
>
> don't you think?
Yes, but you could never do the later...
> As Randal's Rule has it,
... because of another Randal Rule that he pointed out to
some raw newbie here over 7 years ago.[1]
*Never* perform a test to grab a substring into $1 without
also testing the result of the match. (Well, there are a few
exceptions, but start with that, and work your way backwards.)
[1] Message-ID: <uk68f9cg8b.fsf@linda.teleport.com>
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Fri, 25 Apr 2003 22:21:38 -0400
From: Mina Naguib <spam@thecouch.homeip.net>
Subject: Re: Is there an array for ($1, $2, $3, ...)
Message-Id: <S2mqa.14309$_w.275919@wagner.videotron.net>
-----BEGIN xxx SIGNED MESSAGE-----
Hash: SHA1
Sara wrote:
> Of course we can use @ARGV for ($ARGV[0], $ARGV[1], ...)
> and @_ for ($_[0], $_[1],...)
>
> Is there an array defined for ($1, $2, $3,...) after a regex defines
> them? I did a perldoc -q on regex and some other keywords but I didn't
> discover anything related.
No, however such a regex, besides assigning the matches to $1, $2 etc...
Also returns a list with the same values in matching sequence.
@words = ($something =~ /(\w+)/g);
or
$rhyme = "Mary had a little lamb";
($had, $lamb) = ($rhyme =~ /Mary (\w+) a little (\w+)/);
-----BEGIN xxx SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQE+qe0yeS99pGMif6wRAvvcAJ9hZsptAFiouJImxdSX4mbkJYbqAwCfc2Hp
x0NczfdqIECV6kmey0Ic4DY=
=zdx1
-----END PGP SIGNATURE-----
------------------------------
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.
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 4895
***************************************