[25908] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 8135 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue May 31 14:05:29 2005

Date: Tue, 31 May 2005 11:05:07 -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, 31 May 2005     Volume: 10 Number: 8135

Today's topics:
    Re: getting $date <graham@cs.man.ac.uk>
    Re: http auth logindialog box <hackeras@gmail.com>
    Re: http auth logindialog box <no@email.com>
    Re: http auth logindialog box <tadmc@augustmail.com>
    Re: Mail::IMAPClient via SSL <ggershSNACK@CAKEctc.net>
    Re: Mail::IMAPClient via SSL <josef.moellers@fujitsu-siemens.com>
    Re: Mail::IMAPClient via SSL <tadmc@augustmail.com>
    Re: Mail::IMAPClient via SSL <ggershSNACK@CAKEctc.net>
    Re: Mail::IMAPClient via SSL <ggershSNACK@CAKEctc.net>
    Re: Mail::IMAPClient via SSL <tadmc@augustmail.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: 31 May 2005 14:35:27 +0100
From: Graham Gough <graham@cs.man.ac.uk>
Subject: Re: getting $date
Message-Id: <ttlpsv7y0v4.fsf@rpc204.cs.man.ac.uk>

>>>>> "ASU" == A Sinan Unur <1usa@llenroc.ude.invalid> writes:

    ASU> use warnings;

    ASU> my ($mday, $mon, $year) = (localtime)[3 .. 5];

    ASU> printf "%2.2d/%2.2d/%4.4d\n", $mday, $mon + 1, $year + 1900;

Nothing wrong with your solution, but the one I proposed used only
information which could be gleaned from the perldoc entry for
localtime.

TMTOWTDI

Graham




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

Date: Tue, 31 May 2005 18:00:10 +0300
From: Nikos <hackeras@gmail.com>
Subject: Re: http auth logindialog box
Message-Id: <d7hu5o$22q$1@nic.grnet.gr>

Brian Wakem wrote:

> You are clearly very confused and your problem is nothing to do with Perl.
> 
> I suggest you go to google and look up htaccess and htpasswd.  Also read
> http://httpd.apache.org/docs-2.0/howto/htaccess.html, but do not ask
> question about it here - it is OT.

ok i have read and made the .htaccess and .passwd files fro http 
authentication purpsoses

What happens when the user enter the correct data and what happens if he 
doesnt?

Now i think Perl has to take control.

if credentials are  correct then games.pl would run else an error page.

How i can do this with perl?


-- 
What is now proved was once only imagined!


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

Date: Tue, 31 May 2005 16:33:47 +0100
From: Brian Wakem <no@email.com>
Subject: Re: http auth logindialog box
Message-Id: <3g3eerFaean3U1@individual.net>

Nikos wrote:
> Brian Wakem wrote:
> 
>> You are clearly very confused and your problem is nothing to do with 
>> Perl.
>>
>> I suggest you go to google and look up htaccess and htpasswd.  Also read
>> http://httpd.apache.org/docs-2.0/howto/htaccess.html, but do not ask
>> question about it here - it is OT.
> 
> 
> ok i have read and made the .htaccess and .passwd files fro http 
> authentication purpsoses
> 
> What happens when the user enter the correct data and what happens if he 
> doesnt?
> 
> Now i think Perl has to take control.


No.  The webserver has control here.


> if credentials are  correct then games.pl would run else an error page.


The webserver does this for you if you have configured it correctly (I 
have pointed you towards the docs).



-- 
Brian Wakem




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

Date: Tue, 31 May 2005 10:55:02 -0500
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: http auth logindialog box
Message-Id: <slrnd9p26m.mgb.tadmc@magna.augustmail.com>

Nikos <hackeras@gmail.com> wrote:
> Brian Wakem wrote:
> 
>> You are clearly very confused and your problem is nothing to do with Perl.
>> 
>> I suggest you go to google and look up htaccess and htpasswd.  Also read
>> http://httpd.apache.org/docs-2.0/howto/htaccess.html, but do not ask
>> question about it here - it is OT.
> 
> ok i have read and made the .htaccess and .passwd files fro http 
> authentication purpsoses
> 
> What happens when the user enter the correct data and what happens if he 
> doesnt?


The same thing that would happen if your program was written
in Java or Python or Visual Basic.

You've been asked to not ask questions about web server configuration here.

Why are you asking questions about web server configuration here then?

Do you *intend* to piss everybody off, or do you claim it is accidental?


> Now i think Perl has to take control.


Then you are still very confused.

Perl does not "take" control. It is not in charge of servicing the request.

The web server is in charge of controlling the request, it *calls*
your Perl program if authentication has succeeded.


> if credentials are  correct then games.pl would run else an error page.


So which one happened when you tried it then?

Did games.pl run?  (if so, then why is it that you are here again?)

Did you get an error page? (if so, then ask about what the message says in
                            some newsgroup that is related to WWW stuff)


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


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

Date: Tue, 31 May 2005 09:34:43 -0400
From: Greg G <ggershSNACK@CAKEctc.net>
Subject: Re: Mail::IMAPClient via SSL
Message-Id: <_s2dnX8inugH-gHfRVn-jA@ctc.net>

Greg G wrote:
> 
> I'm trying to get Mail::IMAPClient to work via SSL.  I'm running into a 
> problem.  Here's the output:
> 
> # ./imap_test.pl
> SSL OK? 1
> SSL says: * OK mailtest Sendmail Server IMAP4rev1 
> (2.1.5/smserver-2-1-5-build-1174)
> 
> Using Mail::IMAPClient version 2.2.9 and perl version 5.8.6 (5.008006)
>  '0' '' |1|
> Set State : 1
> Sending literal string in two parts: 1 Login "ggtest103z@mydomain.net" {6}
> 
>     then: abcdef
> 
> Sending: 1 Login "XXXXXX" {6}
> 
> Sent 38 bytes
> Can't call method "can_read" on an undefined value at 
> /usr/local/lib/perl5/site_perl/5.8.6/Mail/IMAPClient.pm line 1583.
> #
> #
>     then: abcdef
> 
> Sending: 1 Login "XXXXXX" {6}
> 
> Sent 38 bytes
> Can't call method "can_read" on an undefined value at 
> /usr/local/lib/perl5/site_perl/5.8.6/Mail/IMAPClient.pm line 1583.
> #
> ---------------------------
> Here's the code:
> 
> -------------------------
> #!/usr/local/bin/perl -w
> 
> use IO::Socket::SSL;
> use Mail::IMAPClient;
> 
> 
> my $ssl = IO::Socket::SSL->new (Proto=>'tcp',
>                 #SSL_verify_mod=>0x00,
>                 PeerAddr=>"mailtest.mydomain.net",
>                 PeerPort=>993);
> 
> print "SSL OK? " . (defined $ssl) . "\n";
> 
> print "SSL says: " . <$ssl> . "\n";
> 
> $imap = Mail::IMAPClient->new(Server => "mailtest.mydomain.net",
>                   Socket => $ssl,
>                   Timeout=>5,
>                   User => "ggtest103z\@mydomain.net",
>                   Password => "abcdef",
>                   Debug => 1,
>                   );
> 
> 
> print STDERR " \'$@\' \'$!\' |" . (defined $imap) . "|\n";
> 
> $imap->State ($imap->Connected);
> print "Set State : " . $imap->State . "\n";
> $imap->login();
> print "Logged in $!\n";
> 
> exit 0;
> 
> --------------------
> 
> Any idea what's happening here?  I've tested the mail server and it 
> works fine via SSL.
> 
> Thanks.
> 
> -Greg G

Anybody?  I still can't get this to work...

-Greg G


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

Date: Tue, 31 May 2005 16:14:08 +0200
From: Josef Moellers <josef.moellers@fujitsu-siemens.com>
Subject: Re: Mail::IMAPClient via SSL
Message-Id: <d7hr7a$218$1@nntp.fujitsu-siemens.com>

Greg G wrote:
> Greg G wrote:
>=20
>>
>> I'm trying to get Mail::IMAPClient to work via SSL.  I'm running into =

>> a problem.  Here's the output:
>>
>> # ./imap_test.pl
>> SSL OK? 1
>> SSL says: * OK mailtest Sendmail Server IMAP4rev1=20
>> (2.1.5/smserver-2-1-5-build-1174)
>>
>> Using Mail::IMAPClient version 2.2.9 and perl version 5.8.6 (5.008006)=

>>  '0' '' |1|
>> Set State : 1
>> Sending literal string in two parts: 1 Login "ggtest103z@mydomain.net"=
=20
>> {6}
>>
>>     then: abcdef
>>
>> Sending: 1 Login "XXXXXX" {6}
>>
>> Sent 38 bytes
>> Can't call method "can_read" on an undefined value at=20
>> /usr/local/lib/perl5/site_perl/5.8.6/Mail/IMAPClient.pm line 1583.
>> #
>> #
>>     then: abcdef
>>
>> Sending: 1 Login "XXXXXX" {6}
>>
>> Sent 38 bytes
>> Can't call method "can_read" on an undefined value at=20
>> /usr/local/lib/perl5/site_perl/5.8.6/Mail/IMAPClient.pm line 1583.
>> #
>> ---------------------------
>> Here's the code:
>>
>> -------------------------
>> #!/usr/local/bin/perl -w
>>
>> use IO::Socket::SSL;
>> use Mail::IMAPClient;
>>
>>
>> my $ssl =3D IO::Socket::SSL->new (Proto=3D>'tcp',
>>                 #SSL_verify_mod=3D>0x00,
>>                 PeerAddr=3D>"mailtest.mydomain.net",
>>                 PeerPort=3D>993);
>>
>> print "SSL OK? " . (defined $ssl) . "\n";
>>
>> print "SSL says: " . <$ssl> . "\n";
>>
>> $imap =3D Mail::IMAPClient->new(Server =3D> "mailtest.mydomain.net",
>>                   Socket =3D> $ssl,
>>                   Timeout=3D>5,
>>                   User =3D> "ggtest103z\@mydomain.net",
>>                   Password =3D> "abcdef",
>>                   Debug =3D> 1,
>>                   );
>>
>>
>> print STDERR " \'$@\' \'$!\' |" . (defined $imap) . "|\n";
>>
>> $imap->State ($imap->Connected);
>> print "Set State : " . $imap->State . "\n";
>> $imap->login();
>> print "Logged in $!\n";
>>
>> exit 0;
>>
>> --------------------
>>
>> Any idea what's happening here?  I've tested the mail server and it=20
>> works fine via SSL.
>>
>> Thanks.
>>
>> -Greg G
>=20
>=20
> Anybody?  I still can't get this to work...

I'm sorry if this isn't really the answer, I know too little of the=20
underlying protocol to analyze your problem in-depth, but I had problems =

with imaps myself and have discovered what I consider a bug in=20
/usr/lib/perl5/site_perl/5.8.1/Mail/IMAPClient.pm:

In sub login, I had to replace the "my $string =3D ..." with the followin=
g

         my $string =3D    "Login " . ( $has_quotes ? $id : qq("$id") )
                 . " " .
                 "{" . length($self->Password) .
                         "}\r\n" . $self->Password . "\r\n";

Maybe this helps (sure hope it does),

Josef
--=20
Josef M=F6llers (Pinguinpfleger bei FSC)
	If failure had no penalty success would not be a prize
						-- T.  Pratchett



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

Date: Tue, 31 May 2005 09:05:02 -0500
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: Mail::IMAPClient via SSL
Message-Id: <slrnd9oroe.m9r.tadmc@magna.augustmail.com>

Greg G <ggershSNACK@CAKEctc.net> wrote:
> Greg G wrote:


>> print STDERR " \'$@\' \'$!\' |" . (defined $imap) . "|\n";
                  ^   ^  ^   ^

Single quotes are not meta in a double quoted string, there is
no need to backslash them.

Outputting the return value from defined() is a strange thing
to do. What do you expect to be printed when it returns a
true value? What do you expect to be printed when it returns a
false value?


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


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

Date: Tue, 31 May 2005 11:30:36 -0400
From: Greg G <ggershSNACK@CAKEctc.net>
Subject: Re: Mail::IMAPClient via SSL
Message-Id: <QbWdnYKyHLteHwHfRVn-vQ@ctc.net>

Josef Moellers wrote:
> Greg G wrote:
> 
>> Greg G wrote:
>>
>>>
>>> I'm trying to get Mail::IMAPClient to work via SSL.  I'm running into 
>>> a problem.  Here's the output:
>>>
>>> # ./imap_test.pl
>>> SSL OK? 1
>>> SSL says: * OK mailtest Sendmail Server IMAP4rev1 
>>> (2.1.5/smserver-2-1-5-build-1174)
>>>
>>> Using Mail::IMAPClient version 2.2.9 and perl version 5.8.6 (5.008006)
>>>  '0' '' |1|
>>> Set State : 1
>>> Sending literal string in two parts: 1 Login 
>>> "ggtest103z@mydomain.net" {6}
>>>
>>>     then: abcdef
>>>
>>> Sending: 1 Login "XXXXXX" {6}
>>>
>>> Sent 38 bytes
>>> Can't call method "can_read" on an undefined value at 
>>> /usr/local/lib/perl5/site_perl/5.8.6/Mail/IMAPClient.pm line 1583.
>>> #
>>> #
>>>     then: abcdef
>>>
>>> Sending: 1 Login "XXXXXX" {6}
>>>
>>> Sent 38 bytes
>>> Can't call method "can_read" on an undefined value at 
>>> /usr/local/lib/perl5/site_perl/5.8.6/Mail/IMAPClient.pm line 1583.
>>> #
>>> ---------------------------
>>> Here's the code:
>>>
>>> -------------------------
>>> #!/usr/local/bin/perl -w
>>>
>>> use IO::Socket::SSL;
>>> use Mail::IMAPClient;
>>>
>>>
>>> my $ssl = IO::Socket::SSL->new (Proto=>'tcp',
>>>                 #SSL_verify_mod=>0x00,
>>>                 PeerAddr=>"mailtest.mydomain.net",
>>>                 PeerPort=>993);
>>>
>>> print "SSL OK? " . (defined $ssl) . "\n";
>>>
>>> print "SSL says: " . <$ssl> . "\n";
>>>
>>> $imap = Mail::IMAPClient->new(Server => "mailtest.mydomain.net",
>>>                   Socket => $ssl,
>>>                   Timeout=>5,
>>>                   User => "ggtest103z\@mydomain.net",
>>>                   Password => "abcdef",
>>>                   Debug => 1,
>>>                   );
>>>
>>>
>>> print STDERR " \'$@\' \'$!\' |" . (defined $imap) . "|\n";
>>>
>>> $imap->State ($imap->Connected);
>>> print "Set State : " . $imap->State . "\n";
>>> $imap->login();
>>> print "Logged in $!\n";
>>>
>>> exit 0;
>>>
>>> --------------------
>>>
>>> Any idea what's happening here?  I've tested the mail server and it 
>>> works fine via SSL.
>>>
>>> Thanks.
>>>
>>> -Greg G
>>
>>
>>
>> Anybody?  I still can't get this to work...
> 
> 
> I'm sorry if this isn't really the answer, I know too little of the 
> underlying protocol to analyze your problem in-depth, but I had problems 
> with imaps myself and have discovered what I consider a bug in 
> /usr/lib/perl5/site_perl/5.8.1/Mail/IMAPClient.pm:
> 
> In sub login, I had to replace the "my $string = ..." with the following
> 
>         my $string =    "Login " . ( $has_quotes ? $id : qq("$id") )
>                 . " " .
>                 "{" . length($self->Password) .
>                         "}\r\n" . $self->Password . "\r\n";
> 
> Maybe this helps (sure hope it does),
> 
> Josef

    Unfortunately for me, this is exactly what's in there now.  For 
reference:
# $Id: IMAPClient.pm,v 20001010.20 2003/06/13 18:30:55 dkernen Exp $
$Mail::IMAPClient::VERSION = '2.2.9';

-Greg G


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

Date: Tue, 31 May 2005 12:41:34 -0400
From: Greg G <ggershSNACK@CAKEctc.net>
Subject: Re: Mail::IMAPClient via SSL
Message-Id: <ZNCdnTLwiPD4DgHfRVn-iA@ctc.net>

Tad McClellan wrote:
> Greg G <ggershSNACK@CAKEctc.net> wrote:
> 
>>Greg G wrote:
> 
> 
> 
>>>print STDERR " \'$@\' \'$!\' |" . (defined $imap) . "|\n";
> 
>                   ^   ^  ^   ^
> 
> Single quotes are not meta in a double quoted string, there is
> no need to backslash them.

    My experience is that if I don't escape the single-quotes, my 
variables don't get printed.

> Outputting the return value from defined() is a strange thing
> to do. What do you expect to be printed when it returns a
> true value? What do you expect to be printed when it returns a
> false value?

    I expect to get a "1" if $imap is defined and nothing if it's not. 
Either way, this line has no effect on my code falling down.

-Greg G


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

Date: Tue, 31 May 2005 12:11:24 -0500
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: Mail::IMAPClient via SSL
Message-Id: <slrnd9p6ls.mof.tadmc@magna.augustmail.com>

Greg G <ggershSNACK@CAKEctc.net> wrote:
> Tad McClellan wrote:
>> Greg G <ggershSNACK@CAKEctc.net> wrote:
>>>Greg G wrote:
>> 
>> 
>>>>print STDERR " \'$@\' \'$!\' |" . (defined $imap) . "|\n";
>>                   ^   ^  ^   ^
>> 
>> Single quotes are not meta in a double quoted string, there is
>> no need to backslash them.
> 
>     My experience is that if I don't escape the single-quotes, my 
> variables don't get printed.


You have entered the Twilight Zone then, as that cannot happen
unless there is something else going on that we've not been shown.

If you can reproduce a situation where that occurs, then please
post it here and we can help you understand whatever misunderstanding
it is that you are operating under.


>> Outputting the return value from defined() is a strange thing
>> to do. What do you expect to be printed when it returns a
>> true value? What do you expect to be printed when it returns a
>> false value?
> 
>     I expect to get a "1" if $imap is defined 


You shouldn't expect that, as it can change at any perl revision.

defined() is documented to return only "a true value", not any
particular true value, so it may start returning 100 or 'is defined'
in the future.

Relying on undocumented features is not a good programming practice.


> Either way, this line has no effect on my code falling down.


Right, I did not say that it did.


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


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

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 8135
***************************************


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