[cgiapp] Windows Environment Setup

2009-01-16 Thread Mike Tonks
Hi All,

I was recently asked how to setup a dev environment on Windows for
CGI::Application, and couldn't answer, other than to install ubuntu as
a dual boot and use that.

Can anyone suggest ways to do this?

cheers,

mike

#  CGI::Application community mailing list  
####
##  To unsubscribe, or change your message delivery options,  ##
##  visit:  http://www.erlbaum.net/mailman/listinfo/cgiapp##
####
##  Web archive:   http://www.erlbaum.net/pipermail/cgiapp/   ##
##  Wiki:  http://cgiapp.erlbaum.net/ ##
####




[cgiapp] Re: CGI::Application::Dispatch help

2009-01-16 Thread fREW Schmidt
Ok, I have changed some things around in the hopes that it will fix my
issues, but I am still not having much luck...

Inside of ACD I have Dispatch.pm.  Here is the contents of that file:

package ACD::Dispatch;
use base 'CGI::Application::Dispatch';
use warnings;

sub dispatch_args {
return {
prefix  = 'ACD',
debug = 1,
table   = [
'/'= { app = 'Home', rm = 'welcome' },
':app/:rm?'= { },
],
};
}

1;

I am using Apache 2.2 on windows with mod_perl.

I think this is all you might need to see from there:


VirtualHost *:8080
   ErrorLog C:/path/to/acd/logs/error.log
   Perl
  use lib 'C:/path/to/acd';
  $ENV{MODE} = 'development';
   /Perl
ScriptAlias / C:/path/to/acd
   Location  /
  SetHandler perl-script
  PerlHandler ACD::Dispatch
  Order allow,deny
  Allow from all
   /Location
/VirtualHost



Ok, so here is what has been happening:

Go to:
localhost:8080
Get:
Home, welcome

Go to:
localhost:8080/fdjksalfdsafdsa
Get:
Home, welcome

Go to:
localhost/abc/jkfldjskljfdkls/home_othercontroller/some_rm
Get:
Home/OtherController, some_rm


Michael Peters was trying to help me and said that it has to do with
Apache being weird with Directory directives, but now it's a Location
and the issue is still happening.

So I guess my question is why is it ignoring that first directory and
how do I get it to stop?


Thanks for any help at all!


--

-fREW

#  CGI::Application community mailing list  
####
##  To unsubscribe, or change your message delivery options,  ##
##  visit:  http://www.erlbaum.net/mailman/listinfo/cgiapp##
####
##  Web archive:   http://www.erlbaum.net/pipermail/cgiapp/   ##
##  Wiki:  http://cgiapp.erlbaum.net/ ##
####




Re: [cgiapp] Windows Environment Setup

2009-01-16 Thread Lyle

Mike Tonks wrote:

Hi All,

I was recently asked how to setup a dev environment on Windows for
CGI::Application, and couldn't answer, other than to install ubuntu as
a dual boot and use that.

Can anyone suggest ways to do this?
  


You've got a few options. Depends on what windows they have and what 
they already have setup really.


IIS-ActivePerl
Apache-ActivePerl

I can't say I've used strawberry Perl yet, so can't comment on that option.

ppm install CGI::Application

Komodo Edit is pretty good, they also offer a trial for the full Komodo
http://www.activestate.com


Lyle


#  CGI::Application community mailing list  
####
##  To unsubscribe, or change your message delivery options,  ##
##  visit:  http://www.erlbaum.net/mailman/listinfo/cgiapp##
####
##  Web archive:   http://www.erlbaum.net/pipermail/cgiapp/   ##
##  Wiki:  http://cgiapp.erlbaum.net/ ##
####




Re: [cgiapp] Windows Environment Setup

2009-01-16 Thread fREW Schmidt
On Fri, Jan 16, 2009 at 10:29 AM, Lyle webmas...@cosmicperl.com wrote:
 Mike Tonks wrote:

 Hi All,

 I was recently asked how to setup a dev environment on Windows for
 CGI::Application, and couldn't answer, other than to install ubuntu as
 a dual boot and use that.

 Can anyone suggest ways to do this?


 You've got a few options. Depends on what windows they have and what they
 already have setup really.

 IIS-ActivePerl
 Apache-ActivePerl

 I can't say I've used strawberry Perl yet, so can't comment on that option.

 ppm install CGI::Application

 Komodo Edit is pretty good, they also offer a trial for the full Komodo
 http://www.activestate.com


Also: I would recommend adding the recommended sources to ppm.  Run
the ppm ui and click Edit-Preferences, go to the repositories tab,
and then add all of the suggested from the list.  That will give you
options for plugins and whatnot that you wouldn't have otherwise.

Good luck!


-- 

-fREW

#  CGI::Application community mailing list  
####
##  To unsubscribe, or change your message delivery options,  ##
##  visit:  http://www.erlbaum.net/mailman/listinfo/cgiapp##
####
##  Web archive:   http://www.erlbaum.net/pipermail/cgiapp/   ##
##  Wiki:  http://cgiapp.erlbaum.net/ ##
####




Re: [cgiapp] Windows Environment Setup

2009-01-16 Thread Lyle

fREW Schmidt wrote:

On Fri, Jan 16, 2009 at 10:29 AM, Lyle webmas...@cosmicperl.com wrote:
  

Mike Tonks wrote:


Hi All,

I was recently asked how to setup a dev environment on Windows for
CGI::Application, and couldn't answer, other than to install ubuntu as
a dual boot and use that.

Can anyone suggest ways to do this?

  

You've got a few options. Depends on what windows they have and what they
already have setup really.

IIS-ActivePerl
Apache-ActivePerl

I can't say I've used strawberry Perl yet, so can't comment on that option.

ppm install CGI::Application

Komodo Edit is pretty good, they also offer a trial for the full Komodo
http://www.activestate.com




Also: I would recommend adding the recommended sources to ppm.  Run
the ppm ui and click Edit-Preferences, go to the repositories tab,
and then add all of the suggested from the list.  That will give you
options for plugins and whatnot that you wouldn't have otherwise.
  


Good point I missed that. Also if you are using IIS you'll want to start 
your scripts like:-


#!/Perl/bin/perl.exe
BEGIN {
   use FindBin qw ($RealBin $RealScript);
   use lib $FindBin::RealBin;
   chdir $RealBin;
   if ( $ENV{'SERVER_SOFTWARE'} =~ /IIS/ ) {
   open STDERR, ' iisError.log' || die Can't write to 
$RealBin/issError.log: $!\n;

   binmode STDERR;
   #close STDERR;
   }#if
}#BEGIN

Unlike Linux/Apache, Windows/IIS doesn't execute your Perl scripts with 
the pwd set to where your script actually is. This can play havoc with 
Linux code that uses relative paths for files, directories, require, 
use, etc. This bit of code fixes it.


Also IIS has a habit of sending anything sent to STDERR to STDOUT 
instead. This can cause some weird problems, so either close STDERR or 
set it to your own log file instead (as above).



Hope that helps


Lyle


#  CGI::Application community mailing list  
####
##  To unsubscribe, or change your message delivery options,  ##
##  visit:  http://www.erlbaum.net/mailman/listinfo/cgiapp##
####
##  Web archive:   http://www.erlbaum.net/pipermail/cgiapp/   ##
##  Wiki:  http://cgiapp.erlbaum.net/ ##
####




[cgiapp] Getting error_mode to catch die in cgiapp_prerun

2009-01-16 Thread Lyle

Hi All,
 I've noticed that if my app dies in cgiapp_prerun then my error mode 
defined in setup isn't called.


Is there a reason for this? Is there a way to get error_mode to catch 
errors in cgiapp_prerun?



Sample module:-

package Test;

BEGIN {
   use FindBin qw ($RealBin $RealScript);
   use lib $FindBin::RealBin;
   chdir $RealBin;
   if ( $ENV{'SERVER_SOFTWARE'} =~ /IIS/ ) {
   open STDERR, ' iisError.log' || die Can't write to 
$RealBin/issError.log: $!\n;

   binmode STDERR;
   #close STDERR;
   }#if
}#BEGIN


use base 'CGI::Application';
use strict;

sub setup {
   my $self = shift;
   $self-start_mode('test');
   $self-error_mode( 'error' );
   $self-run_modes(
   'test' = 'test',
   );
}#sub

sub teardown {
   my $self = shift;
}#sub

sub cgiapp_prerun {
   my $self = shift;
   die( Death message ); ## 500 error
}#sub


sub test {
   my $self = shift;
#die( Death message ); ## works
   return Test;
}#sub

sub error {
   my $self = shift;
   return Error mode ran @_;
}


1;


#  CGI::Application community mailing list  
####
##  To unsubscribe, or change your message delivery options,  ##
##  visit:  http://www.erlbaum.net/mailman/listinfo/cgiapp##
####
##  Web archive:   http://www.erlbaum.net/pipermail/cgiapp/   ##
##  Wiki:  http://cgiapp.erlbaum.net/ ##
####




Re: [cgiapp] Getting error_mode to catch die in cgiapp_prerun

2009-01-16 Thread Jaldhar H. Vyas

On Fri, 16 Jan 2009, Lyle wrote:


Hi All,
I've noticed that if my app dies in cgiapp_prerun then my error mode defined 
in setup isn't called.


Is there a reason for this? Is there a way to get error_mode to catch errors 
in cgiapp_prerun?





This is an architectural limitation of CGI::Application.  see the code for 
run() and __get_body() in the source.


A workaround is to wrap your prerun in an eval and call 
$self-error_mode($@) and possibly $self-call_hook('error', $@) yourself 
if it dies.


--
Jaldhar H. Vyas jald...@braincells.com

#  CGI::Application community mailing list  
####
##  To unsubscribe, or change your message delivery options,  ##
##  visit:  http://www.erlbaum.net/mailman/listinfo/cgiapp##
####
##  Web archive:   http://www.erlbaum.net/pipermail/cgiapp/   ##
##  Wiki:  http://cgiapp.erlbaum.net/ ##
####




Re: [cgiapp] Windows Environment Setup

2009-01-16 Thread Jaldhar H. Vyas

On Fri, 16 Jan 2009, Lyle wrote:


Also if you are using IIS you'll want to start your scripts like:-

#!/Perl/bin/perl.exe
BEGIN {
  use FindBin qw ($RealBin $RealScript);
  use lib $FindBin::RealBin;
  chdir $RealBin;
  if ( $ENV{'SERVER_SOFTWARE'} =~ /IIS/ ) {
  open STDERR, ' iisError.log' || die Can't write to 
$RealBin/issError.log: $!\n;

  binmode STDERR;
  #close STDERR;
  }#if
}#BEGIN

Unlike Linux/Apache, Windows/IIS doesn't execute your Perl scripts with the 
pwd set to where your script actually is. This can play havoc with Linux code 
that uses relative paths for files, directories, require, use, etc. This bit 
of code fixes it.


Also IIS has a habit of sending anything sent to STDERR to STDOUT instead. 
This can cause some weird problems, so either close STDERR or set it to your 
own log file instead (as above).




You know what?  You should wrap this and any other IIS quirks into a 
CGI::Application::Plugin::IIS and upload it to CPAN.


--
Jaldhar H. Vyas jald...@braincells.com

#  CGI::Application community mailing list  
####
##  To unsubscribe, or change your message delivery options,  ##
##  visit:  http://www.erlbaum.net/mailman/listinfo/cgiapp##
####
##  Web archive:   http://www.erlbaum.net/pipermail/cgiapp/   ##
##  Wiki:  http://cgiapp.erlbaum.net/ ##
####




Re: [cgiapp] Windows Environment Setup

2009-01-16 Thread Ron Savage
Hi Jaldhar

 You know what?  You should wrap this and any other IIS quirks into a 
 CGI::Application::Plugin::IIS and upload it to CPAN.

The wrapper is called Debian.

Hahahahahahahahahahahahahaha.

-- 
Ron Savage
r...@savage.net.au
http://savage.net.au/index.html



#  CGI::Application community mailing list  
####
##  To unsubscribe, or change your message delivery options,  ##
##  visit:  http://www.erlbaum.net/mailman/listinfo/cgiapp##
####
##  Web archive:   http://www.erlbaum.net/pipermail/cgiapp/   ##
##  Wiki:  http://cgiapp.erlbaum.net/ ##
####




Re: [cgiapp] Windows Environment Setup

2009-01-16 Thread Stewart Heckenberg
Download and install both Apache for Windows and Strawberry Perl from
their respective sites :)

I use a dynamic hosting setup where I can have multiple sites living
in a www directory in My Documents. To do this you need to uncomment
the following lines in your httpd.conf:

Include conf/extra/httpd-vhosts.conf
LoadModule vhost_alias_module modules/mod_vhost_alias.so

And then use something like the following in your extra/httpd-vhosts.conf:

UseCanonicalName Off

VirtualDocumentRoot D:\Documents and Settings\Youdaman\My
Documents\www\%0\html

Directory D:\Documents and Settings\Youdaman\My Documents\www\*\html
Options Indexes FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
/Directory

VirtualScriptAlias D:\Documents and Settings\Youdaman\My Documents\www\%0\cgi
Directory D:\Documents and Settings\Youdaman\My Documents\www\*\cgi
Options None
Order allow,deny
Allow from all
/Directory



Of course change the drive/user/whatever parts above to suit your
particular machine/user.

The way the above works is that in My Documents I have a directory
called www and inside that I have directories which contain the
websites, each having a html and cgi subdirectory.

To make it so that you can view these websites on your local Apache
server, you need to also add a line like the following to your
WINDOWS\system32\drivers\etc\hosts file:

127.0.0.1   foo

From that point you can restart Apache and you should then be able to
type the address http://foo/; in your web browser to view pages that
are stored in foo/html -- test this out by creating an index.html file
in that directory. CGI scripts for your foo website live in foo/cgi
but are accessed via http://foo/cgi-bin/whatever.cgi; -- note the
folder you have is called cgi but the path Apache uses is cgi-bin (as
per the configuration described above).

In terms of then using CGI::Application, it should be a simple matter
of installing the required modules via Strawberry Perl's provided CPAN
interface :)

Hope this helped! I prefer the Apache/Strawberry Perl setup to using
IIS/ActiveState if only because it's more like the Linux environments
I work with on a day-to-day basis and also that I have access to all
the Perl modules in CPAN.

Stew







2009/1/17 Mike Tonks fluffym...@googlemail.com:
 Hi All,

 I was recently asked how to setup a dev environment on Windows for
 CGI::Application, and couldn't answer, other than to install ubuntu as
 a dual boot and use that.

 Can anyone suggest ways to do this?

 cheers,

 mike

 #  CGI::Application community mailing list  
 ####
 ##  To unsubscribe, or change your message delivery options,  ##
 ##  visit:  http://www.erlbaum.net/mailman/listinfo/cgiapp##
 ####
 ##  Web archive:   http://www.erlbaum.net/pipermail/cgiapp/   ##
 ##  Wiki:  http://cgiapp.erlbaum.net/ ##
 ####
 



#  CGI::Application community mailing list  
####
##  To unsubscribe, or change your message delivery options,  ##
##  visit:  http://www.erlbaum.net/mailman/listinfo/cgiapp##
####
##  Web archive:   http://www.erlbaum.net/pipermail/cgiapp/   ##
##  Wiki:  http://cgiapp.erlbaum.net/ ##
####




Re: [cgiapp] Windows Environment Setup

2009-01-16 Thread Rhesa Rozendaal

Mike Tonks wrote:

Hi All,

I was recently asked how to setup a dev environment on Windows for
CGI::Application, and couldn't answer, other than to install ubuntu as
a dual boot and use that.

Can anyone suggest ways to do this?


I had good results with XAMPP (http://www.apachefriends.org/en/xampp.html). 
Comes with Apache, MySQL, PHP, and optionally Perl and mod_perl. It's pretty 
simple to set up, especially if you're not terribly familiar with Windows.


Rhesa



#  CGI::Application community mailing list  
####
##  To unsubscribe, or change your message delivery options,  ##
##  visit:  http://www.erlbaum.net/mailman/listinfo/cgiapp##
####
##  Web archive:   http://www.erlbaum.net/pipermail/cgiapp/   ##
##  Wiki:  http://cgiapp.erlbaum.net/ ##
####




Re: [cgiapp] Re: CGI::Application::Dispatch help

2009-01-16 Thread Ron Savage
Hi fREW

So I guess my question is why is it ignoring that first directory and
how do I get it to stop?

I have an unreleased module CGI::Application::Test::Dispatch, which I've
been playing with trying to reproduce your problems.

I've only tested it under Debian and Apache 2.2.

I'll try Windows later today.

So far, I don't have this specific problem of a directory being ignored.

For instance, this works: http://127.0.0.1/test.dispatch/Phase1

where as this fails: http://127.0.0.1/test.dispatch/xxxcvvv/Phase1
as you'd expect, with this error: The requested
URL /test.dispatch/xxxcvvv/Phase1 was not found on this server.

httpd.conf contains:

Location /test.dispatch
SetHandler perl-script
PerlResponseHandler CGI::Application::Test::Dispatcher
Order deny,allow
Deny from all
Allow from 127.0.0.1
/Location

More later.
-- 
Ron Savage
r...@savage.net.au
http://savage.net.au/index.html



#  CGI::Application community mailing list  
####
##  To unsubscribe, or change your message delivery options,  ##
##  visit:  http://www.erlbaum.net/mailman/listinfo/cgiapp##
####
##  Web archive:   http://www.erlbaum.net/pipermail/cgiapp/   ##
##  Wiki:  http://cgiapp.erlbaum.net/ ##
####