Perl 5.8 and MD5

Perl 5.8 and MD5

am 11.10.2007 19:13:00 von joe

I have been having trouble running some of my Perl scripts that use
Perl 5.6 using a Win 2000 server on 5.8a Win 2003 Server. It took
quite awhile, but I am 99.999999% sure I figured out it is the MD5 b> module.

Every time I remark it out, my scrfipt works. But, the script was
written to use MD5. I use the following line to call it:

use Digest::MD5 qw(md5_hex);

Is there any advice you can give, like, how to see what modules are
installed, to be sure it is?

Any help would be appreciated.

Re: Perl 5.8 and MD5

am 11.10.2007 19:22:11 von Paul Lalli

On Oct 11, 1:13 pm, Joe wrote:
> I have been having trouble running some of my Perl scripts that use
> Perl 5.6 using a Win 2000 server on 5.8a Win 2003 Server. It took
> quite awhile, but I am 99.999999% sure I figured out it is the MD5 > b> module.
>
> Every time I remark it out, my scrfipt works. But, the script was
> written to use MD5. I use the following line to call it:
>
> use Digest::MD5 qw(md5_hex);

This is a text only newsgroup. Why are you posting this fragment in
HTML?

> Is there any advice you can give, like, how to see what modules are
> installed, to be sure it is?

$ perldoc -q installed
Found in /opt2/Perl5_8_4/lib/perl5/5.8.4/pod/perlfaq3.pod
How do I find which modules are installed on my system?


Paul Lalli

Re: Perl 5.8 and MD5

am 11.10.2007 19:22:37 von unknown

Post removed (X-No-Archive: yes)

Re: Perl 5.8 and MD5

am 11.10.2007 19:33:51 von joe

> eval "use Digest::MD5 qw(md5_hex)";
> if ($@) {
> # ouch - better do something else...
> }
>
> --
> Elvis Notargiacomo master AT barefaced DOT cheekhttp://www.notatla.org.uk/goen/

Sorry, about html code, wasn't sure if it would work, now I know it
doesn't.

Anyway, using eval, gave me an error of:

Content-type: text/html

'C:\Inetpub\wwwroot\cgi-bin\TestMD5.pl' script produced no output

I also did print "# ouch - better do something else... " in the if.

Does that mean the module is bad?

Re: Perl 5.8 and MD5

am 11.10.2007 19:59:49 von nobull67

On Oct 11, 6:33 pm, Joe wrote:
> > eval "use Digest::MD5 qw(md5_hex)";
> > if ($@) {
> > # ouch - better do something else...
> > }
>
> > --
> > Elvis Notargiacomo master AT barefaced DOT cheekhttp://www.notatla.org.uk/goen/
>
> Sorry, about html code, wasn't sure if it would work, now I know it
> doesn't.
>
> Anyway, using eval, gave me an error of:
>
> Content-type: text/html
>
> 'C:\Inetpub\wwwroot\cgi-bin\TestMD5.pl' script produced no output
>
> I also did print "# ouch - better do something else... " in the if.
>
> Does that mean the module is bad?

No, it looks like you are bad.

You are bad for not telling us what you are really doing.

That error looks like something a web server program might say. I'd
guess it might be Microsoft IIS.

There was no web server mentioned in your original question.

Going back to your original question when you "have been having
trouble running" some of your Perl scripts could you say how that
trouble was manifest? In particular what errors were printed, logged
or whatever.

BTW: do you have any reason to believe Digest::MD5 is installed?

Re: Perl 5.8 and MD5

am 11.10.2007 20:05:18 von glex_no-spam

Joe wrote:
>> eval "use Digest::MD5 qw(md5_hex)";
>> if ($@) {
>> # ouch - better do something else...
>> }
>>
>> --

>
> Sorry, about html code, wasn't sure if it would work, now I know it
> doesn't.
>
> Anyway, using eval, gave me an error of:
>
> Content-type: text/html

What? The example code you provided doesn't have anything
that would produce that line. If that line is displayed
in your browser, your Web server isn't configured correctly.

>
> 'C:\Inetpub\wwwroot\cgi-bin\TestMD5.pl' script produced no output
>
> I also did print "# ouch - better do something else... " in the if.
>
> Does that mean the module is bad?

No, otherwise you might have seen "# ouch - better do something else".

Why not read the documentation to see what eval actually does, instead
of blindly typing it in?

perldoc -f eval

Looks like your server isn't set up to run CGI correctly or something
is wrong with your script. Either post a short and complete example,
or work with your Web server's administrator to set it up correctly.

Re: Perl 5.8 and MD5

am 11.10.2007 23:48:20 von joe

This the the smallest, I have:

01. #!/usr/bin/perl
02.
03. #Libarry file that will read the form data and store in
formdata{'value'} form
04. require '../lib/forminput.lib';
05.
06. &FormInput;
07.
08. print "HTTP/1.0 200 OK\n" if ($ENV{PERLXS} eq "PerlIS");
09. print "Content-Type: text/html\n\n";
10.
11. use Digest::MD5 qw(md5_hex);
12.
13. print qq(MD5 Encryption);
14.
15. if ($formdata{'flag'} eq "1") {
16. print qq(
17. Encryption
18.

19.

20. $formdata{'toEncrypt'} = );
21.
22. print md5_hex($formdata{'toEncrypt'})
23.
24. }
25. else {
26.
27. print qq(
28.


29. Text to Encrypt:
30.

31.

32.
33.

34. );
35. }
36. print qq();

It runs fine on a Server (Win 2000) with Perl 5.6 installed. It will
not run with a server (Win 2003) and Perl 5.8 installed.

The error message I get is:
Content-type: text/html

'C:\Inetpub\wwwroot\cgi-bin\md5\md5.cgi' script produced no output.

It uses the MD5 module to encrypt a string, (password) in hex. Also,
I read the docs I was able to find on eval, and it says it runs what
is has, like a small program. So,, if it does not work, then
something is wrong with the Module?

Re: Perl 5.8 and MD5

am 12.10.2007 01:49:40 von Jim Gibson

In article <1192139300.936964.261360@22g2000hsm.googlegroups.com>, Joe
wrote:

> This the the smallest, I have:
>
> 01. #!/usr/bin/perl

Please do not post code with line numbers. It makes it harder to
cut-and-paste from your posting.

You should have 'use strict;' here.
You also may want 'use CGI::Carp qw(fatalsToBrowser);'.

> 02.
> 03. #Libarry file that will read the form data and store in
> formdata{'value'} form
> 04. require '../lib/forminput.lib';

What is forminput.lib? Is it a Perl package for processing CGI
requests? You have still not indicated how your script is being
executed. It is apparently being run as a CGI program by a web server,
but it helps to say so explicitly.

> 05.
> 06. &FormInput;
> 07.
> 08. print "HTTP/1.0 200 OK\n" if ($ENV{PERLXS} eq "PerlIS");

What is PERLXS on your new server?

> 09. print "Content-Type: text/html\n\n";
> 10.
> 11. use Digest::MD5 qw(md5_hex);

It is better to have all of you use statements near the beginning of
the program (they all get executed at the beginning, anyway, regardless
of where they are located in the program).

> 12.
> 13. print qq(MD5 Encryption);
> 14.
> 15. if ($formdata{'flag'} eq "1") {
> 16. print qq(
> 17. Encryption
> 18.

> 19.

> 20. $formdata{'toEncrypt'} = );
> 21.
> 22. print md5_hex($formdata{'toEncrypt'})
> 23.
> 24. }
> 25. else {
> 26.
> 27. print qq(
> 28.


> 29. Text to Encrypt:
> 30.

> 31.

> 32.
> 33.

> 34. );
> 35. }
> 36. print qq();
>
> It runs fine on a Server (Win 2000) with Perl 5.6 installed. It will
> not run with a server (Win 2003) and Perl 5.8 installed.

Does it execute from the command line?

>
> The error message I get is:
> Content-type: text/html
>
> 'C:\Inetpub\wwwroot\cgi-bin\md5\md5.cgi' script produced no output.
>
> It uses the MD5 module to encrypt a string, (password) in hex. Also,
> I read the docs I was able to find on eval, and it says it runs what
> is has, like a small program. So,, if it does not work, then
> something is wrong with the Module?

If this is really a CGI program, see the troubleshooting tips at


I would refer you also to 'perldoc -q 500', but the first link on that
page seems not to be working. Try the second one.

--
Jim Gibson

Posted Via Usenet.com Premium Usenet Newsgroup Services
----------------------------------------------------------
** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
----------------------------------------------------------
http://www.usenet.com

Re: Perl 5.8 and MD5

am 15.10.2007 22:47:00 von joe

Here is the revided script using strict with no line numbers

#!/usr/bin/perl

use Digest::MD5 qw(md5_hex);
use CGI::Carp qw(warningsToBrowser fatalsToBrowser); # Module for
sending error message to browser.
use CGI qw(:standard :html3); # Module for using HTML Code
use strict;

#Libarry file that will read the form data and store in
formdata{'value'} form
require '../lib/forminput.lib';

&FormInput;

my %formdata;

print "HTTP/1.0 200 OK\n" if ($ENV{PERLXS} eq "PerlIS");
print "Content-Type: text/html\n\n";

print qq(MD5 Encryption);

if ($formdata{'flag'} eq "1") {
print qq(
Encryption




$formdata{'toEncrypt'} = );

print md5_hex($formdata{'toEncrypt'})

}
else {

print qq(


Text to Encrypt:







);

}

print qq();

Also, this program was written by someone else, I normally use
strict. The &FormInput input is from that person writing, it never
seemed to bother the programs I would modify, so I left 'em in.
Formdata is like using param(). And, YES, I did take it out, wioth
the library line, and it made no difference at all.

Even with the additions I still get the "script produced no output".

The program is run but going here: http://gailbapps/cgi-bin/md5/md5.cgi

Gailbapps is our Win 2003 Sever that has Perl 5.8 installed on it. I
am reading thru that link that was sent to me now.

Re: Perl 5.8 and MD5

am 15.10.2007 22:55:30 von joe

I ran it from the cmd line, with the use diagnostics; line for that
page, and in the Perl log, I get:

PerlParse did not exit clean! I tried looking that up through google,
and it lead me to MD5 last week.

Re: Perl 5.8 and MD5

am 15.10.2007 23:29:58 von paduille.4061.mumia.w+nospam

On 10/15/2007 03:47 PM, Joe wrote:
> Here is the revided script using strict with no line numbers
>
> #!/usr/bin/perl
>
> use Digest::MD5 qw(md5_hex);
> use CGI::Carp qw(warningsToBrowser fatalsToBrowser); # Module for
> sending error message to browser.
> use CGI qw(:standard :html3); # Module for using HTML Code
> use strict;
>
> #Libarry file that will read the form data and store in
> formdata{'value'} form
> require '../lib/forminput.lib';
>
> &FormInput;
>
> my %formdata;
> [...]

This line creates a new lexical variable named formdata that hides the
old variable formdata that had been created by forminput.lib. Do this
instead:

our %formdata;

It's good you posted a somewhat complete program to test. In the process
of trying to get your program to work, I discovered this.

For more good ideas for getting good help out of this newsgroup, read
the posting guidelines:

http://www.augustmail.com/~tadmc/clpmisc/clpmisc_guidelines. html

BTW, it's spelled "library."

Re: Perl 5.8 and MD5

am 15.10.2007 23:36:19 von glex_no-spam

Joe wrote:
> I ran it from the cmd line, with the use diagnostics; line for that
> page, and in the Perl log, I get:
>
> PerlParse did not exit clean! I tried looking that up through google,
> and it lead me to MD5 last week.
>

Look through your forminput.lib.

Re: Perl 5.8 and MD5

am 15.10.2007 23:44:25 von glex_no-spam

Joe wrote:
> Here is the revided script using strict with no line numbers
>
> #!/usr/bin/perl
>
> use Digest::MD5 qw(md5_hex);
> use CGI::Carp qw(warningsToBrowser fatalsToBrowser); # Module for
> sending error message to browser.
> use CGI qw(:standard :html3);

Why aren't you using the methods available to you?

perldoc CGI

>
> Also, this program was written by someone else, I normally use
> strict.

Then maybe 'someone else' should help you.


>The &FormInput input is from that person writing, it never
> seemed to bother the programs I would modify, so I left 'em in.
> Formdata is like using param(). And, YES, I did take it out, wioth
> the library line, and it made no difference at all.
>
> Even with the additions I still get the "script produced no output".

Then start with a basic script.. e.g.

% cat mytest.cgi.
#!/usr/bin/perl
use CGI qw( :standard );
print header, start_html( 'testing' ), p('does this work?'), end_html;


If that works, then add a line or two at a time. If it doesn't
then you need to figure out how to configure your Web server
correctly.

Re: Perl 5.8 and MD5

am 15.10.2007 23:56:55 von glex_no-spam

Joe wrote:
> I ran it from the cmd line, with the use diagnostics; line for that
> page, and in the Perl log, I get:
>
> PerlParse did not exit clean! I tried looking that up through google,
> and it lead me to MD5 last week.
>

Maybe this might help:

http://bugs.activestate.com/show_bug.cgi?id=40576

Re: Perl 5.8 and MD5

am 16.10.2007 00:27:28 von joe

I don't want to make excuses, but, the 'someone else' who wrote some
of the scripts that do not work died in a motorcycle accident about a
year back who was never big on documentation, a cardianl sin I know.
Also, Perl was installed by our Network Administrator with that
persons help. When I ask the Network Admin about it, I get a 'I Don't
Know' I get the run around about reinstalling, but he says NO.

I just need some, possible, hints on how to do this that may work. I
have no idea how to configure a web server, but, this is where my
understanding lacks alot. I am a Help Desk/Programmer who just writes
what I am told too..everything has been in place from the get go for
me.

If anyone knows a way for me to explain how to reconfigure Perl to
work with MD5, I'm all eyes and ears. I am told not to touch Servers,
it is not my job. I just write and maintain programs on them.

Re: Perl 5.8 and MD5

am 16.10.2007 00:57:44 von Ron Bergin

On Oct 15, 1:47 pm, Joe wrote:
> Here is the revided script using strict with no line numbers
>
> #!/usr/bin/perl
>
> use Digest::MD5 qw(md5_hex);
> use CGI::Carp qw(warningsToBrowser fatalsToBrowser); # Module for
> sending error message to browser.
> use CGI qw(:standard :html3); # Module for using HTML Code
Why do you load the CGI module, but never use it?

> use strict;
>
> #Libarry file that will read the form data and store in
> formdata{'value'} form
> require '../lib/forminput.lib';
>
> &FormInput;
>
> my %formdata;

Get rid of that library, I'm sure it's using outdated and poorly
written code, and instead use the methods provided by the CGI module.

#!/usr/bin/perl

use strict;
use CGI;
use Digest::MD5 qw(md5_hex);
use CGI::Carp qw(warningsToBrowser fatalsToBrowser); # used while
debugging

my $cgi = CGI->new;
my %formdata = $cgi->Vars;

>
> print "HTTP/1.0 200 OK\n" if ($ENV{PERLXS} eq "PerlIS");
> print "Content-Type: text/html\n\n";
>
> print qq(MD5 Encryption);

I say again, use the CGI module.

print $cgi->header, $cgi->start_html('MD5 Encryption');
warningsToBrowser(1);
>
> if ($formdata{'flag'} eq "1") {
> print qq(
> Encryption
>

>

> $formdata{'toEncrypt'} = );
>
> print md5_hex($formdata{'toEncrypt'})
>
> }
>
> else {
>
> print qq(
>


> Text to Encrypt:
>

>

>
>
>

> );
>
> }
>
> print qq();

Instead of me rewriting your script for you, you should read the
documentation for the CGI module.
http://search.cpan.org/~lds/CGI.pm-3.29/CGI.pm

Re: Perl 5.8 and MD5

am 16.10.2007 01:13:29 von Ron Bergin

On Oct 15, 3:27 pm, Joe wrote:
>
> If anyone knows a way for me to explain how to reconfigure Perl to
> work with MD5, I'm all eyes and ears. I am told not to touch Servers,
> it is not my job. I just write and maintain programs on them.

Paul already provided the info ( which was perldoc -q installed ) that
points to the documentation on how find out what modules are
installed, buts here's an example on how to test if the Digest::MD5
module is installed.

Executed from the command line:

perl -MDigest::MD5 -e 1

If you don't receive any output, then that means that the module is
installed.

If you receive an error message telling you that it can't find the
module, then either it's not installed, or it may have been
incorrectly installed.

Re: Perl 5.8 and MD5

am 16.10.2007 01:26:07 von Ron Bergin

On Oct 15, 3:57 pm, Ron Bergin wrote:
> On Oct 15, 1:47 pm, Joe wrote:> Here is the revided script using strict with no line numbers
>
[snip]
>
> use the methods provided by the CGI module.
>
> #!/usr/bin/perl
>
> use strict;
> use CGI;
> use Digest::MD5 qw(md5_hex);
> use CGI::Carp qw(warningsToBrowser fatalsToBrowser); # used while
> debugging
>
I noticed that I forgot 1 module.

use warnings;

Re: Perl 5.8 and MD5

am 16.10.2007 01:51:38 von unknown

Post removed (X-No-Archive: yes)

Re: Perl 5.8 and MD5

am 16.10.2007 05:35:05 von Ron Bergin

On Oct 15, 3:27 pm, Joe wrote:
> If anyone knows a way for me to explain how to reconfigure Perl to
> work with MD5, I'm all eyes and ears. I am told not to touch Servers,
> it is not my job. I just write and maintain programs on them.

Paul already provided info that points to the documentation on how
find out what modules are installed, buts here's an example on how to
test if the Digest::MD5 module is installed.

Executed from the command line:

perl -MDigest::MD5 -e 1

If you don't receive any output, then that means that the module is
installed.

If you receive an error message telling you that it can't find the
module, then either it's not installed, or it may have been
incorrectly installed.