[24366] in Perl-Users-Digest
Perl-Users Digest, Issue: 6555 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed May 12 00:06:00 2004
Date: Tue, 11 May 2004 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 Tue, 11 May 2004 Volume: 10 Number: 6555
Today's topics:
Re: How to find the SSL certificate's expiration. <glex_nospam@qwest.invalid>
Re: How to find the SSL certificate's expiration. <vladimir@NoSpamPLZ.net>
Re: Making array elements Unique (Kevin Collins)
Re: Printing multiple Array as multiple column <abigail@abigail.nl>
Re: Printing multiple Array as multiple column <bmb@ginger.libs.uga.edu>
Re: RegExp in one statement <usenet@morrow.me.uk>
Re: RegExp in one statement (Sam Holden)
Re: RegExp in one statement (Kevin Collins)
Re: RegExp in one statement <dev_mail@donstefani.com>
Re: RegExp in one statement (Kevin Collins)
Re: RegExp in one statement <abigail@abigail.nl>
Re: RegExp in one statement <gnari@simnet.is>
Re: RegExp in one statement <nospam@bigpond.com>
Re: Using match variables ($1, $2 ...) as variables. <tadmc@augustmail.com>
Re: Using match variables ($1, $2 ...) as variables. <tadmc@augustmail.com>
Re: Using match variables ($1, $2 ...) as variables. <parimi@none.nowhere.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 11 May 2004 18:17:52 -0500
From: "J. Gleixner" <glex_nospam@qwest.invalid>
Subject: Re: How to find the SSL certificate's expiration.
Message-Id: <Aadoc.71$B_5.42778@news.uswest.net>
perlnovice wrote:
> Hello all,
>
> I would like to write a script running on a client to determine the
> expiration date of a web server's SSL certificate. But I do not know
> how to. Can anybody give me a hint.
Hint: Start by searching the internet! Learn to use google.
Just for fun, after spending only a few minutes, I found:
http://www.mail-archive.com/mon@linux.kernel.org/msg01187.html
------------------------------
Date: Tue, 11 May 2004 23:24:08 GMT
From: lostriver <vladimir@NoSpamPLZ.net>
Subject: Re: How to find the SSL certificate's expiration.
Message-Id: <sgdoc.5217$2_6.159307@weber.videotron.net>
On 11 May 2004 12:16:46 -0700, perlnovice wrote:
> I would like to write a script running on a client to determine the
> expiration date of a web server's SSL certificate. But I do not know
> how to. Can anybody give me a hint.
One way to do it is to use Net::SSLeay module available from CPAN.
#!/usr/local/bin/perl
use Net::SSLeay;
$site = shift || die "Usage: $0 URL\n";
(undef, undef, undef, $server_cert) = &Net::SSLeay::get_https3($site, 443, '/');
if ( defined ($server_cert) ) {
$from = Net::SSLeay::X509_get_notBefore($server_cert);
print Net::SSLeay::P_ASN1_UTCTIME_put2string($from), "\n";
$to = Net::SSLeay::X509_get_notAfter($server_cert);
print Net::SSLeay::P_ASN1_UTCTIME_put2string($to);
}
__END__
--
.signature: No such file or directory
------------------------------
Date: Tue, 11 May 2004 22:23:47 GMT
From: spamtotrash@toomuchfiction.com (Kevin Collins)
Subject: Re: Making array elements Unique
Message-Id: <slrnca2kjj.nef.spamtotrash@doom.unix-guy.com>
In article <n65oc.113943$G_.300@nwrddc02.gnilink.net>, Jürgen Exner wrote:
> Bernard El-Hagin wrote:
>> "George Kinley" <georgekinley@hotmail.com> wrote:
>>> I have an array of duplicate elements "char", I want to make the
>>> elements Unique and throw the redundant
>>> what solution came to my mind is I take element by element out of
>>> an array and create a hash checking the elements with "exists" and
>>> populate the hash is there any more intelligent way to do
>>
>>
>> No.
>
> Actually there is. With a hash there is no need to check for exists()
> because even adding the same key multiple times will result in only one
> entry by the very nature of hashes. No need to waste time with exists().
>
Yes, however you do not end up with the same sort order. Of course, the OP did
not mention that, but it can be a concern.
Kevin
------------------------------
Date: 11 May 2004 22:36:12 GMT
From: Abigail <abigail@abigail.nl>
Subject: Re: Printing multiple Array as multiple column
Message-Id: <slrnca2las.4ga.abigail@alexandra.abigail.nl>
Edward Wijaya (ewijaya@singnet.com.sg) wrote on MMMCMVI September
MCMXCIII in <URL:news:opr7uv9uvruj0cst@news.singnet.com.sg>:
,, Hi,
,,
,, I have again this array:
,,
,, @array1 = (ab, bc, cd, ...)
,, @array2 = (cc, dd, ee, ...)
,,
,, with: print join("\n", @array), "\n";
,, it does give:
,,
,, ab
,, bc
,, cd
,,
,, Can we extend it to for multiple array?
,,
,, so that it gives:
,,
,, ab cc
,, bc dd
,, cd ee
#!/usr/bin/perl
use strict;
use warnings;
no warnings qw /syntax/;
sub zup {
join "\n" => map {join " " => map {shift @$_} @_} @{$_ [0]}
}
my @array1 = qw /ab bc cd de/;
my @array2 = qw /cc dd ee gg/;
my @array3 = qw /12 34 56 78/;
print zup \(@array1, @array2, @array3);
print "\n";
__END__
ab cc 12
bc dd 34
cd ee 56
de gg 78
Abigail
--
use lib sub {($\) = split /\./ => pop; print $"};
eval "use Just" || eval "use another" || eval "use Perl" || eval "use Hacker";
------------------------------
Date: Tue, 11 May 2004 20:55:29 -0400
From: Brad Baxter <bmb@ginger.libs.uga.edu>
Subject: Re: Printing multiple Array as multiple column
Message-Id: <Pine.A41.4.58.0405112047320.14524@ginger.libs.uga.edu>
On Tue, 11 May 2004, Edward Wijaya wrote:
> Hi,
>
> I have again this array:
>
> @array1 = (ab, bc, cd, ...)
> @array2 = (cc, dd, ee, ...)
[...]
>
> Can we extend it to for multiple array?
>
> so that it gives:
>
> ab cc
> bc dd
> cd ee
use warnings;
use strict;
use Array::Each;
my @array1 = qw(ab bc cd de );
my @array2 = qw(cc dd ee ff gg hh );
my @array3 = qw(11 22 33 44 55 );
my $set = Array::Each->new(
set => [ \@array1, \@array2, \@array3 ],
undef => '-',
bound => 0,
);
while( my( $a1, $a2, $a3 ) = $set->each ) {
printf "%12s %12s %12s\n", $a1, $a2, $a3;
}
__END__
ab cc 11
bc dd 22
cd ee 33
de ff 44
- gg 55
- hh -
http://search.cpan.org/~bbaxter/Array-Each-0.02/
Regards,
Brad
------------------------------
Date: Tue, 11 May 2004 22:05:36 +0000 (UTC)
From: Ben Morrow <usenet@morrow.me.uk>
Subject: Re: RegExp in one statement
Message-Id: <c7ring$lif$1@wisteria.csv.warwick.ac.uk>
Quoth dev_mail@donstefani.com:
> How can I do this in one statement?
Why do you need to?
> my $ml_name = $q->param('ml_name');
> $ml_name =~ s/^(\s*)//;
(my $ml_name = $q->param('ml_name')) =~ s/^\s*//;
No need for the parens: you don't use $1.
Are you sure you don't want a /g on there? This will only remove the
first piece of whitespace.
Ben
--
'Deserve [death]? I daresay he did. Many live that deserve death. And some die
that deserve life. Can you give it to them? Then do not be too eager to deal
out death in judgement. For even the very wise cannot see all ends.'
ben@morrow.me.uk
------------------------------
Date: 11 May 2004 22:08:46 GMT
From: sholden@flexal.cs.usyd.edu.au (Sam Holden)
Subject: Re: RegExp in one statement
Message-Id: <slrnca2jne.r1o.sholden@flexal.cs.usyd.edu.au>
On Tue, 11 May 2004 21:58:23 GMT, Don Stefani <dev_mail@donstefani.com> wrote:
> How can I do this in one statement?
>
> my $ml_name = $q->param('ml_name');
> $ml_name =~ s/^(\s*)//;
>
> Thanks
(my $ml_name = $q->param('ml_name')) =~ s/^(\s*)//;
But it's ugly and a hard to read and not worth using.
--
Sam Holden
------------------------------
Date: Tue, 11 May 2004 22:11:32 GMT
From: spamtotrash@toomuchfiction.com (Kevin Collins)
Subject: Re: RegExp in one statement
Message-Id: <slrnca2jsk.nef.spamtotrash@doom.unix-guy.com>
In article <30coc.47437$DF7.39076@newssvr29.news.prodigy.com>, Don Stefani
wrote:
> How can I do this in one statement?
>
> my $ml_name = $q->param('ml_name');
> $ml_name =~ s/^(\s*)//;
>
(my $ml_name = $q->param('ml_name')) =~ s/^\s+//;
The parens are not needed since you are doing nothing with the captured match.
Additionally, you only care about removing space chars if there are some, and
since * means "zero or more" it is better to use +, which means "one or more"
because changing nothing to nothing is meaningless...
Kevin
------------------------------
Date: Tue, 11 May 2004 22:27:41 GMT
From: Don Stefani <dev_mail@donstefani.com>
Subject: Re: RegExp in one statement
Message-Id: <xrcoc.47447$QS7.15801@newssvr29.news.prodigy.com>
Kevin Collins wrote:
> In article <30coc.47437$DF7.39076@newssvr29.news.prodigy.com>, Don Stefani
> wrote:
>
>>How can I do this in one statement?
>>
>>my $ml_name = $q->param('ml_name');
>>$ml_name =~ s/^(\s*)//;
>>
>
> (my $ml_name = $q->param('ml_name')) =~ s/^\s+//;
>
> The parens are not needed since you are doing nothing with the captured match.
> Additionally, you only care about removing space chars if there are some, and
> since * means "zero or more" it is better to use +, which means "one or more"
> because changing nothing to nothing is meaningless...
>
> Kevin
Thanks for the info.
Others seemed to think that this was ugly and hard to read, it works for me.
Thanks to all for you quick replys.
- dstefani
------------------------------
Date: Tue, 11 May 2004 22:43:56 GMT
From: spamtotrash@toomuchfiction.com (Kevin Collins)
Subject: Re: RegExp in one statement
Message-Id: <slrnca2lpc.nef.spamtotrash@doom.unix-guy.com>
In article <c7ring$lif$1@wisteria.csv.warwick.ac.uk>, Ben Morrow wrote:
>
> Quoth dev_mail@donstefani.com:
>> How can I do this in one statement?
>
> Why do you need to?
>
>> my $ml_name = $q->param('ml_name');
>> $ml_name =~ s/^(\s*)//;
>
> (my $ml_name = $q->param('ml_name')) =~ s/^\s*//;
>
> No need for the parens: you don't use $1.
> Are you sure you don't want a /g on there? This will only remove the
> first piece of whitespace.
How many times can you match spaces starting at the beginning of a pattern?
Notice the "^"?
Kevin
------------------------------
Date: 11 May 2004 23:00:58 GMT
From: Abigail <abigail@abigail.nl>
Subject: Re: RegExp in one statement
Message-Id: <slrnca2mpa.4ga.abigail@alexandra.abigail.nl>
Don Stefani (dev_mail@donstefani.com) wrote on MMMCMVI September MCMXCIII
in <URL:news:30coc.47437$DF7.39076@newssvr29.news.prodigy.com>:
-- How can I do this in one statement?
--
-- my $ml_name = $q->param('ml_name');
-- $ml_name =~ s/^(\s*)//;
my ($ml_name) = $q -> ('ml_name') =~ /^\s*(.*)/s;
Abigail
--
print v74.117.115.116.32, v97.110.111.116.104.101.114.32,
v80.101.114.108.32, v72.97.99.107.101.114.10;
------------------------------
Date: Tue, 11 May 2004 23:02:08 -0000
From: "gnari" <gnari@simnet.is>
Subject: Re: RegExp in one statement
Message-Id: <c7rlue$7hu$1@news.simnet.is>
"Don Stefani" <dev_mail@donstefani.com> wrote in message
news:xrcoc.47447$QS7.15801@newssvr29.news.prodigy.com...
> Kevin Collins wrote:
> > In article <30coc.47437$DF7.39076@newssvr29.news.prodigy.com>, Don
Stefani
> > wrote:
> >
> >>How can I do this in one statement?
> >>
> >>my $ml_name = $q->param('ml_name');
> >>$ml_name =~ s/^(\s*)//;
> >>
> >
> > (my $ml_name = $q->param('ml_name')) =~ s/^\s+//;
> >
> Others seemed to think that this was ugly and hard to read, it works for
me.
what do they know? :-)
this is a common perl idiom, and as such easily recognizable,
but should only be used if you are comfortable with it, because
you might have to take a look at it in 6 months time. ask
yourself: will i understand it then ? in that case, fine.
gnari
------------------------------
Date: Wed, 12 May 2004 10:27:20 +1000
From: Gregory Toomey <nospam@bigpond.com>
Subject: Re: RegExp in one statement
Message-Id: <2003779.KvJH33LaZp@GMT-hosting-and-pickle-farming>
Abigail wrote:
> Abigail
>print v74.117.115.116.32, v97.110.111.116.104.101.114.32,
> v80.101.114.108.32, v72.97.99.107.101.114.10;
One of your better ones!
gtoomey
------------------------------
Date: Tue, 11 May 2004 18:53:43 -0500
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: Using match variables ($1, $2 ...) as variables.
Message-Id: <slrnca2ps7.4ls.tadmc@magna.augustmail.com>
Ravi Parimi <parimi@none.nowhere.com> wrote:
> I should've posted my complete code rather than typing
> snippets here and there..
Have you seen the Posting Guidelines that are posted here frequently?
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Tue, 11 May 2004 18:55:44 -0500
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: Using match variables ($1, $2 ...) as variables.
Message-Id: <slrnca2q00.4ls.tadmc@magna.augustmail.com>
Ravi Parimi <parimi@none.nowhere.com> wrote:
[ snip 50-line full-quote with no attribution.
Please learn how to properly compose a followup.
Please do this soon.
]
> This was what I was exactly looking for. It looks a lot more less
^^^^ ^^^^
^^^^ ^^^^
> complicated than what the other posters suggested.
Huh?
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Tue, 11 May 2004 17:36:28 -0700
From: Ravi Parimi <parimi@none.nowhere.com>
Subject: Re: Using match variables ($1, $2 ...) as variables.
Message-Id: <Pine.GSO.4.58.0405111735150.25603@shelltoe.ece.arizona.edu>
> Ravi Parimi <parimi@none.nowhere.com> wrote:
>
>
> [ snip 50-line full-quote with no attribution.
> Please learn how to properly compose a followup.
> Please do this soon.
> ]
Sorry about that.
>
> > This was what I was exactly looking for. It looks a lot more less
> ^^^^ ^^^^
> ^^^^ ^^^^
> > complicated than what the other posters suggested.
>
> Huh?
I wanted to write "a lot less complicated".
--ravi
------------------------------
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 6555
***************************************