CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
Search Posts SEARCH
Who's Online WHO'S
Log in LOG

Home: Perl Programming Help: Beginner:
General Strawberry questions



Oct 11, 2017, 2:34 PM

Post #1 of 4 (3429 views)
General Strawberry questions Can't Post

Hello there everyone, I hope somone can clarify this little problem I have :)

Well, I am on Windows 10, and so I have now Strawberry installed, and strucked to 2 problems I would like to have answered, if you please..

1 ) How does the CPAN module works? I wanted to use the getOpt for command line parameters, so tried to run the "CPAN Client", I clicked on it, a breaksecond of a command window apperad, and then nothing.

2) how do you debug? Maybe it seems strange that I never debuged before, I always used strict and warnings, that was enough. But now I intentionaly invoked a code, which doesn't work:

my $x = <>;  
my $y = fak($x);

print "$x $y \n";

sub fak
my $p = shift;
return ($p * fak($p - 1));

How do I prompt a debug? I tried "-d" in the Strawberry command line, but with no prevail. I hope somebody have some insight concerning this. Thanks in advance!

Veteran / Moderator

Oct 11, 2017, 3:02 PM

Post #2 of 4 (3426 views)
Re: [Wildcard] General Strawberry questions [In reply to] Can't Post

Try to use it from the command line (when on Windows, I use the cmd window prompt, but I guess it should also work on the powershell command line).

Then, something like "cpan module_name" should probably work.

And, to debug, also try from the cmd prompt, with the "-d" command line option:

perl -d

(Then, use "h" to view the available commands in the help menu.)

Chris Charley

Oct 12, 2017, 11:51 AM

Post #3 of 4 (3408 views)
Re: [Wildcard] General Strawberry questions [In reply to] Can't Post

A note on your program (finding a factorial).

It needs a condition to stop the recursion.

use strict;
use warnings;

my $x = <>;
my $y = fak($x);

print "$x $y \n";

sub fak {
my $p = shift;
return 1 if $p == 0;
return ($p * fak($p - 1));


Oct 12, 2017, 1:31 PM

Post #4 of 4 (3403 views)
Re: [Chris Charley] General Strawberry questions [In reply to] Can't Post

First of all, thanks again for the answers, much abliged.
And yeah, I know about that stop condition, that's why I wanted to run a debug through that code, this is the whole point of it :)


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives