modperl - ASP and PERL Will Not Run

Problems with the Windows version of XAMPP, questions, comments, and anything related.

modperl - ASP and PERL Will Not Run

Postby matt6805 » 09. March 2009 21:11

I'm trying to understand Xampps modperl addon. I've installed it as documented.
So running the demos found in these folders works as expected:

Apache module: PERL/2.0.3
Extensions: .pl
Document root: \htdocs\modperl\
Configuration files: \apache\conf\perl.conf + \apache\conf\startup.pl
Examples: \htdocs\modperl\modperl.pl | Alias: http://localhost/perl/modperl.pl

Extensions: .asp
Document root: \htdocs\modperlasp\
Configuration files: \apache\conf\perl.conf
Examples: \htdocs\modperlasp\loop.asp | Alias: http://localhost/asp/loop.asp

However, any other ASP or PERL code I put in these respective folders will not run. I either get a blank page or a page not found message. I'm just grabbing simple code snippets from http://snipplr.com/, and saving them as test docs with the appropriate extension. I don't understand why simple snippets of ASP and PERL code won't run, but the demo code XAMPP provides does :?:

Can anyone explain this? Thanks.

Regards,
Matt
matt6805
 
Posts: 7
Joined: 23. October 2007 22:24

Re: modperl - ASP and PERL Will Not Run

Postby Izzy » 10. March 2009 01:17

Which code snippets are you using then I can try and replicate your issues as without them this is not possible for me to do.
Last edited by Izzy on 12. March 2009 08:08, edited 1 time in total.
Izzy
 
Posts: 3344
Joined: 25. April 2006 17:06

Re: modperl - ASP and PERL Will Not Run

Postby matt6805 » 10. March 2009 14:41

Here's a simple example. I copied this PERL snippet from here: http://snipplr.com/view/5059/date-functions/
Looks like it returns the date in various formats.

Code: Select all
#
sub date_mysql2sec {
#takes: date in "yyyy-mm-dd hh:mm:ss" format (with some freedom)
#returns: date in seconds since 1970 format
    use Time::Local;# 'timelocal_nocheck';
    my $mysqldate = shift;
    $mysqldate =~ /(\d{4}).(\d{2}).(\d{2}).(\d{2}).(\d{2}).(\d{2})/;
    my ($sec,$min,$hour,$mday,$mon,$year) = ($6,$5,$4,$3,$2,$1);
    if ($mon != 0) {$mon--};
    return timelocal($sec,$min,$hour,$mday,$mon,$year);
}

sub date_sec2mysql {
#takes: date in seconds since 1970 format
#returns: date in yyyy-mm-dd hh:mm:ss format
    my $secdate = shift;
    my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday) = localtime($secdate);
    $year += 1900;
    $mon++;
    $mon = $mon < 10 ? "0$mon" : $mon;
    $mday = $mday < 10 ? "0$mday" : $mday;
    $sec = $sec < 10 ? "0$sec" : $sec;
    $min = $min < 10 ? "0$min" : $min;
    $hour = $hour < 10 ? "0$hour" : $hour;   
    return qq{$year-$mon-$mday $hour:$min:$sec};
}

sub date_mysql_now {
#Takes: nothing
#Returns: current date and time in yyyy-mm-dd hh:mm:ss format
    return date_sec2mysql(time);
}


I named it foo.pl. When I place that document at \htdocs\modperl\foo.pl, and run it from http://127.0.0.1/perl/foo.pl, all I get is a blank page. The only code that seems to work for both PERL and ASP test are very simple test's like "Hello World".

Regards,
Matt
matt6805
 
Posts: 7
Joined: 23. October 2007 22:24

Re: modperl - ASP and PERL Will Not Run

Postby Izzy » 10. March 2009 17:32

These are bits of code, a snippet, and not a full perl script, so even though the syntax is correct they will never run as a script runs as they form only a part or bit (a snippet) of a complete perl script.

To use a snippet you would have to learn perl so you could include a snippet into your own script which is the purpose of the web site, a bits of code, snippet, repository http://snipplr.com/about/ - same applies to ASP snippets and to all the code snippets on the site you linked to.

This is the reason your "Hello world" script runs because it is a full script, but your code snippet shows a blank page because it is only a part of a full script.

To acquire free full scripts you would have to go to a web site like hotscripts.com and similar to test modperl and modperlasp in XAMPP.
Last edited by Izzy on 12. March 2009 08:10, edited 1 time in total.
Izzy
 
Posts: 3344
Joined: 25. April 2006 17:06

Re: modperl - ASP and PERL Will Not Run

Postby matt6805 » 10. March 2009 18:15

sound reasoning. I'm more a PHP person, so i didn't know something was missing. I thought the problem was with the plugin, but it seems that's running fine. Good to know. Thank you for your help with this!
matt6805
 
Posts: 7
Joined: 23. October 2007 22:24

Re: modperl - ASP and PERL Will Not Run

Postby Izzy » 11. March 2009 05:58

Your most welcome and glad I could be of some help.



Worth pointing here is that ASP.NET is not the same as Perl:ASP so any scripts aimed at ASP.NET will not work in XAMPP with or without the Perl Addon - see this faq:
http://www.apachefriends.org/en/faq-xam ... s.html#asp

Also the ActivePerl web site may have more info on what Perl:ASP actually is for those researching the subject.
Izzy
 
Posts: 3344
Joined: 25. April 2006 17:06


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 53 guests