[users@httpd] Use base

2015-08-04 Thread Patton, Billy N
I have an app that runs perfectly on our servers that have 5.10.
This multiple inheritance use base "myFile" is fine on those servers.
I'm running on MAC Yosemite and and running 5.18 perl and Apachie
Billys-MacBook-Pro:Perl bpatto$ httpd -v
Server version: Apache/2.4.10 (Unix)
Server built:   May 19 2015 09:36:36

My app times out when I have my use base.  Here's an example :

cp.cgi :
  use CP;

CP.pm
 use base "Base";

Base.pm
 use base 'CGI::Application';
I replaced the above with the below and it goes through this part with no 
problem.
BEGIN {
  if ($] lt '5.18') {
use base 'CGI::Application';
  } else {
use parent 'CGI::Application';
  }
}

In several go the perl modules that get loaded from cpan they still use 'use 
base ".."'
>From perldoc base I get this :
DESCRIPTION
   Unless you are using the "fields" pragma, consider this module
   discouraged in favor of the lighter-weight "parent".


I've been able to follow my cgi down to the CGI::Application before it gets the 
time out.

Any suggestions?

-
To unsubscribe, e-mail: users-unsubscr...@httpd.apache.org
For additional commands, e-mail: users-h...@httpd.apache.org



Re: [users@httpd] email problem.

2015-06-17 Thread Patton, Billy N
I got the problem fixed.
It had nothing to do with Apache.
It was all with the VM setup.

On 6/17/15, 11:54 AM, "Patton, Billy N"  wrote:

>I'm having a problem sending email from my app.
>To simplify at the top of my cp.cgi I added a little code then blocked
>the rest of my script with _END_ .
>Below is my entry cp.cgi
>From a command line if I execute : perl cp.cgi
>I'll get an email.
>If I bury this within my code, at the desired location, I get nothing, no
>errors, no email.
>I've tried replacing smtp.west.com with the actual IP address, same
>results.
>
>From the command line I've checked :
>getsebool -a | grep mail
>allow_postfix_local_write_mail_spool --> on
>httpd_can_sendmail --> on
>logging_syslogd_can_sendmail --> on
>
>This is on a VM.  We have other VMs able to send email.
>It was suggested that it might firewall problem.
>From the command line I can ping the server.
>I can put that snippet of code in a file, execute and receive an email.
>
>cp.cgi
>=
>#!/usr/bin/perl
>
>use Mail::Sender::Easy qw (email);
>
>email({'from' => 'bnpat...@west.com',
>'to' => 'bnpat...@west.com',
>   'subject' => 'test',
>   'smtp' => 'smtp.west.com',
>   '_text' => 'test email'
>  });
>
>_END_
>...
>==
>
>
>
>
>
>
>-
>To unsubscribe, e-mail: users-unsubscr...@httpd.apache.org
>For additional commands, e-mail: users-h...@httpd.apache.org
>


-
To unsubscribe, e-mail: users-unsubscr...@httpd.apache.org
For additional commands, e-mail: users-h...@httpd.apache.org



[users@httpd] email problem.

2015-06-17 Thread Patton, Billy N
I'm having a problem sending email from my app.
To simplify at the top of my cp.cgi I added a little code then blocked the rest 
of my script with _END_ .
Below is my entry cp.cgi
>From a command line if I execute : perl cp.cgi
I'll get an email.
If I bury this within my code, at the desired location, I get nothing, no 
errors, no email.
I've tried replacing smtp.west.com with the actual IP address, same results.

>From the command line I've checked :
getsebool -a | grep mail
allow_postfix_local_write_mail_spool --> on
httpd_can_sendmail --> on
logging_syslogd_can_sendmail --> on

This is on a VM.  We have other VMs able to send email.
It was suggested that it might firewall problem.
>From the command line I can ping the server.
I can put that snippet of code in a file, execute and receive an email.

cp.cgi
=
#!/usr/bin/perl

use Mail::Sender::Easy qw (email);

email({'from' => 'bnpat...@west.com',
'to' => 'bnpat...@west.com',
   'subject' => 'test',
   'smtp' => 'smtp.west.com',
   '_text' => 'test email'
  });

_END_
...
==






-
To unsubscribe, e-mail: users-unsubscr...@httpd.apache.org
For additional commands, e-mail: users-h...@httpd.apache.org



[users@httpd] unsubscribe

2014-12-19 Thread Patton, Billy N

-
To unsubscribe, e-mail: users-unsubscr...@httpd.apache.org
For additional commands, e-mail: users-h...@httpd.apache.org



Re: [users@httpd] Apache seems to crash leading all sites in a multi site environment to access /var/apache2/htdocs

2014-12-09 Thread Patton, Billy N
I’m a rookie also, it’s bee killing me with the little nuances.
in your http.conf make sure you have DocumentRoot set.
I just might be the default that your seeing.

> On Dec 9, 2014, at 2:51 PM, Lars Bonnesen  wrote:
> 
> Installing Apache2 on OpenBSD5.6 as Nginx is now default htttd on OpenBSD and 
> I am more familiar with Apache.
> 
> Allthough... I am facing this weird issue:
> 
> A multi site setup. Several virtual hosts on one IP.
> 
> If I am doing a
> 
>   apachectl2 stop
>   
> and 
> 
>   apachectl2 start
>   
> all sites runs fine untill it seems that Apache is crashing and restarting 
> resulting in all sites accessing /var/apache2/htdocs eventhough that site is 
> not defined ANYwhere!!!
> 
> Doing a
> 
>   apachectl2 restart
>   
> restults in the same thing - but if I am doing the stop, start thing... I am 
> up and running for some minutes again...
> 
> Where to look for hints??? Anyone seen something similar to this before? 
> 
> Regards, Lars.



Re: [users@httpd] http testing question

2014-11-07 Thread Patton, Billy N
I’ve just finished creating a script that will test my app for content and 
functionality.
I use WWW::Mechanize and Test::WWW::Mechanize
Getting their nuances took me some trial and error,  There are some thing it is 
missing, su as proof that a radio button was actually clicked
Or I havn’t figured out that nuance.
For content and functionality it does a good job.
Although I have yet to figure out why it won’t do a follow_link for one of 20, 
when it will follow it perfectly from the app or from the html, when I view 
source and click on it.
Loading would take some parallel threading to load up your server, but then 
you’d have to conceive some way to measure.
All this if you have time and not a budget for doing it.

On Nov 7, 2014, at 6:08 AM, Jeff Trawick 
mailto:traw...@gmail.com>> wrote:

On Thu, Nov 6, 2014 at 2:37 PM, Rose, John B 
mailto:jbr...@utk.edu>> wrote:
Any pro/con views, personal experience, insights on these tools, or any not 
listed here you think are good?

Ab - Apache
jmeter
Webpagetest
Httperf
Apache Flood

We have tried ab, webpagetest, and jmeter a bit but still learning.

Thanks

What aspects do you plan to test?

Most, maybe all, can create arbitrary load on your server, at least when you 
use multiple clients.
Most, maybe all, can check the HTTP response code.
Some can perform detailed checks of response content.
Some can use the response from one request to drive subsequent requests, such 
as when simulating login or more complex user flows.

Maybe the question is what combination of load testing and functional testing 
do you need?

--
Born in Roswell... married an alien...
http://emptyhammock.com/




[users@httpd] OO perl in CGI

2014-10-22 Thread Patton, Billy N
I’ve just recently upgraded my mac to the new Yosemite.
My app was working before this upgrade.  I had no Idea that it would destroy so 
much, but I’ve got most of it back.
It’s the inheritance between perl modules that is killing me.
I know my machine candles inheritance(see example below).

Yesterday I was running Apache 2.2, today I’m running 2.4.9

I have a hierarchy like this
index.html 
cp.cgi

cp.cgi
use CP; 
$cp = CP->new();

CP.pm
use base “Base”;
sub new { # tried this out of desperation
my $self = shift;
$self->SUPER::new();
}
1;
__END__

Base.pm
use base ‘CGI::Application’;
sub new {
my $self = shift;
$self->SUPER::new();
}
1;
__END__


I’m getting the error message
Can't locate object method "new" via package "CP" at 
/Users/bpatto/tool_box/cportal/App/CP.pm line 21.

Just to make sure it is working on my mac I created the following and it works 
perfectly
#!/usr/bin/perl
use strict;
use warnings;
use Data::Dumper;
package Dad { sub new {  my $pkg = shift @_;  my $self = {};  bless $self ,  
$pkg;   }}
package Mom {   use base "Dad”; }
package Baby {   use base "Mom”; }
my $stuff = new Baby;
print Dumper $stuff;



Re: [users@httpd] WWW::Mechanize for testing

2014-10-21 Thread Patton, Billy N
Got it
On Oct 21, 2014, at 10:54 AM, Patton, Billy N  wrote:

> Trying to use WWW::Mechanize for my unit testing of an app.
> I requires a login, but this is something that comes before it hits my .cgi.
> 
> I believe it is using the .htaccess to get it’s data.
> 
> Here is my script using WWW::Mechanize.
> 
> #!/usr/bin/perl -w
> use strict;
> use warnings;
> use Data::Dumper;
> $Data::Dumper::Indent   = 1;
> $Data::Dumper::Sortkeys = 1;
> $Data::Dumper::Deepcopy = 1;
> use Test::More qw (no_plan);
> use Cwd;
> use WWW::Mechanize;
> 
> my $loginID   = 'dogs';
> my $password  = 'pigs';
> my $url   = 'http://cats.sheep/cp.cgi';
> my $mech  = WWW::Mechanize->new(); # start off the whole enchilada
> $mech->set_visible($loginID, $password);  # enter in the loginid and password
> $mech->get($url);
> 
> 
> 
> The documentation I have read tells me to use set_visible.
> 
> When I have it before the get I get the following error.
> HTML::Form::parse: No $base_uri provided at 
> /Library/Perl/5.16/WWW/Mechanize.pm line 2759.
> 
> if I move it after the get I get the following error.
> 
> Error GETing http://billys-cportal-test.dfw0.hypercube-llc.com/cp.cgi: 
> Authorization Required at t/cportal.t line 31.
> 
> 
> So how do I do a get when the login stuff is not controlled by my App?
> 
> 
> 
> -
> To unsubscribe, e-mail: users-unsubscr...@httpd.apache.org
> For additional commands, e-mail: users-h...@httpd.apache.org
> 


-
To unsubscribe, e-mail: users-unsubscr...@httpd.apache.org
For additional commands, e-mail: users-h...@httpd.apache.org



[users@httpd] WWW::Mechanize for testing

2014-10-21 Thread Patton, Billy N
Trying to use WWW::Mechanize for my unit testing of an app.
I requires a login, but this is something that comes before it hits my .cgi.

I believe it is using the .htaccess to get it’s data.

Here is my script using WWW::Mechanize.

#!/usr/bin/perl -w
use strict;
use warnings;
use Data::Dumper;
$Data::Dumper::Indent   = 1;
$Data::Dumper::Sortkeys = 1;
$Data::Dumper::Deepcopy = 1;
use Test::More qw (no_plan);
use Cwd;
use WWW::Mechanize;

my $loginID   = 'dogs';
my $password  = 'pigs';
my $url   = 'http://cats.sheep/cp.cgi';
my $mech  = WWW::Mechanize->new(); # start off the whole enchilada
$mech->set_visible($loginID, $password);  # enter in the loginid and password
$mech->get($url);



The documentation I have read tells me to use set_visible.

When I have it before the get I get the following error.
HTML::Form::parse: No $base_uri provided at /Library/Perl/5.16/WWW/Mechanize.pm 
line 2759.

if I move it after the get I get the following error.

Error GETing http://billys-cportal-test.dfw0.hypercube-llc.com/cp.cgi: 
Authorization Required at t/cportal.t line 31.


So how do I do a get when the login stuff is not controlled by my App?



-
To unsubscribe, e-mail: users-unsubscr...@httpd.apache.org
For additional commands, e-mail: users-h...@httpd.apache.org



Re: [users@httpd] C module

2014-10-20 Thread Patton, Billy N
Thanks, my hello world is now working.
On Oct 20, 2014, at 7:03 AM, Eric Covener 
mailto:cove...@gmail.com>> wrote:


On Mon, Oct 20, 2014 at 7:58 AM, Patton, Billy N 
mailto:billy.pat...@h3net.com>> wrote:
if (!r->handler || strcmp(r->handler, "example-handler")) return (DECLINED);

It's looking for ​SetHandler​ example-handler.



--
Eric Covener
cove...@gmail.com<mailto:cove...@gmail.com>



Re: [users@httpd] C module

2014-10-20 Thread Patton, Billy N
Thanks, my hello world is now working :)
On Oct 20, 2014, at 7:15 AM, Issac Goldstand  wrote:

> 
> On 20/10/2014 14:58, Patton, Billy N wrote:
>> But when the actions you want to take are in the module, how do I call it?
>> Since my file.c is called mod_example.c and it compiles/installs as 
>> mod_example.so
>> Do I need a bogus file IE mod_example
>> Then set a handle for mod_example
>> 
>> where mod_example would be a simple
>> touch mod_example
>> 
>> Then in my .config
>> AddHandler mod_example mod_example
>> 
>> Then call from Chrome as
>> 
>> http://my_site/mod_example
>> 
>> I tried this, but all I got was a blank screen, no errors of any kind.
> 
> Hi Billy,
> 
> Welcome to the wonderful world of C modules for Apache :)
> 
> In the case of cgi, pl and pm you are calling the appropriate handlers
> for every such file on the filesystem
> 
> In your case, you'd either need to decide on a file pattern which will
> always be served by your handler and add an AddHandler line OR (and this
> is probably what you want) assign a specific URL to your module
> explicitly, like this:
> 
> 
>  SetHandler example-handler
> 
> 
> Hope this helps,
>  Issac
> 
> 
> 
> -
> To unsubscribe, e-mail: users-unsubscr...@httpd.apache.org
> For additional commands, e-mail: users-h...@httpd.apache.org
> 


-
To unsubscribe, e-mail: users-unsubscr...@httpd.apache.org
For additional commands, e-mail: users-h...@httpd.apache.org



[users@httpd] C module

2014-10-20 Thread Patton, Billy N
I’m new to Apache.  I’ve gotten mod_perl, php, cgi and html to do my hello 
world.
I’m now trying to get a “c” module to print a simple “hello world”.
I know there is something very simple I’m missing.
I’ve read explanations and examples till they all seem to say the same thing.
I’ve copied examples word for word.
I can get it to compile and have the permissions of all the other .so files.

from my httpd.conf
LoadModule example_module libexec/apache2/mod_example.so

For the mod_perl and .cgi I had these lines
AddHandler cgi-script .cgi
AddHandler mod_perl .pl
AddHandler mod_perl .pm

But when the actions you want to take are in the module, how do I call it?
Since my file.c is called mod_example.c and it compiles/installs as 
mod_example.so
Do I need a bogus file IE mod_example
Then set a handle for mod_example

where mod_example would be a simple
touch mod_example

Then in my .config
AddHandler mod_example mod_example

Then call from Chrome as

http://my_site/mod_example

I tried this, but all I got was a blank screen, no errors of any kind.

Here is my mod_example.c

/* Include the required headers from httpd */
#include "httpd.h"
#include "http_config.h"
#include "http_core.h"
#include "http_protocol.h"
#include "http_request.h"

/* Define prototypes of our functions in this module */
static void register_hooks(apr_pool_t *pool);
static int example_handler(request_rec *r);

/* Define our module as an entity and assign a function for registering hooks  
*/

module AP_MODULE_DECLARE_DATA   example_module =
{
STANDARD20_MODULE_STUFF,
NULL,// Per-directory configuration handler
NULL,// Merge handler for per-directory configurations
NULL,// Per-server configuration handler
NULL,// Merge handler for per-server configurations
NULL,// Any directives we may have for httpd
register_hooks   // Our hook registering function
};


/* register_hooks: Adds a hook to the httpd process */
static void register_hooks(apr_pool_t *pool)
{

/* Hook the request handler */
ap_hook_handler(example_handler, NULL, NULL, APR_HOOK_LAST);
}

/* The handler function for our module.
 * This is where all the fun happens!
 */
static int example_handler(request_rec *r)
{
/* First off, we need to check if this is a call for the "example-handler" 
handler.
 * If it is, we accept it and do our things, if not, we simply return 
DECLINED,
 * and the server will try somewhere else.
 */
if (!r->handler || strcmp(r->handler, "example-handler")) return (DECLINED);

/* Now that we are handling this request, we'll write out "Hello, world!" 
to the client.
 * To do so, we must first set the appropriate content type, followed by 
our output.
 */
ap_set_content_type(r, "text/html");
ap_rprintf(r, "Hello, world!");

/* Lastly, we must tell the server that we took care of this request and 
everything went fine.
 * We do so by simply returning the value OK to the server.
 */
return OK;
}


-
To unsubscribe, e-mail: users-unsubscr...@httpd.apache.org
For additional commands, e-mail: users-h...@httpd.apache.org