Re: Questions about CGI

2018-06-06 Thread Jim Gibson



> On Jun 6, 2018, at 2:16 PM, Ahmad Bilal  wrote:
> 
> Ok, I went over to previously answered questions under the cgi tag here on 
> stackoverflow.

This message was posted to the Perl Beginners list, so you are not at 
Stackoverflow any more.
> 
> This seems to be the most voted one: What is Common Gateway Interface (CGI)?
> 
> But it still doesn't clear a few things, which I'm asking here.
> 
> Since RFC3875 is only a informational doc, and there is no finalized standard.
> 
>   • Who implements CGI protocol? Who defines its "standard behavior" on 
> servers such as Apache.

The CGI protocol is implemented by web servers and web browsers. It is a way 
for browsers to query a server and get dynamic information, rather than a 
static web page. The CGI request is part of the Hypertext Transfer Protocol 
(HTTP). It allows parameters to be sent by the browser to the server, which 
then uses the values of these parameters to generate a dynamic web page that it 
sends back to the browser.

> 
>   • How does C files work with CGI in modern environment. Please 
> elaborate using a "Hello World!" as a response to a form submission.

You can write a CGI program in just about any language. Since this is a Perl 
list, maybe you should be asking about CGI programming in Perl. I have written 
CGI programs in Perl, but now use PHP (for compatibility with existing CGI 
scripts).

Perl has modules to assist in CGI program development. The oldest of these is 
the CGI.pm module, but it has now fallen out of favor, and other modules are 
now recommended. I haven’t used any (or done any CGI programming in Perl for a 
long time), so I can’t recommend any from personal experience.

Check out these pages:

<https://metacpan.org/pod/CGI>
<https://metacpan.org/pod/Task::Kensho#Task::Kensho::WebDev:-Web-Development>


> 
> 
> 
> -- 
> Ahmad Bilal
> 



Jim Gibson

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Questions about CGI

2018-06-06 Thread Ahmad Bilal
Ok, I went over to previously answered questions under the cgi tag here on
stackoverflow.

This seems to be the most voted one: What is Common Gateway Interface (CGI)?
<https://stackoverflow.com/questions/2089271/what-is-common-gateway-interface-cgi>

But it still doesn't clear a few things, which I'm asking here.

Since RFC3875 is only a informational doc, and there is no finalized
standard.

   1.

   Who implements CGI protocol? Who defines its "standard behavior" on
   servers such as Apache.
   2.

   How does C files work with CGI in modern environment. Please elaborate
   using a "Hello World!" as a response to a form submission.



-- 
*Ahmad Bilal*


Re: carp and cgi warnings

2016-02-20 Thread lee
Uri Guttman <u...@stemsystems.com> writes:

> On 02/14/2016 01:09 AM, Uri Guttman wrote:
>> On 02/13/2016 02:07 PM, lee wrote:
>>> Brock Wilcox <awwa...@thelackthereof.org> writes:
>>>
>>>> Greetings!
>>>>
>>>> Could you give an example of these warnings, and even better some
>>>> minimal
>>>> code that generates them?
>>> Something like this gives you warnings in apaches error.log:
>>>
>>>
>>> #!/usr/bin/perl
>>> #
>>> use strict;
>>> use warnings;
>>> use autodie;
>>>
>>> use CGI;# qw(:standard);
>>> [...]
>>>
>>>
>>> The warning says that CGI will be removed from perl and that I should
>>> install it from cpan.  I don't want to install things from cpan but the
>>> package management of the distribution to take care of things because I
>>> don't want to do the package management by myself.
>>>
>>>
>>> For smartmatch:
>>>
>>>
>>> perl -e 'print "foo" ~~ "bar";'
>>> Smartmatch is experimental at -e line 1.
>>>
>>>
>>> You get that for every line you're using smartmatch in.
>>>
>>> Smartmatch works quite well; it's a really cool feature.  I already know
>>> that it's experimental.  I don't need to be reminded of this 10 times
>>> per minute in the log file while I'm trying to find a relevant message
>>> amongst thousands of these useless warnings.
>>
>> read the docs on warnings (perldoc warnings). it is easy to disable
>> any warning you want. note that this will be lexical so you need to
>> turn them off in the right location.
>>
>> uri
>>
>>>
>>
> and even more detail can be read with perldoc perllexwarn. all about
> enabling and disabling lexical warnings.
>
> uri

Thanks, I'll look into it when I find the time.

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




carp and cgi warnings

2016-02-13 Thread lee
Hi,

is there a way to disable the annoying warnings about carp and cgi which
cgi programs write to the web-server's log file in a general way rather
than per program?  Same goes for smartmatch warnings.

The log file is overloaded with these useless messages, which makes it
difficult to find actual errors/warnings.

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: carp and cgi warnings

2016-02-13 Thread Brock Wilcox
Greetings!

Could you give an example of these warnings, and even better some minimal
code that generates them?

Thanks,
--Brock
On Feb 13, 2016 8:19 AM, "lee" <l...@yagibdah.de> wrote:

> Hi,
>
> is there a way to disable the annoying warnings about carp and cgi which
> cgi programs write to the web-server's log file in a general way rather
> than per program?  Same goes for smartmatch warnings.
>
> The log file is overloaded with these useless messages, which makes it
> difficult to find actual errors/warnings.
>
> --
> To unsubscribe, e-mail: beginners-unsubscr...@perl.org
> For additional commands, e-mail: beginners-h...@perl.org
> http://learn.perl.org/
>
>
>


Re: carp and cgi warnings

2016-02-13 Thread Nathan Hilterbrand



On 02/13/2016 07:33 AM, lee wrote:

Hi,

is there a way to disable the annoying warnings about carp and cgi which
cgi programs write to the web-server's log file in a general way rather
than per program?  Same goes for smartmatch warnings.

The log file is overloaded with these useless messages, which makes it
difficult to find actual errors/warnings.



I am not 100% sure what you want to accomplish, but this *might* be 
helpful, or at least be a good place to start looking if you are using 
Apache 2:


https://www.howtoforge.com/setenvif_apache2



--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: carp and cgi warnings

2016-02-13 Thread lee
Brock Wilcox <awwa...@thelackthereof.org> writes:

> Greetings!
>
> Could you give an example of these warnings, and even better some minimal
> code that generates them?

Something like this gives you warnings in apaches error.log:


#!/usr/bin/perl
#
use strict;
use warnings;
use autodie;

use CGI;# qw(:standard);
[...]


The warning says that CGI will be removed from perl and that I should
install it from cpan.  I don't want to install things from cpan but the
package management of the distribution to take care of things because I
don't want to do the package management by myself.


For smartmatch:


perl -e 'print "foo" ~~ "bar";'
Smartmatch is experimental at -e line 1.


You get that for every line you're using smartmatch in.

Smartmatch works quite well; it's a really cool feature.  I already know
that it's experimental.  I don't need to be reminded of this 10 times
per minute in the log file while I'm trying to find a relevant message
amongst thousands of these useless warnings.

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: carp and cgi warnings

2016-02-13 Thread lee
Nathan Hilterbrand <noset...@cotse.net> writes:

> On 02/13/2016 07:33 AM, lee wrote:
>> Hi,
>>
>> is there a way to disable the annoying warnings about carp and cgi which
>> cgi programs write to the web-server's log file in a general way rather
>> than per program?  Same goes for smartmatch warnings.
>>
>> The log file is overloaded with these useless messages, which makes it
>> difficult to find actual errors/warnings.
>>
>
> I am not 100% sure what you want to accomplish, but this *might* be
> helpful, or at least be a good place to start looking if you are using
> Apache 2:

I'm trying to turn off the useless warnings in apaches' error.log from
cgi programs written in perl which keep telling me that cgi will be
removed and that smartmatch is experimental.

You get a really huge log file with totally useless warnings which only
hinder debugging.  I wonder who had the idea to print these, it's
ridiculous.

> https://www.howtoforge.com/setenvif_apache2

I'm not sure if that will help.  Apparently this isn't for suppressing
error messages from cgi programs?

I know you can put something into the perl program to suppress these
messages.  Of course, I don't want to go through all of them for this.
I want to disable these warnings at one place, for all the programs.

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: carp and cgi warnings

2016-02-13 Thread Uri Guttman

On 02/14/2016 01:09 AM, Uri Guttman wrote:

On 02/13/2016 02:07 PM, lee wrote:

Brock Wilcox <awwa...@thelackthereof.org> writes:


Greetings!

Could you give an example of these warnings, and even better some 
minimal

code that generates them?

Something like this gives you warnings in apaches error.log:


#!/usr/bin/perl
#
use strict;
use warnings;
use autodie;

use CGI;# qw(:standard);
[...]


The warning says that CGI will be removed from perl and that I should
install it from cpan.  I don't want to install things from cpan but the
package management of the distribution to take care of things because I
don't want to do the package management by myself.


For smartmatch:


perl -e 'print "foo" ~~ "bar";'
Smartmatch is experimental at -e line 1.


You get that for every line you're using smartmatch in.

Smartmatch works quite well; it's a really cool feature.  I already know
that it's experimental.  I don't need to be reminded of this 10 times
per minute in the log file while I'm trying to find a relevant message
amongst thousands of these useless warnings.


read the docs on warnings (perldoc warnings). it is easy to disable 
any warning you want. note that this will be lexical so you need to 
turn them off in the right location.


uri





and even more detail can be read with perldoc perllexwarn. all about 
enabling and disabling lexical warnings.


uri


--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: carp and cgi warnings

2016-02-13 Thread Uri Guttman

On 02/13/2016 02:07 PM, lee wrote:

Brock Wilcox <awwa...@thelackthereof.org> writes:


Greetings!

Could you give an example of these warnings, and even better some minimal
code that generates them?

Something like this gives you warnings in apaches error.log:


#!/usr/bin/perl
#
use strict;
use warnings;
use autodie;

use CGI;# qw(:standard);
[...]


The warning says that CGI will be removed from perl and that I should
install it from cpan.  I don't want to install things from cpan but the
package management of the distribution to take care of things because I
don't want to do the package management by myself.


For smartmatch:


perl -e 'print "foo" ~~ "bar";'
Smartmatch is experimental at -e line 1.


You get that for every line you're using smartmatch in.

Smartmatch works quite well; it's a really cool feature.  I already know
that it's experimental.  I don't need to be reminded of this 10 times
per minute in the log file while I'm trying to find a relevant message
amongst thousands of these useless warnings.


read the docs on warnings (perldoc warnings). it is easy to disable any 
warning you want. note that this will be lexical so you need to turn 
them off in the right location.


uri






--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: [perl #127353] CGI documentation, start_html missing

2016-01-25 Thread frederik
Hi Kent,

Thanks for your time, seems everyone works late (or early) around
here.

> This is verging into "user support", which is typically better targeted at 
> the "beginners@perl.org"[1] mailing list or any of the Web::Simple support 
> avenues[2], not RT/P5P, however, I don't like to leave something hanging.

I don't know if just Cc'ing beginners@perl.org will work? (I'm not
subscribed)

> On Fri Jan 22 22:58:28 2016, frede...@ofb.net wrote:
> > Thanks for the reply.
> > 
> > I hope that a compatible version of CGI continues to be available from
> > the standard repositories,
> 
> As far as I'm aware, CGI.pm will continue to be maintained and its bugs fixed 
> where possible, and will be available from CPAN mirrors. ( And even in the 
> event it vanished from CPAN, there's always BackPAN :) )

Got it, thank you.

> > because after reading your explanation, and
> > the synopsis of CGI::HTML::Functions, I still don't understand what
> > the problem with the existing interface is, or how I'm supposed to get
> > start_html using HTML::Tiny... 
> 
> There's no need to use start_html with HTML::Tiny.
> 
>   my $content = start_html( child_nodes()  );
> 
> vs
>  
>   my $g = HTML::Tiny->new();
>   my $html = $g->html( 
>$g->... 
>   );
> 
> Are basically the difference you're looking for.
> 
> The difference that matters is instead of *printing* it to STDOUT with 
> Web::Simple, you pass the HTML string inside the last array ( this is how the 
> PSGI protocol works )
> 
> return [ CODE, [ HEADING => VALUE ], [ $html ] ];

That sounds like a big difference. I find it very intuitive to write
code that goes

print start_table(...)
for(...) {
print tr(td(...))
}
print end_table(...)

I don't see a way to do this with HTML::Tiny. Furthermore, all the
documentation for functions like start_table and start_html has been
not only removed from CGI but also fails to appear in
CGI::HTML::Functions. This just seems like a big regression to me,
documentation-wise.

> > or what is "template driven page
> > generation"... and I just noticed that Web::Simple pulled in a ton of
> > dependencies! Oh, the irony. :)
> 
> Its still simple to *use*, and it is optimised for low-overhead startup time 
> and fat-packability irrc :)
> 
> > Wait, templates are just what I feared. ... sigh...
> 
> Templates aren't all that bad. Sometimes its just nicer to write pure HTML 
> than fuss with writing HTML with hundreds of perl function calls =)

I totally agree with that statement, and I could see myself using
Web::Simple/PSGI for certain projects.

But I would also assert that sometimes it's nicer to write Perl
function calls, without having to worry about HTML entities and
matching all those start and end tags with the little angle brackets
around each one... so why should that choice be deprecated, even
"softly"?

> But I'll leave it up to you if you want to send any follow up questions to 
> other channels. :) 
> 
> HTH. 
> 
> 1: http://lists.perl.org/list/beginners.html , 
> http://www.nntp.perl.org/group/perl.beginners/
> 2: https://metacpan.org/pod/Web::Simple#COMMUNITY-AND-SUPPORT

I submitted an issue with the CGI module 

https://github.com/leejo/CGI.pm/issues/195

Sorry I missed that 'perlbug' is only for core modules.

Take care,

Frederick

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




CGI::formbuilder

2016-01-22 Thread lee
Hi,

how do I arrange two (text) input fields side by side rather than one
underneath the other?

How do I automatically set the cursor into a particular field when the
form is loaded so that keyboard input is entered into that field without
the user having to select the field manually first?

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: At wits end CGI

2014-12-03 Thread Patton, Billy N
CGI::Application.pm is version 4.5
Somehow I’ve managed to move beyond this problem. Probably because I dumped 
perlbrew.

I’m now getting a time out.  With traces and multiple debug statements I’m 
getting to this location for the time out:

sub AUTOLOAD {
my($constname);
($constname = $AUTOLOAD) =~ s/.*:://o;
$! = 0;
my $val = constant($constname, @_ ? $_[0] : 0);
if ($! != 0) {
croak Your vendor has not defined Socket macro $constname, used;
}
eval sub $AUTOLOAD { $val };
goto $AUTOLOAD;
}
This is from file 
/System/Library/Perl/Extras/5.18/darwin-thread-multi-2level/Socket6.pm
I hit this inside the debugger.

The code below is from my module that inherits CGI::Application.
From some reason I don’t understand it calls 
CGI::Application::Plugin::TT::import the first thing.
I can’t find where that is coming from.
Why is it calling this before it even calls the “new” in Application.pm


warn Got to here :  . __FILE__ . ':'.__LINE__.\n;
use strict;
use base 'CGI::Application';
warn Got to here :  . __FILE__ . ':'.__LINE__.\n;
use CGI::Application::Plugin::TT; # Template Toolkit
use CGI::Application::Plugin::DBH (qw/dbh_config dbh/); # Database handles


On Nov 25, 2014, at 10:29 AM, John SJ Anderson 
geneh...@genehack.orgmailto:geneh...@genehack.org wrote:

What version of CGI::Application do you have installed?
4.5

Assuming the most recent one
(https://metacpan.org/source/MARKSTOS/CGI-Application-4.50/lib/CGI/Application.pm),
line 1951 is:

   if ( $p{path_info}  $self-query-path_info() ) {

$self-query calls the 'query' method, defined at line 493. I'm
guessing code flow goes into the 'else' half of the branch there, and
ends up calling $self-cgiapp_get_query() (on line 503).

That method is defined at line 250, and ultimately returns the result
of calling CGI-new().

I would suggest either putting in some debug print() statements into
that cgiapp_get_query() routine, or using the debugger to stop
execution inside there and looking at what that call from CGI-new()
is actually returning.

chrs,
john.








On Tue, Nov 25, 2014 at 7:56 AM, Patton, Billy N 
billy.pat...@h3net.commailto:billy.pat...@h3net.com wrote:
OS : mac 10.10.1 Yosemite
Perl version : 5.16.0 (perlbrew)
I have file cp.cgi that is the top level
It uses CP.pm
which inherits Base.pm
which inherits CGI::Application
CGI::Application Requires CGI.pm
CGI.pm has a use CGI::Util qw(… unescape …);

When I try and run cp.cgi I get a timeout.
The erro log only tells me that I get a timeout
[Tue Nov 25 09:13:53.677383 2014] [cgi:warn] [pid 461] [client ::1:63053] 
AH01220: Timeout waiting for output from CGI script 
/Library/WebServer/Documents/cportal/html/cp.cgi, referer: 
http://localhost/index.html

when I try and run it from the command line : perl cp.cgi
I get
h1Software error:/h1
preUndefined subroutine CGI::unescape
at 
/Users/bpatto/perl5/perlbrew/perls/perl-5.16.0/lib/site_perl/5.16.0/CGI/Application.pm
 line 1951.
/pre
p
For help, please send mail to this site's webmaster, giving this error message
and the time and date of the error.

/p
[Tue Nov 25 09:34:59 2014] cp.cgi: Undefined subroutine CGI::unescape
[Tue Nov 25 09:34:59 2014] cp.cgi:  at 
/Users/bpatto/perl5/perlbrew/perls/perl-5.16.0/lib/site_perl/5.16.0/CGI/Application.pm
 line 1951.

unescape exists in CGI::Util.pm and is exported.

When I put a Dumper \%INC I get: Making sure that I wasn’t mixing too many 
version

'CGI/Application.pm'  = 
'/Users/bpatto/perl5/perlbrew/perls/perl-5.16.0/lib/site_perl/5.16.0/CGI/Application.pm’,
'CGI/Application/Plugin/Redirect.pm'  = 
'/Users/bpatto/perl5/perlbrew/perls/perl-5.16.0/lib/site_perl/5.16.0/CGI/Application/Plugin/Redirect.pm',
'CGI/Application/Plugin/TT.pm'  = 
'/Users/bpatto/perl5/perlbrew/perls/perl-5.16.0/lib/site_perl/5.16.0/CGI/Application/Plugin/TT.pm’,
'CGI/Application/Plugin/ValidateRM.pm'  = 
'/Users/bpatto/perl5/perlbrew/perls/perl-5.16.0/lib/site_perl/5.16.0/CGI/Application/Plugin/ValidateRM.pm’,
'CGI/Application/Plugin/LogDispatch.pm'  = 
'/Users/bpatto/perl5/perlbrew/perls/perl-5.16.0/lib/site_perl/5.16.0/CGI/Application/Plugin/LogDispatch.pm',
'CGI/Carp.pm'  = 
'/Users/bpatto/perl5/perlbrew/perls/perl-5.16.0/lib/site_perl/5.16.0/CGI/Carp.pm’,
'CGI/Application/Plugin/Config/YAML.pm'  = 
'/Users/bpatto/perl5/perlbrew/perls/perl-5.16.0/lib/site_perl/5.16.0/CGI/Application/Plugin/Config/YAML.pm',
'CGI/Application/Plugin/DBH.pm'  = 
'/Users/bpatto/perl5/perlbrew/perls/perl-5.16.0/lib/site_perl/5.16.0/CGI/Application/Plugin/DBH.pm’,
'CGI/Util.pm'  = 
'/Users/bpatto/perl5/perlbrew/perls/perl-5.16.0/lib/site_perl/5.16.0/CGI/Util.pm’,
'CGI/Application/Plugin/Forward.pm'  = 
'/Users/bpatto/perl5/perlbrew/perls/perl-5.16.0/lib/site_perl/5.16.0/CGI/Application/Plugin/Forward.pm’,

unescape does not exist in Application, even though it tells me line 1951
%INC shows me that it is including the right file.
Util.pm is exporting
package CGI::Util;
use base 'Exporter';
require 5.008001;
use

Re: CGI::Application::Plugin::TT

2014-11-13 Thread Patton, Billy N
Doing the perlbrew thing now.
perl -MTemplate -e 1 returned nothing
But I did a sudo cpan Template and it told me it was up to date.
Hopefully this perlbrew will help things out.
thanks for the info.
On Nov 12, 2014, at 8:50 AM, John SJ Anderson 
geneh...@genehack.orgmailto:geneh...@genehack.org wrote:

perl -MTemplate -e 1


--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: CGI::Application::Plugin::TT

2014-11-13 Thread Andy Bach
On Wed, Nov 12, 2014 at 9:17 AM, Patton, Billy N billy.pat...@h3net.com
wrote:

 perl -MTemplate -e 1


It doesn't do anything except check that the module Template is available
via the standard include path (see (capital V):
perl -V

for the @INC array of paths) -e 1 is just a script of one char, the digit
one, which perl considers to be okay. Try (misspell your module name):
perl -MTomplate -e 1
Can't locate Tomplate.pm in @INC (@INC contains:
/usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi
/usr/lib/perl5/site_perl/5.8.8 /usr/lib/perl5/site_perl
/usr/lib64/perl5/vendor_perl/5.8.8/x86_64-linux-thread-multi
/usr/lib/perl5/vendor_perl/5.8.8 /usr/lib/perl5/vendor_perl
/usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi /usr/lib/perl5/5.8.8 .).
BEGIN failed--compilation aborted.

-- 

a

Andy Bach,
afb...@gmail.com
608 658-1890 cell
608 261-5738 wk


CGI::Application::Plugin::TT

2014-11-12 Thread Patton, Billy N
I’ve , mistakenly, updated to Mac OS 10.10 Yosemite.
That completely caused my app to fail in Apache 2.4.
Looks like it might be a version problem for TT.pm
I’ve tried to install a new TT.pm from cpan but it tells me that it is up to 
date.
I’ve tried changing the Template-new to HTML::Template- new with bad results.
I’ve tried changing use Template to use HTML::Template with bad results
I’ve tried changing the use Template 2.0; to use Template. results are still it 
fails;
It looks like MAC 10.10 was released with a bunch of incompatible versions of 
perl modules.
What can I do?
The error I’m getting is :

Can't locate object method new via package Template at 
/Library/Perl/5.18/CGI/Application/Plugin/TT.pm line 60.

TT.pm snippett :
use Template 2.0;
...
# Get a Template Toolkit object.  The same object
# will be returned everytime this method is called
# during a request cycle.
#
sub tt_obj {
my $self = shift;

my ($tt, $options, $frompkg) = _get_object_or_options($self);

if (!$tt) {
my $tt_options = $options-{TEMPLATE_OPTIONS};
if (keys %{$options-{TEMPLATE_OPTIONS}}) {
  $tt = Template-new( $options-{TEMPLATE_OPTIONS} ) || carp Can't 
load Template;
} else {
  $tt = Template-new || carp Can't load Template;
}
_set_object($frompkg||$self, $tt);
}
return $tt;
}
...

-
HTML/Template.pm

$HTML::Template::VERSION = '2.95’;
sub new {
my $pkg = shift;
my $self;
{ my %hash; $self = bless(\%hash, $pkg); }
...


Re: CGI::Application::Plugin::TT

2014-11-12 Thread SSC_perl
On Nov 12, 2014, at 4:54 AM, Patton, Billy N wrote:
 I’ve , mistakenly, updated to Mac OS 10.10 Yosemite.
 That completely caused my app to fail in Apache 2.4.

And that's one of the many reasons I'm not updating my MacBook. ;)

You really have too try Perlbrew http://perlbrew.pl/.  It's perfect 
for this.  You can install any version of Perl that you want, and then install 
the modules you'll need.  You can even install multiple versions of Perl and 
each version can have it's own set of modules!  Best of all, it leaves your 
system version of Perl untouched, which helps prevent problems for other apps 
that rely on it.

Perlbrew, along with cpanm, will make your Perl setup as painless as 
possible.  However, I do remember the initial setup was somewhat confusing 
because of a lack of documentation at the time.  Hopefully that's changed by 
now.  I've been using it for years now and I'd never go back.

Frank

SurfShopCART
https://github.com/surfshopcart/surfshop


--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: CGI::Application::Plugin::TT

2014-11-12 Thread John SJ Anderson
On Wed, Nov 12, 2014 at 4:54 AM, Patton, Billy N billy.pat...@h3net.com wrote:
 I’ve , mistakenly, updated to Mac OS 10.10 Yosemite.
 That completely caused my app to fail in Apache 2.4.
 Looks like it might be a version problem for TT.pm

TT.pm is really 'Template.pm'. Are you sure the Perl you're using has
it installed?

What does 'perl -MTemplate -e 1' tell you if you run it in a terminal?

On my Yosemite install, the system perl (at /usr/bin/perl) does not
have Template.pm installed. I'm not sure whether installed modules
were propagated across the update process (because I don't rely on the
system perl for anything), but I would strongly suspect they were
_not_.

You should consider -- *strongly* consider -- using perlbrew or plenv
to set up a Perl installation that is not under the control of your
operating system vendor. That helps reduce the occurrence of these
issues.

 I’ve tried to install a new TT.pm from cpan but it tells me that it is up to 
 date.
 I’ve tried changing the Template-new to HTML::Template- new with bad 
 results.
 I’ve tried changing use Template to use HTML::Template with bad results
 I’ve tried changing the use Template 2.0; to use Template. results are still 
 it fails;

One more note. This ^^ is what thrashing looks like. Don't start
randomly changing around pieces of your code hoping things will
magically work. Look at the actual error message that you're getting,
from the code that used to work. What does that say?

j.

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Testing my CGI

2014-11-04 Thread Patton, Billy N
I’m using WWW::Mechanize for testing my CGI.
I’m having trouble with the $mech-tick

Here’s my code :
  ok($mech-form_name('cdr_format'),getting form cdr_format);
print pAllFields =  . $mech-value('pAllFields') . \n;
219-  ok($mech-tick('pAllFields',1), 'Setting checkbox to native CDR format');
220-  ok($mech-tick('pAllFields’,0), 'Setting checkbox to native CDR format’);



Here’s a snippet of the html :
div id='myForm'
form name='cdr_format' method='POST' action='file_admin.cgi'
input type='hidden' name='rm' value='process_cdr_format'
input type='hidden' name='CGISESSID' 
value='ec4c3463d5a7f9d04d2924968413f240'
input type='hidden' name='cdr_format' value='1'
table border='0' cellpadding='3' cellspacing='0' width='100%'
tr
td class='fieldLabel' width='60%'
We would like the files in native CDR format:
/td
td class='field'
input type='checkbox' class='checkbox' name='pAllFields' value='1'

/td
/tr


When I execute I get this :
ok 40 - getting form cdr_format
Use of uninitialized value in concatenation (.) or string at ./test_cportal.pl 
line 218.
pAllFields =
not ok 41 - Setting checkbox to native CDR format
#   Failed test 'Setting checkbox to native CDR format'
#   at ./test_cportal.pl line 219.
not ok 42 - Setting checkbox to native CDR format
#   Failed test 'Setting checkbox to native CDR format'
#   at ./test_cportal.pl line 220.

Here’s the documentation from WWW::Mechanize
$mech-tick( $name, $value [, $set] )

Ticks the first checkbox that has both the name and value associated with it 
on the current form. Dies if there is no named check box for that value. 
Passing in a false value as the third optional argument will cause the checkbox 
to be unticked.


Re: Testing my CGI

2014-11-04 Thread John SJ Anderson
Look at the source code for the module. The 'tick' method just uses a
bare 'return' on success, which means it's going to fail an ok() test
regardless of whether or not it works.

You may also want to look at Test::WWW::Mechanize.

chrs,
john.


On Tue, Nov 4, 2014 at 7:30 AM, Patton, Billy N billy.pat...@h3net.com wrote:
 I’m using WWW::Mechanize for testing my CGI.
 I’m having trouble with the $mech-tick

 Here’s my code :
   ok($mech-form_name('cdr_format'),getting form cdr_format);
 print pAllFields =  . $mech-value('pAllFields') . \n;
 219-  ok($mech-tick('pAllFields',1), 'Setting checkbox to native CDR 
 format');
 220-  ok($mech-tick('pAllFields’,0), 'Setting checkbox to native CDR 
 format’);



 Here’s a snippet of the html :
 div id='myForm'
 form name='cdr_format' method='POST' action='file_admin.cgi'
 input type='hidden' name='rm' value='process_cdr_format'
 input type='hidden' name='CGISESSID' 
 value='ec4c3463d5a7f9d04d2924968413f240'
 input type='hidden' name='cdr_format' value='1'
 table border='0' cellpadding='3' cellspacing='0' width='100%'
 tr
 td class='fieldLabel' width='60%'
 We would like the files in native CDR format:
 /td
 td class='field'
 input type='checkbox' class='checkbox' name='pAllFields' value='1'

 /td
 /tr


 When I execute I get this :
 ok 40 - getting form cdr_format
 Use of uninitialized value in concatenation (.) or string at 
 ./test_cportal.pl line 218.
 pAllFields =
 not ok 41 - Setting checkbox to native CDR format
 #   Failed test 'Setting checkbox to native CDR format'
 #   at ./test_cportal.pl line 219.
 not ok 42 - Setting checkbox to native CDR format
 #   Failed test 'Setting checkbox to native CDR format'
 #   at ./test_cportal.pl line 220.

 Here’s the documentation from WWW::Mechanize
 $mech-tick( $name, $value [, $set] )

 Ticks the first checkbox that has both the name and value associated with 
 it on the current form. Dies if there is no named check box for that value. 
 Passing in a false value as the third optional argument will cause the 
 checkbox to be unticked.

--
To unsubscribe, e-mail: beginners-cgi-unsubscr...@perl.org
For additional commands, e-mail: beginners-cgi-h...@perl.org
http://learn.perl.org/




Re: cgi and inheritance

2014-10-08 Thread jbdetroit
I haven't seen any PErl code with -log- like that before. I've only seen code 
like that with = error(*).

-Original Message-
From: Patton, Billy billy.pat...@h3net.com
Sent: Oct 6, 2014 9:33 AM
To: beginners-cgi@perl.org beginners-cgi@perl.org
Subject: cgi and inheritance

I’ve recently inherited some code that hasn’t been touched in over 5 years. 
It’s all cgi and OOPerl.
I’ve ran across this one statement that I don’t understand.

$self-log-error(*)

I know the self
and I’ve traced the error to CGI::Application through inheritance.
But it’s the -log- that has me confused.
I have no class named log
I find no place that is does a new on log anywhere in the family tree.
I cannot find any log class anywhere in the family tree of inheritance.

Is this just a method of using a perl hash that I’m not familiar with?
Could it be rewritten as 
$self-{‘log’}-error(*);

Using perl 5.16.2
on MAC 10.9.5
--
To unsubscribe, e-mail: beginners-cgi-unsubscr...@perl.org
For additional commands, e-mail: beginners-cgi-h...@perl.org
http://learn.perl.org/




--
To unsubscribe, e-mail: beginners-cgi-unsubscr...@perl.org
For additional commands, e-mail: beginners-cgi-h...@perl.org
http://learn.perl.org/




cgi and inheritance

2014-10-06 Thread Patton, Billy
I’ve recently inherited some code that hasn’t been touched in over 5 years. 
It’s all cgi and OOPerl.
I’ve ran across this one statement that I don’t understand.

$self-log-error(*)

I know the self
and I’ve traced the error to CGI::Application through inheritance.
But it’s the -log- that has me confused.
I have no class named log
I find no place that is does a new on log anywhere in the family tree.
I cannot find any log class anywhere in the family tree of inheritance.

Is this just a method of using a perl hash that I’m not familiar with?
Could it be rewritten as 
$self-{‘log’}-error(*);

Using perl 5.16.2
on MAC 10.9.5
--
To unsubscribe, e-mail: beginners-cgi-unsubscr...@perl.org
For additional commands, e-mail: beginners-cgi-h...@perl.org
http://learn.perl.org/




Re: cgi and inheritance

2014-10-06 Thread John SJ Anderson
On Mon, Oct 6, 2014 at 6:33 AM, Patton, Billy billy.pat...@h3net.com wrote:
 I’ve recently inherited some code that hasn’t been touched in over 5 years. 
 It’s all cgi and OOPerl.
 I’ve ran across this one statement that I don’t understand.

 $self-log-error(*)

That's calling the 'error()' method, on the result returned by calling
the 'log()' method, on the current object ($self).

You could also write that as:

my $log = $self-log();
$log-error(*)

(I'm assuming '*' is a stand-in for the actual arguments.)

chrs,
john.

--
To unsubscribe, e-mail: beginners-cgi-unsubscr...@perl.org
For additional commands, e-mail: beginners-cgi-h...@perl.org
http://learn.perl.org/




Re: Perl CGI-html quotation marks

2014-07-04 Thread James Kerwin
Hello again,

Apologies for the delay. I shut my laptop in frustration for the night
yesterday.

Here is a chunk of the code:

my $html2 = '/Results.tar.gz
div style=text-align: center;button type=submitDownload
Files/button/div
p style=text-align: center;Click the button below to View your
alignment in JBrowse Viewer/p
input type=button value=Open Window
onclick=window.open(\'
bioinf6.bioc.le.ac.uk/~srpgrp3/JBrowse-1.11.4/index.html?data=http://bioinf6.bioc.le.ac.uk/~srpgrp3/UserFiles
';


my $html4 =
'/datatracks=DNA,transcript_with_no_features,Geneshighlight=\')
  /body
/html';

print $html1;
print $directory;
print $html3;
print $directory;
print $html2;
print $directory;
print $html4;

Another person in my group had a look at it today and let me know that I
hadn't closed the button THING with a . Apparently with that it's able
to handle the single quotation marks.

What a fool!

Thanks,
James.


On Thu, Jul 3, 2014 at 5:23 PM, Uri Guttman u...@stemsystems.com wrote:

 On 07/03/2014 12:16 PM, James Kerwin wrote:

 Hello all,

 I'm currently using Perl CGI to generate a Results webpage. This
 results webpage specifies unique directories generated within the script
 and print these in between the blocks of html so various download and
 display buttons work.

 My problem is that I'm using a button to open a file in a new tab and
 the new tab URL uses single quotes and won't work using double or none.
 This then messes up the printing of the html in the Perl script.

 Can anybody help me? (Example provided below).

   input type=button value=Open Window
 onclick=window.open('THE URL OF THE FILE I WANT TO OPEN IN A NEW TAB
 UPON CLICKING THE BUTTON')


 it would be most helpful if you posted your relevant perl code. if you say
 it messes up printing html i sense you are not creating your html strings
 in the best way.

 uri


 --
 Uri Guttman - The Perl Hunter
 The Best Perl Jobs, The Best Perl Hackers
 http://PerlHunter.com

 --
 To unsubscribe, e-mail: beginners-unsubscr...@perl.org
 For additional commands, e-mail: beginners-h...@perl.org
 http://learn.perl.org/





Re: Perl CGI-html quotation marks

2014-07-04 Thread Sam

On 07/04/2014 12:41 AM, Shaji Kalidasan wrote:

Here's one way to do it

print  BUTTON;
input type=button value=Open Window
onclick=window.open('http://www.example.com')
BUTTON



or:

print qq{input type=button value=Open Window
 onclick=window.open('http://www.example.com')};



--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: Perl CGI-html quotation marks

2014-07-04 Thread Uri Guttman

On 07/04/2014 07:18 AM, James Kerwin wrote:

Hello again,

Apologies for the delay. I shut my laptop in frustration for the night
yesterday.

Here is a chunk of the code:

my $html2 = '/Results.tar.gz
div style=text-align: center;button type=submitDownload
Files/button/div
p style=text-align: center;Click the button below to View your
alignment in JBrowse Viewer/p
input type=button value=Open Window
onclick=window.open(\'bioinf6.bioc.le.ac.uk/~srpgrp3/JBrowse-1.11.4/index.html?data=http://bioinf6.bioc.le.ac.uk/~srpgrp3/UserFiles
http://bioinf6.bioc.le.ac.uk/~srpgrp3/JBrowse-1.11.4/index.html?data=http://bioinf6.bioc.le.ac.uk/~srpgrp3/UserFiles';


my $html4 =
'/datatracks=DNA,transcript_with_no_features,Geneshighlight=\')
   /body
/html';

print $html1;
print $directory;
print $html3;
print $directory;
print $html2;
print $directory;
print $html4;

Another person in my group had a look at it today and let me know that I
hadn't closed the button THING with a . Apparently with that it's
able to handle the single quotation marks.



regardless of the html error you must do a better job with your strings. 
don't use single quotes when you have single quotes in the string. use a 
here document (someone posted that for you) or an alternate delimiter 
(another post showed that). that way you don't need to escape your 
internal quote chars and you can see the text better and find any 
missing angles and such.


also you can print all those in one print call. just pass the variables 
in a list to print. no need to print one at a time.


uri


--
Uri Guttman - The Perl Hunter
The Best Perl Jobs, The Best Perl Hackers
http://PerlHunter.com

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: Perl CGI-html quotation marks

2014-07-04 Thread Shlomi Fish
Hi all,

thanks for helping James (= the original poster).

On Fri, 04 Jul 2014 11:56:05 -0400
Uri Guttman u...@stemsystems.com wrote:

 On 07/04/2014 07:18 AM, James Kerwin wrote:
  Hello again,
 
  Apologies for the delay. I shut my laptop in frustration for the night
  yesterday.
 
  Here is a chunk of the code:
 
  my $html2 = '/Results.tar.gz
  div style=text-align: center;button type=submitDownload
  Files/button/div
  p style=text-align: center;Click the button below to View your
  alignment in JBrowse Viewer/p
  input type=button value=Open Window
  onclick=window.open(\'bioinf6.bioc.le.ac.uk/~srpgrp3/JBrowse-1.11.4/index.html?data=http://bioinf6.bioc.le.ac.uk/~srpgrp3/UserFiles
  http://bioinf6.bioc.le.ac.uk/~srpgrp3/JBrowse-1.11.4/index.html?data=http://bioinf6.bioc.le.ac.uk/~srpgrp3/UserFiles';
 
 
  my $html4 =
  '/datatracks=DNA,transcript_with_no_features,Geneshighlight=\')
 /body
  /html';
 
  print $html1;
  print $directory;
  print $html3;
  print $directory;
  print $html2;
  print $directory;
  print $html4;
 
  Another person in my group had a look at it today and let me know that I
  hadn't closed the button THING with a . Apparently with that it's
  able to handle the single quotation marks.
 
 
 regardless of the html error you must do a better job with your strings. 
 don't use single quotes when you have single quotes in the string. use a 
 here document (someone posted that for you) or an alternate delimiter 
 (another post showed that). that way you don't need to escape your 
 internal quote chars and you can see the text better and find any 
 missing angles and such.
 

Indeed. One should note that Perl 5 has very good quoting support with its
here-documents, interpolation, variable delimiters, and also - templating
systems such as Template Toolkit. There's a thread about it on Sayeret Lambda (=
an Israeli forum of programming languages’ enthusiasts):

* https://groups.google.com/forum/#!topic/sayeret-lambda/oTdS8d0hqoE

It sparked an active discussion there.

When doing Perl, one should make a wise use of all that.

Regards,

Shlomi Fish

-- 
-
Shlomi Fish   http://www.shlomifish.org/
Apple Inc. is Evil - http://www.shlomifish.org/open-source/anti/apple/

What does “IDK” stand for? I don’t know.

Please reply to list if it's a mailing list post - http://shlom.in/reply .

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Perl CGI-html quotation marks

2014-07-03 Thread James Kerwin
Hello all,

I'm currently using Perl CGI to generate a Results webpage. This results
webpage specifies unique directories generated within the script and print
these in between the blocks of html so various download and display buttons
work.

My problem is that I'm using a button to open a file in a new tab and the
new tab URL uses single quotes and won't work using double or none. This
then messes up the printing of the html in the Perl script.

Can anybody help me? (Example provided below).

 input type=button value=Open Window
onclick=window.open('THE URL OF THE FILE I WANT TO OPEN IN A NEW TAB UPON
CLICKING THE BUTTON')

If this isn't clear or it's a total sin to post html in an email to the
list then I apologise.

Any help is greatly appreciated!

Thanks,
James.


Re: Perl CGI-html quotation marks

2014-07-03 Thread Uri Guttman

On 07/03/2014 12:16 PM, James Kerwin wrote:

Hello all,

I'm currently using Perl CGI to generate a Results webpage. This
results webpage specifies unique directories generated within the script
and print these in between the blocks of html so various download and
display buttons work.

My problem is that I'm using a button to open a file in a new tab and
the new tab URL uses single quotes and won't work using double or none.
This then messes up the printing of the html in the Perl script.

Can anybody help me? (Example provided below).

  input type=button value=Open Window
onclick=window.open('THE URL OF THE FILE I WANT TO OPEN IN A NEW TAB
UPON CLICKING THE BUTTON')


it would be most helpful if you posted your relevant perl code. if you 
say it messes up printing html i sense you are not creating your html 
strings in the best way.


uri


--
Uri Guttman - The Perl Hunter
The Best Perl Jobs, The Best Perl Hackers
http://PerlHunter.com

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: Perl CGI-html quotation marks

2014-07-03 Thread Shaji Kalidasan
Here's one way to do it

print  BUTTON;
input type=button value=Open Window onclick=window.open('
http://www.example.com')
BUTTON


On Thu, Jul 3, 2014 at 9:53 PM, Uri Guttman u...@stemsystems.com wrote:

 On 07/03/2014 12:16 PM, James Kerwin wrote:

 Hello all,

 I'm currently using Perl CGI to generate a Results webpage. This
 results webpage specifies unique directories generated within the script
 and print these in between the blocks of html so various download and
 display buttons work.

 My problem is that I'm using a button to open a file in a new tab and
 the new tab URL uses single quotes and won't work using double or none.
 This then messes up the printing of the html in the Perl script.

 Can anybody help me? (Example provided below).

   input type=button value=Open Window
 onclick=window.open('THE URL OF THE FILE I WANT TO OPEN IN A NEW TAB
 UPON CLICKING THE BUTTON')


 it would be most helpful if you posted your relevant perl code. if you say
 it messes up printing html i sense you are not creating your html strings
 in the best way.

 uri


 --
 Uri Guttman - The Perl Hunter
 The Best Perl Jobs, The Best Perl Hackers
 http://PerlHunter.com

 --
 To unsubscribe, e-mail: beginners-unsubscr...@perl.org
 For additional commands, e-mail: beginners-h...@perl.org
 http://learn.perl.org/





-- 
best,
Shaji
--
Your talent is God's gift to you. What you do with it is your gift back to
God.
--


Re: CGI script produces blank screen

2014-06-28 Thread Ahmad Bilal
Perhaps some module on which the script depends is not available/installed
on that server. But yes.. looking into the web server error log should
help.


On 28 June 2014 08:35, John SJ Anderson geneh...@genehack.org wrote:

 On Fri, Jun 27, 2014 at 7:34 PM, SSC_perl p...@surfshopcart.com wrote:
  Any input would be greatly appreciated!

 Look in the web server error log.

 --
 To unsubscribe, e-mail: beginners-unsubscr...@perl.org
 For additional commands, e-mail: beginners-h...@perl.org
 http://learn.perl.org/





-- 
*Ahmad Bilal*
*Founder*

*Buddzter Web Services LLP*


Re: CGI script produces blank screen

2014-06-28 Thread SSC_perl
 Perhaps some module on which the script depends is not available/installed on 
 that server. But yes.. looking into the web server error log should help. 
 
 
 On 28 June 2014 08:35, John SJ Anderson geneh...@genehack.org wrote:
 On Fri, Jun 27, 2014 at 7:34 PM, SSC_perl p...@surfshopcart.com wrote:
  Any input would be greatly appreciated!
 
 Look in the web server error log.

Thanks for the pointers, guys.  It turned out to be an errant line in 
the .htaccess file on that domain.  It would have paid to take that out of the 
equation first.

Frank

http://www.surfshopcart.com/
Setting up shop has never been easier!




CGI script produces blank screen

2014-06-27 Thread SSC_perl
I don't have a lot of info to go on just yet, so please bear with me.

I'm experiencing a problem with a blank screen on a certain install of 
SurfShop.  When on a product detail page that has options, if I try to add that 
item to the cart w/o selecting any of the options, it should return the current 
page with a warning that I need to select the options.  However, I'm getting a 
completely blank screen.  Even when viewing the source, there's no HTML being 
output.

The odd part is that I copied this same installation to another server 
-- so it's an exact duplicate -- and it functions normally there!  As far as I 
can tell, the code seems O.K.  The only difference that I can see, so far, are 
the different servers.  One's running Perl 5.8.8 and the other has 5.10.1.  The 
latter is the one that's working correctly.

What kind of tests can I do to see why it's acting up on one server and 
not another?  I'm already running with warnings and CGI::Carp, but without any 
output, I'm at a loss as what to try next.

Any input would be greatly appreciated!

Thanks,
Frank

http://www.surfshopcart.com/
Setting up shop has never been easier!


--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: CGI script produces blank screen

2014-06-27 Thread John SJ Anderson
On Fri, Jun 27, 2014 at 7:34 PM, SSC_perl p...@surfshopcart.com wrote:
 Any input would be greatly appreciated!

Look in the web server error log.

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: Wanted: Help with DBI/CGI in Windows 8.1/IIS

2014-06-26 Thread Bruce Ferrell

On 06/25/2014 09:52 PM, Bruce Ferrell wrote:

On 06/25/2014 07:53 PM, siegfr...@heintze.com wrote:

The following program works great inside of IIS when called from
internet explorer (IE).

It also works great if I remove the comment characters (#) in column 1
and run it at the cygwin bash command prompt. It displays the expected
HTML.

However, if I only remove the first comment character in column one and
run it in IIS, internet explorer times out and complains about a bad
header being returned.

Can someone help me so I can incorporate DBI and microsoft access in my
web page?
Thanks
Siegfried


use DBI;
use strict;
use warnings;
use POSIX;
use CGI qw(:standard);
use CGI::Cookie;
#my $dbh  = DBI-connect(dbi:ODBC:driver=microsoft access driver
(*.mdb, *.accdb);dbq=c:\\inetpub\\wwwroot\\Nwind.accdb);
# $dbh-{LongReadLen} = 66000;
# $dbh-{LongTruncOk} = 0;
# my $stmt=SELECT * FROM Customers;
# my $sth = $dbh-prepare($stmt);
# $sth-execute || die Could not execute SQL statement $stmt ... maybe
invalid?;
my $q =new CGI;
my $ct = strftime %a %b %d %H:%M:%S %Y\n, localtime;
$q = new CGI;# create new CGI object
print $q-header,# create the HTTP header
   $q-start_html('hello world'), # start the HTML
   $q-h1(hello world $ct); # level 1 header

print $q-end_html;  # end the HTML

I can never remember which list want top or bottom posts so if I got the wrong 
end, please be gentle.

The first question that comes to mind is which perl binary is installed on your 
 windows system?

The next question is what do the iis logs tell you?  The calls to CGI look ok, 
as do the DBI calls except you may want to quote the strings with embedded 
spaces.

I've very conversant in IIS and Apache on both Linux and Windows so feel free 
to contact me off list.

Bruce



One more thing that came up while testing your code... Did you configure the 
ODBC datasource?

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: Wanted: Help with DBI/CGI in Windows 8.1/IIS

2014-06-26 Thread Robert Wohlfarth
On Thu, Jun 26, 2014 at 1:04 AM, Bruce Ferrell bferr...@baywinds.org
wrote:

 On 06/25/2014 09:52 PM, Bruce Ferrell wrote:

 On 06/25/2014 07:53 PM, siegfr...@heintze.com wrote:

 use DBI;
 use strict;
 use warnings;
 use POSIX;
 use CGI qw(:standard);
 use CGI::Cookie;
 #my $dbh  = DBI-connect(dbi:ODBC:driver=microsoft access driver
 (*.mdb, *.accdb);dbq=c:\\inetpub\\wwwroot\\Nwind.accdb);
 # $dbh-{LongReadLen} = 66000;
 # $dbh-{LongTruncOk} = 0;
 # my $stmt=SELECT * FROM Customers;
 # my $sth = $dbh-prepare($stmt);
 # $sth-execute || die Could not execute SQL statement $stmt ... maybe
 invalid?;
 my $q =new CGI;
 my $ct = strftime %a %b %d %H:%M:%S %Y\n, localtime;
 $q = new CGI;# create new CGI object
 print $q-header,# create the HTTP header
$q-start_html('hello world'), # start the HTML
$q-h1(hello world $ct); # level 1 header

 print $q-end_html;  # end the HTML

 snip...

 One more thing that came up while testing your code... Did you configure
 the ODBC datasource?


Is Microsoft Access installed on the server? DBI will need it to read the
file.

-- 
Robert Wohlfarth


Wanted: Help with DBI/CGI in Windows 8.1/IIS

2014-06-25 Thread siegfried
The following program works great inside of IIS when called from
internet explorer (IE).

It also works great if I remove the comment characters (#) in column 1
and run it at the cygwin bash command prompt. It displays the expected
HTML.

However, if I only remove the first comment character in column one and
run it in IIS, internet explorer times out and complains about a bad
header being returned.

Can someone help me so I can incorporate DBI and microsoft access in my
web page?
Thanks
Siegfried


use DBI;
use strict;
use warnings;
use POSIX;
use CGI qw(:standard);
use CGI::Cookie;
#my $dbh  = DBI-connect(dbi:ODBC:driver=microsoft access driver
(*.mdb, *.accdb);dbq=c:\\inetpub\\wwwroot\\Nwind.accdb);
# $dbh-{LongReadLen} = 66000;
# $dbh-{LongTruncOk} = 0;
# my $stmt=SELECT * FROM Customers;
# my $sth = $dbh-prepare($stmt);
# $sth-execute || die Could not execute SQL statement $stmt ... maybe
invalid?;
my $q =new CGI;
my $ct = strftime %a %b %d %H:%M:%S %Y\n, localtime;
$q = new CGI;# create new CGI object
print $q-header,# create the HTTP header
  $q-start_html('hello world'), # start the HTML
  $q-h1(hello world $ct); # level 1 header

print $q-end_html;  # end the HTML



--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: Wanted: Help with DBI/CGI in Windows 8.1/IIS

2014-06-25 Thread Bruce Ferrell

On 06/25/2014 07:53 PM, siegfr...@heintze.com wrote:

The following program works great inside of IIS when called from
internet explorer (IE).

It also works great if I remove the comment characters (#) in column 1
and run it at the cygwin bash command prompt. It displays the expected
HTML.

However, if I only remove the first comment character in column one and
run it in IIS, internet explorer times out and complains about a bad
header being returned.

Can someone help me so I can incorporate DBI and microsoft access in my
web page?
Thanks
Siegfried


use DBI;
use strict;
use warnings;
use POSIX;
use CGI qw(:standard);
use CGI::Cookie;
#my $dbh  = DBI-connect(dbi:ODBC:driver=microsoft access driver
(*.mdb, *.accdb);dbq=c:\\inetpub\\wwwroot\\Nwind.accdb);
# $dbh-{LongReadLen} = 66000;
# $dbh-{LongTruncOk} = 0;
# my $stmt=SELECT * FROM Customers;
# my $sth = $dbh-prepare($stmt);
# $sth-execute || die Could not execute SQL statement $stmt ... maybe
invalid?;
my $q =new CGI;
my $ct = strftime %a %b %d %H:%M:%S %Y\n, localtime;
$q = new CGI;# create new CGI object
print $q-header,# create the HTTP header
   $q-start_html('hello world'), # start the HTML
   $q-h1(hello world $ct); # level 1 header

print $q-end_html;  # end the HTML

I can never remember which list want top or bottom posts so if I got the wrong 
end, please be gentle.

The first question that comes to mind is which perl binary is installed on your 
 windows system?

The next question is what do the iis logs tell you?  The calls to CGI look ok, 
as do the DBI calls except you may want to quote the strings with embedded 
spaces.

I've very conversant in IIS and Apache on both Linux and Windows so feel free 
to contact me off list.

Bruce


--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: bash to perl for cgi

2014-06-18 Thread Philippe Rousselot

Le 18/06/2014 02:46, Goke Aruna a écrit :


When you run  the scripts from the cli, what do you get on your screen?
What about Apache configuration is cgi script executable.
What permission do you have on your script?

Hope those questions can give you a guide.


Hi

thanks for the answer

*error message**:*

Internal Server Error

The server encountered an internal error or misconfiguration and was 
unable to complete your request.


Please contact the server administrator  and inform them of the time the 
error occurred, and anything you might have done that may have caused 
the error.


More information about this error may be available in the server error log.


*rights for files and folders *  rwxr-xr-x

*error message in logs : *

[Wed Jun 18 17:43:38 2014] [error] [client xxx] [host 
www.une-histoire-de-famille.net] Premature end of script headers: geneweb



I tried any kind of permissions, checked on hidden characters in files,

this file with the same permissions works fine

~~
#!/usr/bin/perl
# test.cgi by Bill Weinman [http://bw.org/]
# Copyright 1995-2008 The BearHeart Group, LLC
# Free Software: Use and distribution under the same terms as perl.

use strict;
use warnings;
use CGI;

print foreach (
Content-Type: text/plain\n\n,
BW Test version 5.0\n,
Copyright 1995-2008 The BearHeart Group, LLC\n\n,
Versions:\n=\n,
perl: $]\n,
CGI: $CGI::VERSION\n
);

my $q = CGI::Vars();
print \nCGI Values:\n=\n;
foreach my $k ( sort keys %$q ) {
print $k [$q-{$k}]\n;
}

print \nEnvironment Variables:\n=\n;
foreach my $k ( sort keys %ENV ) {
print $k [$ENV{$k}]\n;
}
~~

thanks for the help.

Philippe




Re: bash to perl for cgi

2014-06-18 Thread Hal Wigoda
It may need to be owned by apache or httpd.
Whoever is running httpd.

On Wed, Jun 18, 2014 at 11:08 AM, Philippe Rousselot
rousse...@rousselot.org wrote:
 Le 18/06/2014 02:46, Goke Aruna a écrit :

 When you run  the scripts from the cli, what do you get on your screen?
 What about Apache configuration is cgi script executable.
 What permission do you have on your script?

 Hope those questions can give you a guide.

 Hi

 thanks for the answer

 error message:

 Internal Server Error

 The server encountered an internal error or misconfiguration and was unable
 to complete your request.

 Please contact the server administrator  and inform them of the time the
 error occurred, and anything you might have done that may have caused the
 error.

 More information about this error may be available in the server error log.


 rights for files and folders   rwxr-xr-x

 error message in logs :

 [Wed Jun 18 17:43:38 2014] [error] [client xxx] [host
 www.une-histoire-de-famille.net] Premature end of script headers: geneweb



 I tried any kind of permissions, checked on hidden characters in files,

 this file with the same permissions works fine

 ~~
 #!/usr/bin/perl
 # test.cgi by Bill Weinman [http://bw.org/]
 # Copyright 1995-2008 The BearHeart Group, LLC
 # Free Software: Use and distribution under the same terms as perl.

 use strict;
 use warnings;
 use CGI;

 print foreach (
 Content-Type: text/plain\n\n,
 BW Test version 5.0\n,
 Copyright 1995-2008 The BearHeart Group, LLC\n\n,
 Versions:\n=\n,
 perl: $]\n,
 CGI: $CGI::VERSION\n
 );

 my $q = CGI::Vars();
 print \nCGI Values:\n=\n;
 foreach my $k ( sort keys %$q ) {
 print $k [$q-{$k}]\n;
 }

 print \nEnvironment Variables:\n=\n;
 foreach my $k ( sort keys %ENV ) {
 print $k [$ENV{$k}]\n;
 }
 ~~

 thanks for the help.

 Philippe





-- 
-
Hal Wigoda
Chicago

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




bash to perl for cgi

2014-06-17 Thread Philippe Rousselot

Hi,

I know nothing about perl and I have a problem with a cgi script for a 
website called geneweb (genealogy stuff).


I moved from one web site to another and now the site does not work and 
give me a 500 error message.


cgi-bin and a perl script work fine. Here is the script I used to test :

~~

#!/usr/bin/perl
# test.cgi by Bill Weinman [http://bw.org/]
# Copyright 1995-2008 The BearHeart Group, LLC
# Free Software: Use and distribution under the same terms as perl.

use strict;
use warnings;
use CGI;

print foreach (
Content-Type: text/plain\n\n,
BW Test version 5.0\n,
Copyright 1995-2008 The BearHeart Group, LLC\n\n,
Versions:\n=\n,
perl: $]\n,
CGI: $CGI::VERSION\n
);

my $q = CGI::Vars();
print \nCGI Values:\n=\n;
foreach my $k ( sort keys %$q ) {
print $k [$q-{$k}]\n;
}

print \nEnvironment Variables:\n=\n;
foreach my $k ( sort keys %ENV ) {
print $k [$ENV{$k}]\n;
}

~~

the script I need to call the program is the following

~~
   #!/bin/sh
DIR=/homez.xxx//www/geneweb607/gw
cd $DIR
$DIR/gwd -cgi 2/dev/null

~~

I guessed, but I may be wrong that I cannot use a sh script (I checked 
for files and folders rights)


Could someone give me a translation in perl of this script so I can try 
out this idea


For info the host provider is OVH and the website is stored on a 'Perso 
2014'



In advance thank you very much

Philippe

--
Philippe Rousselot

--
Philippe Rousselot



Re: bash to perl for cgi

2014-06-17 Thread Jim Gibson

On Jun 17, 2014, at 1:10 AM, Philippe Rousselot rousse...@rousselot.org wrote:

 Hi, 
 
 I know nothing about perl and I have a problem with a cgi script for a 
 website called geneweb (genealogy stuff). 
 
 I moved from one web site to another and now the site does not work and give 
 me a 500 error message. 

Do you have access to the web server logs? Those could be very helpful in 
diagnosing your error.

 the script I need to call the program is the following 
 
 ~~ 
#!/bin/sh 
 DIR=/homez.xxx//www/geneweb607/gw 
 cd $DIR 
 $DIR/gwd -cgi 2/dev/null 
 
 ~~ 
 
 I guessed, but I may be wrong that I cannot use a sh script (I checked for 
 files and folders rights) 

I am no web expert, but as far as I know, there is no reason why you can’t run 
a shell script as a CGI program. However, there may be security issues, and you 
may have reconfigure your server. You are probably better off using Perl 
instead.
  
 Could someone give me a translation in perl of this script so I can try out 
 this idea 

Here is a Perl program that does the same thing as your shell script:

#!/bin/env perl
use strict;
use warnings;
my $dir = q(/homez.xxx//www/geneweb607/gw);
system(“cd $dir;$dir/gwd -cgi 2/dev/null”)’

Good luck!


--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: bash to perl for cgi

2014-06-17 Thread Goke Aruna
When you run  the scripts from the cli, what do you get on your screen?
What about Apache configuration is cgi script executable.
What permission do you have on your script?

Hope those questions can give you a guide.

Regards
On Jun 17, 2014 3:00 PM, Jim Gibson j...@gibson.org wrote:


 On Jun 17, 2014, at 1:10 AM, Philippe Rousselot rousse...@rousselot.org
 wrote:

  Hi,
 
  I know nothing about perl and I have a problem with a cgi script for a
 website called geneweb (genealogy stuff).
 
  I moved from one web site to another and now the site does not work and
 give me a 500 error message.

 Do you have access to the web server logs? Those could be very helpful in
 diagnosing your error.

  the script I need to call the program is the following
 
  ~~
 #!/bin/sh
  DIR=/homez.xxx//www/geneweb607/gw
  cd $DIR
  $DIR/gwd -cgi 2/dev/null
 
  ~~
 
  I guessed, but I may be wrong that I cannot use a sh script (I checked
 for files and folders rights)

 I am no web expert, but as far as I know, there is no reason why you can’t
 run a shell script as a CGI program. However, there may be security issues,
 and you may have reconfigure your server. You are probably better off using
 Perl instead.

  Could someone give me a translation in perl of this script so I can try
 out this idea

 Here is a Perl program that does the same thing as your shell script:

 #!/bin/env perl
 use strict;
 use warnings;
 my $dir = q(/homez.xxx//www/geneweb607/gw);
 system(“cd $dir;$dir/gwd -cgi 2/dev/null”)’

 Good luck!


 --
 To unsubscribe, e-mail: beginners-unsubscr...@perl.org
 For additional commands, e-mail: beginners-h...@perl.org
 http://learn.perl.org/





Running older cgi scripts on nginx

2013-11-07 Thread Angela Barone
Hello,

I've set up a new cloud account to get familiar with nginx and I'd like 
to know if it's possible to run an older cgi perl script, and if so, how would 
I go about doing that?  I think I read somewhere that it could be done with 
Plack, but I can't find any instructions on how to do it.  Can someone help me 
with this?

Grazie mille!
Angela
--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: Running older cgi scripts on nginx

2013-11-07 Thread Jim Gibson

On Nov 7, 2013, at 3:22 PM, Angela Barone wrote:

 Hello,
 
   I've set up a new cloud account to get familiar with nginx and I'd like 
 to know if it's possible to run an older cgi perl script, and if so, how 
 would I go about doing that?  I think I read somewhere that it could be done 
 with Plack, but I can't find any instructions on how to do it.  Can someone 
 help me with this?

I suggest you enter the string 'nginx cgi' into a search engine and follow the 
links. You can also read the nginx documentation on how to execute CGI programs 
here:

http://wiki.nginx.org/Configuration

Scroll down to the sections titled CGI, FastCGI examples, and Embedded 
Perl examples.


--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: BEGIN Block in CGI Script

2013-01-28 Thread Mike Flannigan


Thank you.


On 1/28/2013 3:07 PM, Shawn Corey wrote:

The attached CGI is useful for determining what a script's environment
is.




BEGIN Block in CGI Script

2013-01-27 Thread Mike Flannigan


I have written some CGI applications that start
with this code:


BEGIN {
my $homedir = ( getpwuid($) )[7];
my @user_include;
foreach my $path (@INC) {
if ( -d $homedir . '/perl' . $path ) {
push @user_include, $homedir . '/perl' . $path;
}
}
unshift @INC, @user_include;
}


I have failed to document exactly what this section
is doing and would like to correct that.  Am I correct
when I say that this code includes all the directories
where Perl is located (C:/Perl in my case) in @INC, so
there is little chance of not finding a module I have
installed and am calling in this CGI script?


Mike Flannigan



--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: BEGIN Block in CGI Script

2013-01-27 Thread Ken Slater
On Sun, Jan 27, 2013 at 11:30 AM, Mike Flannigan mikef...@att.net wrote:

 I have written some CGI applications that start
 with this code:


 BEGIN {
 my $homedir = ( getpwuid($) )[7];
 my @user_include;
 foreach my $path (@INC) {
 if ( -d $homedir . '/perl' . $path ) {
 push @user_include, $homedir . '/perl' . $path;
 }
 }
 unshift @INC, @user_include;
 }


 I have failed to document exactly what this section
 is doing and would like to correct that.  Am I correct
 when I say that this code includes all the directories
 where Perl is located (C:/Perl in my case) in @INC, so
 there is little chance of not finding a module I have
 installed and am calling in this CGI script?


 Mike Flannigan


Hi,
I may be wrong, as I haven't used CGI or done much web programming,
but here is my take.
getpwuid seems like a unix call - are you sure this code is running on Windows.
This call is returning the home directory of the effective user of the script.
It the loops through each directory in the Perl include directories (@INC).
If a directory with the same name as a directory in the Perl include
path exists under the a perl subdirectory of the effective user's home
directory, it is added to the Perl include directories.  More
importantly, it is 'unshifted', so it is placed ahead of the usual
include directory that it matches. Thus the user's Perl subdirectory
will be used instead of the standard Perl installation library.
I do not think this would work on Windows, as the include directories
include the drive (C:,etc) in their name.
Not sure whether it would work on Unix (linux, etc), but that seems
like what it was designed for.
HTH,
Ken
HTH,
Ken

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: BEGIN Block in CGI Script

2013-01-27 Thread Shawn H Corey
On Sun, 27 Jan 2013 10:30:38 -0600
Mike Flannigan mikef...@att.net wrote:

 
 I have written some CGI applications that start
 with this code:
 
 
 BEGIN {
  my $homedir = ( getpwuid($) )[7];
  my @user_include;
  foreach my $path (@INC) {
  if ( -d $homedir . '/perl' . $path ) {
  push @user_include, $homedir . '/perl' . $path;
  }
  }
  unshift @INC, @user_include;
 }
 
 
 I have failed to document exactly what this section
 is doing and would like to correct that.  Am I correct
 when I say that this code includes all the directories
 where Perl is located (C:/Perl in my case) in @INC, so
 there is little chance of not finding a module I have
 installed and am calling in this CGI script?

It's better to keep local modules under the same directory as the
script.

use FindBin qw( $RealBin );
use lib $RealBin;

See:
perldoc FindBin
perldoc lib


-- 
Don't stop where the ink does.
Shawn

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: BEGIN Block in CGI Script

2013-01-27 Thread Mike Flannigan


Thanks so much for the quick response.  I
appreciate it.

Of course I am putting this cgi file on my website
domain and running it there, so in a way it is
running on Unix.

It is running that code, but whether it is working
or not is not clear to me.

At the beginning of the code @INC is:
/usr/local/lib/perl5/5.8.8/x86_64-linux/usr/local/lib/perl5/5.8.8/usr/local/lib/perl5/site_perl/5.8.8/x86_64-linux/usr/local/lib/perl5/site_perl/5.8.8/usr/local/lib/perl5/site_perl.


When the code is finished @INC is almost identical:
/usr/local/lib/perl5/5.8.8/x86_64-linux /usr/local/lib/perl5/5.8.8 
/usr/local/lib/perl5/site_perl/5.8.8/x86_64-linux 
/usr/local/lib/perl5/site_perl/5.8.8 /usr/local/lib/perl5/site_perl .


The space at the end is the only thing that is
different.  I am printing $path right after the
foreach for the first @INC printout.  I use
'print \n\n\@INC = @INC\n;' for the 2nd printout
of @INC.

That @INC data is apparently from the website domain.

I get the digest version of this list, so it may
take me a while to respond to all posters.


Mike


On 1/27/2013 10:50 AM, Ken Slater wrote:


Hi,
I may be wrong, as I haven't used CGI or done much web programming,
but here is my take.
getpwuid seems like a unix call - are you sure this code is running on Windows.
This call is returning the home directory of the effective user of the script.
It the loops through each directory in the Perl include directories (@INC).
If a directory with the same name as a directory in the Perl include
path exists under the a perl subdirectory of the effective user's home
directory, it is added to the Perl include directories.  More
importantly, it is 'unshifted', so it is placed ahead of the usual
include directory that it matches. Thus the user's Perl subdirectory
will be used instead of the standard Perl installation library.
I do not think this would work on Windows, as the include directories
include the drive (C:,etc) in their name.
Not sure whether it would work on Unix (linux, etc), but that seems
like what it was designed for.
HTH,
Ken
HTH,
Ken




--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: BEGIN Block in CGI Script

2013-01-27 Thread Shawn H Corey
On Sun, 27 Jan 2013 12:30:17 -0600
Mike Flannigan mikef...@att.net wrote:

 That @INC data is apparently from the website domain.

The attached CGI is useful for determining what a script's environment
is.

-- 
Don't stop where the ink does.
Shawn


env.cgi
Description: Binary data
-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Re: Mojolicious as replacement for cgi?

2013-01-10 Thread Shlomi Fish
Hi Kavita,

On Thu, 10 Jan 2013 13:26:15 +0530
kavita kulkarni kavitahkulka...@gmail.com wrote:

 Hello,
 Is there any simple documentation/book/link besides mojo-lite/CPAN online
 documentation that will help me to understand the OO Perl programming and
 web based perl programming?
 
 I am naive in Perl  OO progamming and have to get quickly started with
 perl mojo.

By naive do you mean inexperienced or not proficient? I'll assume so.

 Thanks in advance.
 

Please see the various resources at http://perl-begin.org/ and especially the
ones at:

* http://perl-begin.org/topics/object-oriented/

* http://perl-begin.org/tutorials/

* http://perl-begin.org/uses/web/

Regards,

Shlomi Fish

 Regards,
 Kavita :-)
 
 
 On Wed, Jan 9, 2013 at 6:39 PM, Manolis Tzanidakis
 mtzanida...@gmail.comwrote:
 
   On Wed (09/01/13), kavita kulkarni wrote:
   Hello,
  
   I am having a cgi script to present DB monitoring results.
   Now, I am thinking about migrating that script into mojo (Mojolocious)
  and
   I have below queries in my mind:
  
   1. What's advantage of using mojo over cgi?
   2. Is mojolocious ready to deploy in production? if so, which version
  goes
   well with perl 5.8.8 on Linux?
   3. Any other suggestion?
   Thanks in advance.
  
   Regards,
   Kavita :-)
 
  Hi there. Mojolicious is great and Mojolicious::Lite would be ideal for
  your project. Plus, it has great docs and tutorials.
 
  To answers your questions:
  1. Security, simplicity.
  2. Better check out perlbrew http://perlbrew.pl/ to install a newer
  perl, without interfering with your distro's packages. A nice production
  setup is nginx as reverse proxy in front of mojo's hypnotoad.
  3. Dancer (http://www.perldancer.org/) is also another option, but I
  prefer Mojo.
 
  Best,
 
  --
  Manolis Tzanidakis
  http://mtzanidakis.com/
  mtzanidakis[at]gmail[dot]com
 
  --
  To unsubscribe, e-mail: beginners-unsubscr...@perl.org
  For additional commands, e-mail: beginners-h...@perl.org
  http://learn.perl.org/
 
 
 



-- 
-
Shlomi Fish   http://www.shlomifish.org/
Beginners Site for the Vim text editor - http://vim.begin-site.org/

PerlJam I’m trying to achieve world peace and this regex is the last thing
standing in my way! ;)

Please reply to list if it's a mailing list post - http://shlom.in/reply .

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: Mojolicious as replacement for cgi?

2013-01-10 Thread Manolis Tzanidakis
On Thu (10/01/13), kavita kulkarni wrote:
 Hello,
 Is there any simple documentation/book/link besides mojo-lite/CPAN online
 documentation that will help me to understand the OO Perl programming and
 web based perl programming?
 
 I am naive in Perl  OO progamming and have to get quickly started with
 perl mojo.
 Thanks in advance.

Hello,
make sure to watch mojo screencasts at http://mojocasts.com/ and follow
through their tutorials. If you need a book to get started - following
best practices - I highly recommend the latest edition of Modern Perl,
http://modernperlbooks.com/books/modern_perl/ .

Give it a couple of days and you'll be on your way.

-- 
Manolis Tzanidakis
http://mtzanidakis.com/
mtzanidakis[at]gmail[dot]com

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Mojolicious as replacement for cgi?

2013-01-09 Thread kavita kulkarni
Hello,

I am having a cgi script to present DB monitoring results.
Now, I am thinking about migrating that script into mojo (Mojolocious) and
I have below queries in my mind:

1. What's advantage of using mojo over cgi?
2. Is mojolocious ready to deploy in production? if so, which version goes
well with perl 5.8.8 on Linux?
3. Any other suggestion?
Thanks in advance.

Regards,
Kavita :-)


Re: Mojolicious as replacement for cgi?

2013-01-09 Thread Manolis Tzanidakis
On Wed (09/01/13), kavita kulkarni wrote:
 Hello,
 
 I am having a cgi script to present DB monitoring results.
 Now, I am thinking about migrating that script into mojo (Mojolocious) and
 I have below queries in my mind:
 
 1. What's advantage of using mojo over cgi?
 2. Is mojolocious ready to deploy in production? if so, which version goes
 well with perl 5.8.8 on Linux?
 3. Any other suggestion?
 Thanks in advance.
 
 Regards,
 Kavita :-)

Hi there. Mojolicious is great and Mojolicious::Lite would be ideal for
your project. Plus, it has great docs and tutorials.

To answers your questions:
1. Security, simplicity.
2. Better check out perlbrew http://perlbrew.pl/ to install a newer
perl, without interfering with your distro's packages. A nice production
setup is nginx as reverse proxy in front of mojo's hypnotoad.
3. Dancer (http://www.perldancer.org/) is also another option, but I
prefer Mojo.

Best,

-- 
Manolis Tzanidakis
http://mtzanidakis.com/
mtzanidakis[at]gmail[dot]com

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: Mojolicious as replacement for cgi?

2013-01-09 Thread kavita kulkarni
Thanks Manolis for your reply.
However, I am not supposed to upgrade my perl.

Regards,
Kavita :-)


On Wed, Jan 9, 2013 at 6:39 PM, Manolis Tzanidakis mtzanida...@gmail.comwrote:

  On Wed (09/01/13), kavita kulkarni wrote:
  Hello,
 
  I am having a cgi script to present DB monitoring results.
  Now, I am thinking about migrating that script into mojo (Mojolocious)
 and
  I have below queries in my mind:
 
  1. What's advantage of using mojo over cgi?
  2. Is mojolocious ready to deploy in production? if so, which version
 goes
  well with perl 5.8.8 on Linux?
  3. Any other suggestion?
  Thanks in advance.
 
  Regards,
  Kavita :-)

 Hi there. Mojolicious is great and Mojolicious::Lite would be ideal for
 your project. Plus, it has great docs and tutorials.

 To answers your questions:
 1. Security, simplicity.
 2. Better check out perlbrew http://perlbrew.pl/ to install a newer
 perl, without interfering with your distro's packages. A nice production
 setup is nginx as reverse proxy in front of mojo's hypnotoad.
 3. Dancer (http://www.perldancer.org/) is also another option, but I
 prefer Mojo.

 Best,

 --
 Manolis Tzanidakis
 http://mtzanidakis.com/
 mtzanidakis[at]gmail[dot]com

 --
 To unsubscribe, e-mail: beginners-unsubscr...@perl.org
 For additional commands, e-mail: beginners-h...@perl.org
 http://learn.perl.org/





Re: Mojolicious as replacement for cgi?

2013-01-09 Thread kavita kulkarni
Hello,
Is there any simple documentation/book/link besides mojo-lite/CPAN online
documentation that will help me to understand the OO Perl programming and
web based perl programming?

I am naive in Perl  OO progamming and have to get quickly started with
perl mojo.
Thanks in advance.

Regards,
Kavita :-)


On Wed, Jan 9, 2013 at 6:39 PM, Manolis Tzanidakis mtzanida...@gmail.comwrote:

  On Wed (09/01/13), kavita kulkarni wrote:
  Hello,
 
  I am having a cgi script to present DB monitoring results.
  Now, I am thinking about migrating that script into mojo (Mojolocious)
 and
  I have below queries in my mind:
 
  1. What's advantage of using mojo over cgi?
  2. Is mojolocious ready to deploy in production? if so, which version
 goes
  well with perl 5.8.8 on Linux?
  3. Any other suggestion?
  Thanks in advance.
 
  Regards,
  Kavita :-)

 Hi there. Mojolicious is great and Mojolicious::Lite would be ideal for
 your project. Plus, it has great docs and tutorials.

 To answers your questions:
 1. Security, simplicity.
 2. Better check out perlbrew http://perlbrew.pl/ to install a newer
 perl, without interfering with your distro's packages. A nice production
 setup is nginx as reverse proxy in front of mojo's hypnotoad.
 3. Dancer (http://www.perldancer.org/) is also another option, but I
 prefer Mojo.

 Best,

 --
 Manolis Tzanidakis
 http://mtzanidakis.com/
 mtzanidakis[at]gmail[dot]com

 --
 To unsubscribe, e-mail: beginners-unsubscr...@perl.org
 For additional commands, e-mail: beginners-h...@perl.org
 http://learn.perl.org/





Re: Is CGI module has bug for Win7?

2012-10-27 Thread Praveen Kumar
Thanks all of you for your suggestions, yesterday late evening I figured it
out about returning \r\n . I also checked after setting input record
separator($/) variable to \r\n which was also working.
I like the idea about setting binmode.

Thanks again.

-- 
Praveen Kumar
http://fedoraproject.org/wiki/User:Kumarpraveen
http://fedoraproject.org/
http://kumar-pravin.blogspot.com


Is CGI module has bug for Win7?

2012-10-26 Thread Praveen Kumar
Hi folks,

Check out below code, is this as expected or kind of bug?

code
use strict;
use warnings;
use CGI;

my $product_id=484f2faee9334559a1a72b4cdc056818;
print Enter NT Login ID : ;
chomp (my $user = STDIN);#praveenku...@gmail.com

print Enter NT Password : ;
chomp (my $password = STDIN); #randompass
print Enter Build Number : ;
chomp (my $bfolder = STDIN); #12

print User : $user, Password : $password, build : $bfolder;


=== Output =
C:\Users\pkumar22\Desktop\MAT_Testingperl matrix-getbuildoutputurl.pl
Enter NT Login ID : praveenku...@gmail.com

Enter NT Password : randompass
Enter Build Number : 12
, build : 12 randompassil.com -- This is what I am getting

User : praveenku...@gmail.com, Password : randompass, build : 12  --
This is what I expect.

/code

-- 
Praveen Kumar
http://fedoraproject.org/wiki/User:Kumarpraveen
http://fedoraproject.org/
http://kumar-pravin.blogspot.com


Re: Is CGI module has bug for Win7?

2012-10-26 Thread Shlomi Fish
Hi Praveen,

On Fri, 26 Oct 2012 15:57:36 +0530
Praveen Kumar kumarpraveen.nit...@gmail.com wrote:

 Hi folks,
 
 Check out below code, is this as expected or kind of bug?
 
 code
 use strict;
 use warnings;
 use CGI;
 
 my $product_id=484f2faee9334559a1a72b4cdc056818;
 print Enter NT Login ID : ;
 chomp (my $user = STDIN);#praveenku...@gmail.com

it is possible that the CGI module traps the STDIN because it is
part of the CGI specification:

http://en.wikipedia.org/wiki/Common_Gateway_Interface

Furthermore, you should look into PSGI/Plack as an alternative to
CGI:

http://en.wikipedia.org/wiki/Perl_Web_Server_Gateway_Interface

Regards,

Shlomi Fish

-- 
-
Shlomi Fish   http://www.shlomifish.org/
Humanity - Parody of Modern Life - http://shlom.in/humanity

danderson “We are NO LONGER the knights who say ‘BitKeeper’. We are now
the knights who say ‘git, git, git, cogito — Linus!’.”

Please reply to list if it's a mailing list post - http://shlom.in/reply .

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: Is CGI module has bug for Win7?

2012-10-26 Thread Ken Slater
On Fri, Oct 26, 2012 at 6:27 AM, Praveen Kumar
kumarpraveen.nit...@gmail.com wrote:
 Hi folks,

 Check out below code, is this as expected or kind of bug?

 code
 use strict;
 use warnings;
 use CGI;

 my $product_id=484f2faee9334559a1a72b4cdc056818;
 print Enter NT Login ID : ;
 chomp (my $user = STDIN);#praveenku...@gmail.com

 print Enter NT Password : ;
 chomp (my $password = STDIN); #randompass
 print Enter Build Number : ;
 chomp (my $bfolder = STDIN); #12

 print User : $user, Password : $password, build : $bfolder;


 === Output =
 C:\Users\pkumar22\Desktop\MAT_Testingperl matrix-getbuildoutputurl.pl
 Enter NT Login ID : praveenku...@gmail.com

 Enter NT Password : randompass
 Enter Build Number : 12
 , build : 12 randompassil.com -- This is what I am getting

 User : praveenku...@gmail.com, Password : randompass, build : 12  --
 This is what I expect.

 /code

 --
 Praveen Kumar
 http://fedoraproject.org/wiki/User:Kumarpraveen
 http://fedoraproject.org/
 http://kumar-pravin.blogspot.com

Hello,
I don't use CGI, but if you look at the values returned from reading
STDIN, you will notice they have a carriage return and a newline as
the last two characters. If CGI is not in the mix, the values only
have a newline (no carriage return).
Someone more familiar with GCI may be able to explain this.
By the way, I tested on Windows XP.
HTH, Ken

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: Is CGI module has bug for Win7?

2012-10-26 Thread Andy Bach
On Fri, Oct 26, 2012 at 5:27 AM, Praveen Kumar
kumarpraveen.nit...@gmail.com wrote:
 , build : 12 randompassil.com -- This is what I am getting

 User : praveenku...@gmail.com, Password : randompass, build : 12  --

Yeah, stack them up and:

User : praveenku...@gmail.com
, Password : randompass
, build : 12  --

That is:
User : praveenku...@gmail.com\r, Password : randompass\r, build : 12\r  --

your chomps are removing \n (newline) from the input but not \r
(carriage return) - Perl normally does that correctly by deciding
which OS you're on.

Hmm:
http://www.perlmonks.org/bare/?node_id=55540

Seems to say that Win32 CGI.pm sets binmode on STDIN (and STDERR,
STDOUT).  Does adding:
$/ = \r\n;

after
use CGI;

make a difference?

-- 

a

Andy Bach,
afb...@gmail.com
608 658-1890 cell
608 261-5738 wk

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: Is CGI module has bug for Win7?

2012-10-26 Thread Charles DeRykus
On Fri, Oct 26, 2012 at 10:25 AM, Andy Bach afb...@gmail.com wrote:
 On Fri, Oct 26, 2012 at 5:27 AM, Praveen Kumar
 kumarpraveen.nit...@gmail.com wrote:
 , build : 12 randompassil.com -- This is what I am getting

 User : praveenku...@gmail.com, Password : randompass, build : 12  --

 Yeah, stack them up and:

 User : praveenku...@gmail.com
 , Password : randompass
 , build : 12  --

 That is:
 User : praveenku...@gmail.com\r, Password : randompass\r, build : 12\r  --

 your chomps are removing \n (newline) from the input but not \r
 (carriage return) - Perl normally does that correctly by deciding
 which OS you're on.

 Hmm:
 http://www.perlmonks.org/bare/?node_id=55540

 Seems to say that Win32 CGI.pm sets binmode on STDIN (and STDERR,
 STDOUT).  Does adding:
 $/ = \r\n;

 after
 use CGI;

Or, just:

   binmode  STDIN,  :crlf;

This is Perl's layer to implement DOS/Windows like CRLF line endings.
See: perldoc perlio

-- 
Charles DeRykus

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: cgi development environment

2012-09-19 Thread David Dorward
On 18 Sep 2012, at 13:34, Chris Stinemetz chrisstinem...@gmail.com wrote:
 I am very interested in cgi scripting. I have only used php for web
 development in the past.

CGI or Perl? For a long time CGI with Perl was a popular combination so there 
are a lot of documents which conflate the two.

It is possible to do CGI programming in PHP (which you already know), but 
PSGI[1] is the flavour du jour for server side web programming with Perl.

CGI is still a plausible option though. It has the benefit of simplicity (but 
isn't the most efficient option).

[1] http://plackperl.org/


-- 
David Dorward
http://dorward.me.uk


--
To unsubscribe, e-mail: beginners-cgi-unsubscr...@perl.org
For additional commands, e-mail: beginners-cgi-h...@perl.org
http://learn.perl.org/




Re: cgi development environment

2012-09-19 Thread Chris Stinemetz
I have my Perl cgi development environment all set-up. I actually
wound up setting up an instance through Amazon AWS.
Very cool service by Amazon.

I am having issues with my first script and have hopes someone may be
able to explain to me whey it isn't working correctly.

The error is coming form line 11 and the error is:

Premature end of script headers: test2.cgi
Bareword left not allowed while strict subs in use at
/usr/lib/cgi-bin/test2.cgi line 7.
Execution of /usr/lib/cgi-bin/test2.cgi aborted due to compilation errors.
Premature end of script headers: test2.cgi


  1 #!/usr/bin/perl
  2 use warnings;
  3 use strict;
  4 use CGI;
  5
  6 my $q = CGI-new;
  7 print $q-header(-type='text/html'),
  8   $q-start_html('hello world'), # start the HTML
  9   $q-h1({-align=right},'hello world'), # level 1 header
 10   $q-h1({-align=left});
 11   $q-h1('some','contents');
 12   $q-end_html;  # end the HTML

Thank you in advance,

-Chris

-- 
To unsubscribe, e-mail: beginners-cgi-unsubscr...@perl.org
For additional commands, e-mail: beginners-cgi-h...@perl.org
http://learn.perl.org/




Re: cgi development environment

2012-09-19 Thread Mike Williams
On Wed, Sep 19, 2012 at 10:48 PM, Chris Stinemetz
chrisstinem...@gmail.comwrote:


  am having issues with my first script and have hopes someone may be
 able to explain to me whey it isn't working correctly.

 The error is coming form line 11 and the error is:

 Premature end of script headers: test2.cgi
 Bareword left not allowed while strict subs in use at


The error message is a major clue.  Try quotes around left


 /usr/lib/cgi-bin/test2.cgi line 7.
 Execution of /usr/lib/cgi-bin/test2.cgi aborted due to compilation errors.
 Premature end of script headers: test2.cgi


   1 #!/usr/bin/perl
   2 use warnings;
   3 use strict;
   4 use CGI;
   5
   6 my $q = CGI-new;
   7 print $q-header(-type='text/html'),
   8   $q-start_html('hello world'), # start the HTML
   9   $q-h1({-align=right},'hello world'), # level 1 header
  10   $q-h1({-align=left});
  11   $q-h1('some','contents');
  12   $q-end_html;  # end the HTML


You have a couple other issues.  Since you have one print statement, spread
over multiple lines, the semi-colons on lines 10 and 11 are bugs.  They
should be commas.  The semi-colons terminate the statement resulting in
syntax errors.

Mike


Re: cgi development environment

2012-09-19 Thread Chris Stinemetz

 You have a couple other issues.  Since you have one print statement, spread
 over multiple lines, the semi-colons on lines 10 and 11 are bugs.  They
 should be commas.  The semi-colons terminate the statement resulting in
 syntax errors.

 Mike

Thank you. That fixed it.

-Chris

-- 
To unsubscribe, e-mail: beginners-cgi-unsubscr...@perl.org
For additional commands, e-mail: beginners-cgi-h...@perl.org
http://learn.perl.org/




Re: cgi development environment

2012-09-19 Thread Shaun Fryer
Also check out http://search.cpan.org/~lds/CGI.pm-3.08/CGI/Carp.pm
--
Shaun Fryer
--
perl -e 'print chr for map{$_+=22}($ARGV[0])=~/(\d\d)/g' \
52959394107588899482799210587992861082757785799222
--


On Wed, Sep 19, 2012 at 11:54 PM, Chris Stinemetz
chrisstinem...@gmail.com wrote:

 You have a couple other issues.  Since you have one print statement, spread
 over multiple lines, the semi-colons on lines 10 and 11 are bugs.  They
 should be commas.  The semi-colons terminate the statement resulting in
 syntax errors.

 Mike

 Thank you. That fixed it.

 -Chris

 --
 To unsubscribe, e-mail: beginners-cgi-unsubscr...@perl.org
 For additional commands, e-mail: beginners-cgi-h...@perl.org
 http://learn.perl.org/



-- 
To unsubscribe, e-mail: beginners-cgi-unsubscr...@perl.org
For additional commands, e-mail: beginners-cgi-h...@perl.org
http://learn.perl.org/




cgi development environment

2012-09-18 Thread Chris Stinemetz
Hello list,

I am very interested in cgi scripting. I have only used php for web
development in the past.
Would someone please let me know of any good tutorials to get windows
based web development environment set up and get my feet wet?

Thank you in advance,

Chris

-- 
To unsubscribe, e-mail: beginners-cgi-unsubscr...@perl.org
For additional commands, e-mail: beginners-cgi-h...@perl.org
http://learn.perl.org/




Re: cgi development environment

2012-09-18 Thread Mark Haney

On 09/18/2012 08:34 AM, Chris Stinemetz wrote:

Hello list,

I am very interested in cgi scripting. I have only used php for web
development in the past.
Would someone please let me know of any good tutorials to get windows
based web development environment set up and get my feet wet?

Thank you in advance,

Chris



Is there any particular reason it has to be Windows based?  Not that I 
think it matters, but perl works okay on windows, but it's not a 
platform combo I would recommend.


Would you consider learning it in a VM in Linux?

Otherwise I can get you setup in windows with Perl if you like.  I had 
to write up a setup sheet when I was working on a project.




--

Mark Haney
Software Developer/Consultant
AB Emblem
ma...@abemblem.com
Linux marius.homelinux.org 3.5.1-1.fc17.x86_64 GNU/Linux

--
To unsubscribe, e-mail: beginners-cgi-unsubscr...@perl.org
For additional commands, e-mail: beginners-cgi-h...@perl.org
http://learn.perl.org/




Re: cgi development environment

2012-09-18 Thread David Christensen

On 09/18/12 05:34, Chris Stinemetz wrote:

I am very interested in cgi scripting. I have only used php for web
development in the past.
Would someone please let me know of any good tutorials to get windows
based web development environment set up and get my feet wet?


http://www.google.com/search?q=windows+cgi+howto

http://www.cgi101.com/book/

http://www.cgi101.com/book/connect/winxp.html


HTH,

David


--
To unsubscribe, e-mail: beginners-cgi-unsubscr...@perl.org
For additional commands, e-mail: beginners-cgi-h...@perl.org
http://learn.perl.org/




Re: cgi development environment

2012-09-18 Thread Shaun Fryer
Native Win32 Perl: http://strawberryperl.com/
Win32 Linux compat layer: http://www.cygwin.com/
Free virtualization env: https://www.virtualbox.org/
Perl Win32 API bindings: https://www.google.ca/search?q=perl+win32+ole
--
Shaun Fryer
--
perl -e 'print chr for map{$_+=22}($ARGV[0])=~/(\d\d)/g' \
52959394107588899482799210587992861082757785799222
--

On Tue, Sep 18, 2012 at 9:19 AM, David Christensen
dpchr...@holgerdanske.com wrote:
 On 09/18/12 05:34, Chris Stinemetz wrote:

 I am very interested in cgi scripting. I have only used php for web
 development in the past.
 Would someone please let me know of any good tutorials to get windows
 based web development environment set up and get my feet wet?


 http://www.google.com/search?q=windows+cgi+howto

 http://www.cgi101.com/book/

 http://www.cgi101.com/book/connect/winxp.html


 HTH,

 David


 --
 To unsubscribe, e-mail: beginners-cgi-unsubscr...@perl.org
 For additional commands, e-mail: beginners-cgi-h...@perl.org
 http://learn.perl.org/



-- 
To unsubscribe, e-mail: beginners-cgi-unsubscr...@perl.org
For additional commands, e-mail: beginners-cgi-h...@perl.org
http://learn.perl.org/




Re: cgi development environment

2012-09-18 Thread Chris Stinemetz
On Tue, Sep 18, 2012 at 5:46 AM, Mark Haney ma...@abemblem.com wrote:
 On 09/18/2012 08:34 AM, Chris Stinemetz wrote:

 Hello list,

 I am very interested in cgi scripting. I have only used php for web
 development in the past.
 Would someone please let me know of any good tutorials to get windows
 based web development environment set up and get my feet wet?

 Thank you in advance,

 Chris


 Is there any particular reason it has to be Windows based?  Not that I think
 it matters, but perl works okay on windows, but it's not a platform combo I
 would recommend.

 Would you consider learning it in a VM in Linux?

 Otherwise I can get you setup in windows with Perl if you like.  I had to
 write up a setup sheet when I was working on a project.


I'm not against using VM to set-up a linux box. If you have a write up
I would like to see it.

Thank you,

Chris

-- 
To unsubscribe, e-mail: beginners-cgi-unsubscr...@perl.org
For additional commands, e-mail: beginners-cgi-h...@perl.org
http://learn.perl.org/




Re: cgi development environment

2012-09-18 Thread Shaun Fryer
If you're running Windows and have a decent amount of RAM, try
installing vbox and then you should be able to find/follow
instructions online to load/install any of the freely available linux
iso's downloadable from the distro's website. I'd recommend either
Ubuntu or Mint, though your preference may vary. It's generally pretty
straight forward.
--
Shaun Fryer
--
perl -e 'print chr for map{$_+=22}($ARGV[0])=~/(\d\d)/g' \
52959394107588899482799210587992861082757785799222
--


On Tue, Sep 18, 2012 at 7:53 PM, Chris Stinemetz
chrisstinem...@gmail.com wrote:
 On Tue, Sep 18, 2012 at 5:46 AM, Mark Haney ma...@abemblem.com wrote:
 On 09/18/2012 08:34 AM, Chris Stinemetz wrote:

 Hello list,

 I am very interested in cgi scripting. I have only used php for web
 development in the past.
 Would someone please let me know of any good tutorials to get windows
 based web development environment set up and get my feet wet?

 Thank you in advance,

 Chris


 Is there any particular reason it has to be Windows based?  Not that I think
 it matters, but perl works okay on windows, but it's not a platform combo I
 would recommend.

 Would you consider learning it in a VM in Linux?

 Otherwise I can get you setup in windows with Perl if you like.  I had to
 write up a setup sheet when I was working on a project.


 I'm not against using VM to set-up a linux box. If you have a write up
 I would like to see it.

 Thank you,

 Chris

 --
 To unsubscribe, e-mail: beginners-cgi-unsubscr...@perl.org
 For additional commands, e-mail: beginners-cgi-h...@perl.org
 http://learn.perl.org/



-- 
To unsubscribe, e-mail: beginners-cgi-unsubscr...@perl.org
For additional commands, e-mail: beginners-cgi-h...@perl.org
http://learn.perl.org/




how to set session variable (not session cookie) using perl CGI

2012-08-07 Thread Rajeev Prasad
I am using CGI.pm on my website, but I generate my pages using TT (template 
Toolkit).
 
I have few questions:
 
0. how to have a session variable (not a session cookie)? If I do not want to 
use cookie, do i have to store session data in a temp file on server and check 
it with each page load?
 
 
1.  How do I pass a cookie to the page I am displaying using tt ? is following 
ok?
 
print Content-type: text/html\n\n;
print $q-header(-cookie=$mycookie);
...further code to generate page using tt
 
2. another related issue is: How do I send a redirect URL to the browser 
client, based on some conditions in the logic?
 
ty.
Rajeev

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: how to set session variable (not session cookie) using perl CGI

2012-08-07 Thread David Christensen

On 08/07/12 14:40, Rajeev Prasad wrote:

I am using CGI.pm on my website, but I generate my pages using TT (template 
Toolkit).
I have few questions:
0. how to have a session variable (not a session cookie)? If I do not want to 
use cookie, do i have to store session data in a temp file on server and check 
it with each page load?
1.  How do I pass a cookie to the page I am displaying using tt ? is following 
ok?
print Content-type: text/html\n\n;
print $q-header(-cookie=$mycookie);
...further code to generate page using tt
2. another related issue is: How do I send a redirect URL to the browser 
client, based on some conditions in the logic?


http://www.wiley.com/legacy/compbooks/stein/

http://shop.oreilly.com/product/9781565924192.do

http://shop.oreilly.com/product/9780596004767.do


HTH,

David

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: how to set session variable (not session cookie) using perl CGI

2012-08-07 Thread Ron Bergin

-- 
Rajeev Prasad wrote:
 I am using CGI.pm on my website, but I generate my pages using TT
 (template Toolkit).
  
 I have few questions:
  
 0. how to have a session variable (not a session cookie)? If I do not want
 to use cookie, do i have to store session data in a temp file on server
 and check it with each page load?
  
  
 1.  How do I pass a cookie to the page I am displaying using tt ? is
 following ok?
  
 print Content-type: text/html\n\n;
 print $q-header(-cookie=$mycookie);
 ...further code to generate page using tt
  
 2. another related issue is: How do I send a redirect URL to the browser
 client, based on some conditions in the logic?
  
 ty.
 Rajeev

 --

http://search.cpan.org/~markstos/CGI-Session-4.48/lib/CGI/Session.pm

---
Ron Bergin



-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: how to set session variable (not session cookie) using perl CGI

2012-08-07 Thread Rajeev Prasad
Thank you Ron and David.


- Original Message -
From: Ron Bergin r...@i.frys.com
To: Rajeev Prasad rp.ne...@yahoo.com
Cc: perl list beginners@perl.org
Sent: Tuesday, August 7, 2012 9:36 PM
Subject: Re: how to set session variable (not session cookie) using perl CGI


-- 
Rajeev Prasad wrote:
 I am using CGI.pm on my website, but I generate my pages using TT
 (template Toolkit).
  
 I have few questions:
  
 0. how to have a session variable (not a session cookie)? If I do not want
 to use cookie, do i have to store session data in a temp file on server
 and check it with each page load?
  
  
 1.  How do I pass a cookie to the page I am displaying using tt ? is
 following ok?
  
 print Content-type: text/html\n\n;
 print $q-header(-cookie=$mycookie);
 ...further code to generate page using tt
  
 2. another related issue is: How do I send a redirect URL to the browser
 client, based on some conditions in the logic?
  
 ty.
 Rajeev

 --

http://search.cpan.org/~markstos/CGI-Session-4.48/lib/CGI/Session.pm

---
Ron Bergin



-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




net::openssh error in CGI: Invalid or bad combination of options ('key_path')

2012-06-28 Thread Rajeev Prasad
hello can anyone help?

following is failing:

my $ssh = Net::OpenSSH-new($host,
        user = abc123,
        ctl_dir = /home/openssh_lib_home,
        key_path = /home/openssh_lib_home/.ssh/,
        master_opts = [-o = 'StrictHostKeyChecking=no',
                        -o = 'ConnectTimeout 60'],
        );

getting error:    Invalid or bad combination of options ('key_path')


folder permissions are:

drwxrwsr-x  3 www-data www-data 4096 2012-06-28 16:24 /home/openssh_lib_home


drwxr-sr-x 2 www-data www-data 4096 2012-06-28 16:24 /home/openssh_lib_home/.ssh

-rw--- 1 www-data www-data 1679 2012-06-27 21:30 
/home/openssh_lib_home/.ssh/id_rsa
-rw-r--r-- 1 www-data www-data  395 2012-06-28 16:24 
/home/openssh_lib_home/.ssh/id_rsa.pub

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: net::openssh error in CGI: Invalid or bad combination of options ('key_path')

2012-06-28 Thread Shlomi Fish
Hi Rajeev,

On Thu, 28 Jun 2012 10:00:08 -0700 (PDT)
Rajeev Prasad rp.ne...@yahoo.com wrote:

 hello can anyone help?
 
 following is failing:
 
 my $ssh = Net::OpenSSH-new($host,
         user = abc123,
         ctl_dir = /home/openssh_lib_home,
         key_path = /home/openssh_lib_home/.ssh/,
         master_opts = [-o = 'StrictHostKeyChecking=no',
                         -o = 'ConnectTimeout 60'],
         );

key_path should point to the file of the private key on the disk - not its
containing directory.

Regards,

Shlomi Fish

 
 getting error:    Invalid or bad combination of options ('key_path')
 
 
 folder permissions are:
 
 drwxrwsr-x  3 www-data www-data 4096 2012-06-28 16:24 /home/openssh_lib_home
 
 
 drwxr-sr-x 2 www-data www-data 4096 2012-06-28 16:24 
 /home/openssh_lib_home/.ssh
 
 -rw--- 1 www-data www-data 1679 2012-06-27 21:30 
 /home/openssh_lib_home/.ssh/id_rsa
 -rw-r--r-- 1 www-data www-data  395 2012-06-28 16:24 
 /home/openssh_lib_home/.ssh/id_rsa.pub
 



-- 
-
Shlomi Fish   http://www.shlomifish.org/
My Favourite FOSS - http://www.shlomifish.org/open-source/favourite/

Every successful open source project will eventually spawn a sub‐project.

Please reply to list if it's a mailing list post - http://shlom.in/reply .

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: net::openssh error in CGI: Invalid or bad combination of options ('key_path')

2012-06-28 Thread Rajeev Prasad


- Original Message -

From: Shlomi Fish shlo...@shlomifish.org
To: Rajeev Prasad rp.ne...@yahoo.com
Cc: perl list beginners@perl.org
Sent: Thursday, June 28, 2012 12:46 PM
Subject: Re: net::openssh error in CGI: Invalid or bad combination of options 
('key_path')

Hi Rajeev,

On Thu, 28 Jun 2012 10:00:08 -0700 (PDT)
Rajeev Prasad rp.ne...@yahoo.com wrote:

 hello can anyone help?
 
 following is failing:
 
 my $ssh = Net::OpenSSH-new($host,
         user = abc123,
         ctl_dir = /home/openssh_lib_home,
         key_path = /home/openssh_lib_home/.ssh/,
         master_opts = [-o = 'StrictHostKeyChecking=no',
                         -o = 'ConnectTimeout 60'],
         );

key_path should point to the file of the private key on the disk - not its
containing directory.

Regards,

    Shlomi Fish

 
 getting error:    Invalid or bad combination of options ('key_path')
 
 
 folder permissions are:
 
 drwxrwsr-x  3 www-data www-data 4096 2012-06-28 16:24 /home/openssh_lib_home
 
 
 drwxr-sr-x 2 www-data www-data 4096 2012-06-28 16:24 
 /home/openssh_lib_home/.ssh
 
 -rw--- 1 www-data www-data 1679 2012-06-27 21:30 
 /home/openssh_lib_home/.ssh/id_rsa
 -rw-r--r-- 1 www-data www-data  395 2012-06-28 16:24 
 /home/openssh_lib_home/.ssh/id_rsa.pub
 



-- 
-
Shlomi Fish       http://www.shlomifish.org/
My Favourite FOSS - http://www.shlomifish.org/open-source/favourite/

Every successful open source project will eventually spawn a sub‐project.

Please reply to list if it's a mailing list post - http://shlom.in/reply .






hello Shlomi,

howdy

I made the change, but it still gives same error.

 my $ssh = Net::OpenSSH-new($host,
     user = abc123,
     ctl_dir = /home/openssh_lib_home,
     key_path = /home/openssh_lib_home/.ssh/id_rsa,
     master_opts = [-o = 'StrictHostKeyChecking=no',
                     -o = 'ConnectTimeout 60'],
     );


It works with username password supplied. but i suspect some internal 
issue as i can see in error logs - when i run it with userid/passwd and 
ctl_dir options, it still tries to access/save ssh info in /var/www.ssh 
!!! that however does not stop the ssh from being happening.


key_path options still dont work :(

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: net::openssh error in CGI: Invalid or bad combination of options ('key_path')

2012-06-28 Thread Rajeev Prasad
so finally I settle down for uid password authentication.

plus i built the .ssh directory under /var/www (home folder for www-data). and 
use it as ctl_dir, i get no error message and it works. I am worried about 
below:

1. uid/pwd is not safe for scripts, so how can i use key based authentication?
2. since the module insist on having a .ssh folder in home directory(/var/www), 
of web user (www-data on linux), how safe is it to have a .ssh folder under 
/var/www ??

anyone know?

ty.
Rajeev




- Original Message -
From: Rajeev Prasad rp.ne...@yahoo.com
To: Shlomi Fish shlo...@shlomifish.org
Cc: perl list beginners@perl.org
Sent: Thursday, June 28, 2012 2:36 PM
Subject: Re: net::openssh error in CGI: Invalid or bad combination of options 
('key_path')



- Original Message -

From: Shlomi Fish shlo...@shlomifish.org
To: Rajeev Prasad rp.ne...@yahoo.com
Cc: perl list beginners@perl.org
Sent: Thursday, June 28, 2012 12:46 PM
Subject: Re: net::openssh error in CGI: Invalid or bad combination of options 
('key_path')

Hi Rajeev,

On Thu, 28 Jun 2012 10:00:08 -0700 (PDT)
Rajeev Prasad rp.ne...@yahoo.com wrote:

 hello can anyone help?
 
 following is failing:
 
 my $ssh = Net::OpenSSH-new($host,
         user = abc123,
         ctl_dir = /home/openssh_lib_home,
         key_path = /home/openssh_lib_home/.ssh/,
         master_opts = [-o = 'StrictHostKeyChecking=no',
                         -o = 'ConnectTimeout 60'],
         );

key_path should point to the file of the private key on the disk - not its
containing directory.

Regards,

    Shlomi Fish

 
 getting error:    Invalid or bad combination of options ('key_path')
 
 
 folder permissions are:
 
 drwxrwsr-x  3 www-data www-data 4096 2012-06-28 16:24 /home/openssh_lib_home
 
 
 drwxr-sr-x 2 www-data www-data 4096 2012-06-28 16:24 
 /home/openssh_lib_home/.ssh
 
 -rw--- 1 www-data www-data 1679 2012-06-27 21:30 
 /home/openssh_lib_home/.ssh/id_rsa
 -rw-r--r-- 1 www-data www-data  395 2012-06-28 16:24 
 /home/openssh_lib_home/.ssh/id_rsa.pub
 



-- 
-
Shlomi Fish       http://www.shlomifish.org/
My Favourite FOSS - http://www.shlomifish.org/open-source/favourite/

Every successful open source project will eventually spawn a sub‐project.

Please reply to list if it's a mailing list post - http://shlom.in/reply .






hello Shlomi,

howdy

I made the change, but it still gives same error.

 my $ssh = Net::OpenSSH-new($host,
     user = abc123,
     ctl_dir = /home/openssh_lib_home,
     key_path = /home/openssh_lib_home/.ssh/id_rsa,
     master_opts = [-o = 'StrictHostKeyChecking=no',
                     -o = 'ConnectTimeout 60'],
     );


It works with username password supplied. but i suspect some internal 
issue as i can see in error logs - when i run it with userid/passwd and 
ctl_dir options, it still tries to access/save ssh info in /var/www.ssh 
!!! that however does not stop the ssh from being happening.


key_path options still dont work :(

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Net::OpenSSH failing in CGI

2012-06-27 Thread Rajeev Prasad


my $ssh = Net::OpenSSH-new($host,
        user = abc123,
        ctl_dir = /var/www/mysite.com/www/openssh_lib_home/
        );

ssh is not happening, when i catch the error, i get below:

error:  ctl_dir /var/www/mysite.com/www/openssh_lib_home/ is not secure

folder is :

$ ls -l /var/www/mysite.com/www/|grep ssh
drwx--  2 abc123 abc123 4096 2012-06-27 20:41 openssh_lib_home

I also changed ownership to www-data, but it still throws same error.

drwxr-xr-x  2 www-data www-data  4096 2012-06-27 21:06 openssh_lib_home



background: first it was trying to create under /var/www:  was failing due to 
no permission.


unable to create ctl_dir /var/www/.libnet-openssh-perl: No such file or 
directory 


so i added option ctl_dir, but i am not sure why is it failing now, to me 
permissions look ok??? is it still trying to start ssh as www-data (even if it 
is, then why wont it work if i make www-data as owner of folder)?

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: Net::OpenSSH failing in CGI

2012-06-27 Thread Rajeev Prasad
i was able to resolve that with creating a folder for www-data  under /home 
dont know how secure but thats what i could think of.. 


new problem is: 


Could not create directory '/var/www/.ssh'.\r
Failed to add the host to the list of known hosts (/var/www/.ssh/known_hosts).\r
Permission denied 
(gssapi-keyex,gssapi-with-mic,publickey,keyboard-interactive).\r

well, why is it trying to create anything in /var/www, havent i already defined 
ctl_dir ???



and, when i try to use key_path option i get this error: (so i am not using it 
for now)
Invalid or bad combination of options ('key_path') at .


currently it looks like:
my $ssh = Net::OpenSSH-new($host,
        user = abc123,
        ctl_dir = /home/openssh_lib_home/
        master_opts = [-o = 'StrictHostKeyChecking=no',
                        -o = 'ConnectTimeout 60'],
        );

# ls -l /home|grep open
drwxrwsr-x  2 www-data www-data 4096 2012-06-27 21:54 openssh_lib_home





- Original Message -
From: Rajeev Prasad rp.ne...@yahoo.com
To: perl list beginners@perl.org
Cc: 
Sent: Wednesday, June 27, 2012 4:13 PM
Subject: Net::OpenSSH failing in CGI



my $ssh = Net::OpenSSH-new($host,
        user = abc123,
        ctl_dir = /var/www/mysite.com/www/openssh_lib_home/
        );

ssh is not happening, when i catch the error, i get below:

error:  ctl_dir /var/www/mysite.com/www/openssh_lib_home/ is not secure

folder is :

$ ls -l /var/www/mysite.com/www/|grep ssh
drwx--  2 abc123 abc123 4096 2012-06-27 20:41 openssh_lib_home

I also changed ownership to www-data, but it still throws same error.

drwxr-xr-x  2 www-data www-data  4096 2012-06-27 21:06 openssh_lib_home



background: first it was trying to create under /var/www:  was failing due to 
no permission.


unable to create ctl_dir /var/www/.libnet-openssh-perl: No such file or 
directory 


so i added option ctl_dir, but i am not sure why is it failing now, to me 
permissions look ok??? is it still trying to start ssh as www-data (even if it 
is, then why wont it work if i make www-data as owner of folder)?

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: Attach iCal event to an cgi mail

2012-06-11 Thread Peter Scott
After your program has opened SENDMAIL, open it again in the debugger to 
wherever you want (e.g., open SENDMAIL, 'STDOUT').  Since it's a 
bareword filehandle, you'll be reopening the same one.

On Thu, 07 Jun 2012 12:59:20 -0700, mstep wrote:
 Yes the Filehandle is opened for writing. Is there any means to look
 inside? How to redirect the content of SENDMAIL in the debugger?

 Am Donnerstag, 7. Juni 2012 06:19:43 UTC+2 schrieb Peter Scott:
 On Mon, 04 Jun 2012 10:37:35 -0700, Marek wrote:
 
  Could somebody please tell me, how can I see into a FILEHANDLE in
  Perl debugger? I tried with  x SENDMAIL but I get only empty
  array.
 
 That filehandle is open for *output* in your program!  What is it you
 want to examine?
 
 --
 Peter Scott
 http://www.perlmedic.com/ http://www.perldebugged.com/
 http://www.informit.com/store/product.aspx?isbn=0137001274
 http://www.oreillyschool.com/certificates/perl-programming.php





-- 
Peter Scott
http://www.perlmedic.com/ http://www.perldebugged.com/
http://www.informit.com/store/product.aspx?isbn=0137001274
http://www.oreillyschool.com/certificates/perl-programming.php

-- 
To unsubscribe, e-mail: beginners-cgi-unsubscr...@perl.org
For additional commands, e-mail: beginners-cgi-h...@perl.org
http://learn.perl.org/




Re: Attach iCal event to an cgi mail

2012-06-08 Thread mstep
Hello Peter!

Thank you for your reply! 
Meanwhile my sendmail is working! Was quite difficult to program it. 

Yes the Filehandle is opened for writing. Is there any means to look inside? 
How to redirect the content of SENDMAIL in the debugger?

Greetings from Munich - heavy thunderstorm here 


marek


Am Donnerstag, 7. Juni 2012 06:19:43 UTC+2 schrieb Peter Scott:
 On Mon, 04 Jun 2012 10:37:35 -0700, Marek wrote:
 
  Could somebody please tell me, how can I see into a FILEHANDLE in Perl
  debugger? I tried with  x SENDMAIL but I get only empty array.
 
 That filehandle is open for *output* in your program!  What is it you 
 want to examine?
 
 -- 
 Peter Scott
 http://www.perlmedic.com/ http://www.perldebugged.com/
 http://www.informit.com/store/product.aspx?isbn=0137001274
 http://www.oreillyschool.com/certificates/perl-programming.php


-- 
To unsubscribe, e-mail: beginners-cgi-unsubscr...@perl.org
For additional commands, e-mail: beginners-cgi-h...@perl.org
http://learn.perl.org/




Re: Attach iCal event to an cgi mail

2012-06-07 Thread Peter Scott
On Mon, 04 Jun 2012 10:37:35 -0700, Marek wrote:

 Could somebody please tell me, how can I see into a FILEHANDLE in Perl
 debugger? I tried with  x SENDMAIL but I get only empty array.

That filehandle is open for *output* in your program!  What is it you 
want to examine?

-- 
Peter Scott
http://www.perlmedic.com/ http://www.perldebugged.com/
http://www.informit.com/store/product.aspx?isbn=0137001274
http://www.oreillyschool.com/certificates/perl-programming.php

-- 
To unsubscribe, e-mail: beginners-cgi-unsubscr...@perl.org
For additional commands, e-mail: beginners-cgi-h...@perl.org
http://learn.perl.org/




Attach iCal event to an cgi mail

2012-06-04 Thread Marek

Hello all!


I made up a script for a taxi company to order a taxi. Everything is
working. I have only problems to attach an iCal event, so that you
only have to click on it and it is in your iCalendar.

The shortened script for mailing an attached file for the iCal event
is doing nothing, without any error (script 2). The other script 1 is
working. I don't understand why.

Could somebody please tell me, how can I see into a FILEHANDLE in Perl
debugger? I tried with  x SENDMAIL but I get only empty array.

Thank you for your help

marek



***Script 1***

#!/usr/bin/perl

# Inspired from: http://wiki.perl-community.de/Wissensbasis/SendmailAttachments


use strict;
use warnings;
use MIME::Base64;

my $file_path = /Users/you/Documents/webpages/cgi-bin/tmp;
my $file_name = ical_summary.ics;

open(M, |/usr/sbin/sendmail -t -oi) or die Can't open mailprogram:
'/usr/sbin/sendmail'!\n$!;
print M MIME-Version: 1.0\n;
print M qq(To: Your Name you\@yourdomain.com\n);
print M qq(From: Your Name you\@yourdomain.com\n);
print M qq(Reply-to: Your Name you\@yourdomain.com\n);
print M Subject: E-Mail - the corrected version!\n;
my $boundary = ==.substr(pack('u', ('E-Mail'.'Your Name')),
0, 24);
print M qq(Content-type: multipart/mixed; boundary=$boundary\n);
print M qq(--$boundary\nContent-Type: text/plain;
charset=UTF-8\nContent-Transfer-Encoding: 7bit\n\n);
print M qq(\nAnd there is a test again!\n);
print M \n--$boundary\n;
print M qq(Content-type: application/octet-stream;
name=$file_name\n);
print M Content-Transfer-Encoding: base64\n;
print M qq(Content-Disposition: attachment;\nContent-Type: text/
calendar filename=$file_name\nContent-Transfer-Encoding: base64\n);
open(F, $file_path/$file_name) or die Can't open data: '$file_path/
$file_name'!\n$!;
my $data;

{
binmode F;
local $/;
$data = F;
}
close(F) or die Can't close: '$file_path/$file_name'! $!\n;
my $codiert = MIME::Base64::encode($data);
print M \n$codiert\n;
print M qq(\n--$boundary--\n);
close(M) or die Can't close the filehandle M: $!;

__END__


***Script 2*

#! /usr/bin/perl

use strict;
use warnings;

use MIME::Base64;

my $mailprog = '/usr/sbin/sendmail -t -oi';
my $postmaster = 'y...@yourdomain.com';
my @recipients = ( 'i...@anothedomain.de', 'ma...@yourdomain.com' );

my $ical_data_start = 20120601T21;
my $ical_data_end = 20120601T22;
my $ical_summary = Dinner;
my $ical_location = Hörwartstr;
my $ical_file_name = $ical_summary . .ics;

my $ical_data = EOICAL;
BEGIN:VCALENDAR
BEGIN:VEVENT
DTEND;TZID=Europe/Berlin:$ical_data_end
SUMMARY:$ical_summary
DTSTART;TZID=Europe/Berlin:$ical_data_start
DTSTAMP:20120521T190638Z
LOCATION:$ical_location
SEQUENCE:0
BEGIN:VALARM
TRIGGER:-PT1H
DESCRIPTION:Event reminder
ACTION:DISPLAY
END:VALARM
END:VEVENT
END:VCALENDAR
EOICAL

$ical_data = encode_base64($ical_data);

my $reply = 'Your Name y...@yourdomain.com';
my $from = $reply;
my $subject = Abholung vom 1.6.2012, 21:00;
my $body = This is a test :-) Corrected Version! You really have to
pay attention to the line endings between the different headers!\n\tda
maaki;
my $boundary = = . time() . =;

foreach my $to (@recipients) {
my $result;
eval {
local $SIG{__DIE__};
$result = open SENDMAIL, | $mailprog;
};
if ($@) {
die $@ unless $@ =~ /Insecure directory/;
delete $ENV{PATH};
$result = open SENDMAIL, | $mailprog;
}

die Can't open mailprog [$mailprog]\n unless $result;

my $data = EOMAIL;
MIME-Version: 1.0
From: $from
To: $to
Reply-to: $reply
Subject: $subject
Content-Type = multipart/mixed; boundary=$boundary

--$boundary
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit

$body
--$boundary
Content-Disposition: attachment;
Content-Type: text/calendar filename=$ical_file_name
Content-Transfer-Encoding: base64

$ical_data

--$boundary--
EOMAIL

print SENDMAIL $data or die write to sendmail pipe: $!;
close SENDMAIL or die Closing of SENDMAIL failed: $!;
}


--
To unsubscribe, e-mail: beginners-cgi-unsubscr...@perl.org
For additional commands, e-mail: beginners-cgi-h...@perl.org
http://learn.perl.org/




Re: CGI setuid programs

2012-05-22 Thread Marek Nožka
On Fri, 11 May 2012 17:25:35 -0300 Tessio Fechine oiss...@gmail.com wrote
to beginners@perl.org:

 Hello,
 Everywhere I read about cgi setuid programs says that it is wrong and must
 never be done,
 but nobody says how to circumvent the need of it.
 In my case, I need to read a password from a protected file (read only,
 owned by root) to connect to a database.
 How can I do this without running setuid?
 
 Thanks!

I use sudo.

-- 
 @ @ @ Marek Nožka
 '.@
 :*`@   email: marek @t tlapicka d.t net
 `*'   jabber: tlapicka @t jabber d.t spseol d.t cz
  ::  web: http://tlapicka.net/
  `'
  `'   Powered by Debian GNU/Linux
  `.**'
¨¨

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Closing CGI/DB connections

2012-05-21 Thread Mark Haney
I know this will sound incredibly stupid and n00bish, but I've 
encountered something I've never dealt with before.  I'm setting up a 
perl based web application (this is my first web app, not my first perl) 
and have an issue with multiple DBI calls in a page and how I handle 
those calls.  For the most part, I've keep my code over the years to one 
DBI handle per script, so this is new to me.


If I have code like this:


my $dbh = DBI-connect(config('data_source'), config('username'), 
config('password'));
my $dao = EmbMon::DAO-new($dbh);
my $sql = qq/SELECT abbreviation from factory/;
my $sth = $dbh-prepare($sql);
$sth-execute();


and I want to run another query to the same DB, can I do something like:

my $sql = qq/Select * from table/;
my $sth = $dbh-prepare($sql);
$sth-execute();

Or do I need to call DBI-connect again?  I've curious as to how this is 
handled, since I don't see a close() or disconnect() used in any of the 
existing, inherited, code, which I normally use just to clean up after 
the script runs.


What's the best way to do this?

--

Mark Haney
Software Developer/Consultant
AB Emblem
ma...@abemblem.com
Linux marius.homelinux 3.3.5-2.fc16.x86_64 GNU/Linux

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: Closing CGI/DB connections

2012-05-21 Thread jm
i have a whole collection of scripts that does this... at home.
it's been quite a while but i believe what you want is

$dbh-commit;
$dbh-disconnect'

to close a particular connection.
hopefully someone can verify/correct

http://search.cpan.org/~timb/DBI-1.620/DBI.pm
will document all the details of DBI.


On Mon, May 21, 2012 at 10:34 AM, Mark Haney ma...@abemblem.com wrote:

 I know this will sound incredibly stupid and n00bish, but I've encountered
 something I've never dealt with before.  I'm setting up a perl based web
 application (this is my first web app, not my first perl) and have an issue
 with multiple DBI calls in a page and how I handle those calls.  For the
 most part, I've keep my code over the years to one DBI handle per script,
 so this is new to me.

 If I have code like this:

 my $dbh = DBI-connect(config('data_**source'), config('username'),
 config('password'));
my $dao = EmbMon::DAO-new($dbh);
my $sql = qq/SELECT abbreviation from factory/;
my $sth = $dbh-prepare($sql);
$sth-execute();


 and I want to run another query to the same DB, can I do something like:

 my $sql = qq/Select * from table/;
 my $sth = $dbh-prepare($sql);
 $sth-execute();

 Or do I need to call DBI-connect again?  I've curious as to how this is
 handled, since I don't see a close() or disconnect() used in any of the
 existing, inherited, code, which I normally use just to clean up after the
 script runs.

 What's the best way to do this?

 --

 Mark Haney
 Software Developer/Consultant
 AB Emblem
 ma...@abemblem.com
 Linux marius.homelinux 3.3.5-2.fc16.x86_64 GNU/Linux

 --
 To unsubscribe, e-mail: beginners-unsubscr...@perl.org
 For additional commands, e-mail: beginners-h...@perl.org
 http://learn.perl.org/





-- 
since this is a gmail account, please verify the mailing list is included
in the reply-to addresses.


CGI setuid programs

2012-05-11 Thread Tessio Fechine
Hello,
Everywhere I read about cgi setuid programs says that it is wrong and must
never be done,
but nobody says how to circumvent the need of it.
In my case, I need to read a password from a protected file (read only,
owned by root) to connect to a database.
How can I do this without running setuid?

Thanks!


Re: CGI setuid programs

2012-05-11 Thread David Christensen

On 05/11/2012 01:25 PM, Tessio Fechine wrote:

Everywhere I read about cgi setuid programs says that it is wrong and must
never be done,
but nobody says how to circumvent the need of it.
In my case, I need to read a password from a protected file (read only,
owned by root) to connect to a database.
How can I do this without running setuid?


How about changing the owner of the file to match the user your web 
server runs under?



HTH,

David


--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: PERL CGI, HTML and PHP

2012-04-26 Thread Michael Rasmussen
On Wed, Apr 25, 2012 at 01:51:46PM -0400, Mark Haney wrote:
 I've got, what I hope is a fairly simple problem that someone can point  
 me to the best (or best practices anyway) way to handle it.

 I'm writing a web app that monitors embroidery machines and generates  
 reports on various metrics for the company management.  My issue arises  
 from the fact that I've had to move from a pure perl web interface to  
 PHP for it's additional feature set.  Until now, all my output has been  
 generated by perl CGI scripts and output to STDOUT directly, which is  
 fine, but leaves the report rather sparse looking. (FTR, I'm no web  
 designer, I'm here to make it work, not make it pretty, however, I do  
 have to do some preliminary prettifying.)

 That wasn't a real problem, but now I want to take that output and fold  
 it into the PHP headers and footers I've built to keep from having to  
 rewrite the navigation menus and copyright info and such and I can't  
 quite figure out the best way to do it.

I'm late to the conversation.  Could you describe the page needs without
doing so in terms of php can do?

Navigate menus and copyright info and such sound like standard header/footer
information.  This can easily be handled in Perl.  Even easier if you 
use Template::Toolkit or Mason or fill_in_the_blank templating. 

Navigation menus can be dynamically derived from a data structure defining
previous/next relationships.


 I'd really like to be able to output this report to the browser directly  
 with PHP code in it to match the format of the rest of the interface,  

the PHP generates some HTML, Perl does that well.

 The only way I've come up with is to simply output the report data to  
 disk as an HTML file and then include that output in a PHP page that is  
 correctly formatted.

Again, you haven't described why Perl can't create the same HTML the PHP does.



-- 
Michael Rasmussen, Portland Oregon  
  Other Adventures: http://www.jamhome.us/ or http://westy.saunter.us/
Fortune Cookie Fortune du courrier:
It's not a problem unless it's chronic.
~  Linda Connor

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




RE: PERL CGI, HTML and PHP

2012-04-26 Thread Bob McConnell
 From: Mark Haney
 
 I understand the desire to 'keep with one scripting language', but what
 I don't understand is why take a stand like that, yet continue to use
 javascript with PHP and ASP pages.  Seems to me, that in the right
 instance combining the two can be very powerful.  Personally, I've found
 the flexibility in report manipulation of perl to be better than
 anything else I've used, so I plan on keeping it for reports and using
 PHP for the front end/UI stuff.

This exposes the source of your confusion. Javascript is executed in the 
browser, while Perl, PHP, ASP and JSP are all executed on the server. So JS 
simply complements all of the others. The biggest issue is that you cannot 
depend on JS being allowed on the client. It is seen by many as a security 
problem, a very reasonable view, so it will be disabled either globally or by 
using NoScript or similar add-ons. As a result, it should never be used to 
enable critical elements of a web page, but only to enhance the presentation.

Bob McConnell


--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: PERL CGI, HTML and PHP

2012-04-26 Thread Mark Haney

On 04/26/2012 07:22 AM, Michael Rasmussen wrote:



Again, you haven't described why Perl can't create the same HTML the PHP does.





Obviously, I didn't explain myself quite well enough.  Let me try again. 
 I've got a web app I'm building for the company I work for.  It was 
initially started by an intern in pure perl and was more or less nothing 
but some CGI to dump data into a DB and pull data out of that DB.  The 
perl code generated basic HTML tables and output and nothing else.


Keep in mind here that I've used perl quite a bit, but /never/ in the 
context of actually building a website. Not from the ground up.  I have 
built them in C#, ASP, and PHP, so I'm no n00b to web design.  Just when 
using perl.


I found, that with researching how to do things in perl (like dynamic 
dropdown boxes) I was having trouble finding resources that worked for 
me.  At that point, I moved to PHP since I knew how to do things with it.


That brings me to my problem.  I have these reports already built in 
perl, and all I want is something like this:


PHP/HTML form - PERL CGI - PHP/HTML

Essentially I want perl to do the grunt work and output it to my PHP 
framework.  The only option I found that works (mostly) is to output the 
report into a file and then include it in the PHP code.  The only issue 
there is that I can't inject PHP code into the CGI like I do with 
straight HTML (like print table/table).


I thought this would have been a fairly simple question to ask, like 
I've overlooked the obvious and needed it pointed out.  Ah well.


At this point, I have no problem at all with ripping out what PHP I've 
done for straight up perl if I can find the resources that can walk me 
through the design and framework setup.  I noticed replies about perl 
templates and I'll look into them now.


My apologies for sounding like a troll.  It was a question I thought had 
a quick answer. You live and learn.





--

Mark Haney
Software Developer/Consultant
AB Emblem
ma...@abemblem.com
Linux marius.homelinux 3.3.2-6.fc16.x86_64 GNU/Linux

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: PERL CGI, HTML and PHP

2012-04-26 Thread Mark Haney

On 04/26/2012 08:27 AM, Bob McConnell wrote:

From: Mark Haney





This exposes the source of your confusion. Javascript is executed in the 
browser, while Perl, PHP, ASP and JSP are all executed on the server. So JS 
simply complements all of the others. The biggest issue is that you cannot 
depend on JS being allowed on the client. It is seen by many as a security 
problem, a very reasonable view, so it will be disabled either globally or by 
using NoScript or similar add-ons. As a result, it should never be used to 
enable critical elements of a web page, but only to enhance the presentation.

Bob McConnell





Well, I kind of agree with you.  It's still a scripting language. 
Regardless of its function. (At least in my mind.)


Still, despite all this, I'm not really any closer to a solution than I 
was when I sent the OP.  I'm looking at the Template-Toolkit, and that 
might be a long term solution, but the dearth of 'beginner-style' 
documentation for it makes me think there's a fairly large learning 
curve with it, and frankly, if that's the case, I might actually stick 
with the devil I know.



--

Mark Haney
Software Developer/Consultant
AB Emblem
ma...@abemblem.com
Linux marius.homelinux 3.3.2-6.fc16.x86_64 GNU/Linux

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: PERL CGI, HTML and PHP

2012-04-26 Thread Madrigal, Juan A
Just throwing in my two cents:

Javascript can run in the backend as well. Take a look at Node.js;
http://nodejs.org/

As far as perl on the web end, look into perldancer
(http://perldancer.org/), mojolicious (http://mojolicio.us/) or catalyst
(http://www.catalystframework.org/)

They are all modern MVC web frameworks that should get you up and running
quickly.
For deployment I would look into PSGI: http://plackperl.org/

Regards,

Juan Madrigal


Web Developer
Web and Emerging Technologies
University of Miami
Richter Library





On 4/26/12 2:19 PM, Mark Haney ma...@abemblem.com wrote:

On 04/26/2012 08:27 AM, Bob McConnell wrote:
 From: Mark Haney



 This exposes the source of your confusion. Javascript is executed in
the browser, while Perl, PHP, ASP and JSP are all executed on the
server. So JS simply complements all of the others. The biggest issue is
that you cannot depend on JS being allowed on the client. It is seen by
many as a security problem, a very reasonable view, so it will be
disabled either globally or by using NoScript or similar add-ons. As a
result, it should never be used to enable critical elements of a web
page, but only to enhance the presentation.

 Bob McConnell




Well, I kind of agree with you.  It's still a scripting language.
Regardless of its function. (At least in my mind.)

Still, despite all this, I'm not really any closer to a solution than I
was when I sent the OP.  I'm looking at the Template-Toolkit, and that
might be a long term solution, but the dearth of 'beginner-style'
documentation for it makes me think there's a fairly large learning
curve with it, and frankly, if that's the case, I might actually stick
with the devil I know.


-- 

Mark Haney
Software Developer/Consultant
AB Emblem
ma...@abemblem.com
Linux marius.homelinux 3.3.2-6.fc16.x86_64 GNU/Linux

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: PERL CGI, HTML and PHP

2012-04-26 Thread Matthew K


 Mark,
It seems like you have a hammer, and you really want this to be a nail. It just 
isn't. It's more like a paper clip.

Perl and PHP are both server side scripting languages, which means they run on 
the server. If you use them, you should pick one because they serve the same 
purpose. You don't need either of them to create dynamic dropdown boxes. In 
fact, you don't want to use either of them in this case. If you use them, then 
you need to refresh the page (or a portion of it). You don't want to send 
request like that over the network, then process it by a server, return the 
response back over the network, and then render it in the browser. This isn't 
the best code design for things that are updating frequently. You want them to 
be fast and responsive. In order to do that, you really want to run them on the 
computer that already has the page loaded in memory. Memory which is much 
faster than an internet connection and two separate machines processing it.

I would suggest building the dynamic boxes in javascript (which runs client 
side). It has a different purpose than PHP or perl and compliments either of 
them nicely.


Matt



- Original Message -
 From: Mark Haney ma...@abemblem.com
 To: beginners@perl.org
 Cc: 
 Sent: Thursday, April 26, 2012 12:19 PM
 Subject: Re: PERL CGI, HTML and PHP
 
 
 Well, I kind of agree with you.  It's still a scripting language. Regardless 
 of its function. (At least in my mind.)
 
 Still, despite all this, I'm not really any closer to a solution than I was 
 when I sent the OP.  I'm looking at the Template-Toolkit, and that might be 
 a long term solution, but the dearth of 'beginner-style' documentation 
 for it makes me think there's a fairly large learning curve with it, and 
 frankly, if that's the case, I might actually stick with the devil I know.
 
 
 -- 
 Mark Haney
 Software Developer/Consultant
 AB Emblem
 ma...@abemblem.com
 Linux marius.homelinux 3.3.2-6.fc16.x86_64 GNU/Linux

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: PERL CGI, HTML and PHP

2012-04-26 Thread Lesley Binks
On Thu, Apr 26, 2012 at 08:32:29AM -0400, Mark Haney wrote:
 On 04/26/2012 07:22 AM, Michael Rasmussen wrote:
 
 
 Again, you haven't described why Perl can't create the same HTML the PHP 
 does.
 
 
 
 
 Obviously, I didn't explain myself quite well enough.  Let me try
 again.  I've got a web app I'm building for the company I work for.
 It was initially started by an intern in pure perl and was more or
 less nothing but some CGI to dump data into a DB and pull data out
 of that DB.  The perl code generated basic HTML tables and output
 and nothing else.

Well this confuses me from the start :)
The perl scripts collect data from the sewing machines and then use CGI to dump
the data in a database?  CGI isn't necessary to do that part. DBI interfaces to
a database and you are hopefully already using that in the scripts.

Step 1: separate the function of collecting the data and storing it from the 
form
generation.
Step 2: If you really want to continue to use Perl then write the scripts 
to read the data from the database and present that.  If your data is stored in
such a way that you can't do that then you have a db design problem to fix.
Step 3: Now you have access to your data you can look at templating systems.
There are many perl templating systems.  TT is a good one - I use it to
breaking point.  Here is where you start with TT
http://search.cpan.org/~abw/Template-Toolkit-2.24/lib/Template/Toolkit.pod
http://search.cpan.org/~abw/Template-Toolkit-2.24/lib/Template/Manual.pod
http://search.cpan.org/~abw/Template-Toolkit-2.24/lib/Template/Manual/Intro.pod

although you may want to look at some of the pointers to MVC frameworks
provided below.
 
 Keep in mind here that I've used perl quite a bit, but /never/ in
 the context of actually building a website. Not from the ground up.
 I have built them in C#, ASP, and PHP, so I'm no n00b to web design.
 Just when using perl.
 
Perl documention is available via the command line using perldoc e.g.
perldoc CGI
perldoc DBI

If you do have any experience in web design then you'll be aware of the
separation of the different parts of a web page - CSS for styling, HTML for
layout ring any bells?

This separation of function is not new - it's applied in a lot of places
 I found, that with researching how to do things in perl (like
 dynamic dropdown boxes) I was having trouble finding resources that
 worked for me.  At that point, I moved to PHP since I knew how to do
 things with it.
There are a number of resources available including the documentation on your
system, the Modern Perl book
http://modernperlbooks.com/books/modern_perl/chapter_00.html
http://learn.perl.org, http://cpan.org and http://perlmonks.org - long may they
all shine under the sun.
 
 That brings me to my problem.  I have these reports already built in
 perl, and all I want is something like this:
 
 PHP/HTML form - PERL CGI - PHP/HTML
This is seriously horrible.
One problem I have is that you're cobbling things together and cobbling them
poorly with a really half-baked idea and all you really presented was a query
about how to solve your half-baked idea . 
Your simplest route is to learn the CGI module in Perl and use it.

 
 Essentially I want perl to do the grunt work and output it to my PHP
 framework.  The only option I found that works (mostly) is to output
 the report into a file and then include it in the PHP code.  The
 only issue there is that I can't inject PHP code into the CGI like I
 do with straight HTML (like print table/table).
This mad-cap scheme was doomed to failure from the start.  Did you check
whether you could actually achieve this code injection before you started?

 
 I thought this would have been a fairly simple question to ask, like
 I've overlooked the obvious and needed it pointed out.  Ah well.
 
You presented something no one would probably ever think or want to do for a
start.  This idea of using PHP then Perl then PHP and then -oh I have to dart
back into the perl CGI script and hackitaboutinitusingPHP would probably have
me showing you the door if I were your boss.

Most of us are not telepathic or instantly know what you mean when you fail to
explain your real problem - which is that you would like to conitinue to use
Perl - and I would hazard a guess that it is because it grabs the data and
stores it so well - but you've introduced PHP into the mix because you can
write in that.  Well, it's hard to think of a good analogy to this but I guess
learning to drive a car is a lot like riding a bike so I'll do the latter
instead of the former because it will really prepare me for driving a car.
Would you do that, too?

You will find people here will get puzzled if you merely present a half-baked
solution to your problem as the problem you wish to solve.  

 At this point, I have no problem at all with ripping out what PHP
h I've done for straight up perl if I can find the resources that can
 walk me through the design and framework setup.  I noticed replies
 about

  1   2   3   4   5   6   7   8   9   10   >