Bookmarks

Yahoo Gmail Google Facebook Delicious Twitter Reddit Stumpleupon Myspace Digg

Search queries

nrao wwwxxx, xxxxxdup, procmail change subject header, wwwXxx not20, Wwwxxx.doks sas, linux raid resync after reboot, bind-address mysql multiple, sanibleone xxxx, ftp://192.168.100.100/, www.xxxcon

Links

XODOX
Impressum

#1: Perl 5.8 and MD5

Posted on 2007-10-11 19:13:00 by 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 <b>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:

<b><code>use Digest::MD5 qw(md5_hex);</code></b>

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.

Report this message

#2: Re: Perl 5.8 and MD5

Posted on 2007-10-11 19:22:11 by Paul Lalli

On Oct 11, 1:13 pm, Joe <jruff...@gailborden.info> 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 <b>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:
>
> <b><code>use Digest::MD5 qw(md5_hex);</code></b>

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

Report this message

#3: Re: Perl 5.8 and MD5

Posted on 2007-10-11 19:22:37 by unknown

Post removed (X-No-Archive: yes)

Report this message

#4: Re: Perl 5.8 and MD5

Posted on 2007-10-11 19:33:51 by 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?

Report this message

#5: Re: Perl 5.8 and MD5

Posted on 2007-10-11 19:59:49 by nobull67

On Oct 11, 6:33 pm, Joe <jruff...@gailborden.info> 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?

Report this message

#6: Re: Perl 5.8 and MD5

Posted on 2007-10-11 20:05:18 by 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.

Report this message

#7: Re: Perl 5.8 and MD5

Posted on 2007-10-11 23:48:20 by 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(<html><head><title>MD5 Encryption</title></head><body>);
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. <form action="md5.cgi?flag=1" method="post">
29. Text to Encrypt: <input type="text" name="toEncrypt">
30.

31.

32. <input type="submit" value="Encrypt">
33. </form>
34. );
35. }
36. print qq(</body></html>);

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?

Report this message

#8: Re: Perl 5.8 and MD5

Posted on 2007-10-12 01:49:40 by Jim Gibson

In article <1192139300.936964.261360@22g2000hsm.googlegroups.com>, Joe
<jruffino@gailborden.info> 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(<html><head><title>MD5 Encryption</title></head><body>);
> 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. <form action="md5.cgi?flag=1" method="post">
> 29. Text to Encrypt: <input type="text" name="toEncrypt">
> 30.

> 31.

> 32. <input type="submit" value="Encrypt">
> 33. </form>
> 34. );
> 35. }
> 36. print qq(</body></html>);
>
> 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
<http://www.perlmonks.org/?node_id=380424>

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

Report this message

#9: Re: Perl 5.8 and MD5

Posted on 2007-10-15 22:47:00 by 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(<html><head><title>MD5 Encryption</title></head><body>);

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




$formdata{'toEncrypt'} = );

print md5_hex($formdata{'toEncrypt'})

}
else {

print qq(
<form action="md5.cgi?flag=1" method="post">
Text to Encrypt: <input type="text" name="toEncrypt">




<input type="submit" value="Encrypt">

</form>
);

}

print qq(</body></html>);

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.

Report this message

#10: Re: Perl 5.8 and MD5

Posted on 2007-10-15 22:55:30 by 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.

Report this message

#11: Re: Perl 5.8 and MD5

Posted on 2007-10-15 23:29:58 by 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."

Report this message

#12: Re: Perl 5.8 and MD5

Posted on 2007-10-15 23:36:19 by 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.

Report this message

#13: Re: Perl 5.8 and MD5

Posted on 2007-10-15 23:44:25 by 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.

Report this message

#14: Re: Perl 5.8 and MD5

Posted on 2007-10-15 23:56:55 by 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

Report this message

#15: Re: Perl 5.8 and MD5

Posted on 2007-10-16 00:27:28 by 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.

Report this message

#16: Re: Perl 5.8 and MD5

Posted on 2007-10-16 00:57:44 by Ron Bergin

On Oct 15, 1:47 pm, Joe <jruff...@gailborden.info> 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(<html><head><title>MD5 Encryption</title></head><body>);

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(
> <form action="md5.cgi?flag=1" method="post">
> Text to Encrypt: <input type="text" name="toEncrypt">
>

>

> <input type="submit" value="Encrypt">
>
> </form>
> );
>
> }
>
> print qq(</body></html>);

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

Report this message

#17: Re: Perl 5.8 and MD5

Posted on 2007-10-16 01:13:29 by Ron Bergin

On Oct 15, 3:27 pm, Joe <jruff...@gailborden.info> 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.

Report this message

#18: Re: Perl 5.8 and MD5

Posted on 2007-10-16 01:26:07 by Ron Bergin

On Oct 15, 3:57 pm, Ron Bergin <r...@i.frys.com> wrote:
> On Oct 15, 1:47 pm, Joe <jruff...@gailborden.info> 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;

Report this message

#19: Re: Perl 5.8 and MD5

Posted on 2007-10-16 01:51:38 by unknown

Post removed (X-No-Archive: yes)

Report this message

#20: Re: Perl 5.8 and MD5

Posted on 2007-10-16 05:35:05 by Ron Bergin

On Oct 15, 3:27 pm, Joe <jruff...@gailborden.info> 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.

Report this message