RE: Volunteer Project

2001-09-20 Thread Bradley M. Handy

Send me the details of the project and I'll look it over.  Right now I'm
pretty busy, but I've wanted to work on a volunteer for a while now.

Bradley M. Handy
Senior Programmer/Owner
Jack-of-all-trades Programming Services
--www.jack-of-all-trades.net
--mailto:[EMAIL PROTECTED]

> -Original Message-
> From: Teresa Raymond [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, September 20, 2001 9:41 AM
> To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
> Subject: Volunteer Project
>
>
> Is anyone interested in doing a volunteer project for
> www.selfhelpmagazine.com with me?  This is a project that involves a
> SQL database which I have zero experience with but have bought the
> Programming the Perl DBI book.
>
>
> ---
> -  Teresa Raymond -
> -  [EMAIL PROTECTED]   -
> -  http://www.mariposanet.com -
> ---
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: uninitialised value strings

2001-08-29 Thread Bradley M. Handy

Most likely because no data is being passed to the script.


Brad

> -Original Message-
> From: Francesco Scaglioni [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, August 29, 2001 9:23 AM
> To: [EMAIL PROTECTED]
> Cc: [EMAIL PROTECTED]
> Subject: RE: uninitialised value strings
> 
> 
> Hi again,
> 
> the script now reads ( see below ) but I still get errors as follows:
> 
> ** (at end of line) =  where use of uninitialised value in 
> cancatenation and
> *** (at end of line) =  where use of uninitialised value in pattern
> match
> 
> How should I initialise those values?
> 
> Cheers
> 
> Francessco
> 
> #!/usr/bin/perl -w
> #/
> # add taint check later
> #
> use CGI qw(:standard);
> use strict;
> use CGI::Carp qw(fatalsToBrowser); # remove later
> use Fcntl qw(:flock);
> 
> my $q = CGI -> new();
> my $filename =  param('filename');
> my $subject  =  param('subject');
> my $action   =  param('action');
> 
> my @subjects = ( 'running', 'computers', 'med_pol', 'med_clin', 
> 'misc', 'links' );
> my $DATA_DIR = ( "../data/$subject" );  # **
> my $COMMENT_DIR = ( "../data/$subject/.comments" ); # **
> 
> ( my $today = localtime )  =~ s/ +\d+:\d+:\d+/,/;
> 
> 
> ( $filename ) = ( $q->param('filename') =~ /^(\d+)$/ );  # ***
> ( $subject  ) = ( $q->param('subject' ) =~ /^(\w+)$/ );  # ***
> ( $action   ) = ( $q->param('action ' ) =~ /^(\w+)$/ ) || 'start' ;#***
> 
> 
> if( $action eq 'start'   ) { start(); }
> elsif ( $action eq 'list') { list() ; }
> elsif ( $action eq 'display' ) { display(); }
> elsif ( $action eq 'comment' ) { comment(); }
> else  { start(); }
> 

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: uninitialised value strings

2001-08-29 Thread Bradley M. Handy



> -Original Message-
> From: Francesco Scaglioni [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, August 29, 2001 8:00 AM
> To: [EMAIL PROTECTED]
> Subject: uninitialised value strings
>
>
> Hi,
>
> I have been playing around with the rat book but have the following
> problem:
>
> The attached snippet of code produces errors of unitialised value
> strings for the lines I have marked.  The script compiles OK.  What
> obvious newbie thing am I missing?
>
> Cheers & Thanks
>
> Francesco
>
> #!/usr/bin/perl -w
> #
> # add taint check later
>
> use CGI qw(:standard);
> use strict;
> use CGI::Carp qw(fatalsToBrowser); # remove later
> use Fcntl qw(:flock);
>
> my $filename =  param('filename');
> my $subject  =  param('subject');
> my $action   =  param('action');
>
> my @subjects = ( 'running', 'computers', 'med_pol', 'med_clin',
> 'misc', 'links' );
> my $DATA_DIR = ( "../data/$subject" ); # USE OF UNINITIALISED VALUE IN
># CONCATENATION (.)
> my $COMMENT_DIR = ( "../data/$subject/.comments" );   # USE OF
> UNINITIALISED
>   # VALUE IN
> CONCATENATION
>
> ( my $today = localtime )  =~ s/ +\d+:\d+:\d+/,/;
>
>
> #( $filename ) = ( $q->param('filename') =~ /^(\d+)$/ );
> #( $subject  ) = ( $q->param('subject' ) =~ /^(\w+)$/ );
> #( $action   ) = ( $q->param('action ' ) =~ /^(\w+)$/ ) || 'start' ;

You do not have a variable '$q' initialized to any value (perl should be
complaining about calling an invalid method).  You are using it as if you
have assigned it a reference to a CGI object.  However, you can just get
rid of the '$q->' all together, because you've imported the 'param'
function with the call to 'use CGI qw(:standard)'.

Side Note:
When you get more involved with Perl, take a look at the module
CGI::Application.
It is a framework for doing CGI Applications based on run modes (which you
are
doing with your '$action' variable).

>
>
> if( $action eq 'start'   ) { start(); }# USE OF
> UNINITIALISED VALUE
># IN STRING
> elsif ( $action eq 'list') { list() ; }
> elsif ( $action eq 'display' ) { display(); }
> elsif ( $action eq 'comment' ) { comment(); }
> else  { start(); }
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: System Health Checks

2001-08-28 Thread Bradley M. Handy

Forgot to send my post to the list.  Sorry.



I can point you to a module, but I can point you to a software product that
works for *nix and NT.  Try http://bb4.com.  The product is called Big
Brother, and it's used on campus here at Spring Arbor University.  Our
sysadmin uses it, so I can't give you details, but I know it works well.

Bradley M. Handy
Programmer Analyst
Spring Arbor University
--www.arbor.edu
--mailto:[EMAIL PROTECTED]

Quote: If women don't find you handsome
they should at least find you Handy.
-- Steve Smith as Red Green from the Red Green Show

> -Original Message-
> From: James Kelty [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, August 28, 2001 12:22 PM
> To: [EMAIL PROTECTED]
> Subject: System Health Checks...
>
>
> So I have a bunch of systems in my network that require a
> monitoring system
> to
> test if network connectivity is there (sound familiar anyone?). So, rather
> than
> try some of the many programs out there for this, I, naturally, decided to
> write
> a cgi in perl! Woo Hoo!
>
> At first I thought about opening a socket to each system to test it, and
> that worked
> except for the NT hosts.(They weren't running the ssh service
> that the *Nix
> systems were).
>
> Then I thought about doing a ping, but I am having trouble
> finding a module
> for ICMP, so,
> before I code a little more for ICMP, can anyone point me towards a module
> that uses ICMP
> with nearly the same syntax as IO::Socket has for tcp?
>
> Thanks.
>
> -James
>
>
> James Kelty
> Sr. Unix Systems Administrator
> The Ashland Agency
> [EMAIL PROTECTED]
> 541.488.0801
>
>
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: Browser Problem

2001-08-23 Thread Bradley M. Handy

Check any 'Content-type' header that you send.  The header should be
'Content-type: text/html'.  If you are not sending a 'Content-type' header,
then you should be.  To do this simply put one of the following statements
in your code:

# if you are using Lincoln Stein's CGI.pm module.
print CGI->header();

or

# if you are NOT using Lincoln Stein's CGI.pm module.
print "Content-type: text/html\n\n";

The reason the HTML is being read as plain text, is due to the fact Netscape
and Opera are being the content is 'Content-type: text/plain'.

Bradley M. Handy
Senior Programmer/Owner
Jack-of-all-trades Programming Services
--www.jack-of-all-trades.net
--mailto:[EMAIL PROTECTED]

> -Original Message-
> From: Advance Design - Vance [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, August 23, 2001 2:18 PM
> To: [EMAIL PROTECTED]
> Subject: Browser Problem
>
>
> Hello
> I have written some web pages incorporating Forms and Perl
> processing on the server. Everything works fine on my IE 5.5
> Browser but when I use the Netscape 4.7 and Opera 5.12 browsers,
> the HTML sent back from the Perl programme appears as (source) text.
> Do you have any ideas why.
>
> Thanks
>


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: Upload script

2001-08-21 Thread Bradley M. Handy

Here's what going on.

# $file is now assigned the name of a file, which has been uploaded using
your form.
my $file = $q->param( "file" ) || error ($q, "No file received.");

# the 'upload' subroutine has the same usage as 'param', but is used for
file uploads.
# so instead of passing $file to 'upload' you should be passing "file".
# (this is according to the CGI docs.)  'upload' returns a filehandle, while
'param' returns
# a file name.  this may be your problem.
my $fh = $q->upload( $file );


If you want to use the subroutine 'uploadInfo' then you will need to
retrieve the filename
from the CGI object using 'param', but for a filehandle you should use
'upload'.


Hope this helps.


Bradley M. Handy
Senior Programmer/Owner
Jack-of-all-trades Programming Services
--www.jack-of-all-trades.net
--mailto:[EMAIL PROTECTED]





> -Original Message-
> From: Lynn Glessner [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, August 21, 2001 2:51 PM
> To: Bradley M. Handy
> Subject: Re: Upload script
>
>
> I don't want to repost to the whole list again, so I'll just send to you.
> Would appreciate any insight you have. I have CGI.pm 2.76
>
>
>
> - Original Message -
> From: "Bradley M. Handy" <[EMAIL PROTECTED]>
> To: "Lynn Glessner" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
> Sent: Tuesday, August 21, 2001 11:14 AM
> Subject: RE: Upload script
>
>
> > If you have downloaded the latest version of CGI, then that may be your
> > problem.  CGI.pm versions 3.0 and above are ALPHA code and shouldn't be
> used
> > in production environments.  (I don't even use that version in test
> > environments.)  The latest STABLE version of CGI.pm was 2.753,
> but I think
> > now it maybe 2.76.  (Check you local CPAN dealer for more details.)  In
> any
> > case, you should download the latest 2.x version of CGI.pm and use that.
> >
> > If you ARE using the latest 2.x version of CGI.pm, then could you post
> your
> > code so we can have a look at it.  Or, is that not possible.
> >
> > Bradley M. Handy
> > Senior Programmer/Owner
> > Jack-of-all-trades Programming Services
> > --www.jack-of-all-trades.net
> > --mailto:[EMAIL PROTECTED]
> >
> > > -Original Message-
> > > From: Curtis Poe [mailto:[EMAIL PROTECTED]]
> > > Sent: Tuesday, August 21, 2001 1:40 PM
> > > To: Lynn Glessner; [EMAIL PROTECTED]; [EMAIL PROTECTED]
> > > Subject: Re: Upload script
> > >
> > >
> > > --- Lynn Glessner <[EMAIL PROTECTED]> wrote:
> > > > The name of my upload file isn't literally file, it is contained in
> the
> > > > variable named file. I agree that the upload method is probably
> > > my problem;
> > > > someone else said it was just buggy. :(
> > >
> > > I don't necessarily know that this method is buggy.  I was just
> > > pointing out that many people have
> > > had difficulties with it.  For some, it's an older version of
> > > CGI.pm.  For others, it's misuse,
> > > and others circumstances, it just seems to 'fail'.  Maybe it's
> > > bugs, maybe it's some confusion
> > > over the documentation.  I've just seen enough problems with
> > > enough programmers that I avoid it.
> > >
> > > Cheers,
> > > Curtis Poe
> > >
> > > =
> > > Senior Programmer
> > > Onsite! Technology (http://www.onsitetech.com/)
> > > "Ovid" on http://www.perlmonks.org/
> > >
> > > __
> > > Do You Yahoo!?
> > > Make international calls for as low as $.04/minute with
> Yahoo! Messenger
> > > http://phonecard.yahoo.com/
> > >
> > > --
> > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > For additional commands, e-mail: [EMAIL PROTECTED]
> > >
> >
>


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: Upload script

2001-08-21 Thread Bradley M. Handy

If you have downloaded the latest version of CGI, then that may be your
problem.  CGI.pm versions 3.0 and above are ALPHA code and shouldn't be used
in production environments.  (I don't even use that version in test
environments.)  The latest STABLE version of CGI.pm was 2.753, but I think
now it maybe 2.76.  (Check you local CPAN dealer for more details.)  In any
case, you should download the latest 2.x version of CGI.pm and use that.

If you ARE using the latest 2.x version of CGI.pm, then could you post your
code so we can have a look at it.  Or, is that not possible.

Bradley M. Handy
Senior Programmer/Owner
Jack-of-all-trades Programming Services
--www.jack-of-all-trades.net
--mailto:[EMAIL PROTECTED]

> -Original Message-
> From: Curtis Poe [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, August 21, 2001 1:40 PM
> To: Lynn Glessner; [EMAIL PROTECTED]; [EMAIL PROTECTED]
> Subject: Re: Upload script
>
>
> --- Lynn Glessner <[EMAIL PROTECTED]> wrote:
> > The name of my upload file isn't literally file, it is contained in the
> > variable named file. I agree that the upload method is probably
> my problem;
> > someone else said it was just buggy. :(
>
> I don't necessarily know that this method is buggy.  I was just
> pointing out that many people have
> had difficulties with it.  For some, it's an older version of
> CGI.pm.  For others, it's misuse,
> and others circumstances, it just seems to 'fail'.  Maybe it's
> bugs, maybe it's some confusion
> over the documentation.  I've just seen enough problems with
> enough programmers that I avoid it.
>
> Cheers,
> Curtis Poe
>
> =
> Senior Programmer
> Onsite! Technology (http://www.onsitetech.com/)
> "Ovid" on http://www.perlmonks.org/
>
> __
> Do You Yahoo!?
> Make international calls for as low as $.04/minute with Yahoo! Messenger
> http://phonecard.yahoo.com/
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: Best Practices: Error Handling???

2001-08-14 Thread Bradley M. Handy

Try the Error.pm module.  You can find it at:
http://search.cpan.org/doc/MSERGEANT/AxKit-1.4/Error-0.13/Error.pm

Brad Handy
--www.jack-of-all-trades.net
--mailto:[EMAIL PROTECTED]


> -Original Message-
> From: David Simcik [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, August 14, 2001 10:52 AM
> To: Perl Cgi
> Subject: Best Practices: Error Handling???
>
>
>
> I've been perusing the Camel book, the Cookbook, CGI Programming
> w/Perl, and
> Effective Perl for answers to this question, but have yet to find
> one or two
> definitive solutions. I've seen the standard die/eval() statements and the
> use of the various incarnations of Carp, but I have yet to see anyone say
> something along the lines of "this is the most common approach". I find
> myself longing for the consistency of try/catch blocks. Can
> anyone shed some
> light on the situation?
>
> Regards,
> DTS
>
>
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: Multiple values and regex issue

2001-08-13 Thread Bradley M. Handy

http://search.cpan.org/search?module=CGI

Brad Handy
--www.jack-of-all-trades.net
[EMAIL PROTECTED]


> -Original Message-
> From: Teresa Raymond [mailto:[EMAIL PROTECTED]]
> Sent: Monday, August 13, 2001 12:48 PM
> To: Moon, John
> Cc: [EMAIL PROTECTED]
> Subject: RE: Multiple values and regex issue
> 
> 
> My computer has died so, I'm using my husband's which means that I 
> have lost all my links.  So, could someone please post the CGI.pm 
> documentation link?
> 
> >I believe what may be happening is the listbox/checkbox is returning an
> >array so $param{$i} for them is an array reference ... There is 
> a discussing
> >in the doc for CGI about this ...
> >
> >
> >Hope this helps ...
> >
> >jwm
> >
> >PS ...
> >
> >foreach (keys %params)
> > {
> > print "error msg" if ($params{$_} !~ /^([\w\s\.\/-]+)$/i);
> > }
> >
> >I forget about "$_" ... it's free
> >
> >
> >-Original Message-
> >From: Teresa Raymond [mailto:[EMAIL PROTECTED]]
> >Sent: August 11, 2001 13:03
> >To: [EMAIL PROTECTED]
> >Subject: Multiple values and regex issue
> >
> >
> >I have the below regex which works except when I send multiple values
> >through a drop down list or through checkboxes.  The test evaluates
> >true and prints the Error Msg every time multiple values are passed.
> >Any suggestions?
> >
> >foreach my $i (keys %params)
> >{
> >if ($params{$i} !~/^([\w\s\.\/-]+)$/i)
> > {
> >print "Error Msg";
> >}
> >}
> >
> >--
> >To unsubscribe, e-mail: [EMAIL PROTECTED]
> >For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> -- 
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: Perl Editors

2001-08-08 Thread Bradley M. Handy

I can attest to that.  I'm running Win98, and I have 256M of RAM and P3 800.
The stinking program hangs about 75% of the time after just clicking inside
the text window.

Brad Handy
--www.jack-of-all-trades.net
[EMAIL PROTECTED]


> -Original Message-
> From: Mel Matsuoka [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, August 08, 2001 10:11 AM
> To: [EMAIL PROTECTED]
> Subject: RE: Perl Editors
>
>
> At 07:35 PM 08/08/2001 +0100, Joel Hughes wrote:
> >I've used ActiveStates Komodo editor which is nice & free
> >
>
> Not to start another editor religious-war, but Komodo, while being a great
> idea on paper, just doesn't execute very well in real life (at least on
> Windows2000). First off, the damn thing wants over 100 megabytes of
> diskspace and consumes MASSIVE amounts of system resources while its
> running. Very slow.
>
> If Activestate can optimize Komodo so its faster and not so bloated, it
> will definitely be a great option.
>
> But for now, nothing on Windows can beat UltraEdit and PerlBuilder...at
> least for me.
>
> Aloha,
> mel
>
> --
> mel matsuokaHawaiian Image Productions
> Chief Executive Alphageek  (vox)1.808.531.5474
> [EMAIL PROTECTED]  (fax)1.808.526.4040
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: Perl Editors

2001-08-08 Thread Bradley M. Handy

Is there are URL where I can get the version for Windows?

Brad Handy
--www.jack-of-all-trades.net
[EMAIL PROTECTED]

> -Original Message-
> From: Brett W. McCoy [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, August 08, 2001 3:02 PM
> To: Bradley M. Handy
> Cc: Kuchler, David; [EMAIL PROTECTED]
> Subject: RE: Perl Editors
> 
> 
> On Wed, 8 Aug 2001, Bradley M. Handy wrote:
> 
> > I just downloaded Komodo and subscribed for a non-commercial 
> license (I work
> > for a non-profit organization).  The non-commercial license is free.
> 
> Just to make this an official 'editor religious war', I will also
> recommend emacs/xemacs -- it supports color syntax highlighting, syntax
> checking, and a few other neat thingies.
> 
> And yes, emacs is available for Windows and is GPLed.
> 
> -- Brett
>  http://www.chapelperilous.net/btfwk/
> 
> A complex system that works is invariably found to have evolved from a
> simple system that works.
> 

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: Perl Editors

2001-08-08 Thread Bradley M. Handy

I just downloaded Komodo and subscribed for a non-commercial license (I work
for a non-profit organization).  The non-commercial license is free.

Brad Handy
--www.jack-of-all-trades.net
[EMAIL PROTECTED]


> -Original Message-
> From: Kuchler, David [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, August 08, 2001 2:40 PM
> To: [EMAIL PROTECTED]
> Subject: RE: Perl Editors
>
>
> When I saw Komodo, there were three licensing options for Windows
> environments:  Commercial (needed for any real use), Evaluation
> (free for 21
> days, but must purchase afterwards), and Non-Commercial (limited
> to teaching
> or learning).  Now, I know that to use Komodo on Linux is free,
> but I don't
> know if the Non-Commercial license for Windows is free.  Could
> anyone (Joel,
> perhaps) shed some light on this?
>
>
>
> David T. Kuchler
> Technical Configurator
> Pioneer Standard Electronics
> [EMAIL PROTECTED]
>
>
>
>
> -Original Message-
> From: Joel Hughes [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, August 08, 2001 2:36 PM
> To: [EMAIL PROTECTED]
> Subject: RE: Perl Editors
>
>
> I've used ActiveStates Komodo editor which is nice & free
>
> joel
>
> -Original Message-
> From: Al Hospers [mailto:[EMAIL PROTECTED]]
> Sent: 08 August 2001 18:49
> To: [EMAIL PROTECTED]
> Subject: RE: Perl Editors
>
>
> I'm assuming that what is meant by /compiling/ is really syntax
> checking...
>
> Al Hospers
> CamberSoft, Inc.
> alcambersoftcom
> http://www.cambersoft.com
>
> A famous linguist once said:
> "There is no language wherein a double
> positive can form a negative."
>
> YEAH, RIGHT
>
>
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: Redirecting STDOUT

2001-08-07 Thread Bradley M. Handy

Have you taken a look at the GnuPG or Crypt::GPG modules on CPAN?
These would probably work really good for what you're doing, and
you wouldn't have to worry about redirecting STDOUT.

Brad Handy
--www.jack-of-all-trades.net
[EMAIL PROTECTED]

> -Original Message-
> From: Mark Ross [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, August 07, 2001 12:11 PM
> To: [EMAIL PROTECTED]
> Subject: Redirecting STDOUT
>
>
> Hi all,
>
> I have a Perl script that takes the contents of a
> form, feeds them to GnuPG for encryption and then
> emails me the encrypted document. GPG wants to either
> display the results in STDOUT or write a text file,
> both of which aren’t good.
>
> I was hoping redirect STDOUT to a variable for a short
> time.
>
> I’ve seen references to redirecting filehandles in the
> documentation, but no details on how to do it. (Which
> I’m sure are there, but I’ve just missed). Could
> someone point me where to look?
>
> Thanks,
> --Mark.
>
> __
> Do You Yahoo!?
> Make international calls for as low as $.04/minute with Yahoo! Messenger
> http://phonecard.yahoo.com/
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: M$ Word to HTML

2001-08-07 Thread Bradley M. Handy

If you have Dreamweaver you can use the 'Clean up Word HTML' option in the
Modify menu on the toolbar.

Brad Handy
--www.jack-of-all-trades.net
[EMAIL PROTECTED]

> -Original Message-
> From: Adam Carson [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, August 07, 2001 11:22 AM
> To: [EMAIL PROTECTED]
> Cc: [EMAIL PROTECTED]
> Subject: Re: M$ Word to HTML
>
>
> I have tried that, and Word generates HTML documents (XML
> actually) that have consistently had incorrect formatting.
>
>   Adam Carson
> MIS Department
>  Berkeley County, SC
>
> >>> "Brett W. McCoy" <[EMAIL PROTECTED]> 08/07/01 11:22AM >>>
> On Tue, 7 Aug 2001, Adam Carson wrote:
>
> > Does anyone know of a perl module/program to convert M$ Word
> documents into HTML?  I have looked at the perldocs, and searched
> CPAN, but haven't found one.
>
> Word itself can generate HTML documents from Word documents.  Maybe you
> can set up some OLE automation to perform this task (you can do OLE
> automation in Perl with ActiveState Perl).
>
> -- Brett
>  http://www.chapelperilous.net/btfwk/
> 
> It'll be just like Beggars' Canyon back home.
>   -- Luke Skywalker
>
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: Tie and HASHREF's

2001-08-01 Thread Bradley M. Handy

I decided that I would try it myself, and I have found that the code below
is correct.  For a tied hash (%hash), and the variable $hashref is assigned
\%hash the following lines are equivalent:

$hashref->{key} eq $hash{key};
$hash{key} eq $hash{key};

Brad Handy
--www.jack-of-all-trades.net
[EMAIL PROTECTED]

> -Original Message-
> From: Bradley M. Handy [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, August 01, 2001 10:27 AM
> To: [EMAIL PROTECTED]
> Subject: Tie and HASHREF's
> 
> 
> I am wondering about the use of tie with hashes and then returning a
> reference to that tied hash.
> 
> If have the following code:
> 
> ##--- Begin Code
> 
> 
> #!/usr/bin/perl -w
> 
> use strict;
> use Apache::Session::DB_File;
> 
> my %session;
> tie %session, Apache::Session::DB_File, ,
>   {FileName=>'/path/to/db_file', LockDirectory=>'path/to/'};
> my $hashref = \%session;
> 
> ##--- End Code
> 
> Is
> 
>   $hashref->{session_var} = session_value;
> 
> the same as
> 
>   $session{session_var} = session_value;
> 
> 
> 
> Bradley M. Handy
> Programmer/Analyst, Spring Arbor University
> 106 E. Main Street, St 22, Spring Arbor, Michigan 49283
> 
> Phone:+1 517 750 6675
>   +1 800 968 9103 x1675
> Email:[EMAIL PROTECTED]
> 
> If women don't find you handsome, they should at least
> find you handy.
> -- Steve Smith as Red Green from The Red Green Show
> 
> 
> -- 
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Tie and HASHREF's

2001-08-01 Thread Bradley M. Handy

I am wondering about the use of tie with hashes and then returning a
reference to that tied hash.

If have the following code:

##--- Begin Code


#!/usr/bin/perl -w

use strict;
use Apache::Session::DB_File;

my %session;
tie %session, Apache::Session::DB_File, ,
{FileName=>'/path/to/db_file', LockDirectory=>'path/to/'};
my $hashref = \%session;

##--- End Code

Is

$hashref->{session_var} = session_value;

the same as

$session{session_var} = session_value;


========
Bradley M. Handy
Programmer/Analyst, Spring Arbor University
106 E. Main Street, St 22, Spring Arbor, Michigan 49283

Phone:  +1 517 750 6675
+1 800 968 9103 x1675
Email:  [EMAIL PROTECTED]

If women don't find you handsome, they should at least
find you handy.
-- Steve Smith as Red Green from The Red Green Show


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: PERL and JavaScript

2001-07-31 Thread Bradley M. Handy

Have you thought of doing named anchors?  (ie. )

If you use separate forms for each section, and direct them to the same
script except at the end of the action URL you add '#anchor_name' w/o the
quotes, the page should load up where you want it to.

I have a very simple script to show my point.

Go to --> http://test.jack-of-all-trades.net/cgi-bin/test.cgi

Notice that the page is just blank except for a submit button.  View the
source and notice the action URL of the form tag.  Also notice that the page
is completely blank save the submit button.  Click the submit button and you
will see what happens.

NOTE:  Make sure you use the POST method, or it may not work.  POST method
is the best way to go anyway, IMOHO.

Brad Handy
--www.jack-of-all-trades.net
[EMAIL PROTECTED]

> -Original Message-
> From: Chris Johnstone [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, July 31, 2001 3:52 PM
> To: Bradley M. Handy
> Subject: RE: PERL and JavaScript
>
>
> First of all I'm using the CGI.PM module to generate
> my CGI [which is all done using CGI.pm's functions].
>
> Anyways, the exact problem was this:
>
> I have a form with several "internal submission
> buttons". Then there is a "final submission button",
> which is for when you are entirely done.
>
> For these "internal submission buttons", I am using
> hidden fields to maintain state, and subroutines to
> rextract, sort, and edit the data found in them.
>
> Since my form is very large, it contains many subparts
> where "internal submission buttons" are needed; so
> when a user clicks an internal submission button, the
> data on the form is taken to the server and it does
> some processing and prints it out in the way the user
> would expect. However, the user was ALWAYS taken to
> the head of the form, no matter what clever trick I
> tried, rather then to the sub-section they were in [my
> form is all on 1 page, and when you submit it, it goes
> to a different page].
>
> After searching and searching and trying various
> things, I found that pulling JavaScript into my CGI.PM
> framework would enable me to do what I needed to do.
> So this bit of code did what I couldn'd do before:
> submit(-name=>'internalsubmission1',
>-label=>'Submit a foo',
>
> -onClick=>"document.encode.action='#subsection1'");
>
> Heres an illustration, I hope this makes it clear:
> So a simple example would be a dynamic CGI page, where
> you have this
>
> Submit a number [_] [SUBMIT NUMBER]
>
> Number summing goodness:
> NumberTotal
>   3  3   *
>   4  7   *
>  10 17   *
>   5 22   *
>
> Submit a word [___] [SUBMIT WORD]
>
> Word alphabetizing coolness:
> apple,  [DELETE WORD] *
> avocado,[DELETE WORD] *
> peach,  [DELETE WORD] *
> pear,   [DELETE WORD] *
> pineapple   [DELETE WORD] *
>
> * means that the content which appears in these areas
> relies on subroutines which sort, analyze data
>
> Hopefully you get the jist of this. I have just been
> making up my own techniques of generating content with
> CGI and I can't seem to find any text out there that
> goes beyond the beginner level :I
>
> Thanks
>
> Chris
> --- "Bradley M. Handy" <[EMAIL PROTECTED]>
> wrote:
> > What kind of problems were you having with Perl?
> >
> > Brad Handy
> > --www.jack-of-all-trades.net
> > [EMAIL PROTECTED]
> >
> >
> > > -Original Message-
> > > From: Chris Johnstone
> > [mailto:[EMAIL PROTECTED]]
> > > Sent: Tuesday, July 31, 2001 3:23 PM
> > > To: [EMAIL PROTECTED]
> > > Subject: PERL and JavaScript
> > >
> > >
> > > I am a beginning PERL programmer working primarily
> > > with the CGI interface, and have just encountered
> > my
> > > first problem which I couldn't solve with PERL.
> > After
> > > about a solid week of trying different things, I
> > gave
> > > up and used a little JavaScript code. My question
> > is,
> > > do "professional" programmers working on large
> > > applications using the CGI interface oftern turn
> > to
> > > JavaScript, or do they try to solve everything
> > > internally with PERL?
> > >
> > > Chris Johnstone
> > >
> > > __
> > > Do You Yahoo!?
> > > Make international calls for as low as $.04/minute
> > with Yahoo! Messenger
> > > http://phonecard.yahoo.com/
> > >
> > > --
> > > To unsubscribe, e-mail:
> > [EMAIL PROTECTED]
> > > For additional commands, e-mail:
> > [EMAIL PROTECTED]
> > >
>
>
> __
> Do You Yahoo!?
> Make international calls for as low as $.04/minute with Yahoo! Messenger
> http://phonecard.yahoo.com/
>


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: PERL and JavaScript

2001-07-31 Thread Bradley M. Handy

What kind of problems were you having with Perl?

Brad Handy
--www.jack-of-all-trades.net
[EMAIL PROTECTED]


> -Original Message-
> From: Chris Johnstone [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, July 31, 2001 3:23 PM
> To: [EMAIL PROTECTED]
> Subject: PERL and JavaScript
> 
> 
> I am a beginning PERL programmer working primarily
> with the CGI interface, and have just encountered my
> first problem which I couldn't solve with PERL. After
> about a solid week of trying different things, I gave
> up and used a little JavaScript code. My question is,
> do "professional" programmers working on large
> applications using the CGI interface oftern turn to
> JavaScript, or do they try to solve everything
> internally with PERL?
> 
> Chris Johnstone
> 
> __
> Do You Yahoo!?
> Make international calls for as low as $.04/minute with Yahoo! Messenger
> http://phonecard.yahoo.com/
> 
> -- 
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: Date

2001-07-25 Thread Bradley M. Handy

Also, take a local a the Date::Calc module for the date arithmetic.

Brad Handy
--www.jack-of-all-trades.net
[EMAIL PROTECTED]

> -Original Message-
> From: Venkat Mohan [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, July 25, 2001 12:58 PM
> To: 'Fred Sahakian'; <
> Subject: RE: Date
>
>
> You can use Time::Local package.
>
> There is a function timelocal takes the seconds, minutes, hours,
> day, month,
> year and returns epoch seconds.
>
> - Venkat
>
> -Original Message-
> From: Fred Sahakian [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, July 25, 2001 9:53 AM
> To: <
> Subject: Date
>
>
> Im Stuck!
>
> I need to figure out how to covert a date such as 10242001 into Epoch time
> or another format where as I can subtract 2 calendar dates and
> get a number.
>
> thanks
>
>
>
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: script headers

2001-07-24 Thread Bradley M. Handy

If you don't have the following line in your code then you should add it.

print "Content-type: text/html\n\n";

or if you're using the CGI object

print CGI->header();

This should be done before you print anything to the browser.

Brad Handy 
--www.jack-of-all-trades.net
[EMAIL PROTECTED]

> -Original Message-
> From: Sally [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, July 24, 2001 11:17 AM
> To: perlcgi
> Subject: script headers
> 
> 
> Can anyone give me a general idea what the error premature end of script
> headers means? Is it an incorrect filename, or that the file 
> can't be found
> or something else?
> 
> 
> -- 
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Database Connection Pooling (Java vs. Perl)

2001-07-24 Thread Bradley M. Handy

In Java there is the ability to do database connection pooling, where you
have a ConnectionPool object that contains multiple database connection in
it.  When you need a connection to a database, you get one from the pool and
go.

Is there a way to do this in Perl, or is there some article I could read to
learn how to do this.

Brad Handy
--www.jack-of-all-trades.net
[EMAIL PROTECTED]


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: e-mailing HTML form results

2001-07-23 Thread Bradley M. Handy



> -Original Message-
> From: Helen Dickey [mailto:[EMAIL PROTECTED]]
> Sent: Monday, July 23, 2001 7:11 AM
> To: '[EMAIL PROTECTED]'
> Subject: RE: e-mailing HTML form results
>
>
> I finished correcting the errors which gave software and comp. error
> messages.
> Now I get the pretty page back on my web browser, but it does not send
> E-mail to me.
> The two lines that I think might have the problem are:
>
> $smtp = Net::SMTP->new("summitrelocation.com");
The server you connect to needs to be the name of the email server.  It will
most likely NOT be just summitrelocation.com.  It should something like
mail.summitrelocation.com, or smtp.summitrelocatio.com.  You need to check
with her, or her hosting provider for the details.

> $smtp->to("helend\@his.com");
>
> (I am writing a response form for my friend Kathy who started the
> business Summit Relocation and I write her web pages---my first try at
> being a webmaster---and she wants the pretty page we get back on the web
> browser to be e-mailed  to her (eventually to her---I am having it
> e-mailed to me while I test)
>
> Please help.
>
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: Table display speed: can be improved?

2001-07-20 Thread Bradley M. Handy

try this:

my $row;
print "";
while($row = $dbh->fetch()) {
print Tr([td([@$row[1..18]])]);
}
print "";

This only pulls a database resultset row into memory when you need.  In your
earlier example you pull everything into memory first and then print it out.
This can be quite inefficient.  I'm not sure how much this will speed up
your load time, if any, but it theoretically should work.

Brad Handy

--www.jack-of-all-trades.net
[EMAIL PROTECTED]


> -Original Message-
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
> Sent: Friday, July 20, 2001 7:07 AM
> To: [EMAIL PROTECTED]
> Subject: Table display speed: can be improved?
>
>
> Hi,
>
>   I have to display some tables with several hundreds of rows in one
> page. It takes more than 30s for 150 rows with that code:
>
> $recordset = $dbh->selectall_arrayref($query, undef);
>
> print "";
> foreach $row(@$recordset)
>

>   print Tr([td([@$row[1..18]])]);
>   }
> print "";
>
>
> Has anyone a clue how to improve that to some seconds?
>
> Thanks,
>
> Yann
>
>
> ===
> De verzonden informatie is uitsluitend bestemd voor de geadresseerde
> natuurlijke persoon of rechtspersoon en bevat mogelijk
> vertrouwelijke en/of
> geprivilegeerde gegevens. Met uitzondering van de geadresseerde persoon is
> het niet toegestaan de informatie openbaar te maken, te kopiëren, te
> verspreiden of anderszins actie te ondernemen op basis van de informatie.
> Indien u de informatie abusievelijk heeft ontvangen, neem dan
> contact op met
> de afzender en verwijder de informatie uit alle computers. Dutchtone staat
> niet in voor de juiste en complete verzending van de informatie,
> noch is zij
> aansprakelijk voor de vertraagde ontvangst hiervan.
>
> The information transmitted is intended exclusively for the
> person or entity
> to which it is addressed and may contain confidential and/or privileged
> material. Any disclosure, copying, distribution or other action
> based upon
> the information by persons or entities other than the intended
> recipient is
> prohibited. If you receive this information in error, please contact the
> sender and delete the material from any and all computers. Dutchtone does
> not warrant a proper and complete transmission of this
> information, nor does
> it accept liability for any delays.
> ===
>
>
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: new one...

2001-07-20 Thread Bradley M. Handy

In my experience with Perl, whenever you use the construct 'print
<<"tag_name";' you need to surround it with either single quotes (') or
double quotes (").  That's the only thing that I see that could be wrong.

Brad Handy

--www.jack-of-all-trades.net
[EMAIL PROTECTED]

> -Original Message-
> From: bc [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, July 19, 2001 6:04 PM
> To: [EMAIL PROTECTED]; Mel Matsuoka
> Subject: new one...
>
>
> new error, darn, i wish the browser would print the errored line #, any
> ideas yall?
>
> Execution of customgame.pl aborted due to compilation errors.
>
> was the error...
> here was my page...
>
> #!/usr/bin/perl -w
> use CGI::Carp qw(fatalsToBrowser);
> #howdy
> use CGI qw(param);
>
> print< content-type: text/html
>
> 
> customgame
> 
> 
> end_of_html_start
>
> $guess = param("guess");
> $name = param("name");
>   if ($guess = "") {
>  if ($name eq "") {
>  print ("hello there, please enter name here: action=customgame.pl> value=enter>");
>  } elsif ($name eq "randal") {
>  print ("hi, since you're $name , you do not have to guess the secret
> word!");
>  } else {
>  print ("your not randal, so you have to guess the secret word: method=post action=customgame.pl> type=submit value=enter>");
>  print ("hello there, please enter another name here: action=customgame.pl> value=enter>");
>   }
>   } elsif ($guess = "toe") {
>   print ("you guessed it!  good job bossman!");
>   print ("go read the http://www.abcnews.com>news");
>   ) else (
>   print ("Wrong! http://toes.netfirms.com>go again...");
>   }
>
> print< 
> END
>
>
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: CGI script to ftp from client to webserver

2001-07-19 Thread Bradley M. Handy

Take a look at the Documentation for the CGI.pm module at:
http://search.cpan.org/search?module=CGI

or presuming that the perl location is in your PATH environment variable you
can do this:
perldoc CGI

Brad Handy

--www.jack-of-all-trades.net
[EMAIL PROTECTED]


> -Original Message-
> From: Kerns, Justin [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, July 19, 2001 2:23 PM
> To: '[EMAIL PROTECTED]'
> Subject: CGI script to ftp from client to webserver
>
>
> I am trying to write a script that will allow a user to upload a file (any
> size) to my webserver (W2K).  Can anyone offer any good suggestions for
> starting off?
>
> Thanks in advance.
>
> JK...
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: e-mailing HTML form results

2001-07-18 Thread Bradley M. Handy

If you are going to use the 'datasend' and 'dataend' subroutines then you
must change your to do the following:

$smtp->data();
$smtp->datasend("whatever1\n");
$smtp->datasend("whatever2\n");
$smtp->datasend("whatever3\n");
$smtp->dataend();

One thing to note.  When you start sending data, it is best to send a
Subject line that ends with two "\n".  This tells the email program what the
subject is, and it also tells the email program where the body of the
message starts.  If you don't want to print subject line then at least print
two "\n" characters.

$smtp->datasend("Subject: Subject line here\n\n");

or

$smtp->datasend("\n\n");

I my experience with this module, if you don't do this, then the email will
be unreadable by the recipient.

Brad Handy

--www.jack-of-all-trades.net
[EMAIL PROTECTED]



> -Original Message-
> From: Helen Dickey [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, July 18, 2001 6:21 AM
> To: '[EMAIL PROTECTED]'
> Subject: Re: e-mailing HTML form results
>
>
> Dear Floptop or Bradley or whoever,
> Thank you for your help so far. I have several lines to datasend.
> Do I have to put them all in a string
>  $smtp->datasend("\n");
>  $smtp->datasend("whatever1whatever2whatever3\n");
>  $smtp->dataend();
>  $smtp->quit;
> Or may I
>  $smtp->datasend("\n");
>  $smtp->datasend("whatever1\n");
>   $smtp->datasend("whatever2\n");
>  $smtp->datasend("whatever3\n");
> $smtp->dataend();
>  $smtp->quit;
> Or is there supposed to be only one \n
> $smtp->datasend("\n");
>  $smtp->datasend("whatever1");
>   $smtp->datasend("whatever2");
>  $smtp->datasend("whatever3\n");
> $smtp->dataend();
>  $smtp->quit;
>
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: e-mailing HTML form results

2001-07-18 Thread Bradley M. Handy



> -Original Message-
> From: Helen Dickey [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, July 18, 2001 6:34 AM
> To: '[EMAIL PROTECTED]'
> Subject: Re: e-mailing HTML form results
> 
> 
> Hi again,
> Can the line
> $smtp->to('[EMAIL PROTECTED]");
> be
> $smtp->to('[EMAIL PROTECTED],STDOUT");
> ?

No it cannot.
> 
> 
> -- 
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: CGI vars

2001-07-17 Thread Bradley M. Handy

Multiple form parameters of the same name are interpretted by CGI.pm as an
array.  The first one to appear in the form is the 0th element and then it
goes on from there.  For instance:










If the form is submitted with all these checkboxes checked, then CGI.pm will
create an array that is structured like this:
@param_array = ('Tea', 'Coffee', 'Soft Drinks', 'Juice', 'Milk');

Now if you have a script that looks like this:

#!/path/to/perl -w

use CGI;
use strict;

my $q = new CGI qw(-debug);

foreach ($q->param('param1')) {
print;  # prints each element is succession.
print "\n";
}

print "\n\n";

my $param_value = $q->param('param1');  # assigns the first element of the
array, in this case the string 'Tea'.

print "${param_values}\n";  # prints the string 'Tea'.


# End test script.

Enter the following command:

perl test_script.pl

The script will pause for input.  Enter the following as input:

param1=Tea¶m1=Coffee¶m1=Soft%20Drinks¶m1=Juice¶m1=Milk

Press the return key and then hit CTRL-D (for Unix systems) or CTRL-Z (I
believe for Windows systems) to issue the end of file character so CGI.pm
will stop reading output and the script will continue processing.

The output is below.

# Begin output.
Tea
Coffee
Soft Drinks
Juice
Milk


Tea
# End output.

The way the param subroutine works in CGI.pm is like this:
1.)  if called in scalar context it returns the first element of the array.
2.)  if called in array context it returns the entire array.

NOTE:  This is not the case with version 3+ of the CGI package of modules.
Version 3+ is ALPHA CODE and shouldn't be used in production servers.  This
output was obtained using CGI Version 2.753 which is the latest production
release of the CGI package of modules by Lincoln D. Stein.

Brad Handy

--www.jack-of-all-trades.net
[EMAIL PROTECTED]


> -Original Message-
> From: Maxim Berlin [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, July 17, 2001 8:34 AM
> To: cgi
> Subject: Re: CGI vars
>
>
> Hello Jerry,
>
> Tuesday, July 17, 2001, Jerry Preston <[EMAIL PROTECTED]> wrote:
>
> JP> Hi,
>
> JP> I setup a var to hold data:
>
> JP>   $name = $query->param('name');
>
> JP> I get a user input in a textfield.
>
> JP>   print $query->popup_menu( -name=>'name',
> JP> -values  => $T_NAME{ "\L$fab" },
> JP> -default => ''
> JP>   );
> JP> I want to remove it
>
> JP> undef $name;
> JP> print $query->hidden( 'name', $name );
>
> JP> or
>
> JP>print $query->hidden( 'name', "" );
>
> JP> I am unable to drop / delete / clear out the var "name".
>
> JP> What am I doing wrong?
> if i correctly understand, you try to redefine variable inside
> cgi-generated html, yes? i think it is incorrect.
> check, what your browser does with this sample:
>
> **
> #!/usr/local/bin/perl
>
> use strict;
> use CGI qw/:all/;
>
> print header;
>
> print < 
> test
> 
> 
> 
> 
> 
> 
> 
> END
>
> print "param1 = ",param("param1"),"";
> print "param2 = ",param("param2"),"";
>
> print '';
> **
> on my ie5 i got this:
>
> param1 = param1_valredefined1
> param2 = param2_val
>
> Best wishes,
>  Maximmailto:[EMAIL PROTECTED]
>
>
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: e-mailin HTML of form results

2001-07-16 Thread Bradley M. Handy

Check out the documentation for the Net::SMTP module at:

http://search.cpan.org/search?module=Net::SMTP

Brad Handy

--www.jack-of-all-trades.net
[EMAIL PROTECTED]

> -Original Message-
> From: Helen Dickey [mailto:[EMAIL PROTECTED]]
> Sent: Monday, July 16, 2001 7:40 AM
> To: '[EMAIL PROTECTED]'
> Subject: e-mailin HTML of form results 
> 
> 
> Hi,
> I wrote an HTML form.  I wrote a perl script to read the form input and
> print the results on a pretty HTML table. I get the results fine and
> prety on my screen when I submit but I want to know how to send the
> resulting HTML page that I see to an e-mail address.
> Helen
> 
> 
> -- 
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: Crtl + C

2001-07-16 Thread Bradley M. Handy

If you have Term::ReadKey installed try this.  If you don't have
Term::ReadKey installed then you can get from CPAN at:

http://search.cpan.org/search?module=Term::ReadKey

If you are using Windows, then I'm not sure if Term::ReadKey will work.

Here is a test script I wrote to show how Term::ReadKey works (a small
sampling anyway).

# Start script.
#!/path/to/perl -w

use Term::ReadKey;

ReadMode 4, STDIN;

my $char;
print 'ReadMode 4.  Echo is off and control characters disabled.' . "\n";
print 'Press "q" to quit. --> ';
while(1) {
if(defined($char = ReadKey -1, STDIN)) {
if($char ne 'q') {
print "\nYou typed '${char}'\n";
print "--> ";
} else {
last;
}
}
}

ReadMode 0, STDIN;
ReadMode 3, STDIN;

print 'ReadMode 3.  Echo is off and control-break (^C) breaks the read
cycle.' . "\n";
print 'Press ^C to quit. --> ';
while(1) {
if(defined($char = ReadKey -1, STDIN)) {
print "\nYou typed '${char}'\n";
print "--> ";
}
}

ReadMode 0, STDIN;

# End script.

> -Original Message-
> From: Thomas Jakub [mailto:[EMAIL PROTECTED]]
> Sent: Monday, July 16, 2001 9:19 AM
> To: [EMAIL PROTECTED]
> Subject: Crtl + C
>
>
> This is the code segment I was working with.  When I
> hit Crtl + C, or whatever, it doesn't break at all.
> It just keeps on going...  Just to make sure I have
> all my basis covered, what are some of the other linux
> break keystrokes?  Here's the unbreakable code, which
> I want to be made breakable:
>
> $SIG{INT} = \&end;
>
> run();
>
> sub run {
> while (1) {
> print "blah\n";
> }}
>
> sub end {
> $SIG{QUIT} = \&end;
> print "ending\n";
> die;
> }
>
> --- "Bradley M. Handy" <[EMAIL PROTECTED]>
> wrote:
> > If you are using the Term::ReadKey module, what read
> > module do you have it
> > in?  Can you post your code?
> >
> > Brad Handy
> >
> > --www.jack-of-all-trades.net
> > [EMAIL PROTECTED]
> >
> > > -Original Message-
> > > From: Thomas Jakub [mailto:[EMAIL PROTECTED]]
> > > Sent: Sunday, July 15, 2001 2:33 AM
> > > To: [EMAIL PROTECTED]
> > > Subject: Re: breakable loop???
> > >
> > >
> > > Maybe I should try to rewrite my email in a more
> > easy
> > > to understand way, since no one is replying...
> > >
> > > I did the SIG{INT} thingie, and even had a die;
> > > command at the end of it, but I can't break out of
> > the
> > > function.  Crtl + C does nothing.  So, die; does
> > make
> > > it so Crtl + C works, even if there is a SIG{INT}
> > > thingie in there?
> > >
> > > --- Thomas Jakub <[EMAIL PROTECTED]> wrote:
> > > > maybe I'm not implementing the SIG{ING} thingie
> > > > right...
> > > > I had a die; command in there, but that didn't
> > > > work...
> > > >
> > > > --- Thomas Jakub <[EMAIL PROTECTED]> wrote:
> > > > > Ummm...  I can't seem to break out of my
> > infinite
> > > > > loops by doing crtl + c...  consequently, I
> > can't
> > > > go
> > > > > into the SIG{INT} function...  I tried Crtl +
> > > > > Backspace, but that didn't work to well
> > either...
> > > > > Crtl + S stopped it, but that was it...  What
> > are
> > > > > the
> > > > > control signals for unix?  Or am I doing
> > something
> > > > > wrong, or what?
> > > > >
> > > > > --- Will Cottay <[EMAIL PROTECTED]> wrote:
> > > > > > You might want to look at the CPAN module
> > > > > > Term::ReadKey.  It provides
> > > > > > for
> > > > > > non-blocking reads.
> > > > > >
> > > > > > Or, you could install a signal handler ie:
> > > > > >
> > > > > > $SIG{INT} = \&report_stats;
> > > > > >
> > > > > > while (1) {
> > > > > > ... your website checking code here ...
> > > > > >  }
> > > > > >
> > > > > > sub report_stats {
> > > > > > $SIG{QUIT} = \&report_stats;
> > > > > >

RE: breakable loop???

2001-07-16 Thread Bradley M. Handy

If you are using the Term::ReadKey module, what read module do you have it
in?  Can you post your code?

Brad Handy

--www.jack-of-all-trades.net
[EMAIL PROTECTED]

> -Original Message-
> From: Thomas Jakub [mailto:[EMAIL PROTECTED]]
> Sent: Sunday, July 15, 2001 2:33 AM
> To: [EMAIL PROTECTED]
> Subject: Re: breakable loop???
>
>
> Maybe I should try to rewrite my email in a more easy
> to understand way, since no one is replying...
>
> I did the SIG{INT} thingie, and even had a die;
> command at the end of it, but I can't break out of the
> function.  Crtl + C does nothing.  So, die; does make
> it so Crtl + C works, even if there is a SIG{INT}
> thingie in there?
>
> --- Thomas Jakub <[EMAIL PROTECTED]> wrote:
> > maybe I'm not implementing the SIG{ING} thingie
> > right...
> > I had a die; command in there, but that didn't
> > work...
> >
> > --- Thomas Jakub <[EMAIL PROTECTED]> wrote:
> > > Ummm...  I can't seem to break out of my infinite
> > > loops by doing crtl + c...  consequently, I can't
> > go
> > > into the SIG{INT} function...  I tried Crtl +
> > > Backspace, but that didn't work to well either...
> > > Crtl + S stopped it, but that was it...  What are
> > > the
> > > control signals for unix?  Or am I doing something
> > > wrong, or what?
> > >
> > > --- Will Cottay <[EMAIL PROTECTED]> wrote:
> > > > You might want to look at the CPAN module
> > > > Term::ReadKey.  It provides
> > > > for
> > > > non-blocking reads.
> > > >
> > > > Or, you could install a signal handler ie:
> > > >
> > > > $SIG{INT} = \&report_stats;
> > > >
> > > > while (1) {
> > > > ... your website checking code here ...
> > > >  }
> > > >
> > > > sub report_stats {
> > > > $SIG{QUIT} = \&report_stats;
> > > > ...Your stat reporting and exit code here
> > > > }
> > > >
> > > > and hit ^C when you want it to report and stop.
> > > >
> > > >
> > > >
> > > > Thomas Jakub wrote:
> > > >
> > > > > --- Adam Carson <[EMAIL PROTECTED]>
> > > wrote:
> > > > > > Since you said that you are trying to hit a
> > > > > > webserver until you tell it to stop, you
> > might
> > > > want
> > > > > > it to check for a different condition, such
> > as
> > > a
> > > > > > certain number of hits or a timeout, etc.
> > In
> > > > Pascal
> > > > > > there is a getkey function, I don't think
> > Perl
> > > > has
> > > > > > an equivalent though.
> > > > >
> > > > > I got it so it does it for as many iterations
> > as
> > > > you
> > > > > specify, but I was hoping to get it so it
> > could
> > > do
> > > > it
> > > > > continiously until someone hits enter.  Like,
> > > > maybe I
> > > > > could start it on Friday, sometime, without
> > any
> > > > > concern for how many iterations it does per
> > > > second,
> > > > > and on monday, I can just hit enter to
> > terminate
> > > > it,
> > > > > and get the run time statistics of it, thus
> > far.
> > >
> > > > Or
> > > > > maybe just do it until I need to reboot the
> > > > computer -
> > > > > I could just hit enter, and reboot...
> > > > > Anyhow, someone suggested that I do it with
> > > > threads...
> > > > >  how would I do this?
> > > > >
> > > > > >
> > > > > >   Adam
> > Carson
> > > > > > MIS
> > Department
> > > > > >  Berkeley
> > County,
> > > SC
> > > > > >
> > > > > > >>> Thomas Jakub <[EMAIL PROTECTED]>
> > 07/12/01
> > > > > > 02:20PM >>>
> > > > > > so...  is their a function that won't wait
> > for
> > > > me to
> > > > > > hit enter, and can still get the keys?  Or
> > > > rather,
> > > > > > one
> > > > > > that will read only once every time it goes
> > > > through
> > > > > > the while loop?
> > > > > >
> > > > > > --- Adam Carson <[EMAIL PROTECTED]>
> > > > wrote:
> > > > > > > Aaron,
> > > > > > >   If you read the rest of my post, I
> > mention
> > > > that
> > > > > > > there is still a problem with the code, ie
> > > the
> > > > > > > waiting for STDIN.  I was just pointing
> > out
> > > > one
> > > > > > flaw
> > > > > > > in the streamlined version, as it seemed
> > to
> > > be
> > > > the
> > > > > > > better way to go for that particular task.
> >
> > > I
> > > > too
> > > > > > > read the perldocs and saw the same thing.
> > > In
> > > > > > fact,
> > > > > > > I suggested to Thomas that he check them
> > > > regarding
> > > > > > > just that problem.  That message also went
> > > to
> > > > the
> > > > > > > list.
> > > > > > >
> > > > > > >  Regards,
> > > > > > >
> > > > > > >   Adam
> > > Carson
> > > > > > > MIS
> > > Department
> > > > > > >  Berkeley
> > > County,
> > > > SC
> > > > > > >
> > > > > > > >>> Aaron Craig <[EMAIL PROTECTED]>
> > > 07/12/01
> > > > > > > 04:59AM >>>
> > > > > > > At 13:36 11.07.2001 -0400, Adam Carson
> > > wrote:
> > > > > > > >--- Adam Carson
> > <[EMAIL PROTECTED]>
> > > > > > wrote:
> > > > > > > > > Gary, yo

RE: Excel to html via CGI

2001-07-16 Thread Bradley M. Handy

Take a look at the module Spreadsheet::ParseExcel.

http://search.cpan.org/search?module=Spreadsheet::ParseExcel.

Brad Handy

--www.jack-of-all-trades.net
[EMAIL PROTECTED]


> -Original Message-
> From: Deneb Pettersson (LMF) [mailto:[EMAIL PROTECTED]]
> Sent: Monday, July 16, 2001 4:58 AM
> To: '[EMAIL PROTECTED]'
> Subject: Excel to html via CGI
>
>
> Hi. Just wondering if someone has doen dynamic pages with
> infromation extracted from a excel document. My current solution
> for the problem is pretty simple, but it could be even easier if
> you can get the info out of the excel. Atm. I am thinking of
> saving the excel document as excel, that way i get all the info,
> and I get graphs as gif's.  Then I was thinking of just letting
> the CGI read the info from the documents and use the graphs which
> excel saves as img0001.gof etc. as pictures. That way whe someoen
> edit the excel i can just tell tehm to save as html and then i
> get the updated version of the pages.
>
> What would be easier is to have the data extracted from the excel
> directly, but i ahve no idea how that is done, or if it even is
> possible. Has someone done something similar?
>
>
> And the reason for not using the direct html output from excel is
> that it's crappy code, it doesnät look the way I want it to, and
> it hasn't gottne the corporate included SSI's for the intranet
>
> Deneb
>
> Deneb Pettersson
> Node Product Unit Media Gateway
> Oy L M Ericsson Ab
> Tel: +358 9 299 3112
> Mobile: +358 40 510 6487
> mailto:[EMAIL PROTECTED]
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: Nasty

2001-07-13 Thread Bradley M. Handy

Honestly, I don't think it would be fair to say that.


> -Original Message-
> From: Camilo Gonzalez [mailto:[EMAIL PROTECTED]]
> Sent: Friday, July 13, 2001 4:46 PM
> To: [EMAIL PROTECTED]
> Subject: Nasty
> 
> 
> I don't work with a lot of programmers. I hope to get into a 
> situation where
> I do. Is it fair to say the majority are *holes?
> 
> -- 
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: Copy and past HTML into a perl script

2001-07-13 Thread Bradley M. Handy

No they aren't equivalent.

The first prints out -> The rain in $Spain

The second prints out -> The rain in "$Spain"

Does that clarify things?


> -Original Message-
> From: Camilo Gonzalez [mailto:[EMAIL PROTECTED]]
> Sent: Friday, July 13, 2001 4:08 PM
> To: 'Bradley M. Handy'; Camilo Gonzalez; 'Brett W. McCoy'
> Cc: Tony Paterra; [EMAIL PROTECTED]
> Subject: RE: Copy and past HTML into a perl script
>
>
> So let's clarify this. You believe the following to be equivalent:
>
> print ( 'The rain in $Spain' );
> print ( 'The rain in "$Spain"' );
>
> -Original Message-
> From: Bradley M. Handy [mailto:[EMAIL PROTECTED]]
> Sent: Friday, July 13, 2001 2:58 PM
> To: Camilo Gonzalez; 'Brett W. McCoy'
> Cc: Tony Paterra; [EMAIL PROTECTED]
> Subject: RE: Copy and past HTML into a perl script
>
>
> I believe that to be incorrect.  The outermost quotes win.
>
> Brad
>
> --www.jack-of-all-trades.net
> [EMAIL PROTECTED]
>
>
> > -----Original Message-
> > From: Camilo Gonzalez [mailto:[EMAIL PROTECTED]]
> > Sent: Friday, July 13, 2001 3:55 PM
> > To: 'Brett W. McCoy'; Camilo Gonzalez
> > Cc: 'Bradley M. Handy'; Tony Paterra; [EMAIL PROTECTED]
> > Subject: RE: Copy and past HTML into a perl script
> >
> >
> > That's true, but if you have double quotes inside of single quotes, the
> > double quotes will still interpolate. In other words, the
> enclosing single
> > quotes will not block the mighty interpolative power of the
> > enclosed double
> > quotes. Please let me know if you believe this yo be incorrect.
> >
> > -Original Message-
> > From: Brett W. McCoy [mailto:[EMAIL PROTECTED]]
> > Sent: Friday, July 13, 2001 2:35 PM
> > To: Camilo Gonzalez
> > Cc: 'Bradley M. Handy'; Tony Paterra; [EMAIL PROTECTED]
> > Subject: RE: Copy and past HTML into a perl script
> >
> >
> > On Fri, 13 Jul 2001, Camilo Gonzalez wrote:
> >
> > > I'm not sure your second example would work. I don't think
> single quotes
> > > block interpolation
> >
> > What do you mean by that?  Variables do not interpolate if the string is
> > delimited by single quotes or q();
> >
> > -- Brett
> >http://www.chapelperilous.net/btfwk/
> > 
> > It is the wisdom of crocodiles, that shed tears when they would devour.
> > -- Francis Bacon
> >
>
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: Copy and past HTML into a perl script

2001-07-13 Thread Bradley M. Handy

I believe that to be incorrect.  The outermost quotes win.

Brad

--www.jack-of-all-trades.net
[EMAIL PROTECTED]


> -Original Message-
> From: Camilo Gonzalez [mailto:[EMAIL PROTECTED]]
> Sent: Friday, July 13, 2001 3:55 PM
> To: 'Brett W. McCoy'; Camilo Gonzalez
> Cc: 'Bradley M. Handy'; Tony Paterra; [EMAIL PROTECTED]
> Subject: RE: Copy and past HTML into a perl script
>
>
> That's true, but if you have double quotes inside of single quotes, the
> double quotes will still interpolate. In other words, the enclosing single
> quotes will not block the mighty interpolative power of the
> enclosed double
> quotes. Please let me know if you believe this yo be incorrect.
>
> -Original Message-
> From: Brett W. McCoy [mailto:[EMAIL PROTECTED]]
> Sent: Friday, July 13, 2001 2:35 PM
> To: Camilo Gonzalez
> Cc: 'Bradley M. Handy'; Tony Paterra; [EMAIL PROTECTED]
> Subject: RE: Copy and past HTML into a perl script
>
>
> On Fri, 13 Jul 2001, Camilo Gonzalez wrote:
>
> > I'm not sure your second example would work. I don't think single quotes
> > block interpolation
>
> What do you mean by that?  Variables do not interpolate if the string is
> delimited by single quotes or q();
>
> -- Brett
>  http://www.chapelperilous.net/btfwk/
> 
> It is the wisdom of crocodiles, that shed tears when they would devour.
>   -- Francis Bacon
>


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: Copy and past HTML into a perl script

2001-07-13 Thread Bradley M. Handy

Correct.



> -Original Message-
> From: Brett W. McCoy [mailto:[EMAIL PROTECTED]]
> Sent: Friday, July 13, 2001 3:35 PM
> To: Camilo Gonzalez
> Cc: 'Bradley M. Handy'; Tony Paterra; [EMAIL PROTECTED]
> Subject: RE: Copy and past HTML into a perl script
>
>
> On Fri, 13 Jul 2001, Camilo Gonzalez wrote:
>
> > I'm not sure your second example would work. I don't think single quotes
> > block interpolation
>
> What do you mean by that?  Variables do not interpolate if the string is
> delimited by single quotes or q();
>
> -- Brett
>  http://www.chapelperilous.net/btfwk/
> 
> It is the wisdom of crocodiles, that shed tears when they would devour.
>   -- Francis Bacon
>
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: Copy and past HTML into a perl script

2001-07-13 Thread Bradley M. Handy

Try running the following code as a test script:

--- Start code

#!/path/to/perl

my $var = "I'm interpolated";

print 'This is a variable name->  $var';
print "\nThis is a variable value->  $var \n";

-- End code


Your output should be:

This is a variable name->  $var
This is a variable value->  I'm interpolated


Brad Handy

--www.jack-of-all-trades.net
[EMAIL PROTECTED]



> -Original Message-
> From: Camilo Gonzalez [mailto:[EMAIL PROTECTED]]
> Sent: Friday, July 13, 2001 3:25 PM
> To: 'Bradley M. Handy'; Tony Paterra; [EMAIL PROTECTED]
> Subject: RE: Copy and past HTML into a perl script
>
>
> Bradley,
>
> I'm not sure your second example would work. I don't think single quotes
> block interpolation
>
> -Original Message-
> From: Bradley M. Handy [mailto:[EMAIL PROTECTED]]
> Sent: Friday, July 13, 2001 12:56 PM
> To: Tony Paterra; [EMAIL PROTECTED]
> Subject: RE: Copy and past HTML into a perl script
>
>
> Your quotes may be mismatched.  Meaning that you are enclosing the entire
> HTML source with double quotes and you have unescaped double
> quotes in your
> HTML source.  That would confuse perl.
>
>   For example:
>
>   print "";  # in this line image.gif is
> a bareword.
>
>   You should do this:
>
>   print '';  # this does not interpolate
> variables
> though.
>
>   or
>
>   print "";  # this does interpolate
> variables.
>
>   or
>
> print <<"HTML";   # this does
> interpolate variables if
> you use double
> quotes.
> 
> HTML
>
> But if you're looking for a longer term solution.  Here are my
> suggestions:
>
>   1. Use the Template Toolkit set of modules available at:
>   http://search.cpan.org/search?module=Template
>   2. Use the HTML::Template module available at:
>   http://search.cpan.org/search?module=HTML::Template
>   3. Put your HTML in a separate file, open it and the print the lines
> as you
> read them.
>
> If you do one of the above then you can modify your HTML source and not
> worry about screwing up your code.  Plus it makes your code more readable.
>
> Brad Handy
>
> --www.jack-of-all-trades.net
> [EMAIL PROTECTED]
>
>
> > -Original Message-
> > From: Tony Paterra [mailto:[EMAIL PROTECTED]]
> > Sent: Friday, July 13, 2001 1:45 PM
> > To: [EMAIL PROTECTED]
> > Subject: Copy and past HTML into a perl script
> >
> >
> > I have a cgi script that I need to past approx 40 lines of HTML
> > into.  I was
> > hoping I could just get away with having a
> >
> > print "";
> >
> > and get away with that but sadly no, I get incomplete set of
> > headers errors.
> >
> > Any suggestions?
> >
> > Thanks,
> > Tony
> >
> >
> > --
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
>
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: Copy and past HTML into a perl script

2001-07-13 Thread Bradley M. Handy

Your quotes may be mismatched.  Meaning that you are enclosing the entire
HTML source with double quotes and you have unescaped double quotes in your
HTML source.  That would confuse perl.

For example:

print "";  # in this line image.gif is a bareword.

You should do this:

print '';  # this does not interpolate variables
though.

or

print "";  # this does interpolate variables.

or

print <<"HTML"; # this does interpolate variables if you use 
double
quotes.

HTML

But if you're looking for a longer term solution.  Here are my suggestions:

1. Use the Template Toolkit set of modules available at:
http://search.cpan.org/search?module=Template
2. Use the HTML::Template module available at:
http://search.cpan.org/search?module=HTML::Template
3. Put your HTML in a separate file, open it and the print the lines as you
read them.

If you do one of the above then you can modify your HTML source and not
worry about screwing up your code.  Plus it makes your code more readable.

Brad Handy

--www.jack-of-all-trades.net
[EMAIL PROTECTED]


> -Original Message-
> From: Tony Paterra [mailto:[EMAIL PROTECTED]]
> Sent: Friday, July 13, 2001 1:45 PM
> To: [EMAIL PROTECTED]
> Subject: Copy and past HTML into a perl script
>
>
> I have a cgi script that I need to past approx 40 lines of HTML
> into.  I was
> hoping I could just get away with having a
>
> print "";
>
> and get away with that but sadly no, I get incomplete set of
> headers errors.
>
> Any suggestions?
>
> Thanks,
> Tony
>
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: Regrex substitution!!!

2001-07-12 Thread Bradley M. Handy

You still could use s///.  You just need to take out the '+' sign like so:

$number =~ s/\d/x/g;

If you use the regexp above for the following example here is what you get:

$number = '1 1';# before regexp
$number =~ s/\d/x/g;# perform regexp
$number = 'x x';# after regexp

If you leave the '+' sign in this is what happens:

$number = '1 1';# before regexp
$number =~ s/\d+/x/g;   # perform regexp
$number = 'x x';# after regexp

The '+' was telling PERL to group as many numbers as it could into one
substitution.


Brad

> -Original Message-
> From: darren chamberlain [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, July 12, 2001 12:30 PM
> To: [EMAIL PROTECTED]
> Subject: Re: Regrex substitution!!!
>
>
> Fernando <[EMAIL PROTECTED]> said something to this effect on 07/11/2001:
> > I have a credit card number that I want to change to email a
> > reciept to the customer. This is that I want:
> >
> > I have this number: e.j.  8578 596 8552
> > I want to convert all the number to "x" like that  xxx 
> >
> > when I use this:
> >
> > $number = " 8578 596 8552";
> > $number =~ s/\d+/x/g;
> >
> > Perl give only one "x" in the result.
>
> Try tr/// rather than s///
>
> $number =~ tr/[0-9]/x/;
>
> Faster, and it does what you want.
>
> (darren)
>
> --
> "The first rule of magic is simple.  Don't waste your time waving your
> hands and hoping when a rock or a club will do."
> -- McCloctnik the Lucid
>




RE: breakable loop???

2001-07-11 Thread Bradley M. Handy



> -Original Message-
> From: Thomas Jakub [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, July 11, 2001 11:43 AM
> To: [EMAIL PROTECTED]
> Subject: breakable loop???
>
>
> I have the following code segment:
>
> for ($count=1;$count<11;$count++)
> {
> $c=getc;

Your script is pausing here for input from STDIN.  I'm not really sure how
to solve your problem though.
You would need some kind of event handler, and haven't tried doing those in
PERL yet.

> $count=1;
> print "blah\n";
> if (ord($c) eq 10)
> {
> print "Stopping..."
> $count = 12;
> }
> }
>
> I'm trying to get it so it prints a bunch of "blah's"
> until I hit the enter key, at which point it will say
> that it is stopping.  However, when I run this piece
> of code, it says only one blah, and even then, it is
> after I hit enter...  So, what am I doing wrong?
>
> __
> Do You Yahoo!?
> Get personalized email addresses from Yahoo! Mail
> http://personal.mail.yahoo.com/
>




RE: Bucks

2001-07-11 Thread Bradley M. Handy

For the answer to your question take a look at the following URL:

http://soldc.sun.com/polls/index.jshtml

Brad Handy

--www.jack-of-all-trades.net
[EMAIL PROTECTED]



> -Original Message-
> From: Camilo Gonzalez [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, July 11, 2001 10:35 AM
> To: [EMAIL PROTECTED]
> Subject: Bucks
>
>
> I've been writing PERL scripts for over two years now. It's the
> only type of
> CGI I know. Would any of you more seasoned programmers say that there's
> still a market for PERL programmers? I've read of Python and possibly PHP
> taking over PERL's place as THE CGI language. I've also heard ASP takes up
> fewer server resources than PERL and is easier to write. Do you see ASP
> replacing PERL?
>
> I'm a web designer and developer who knows PERL, Javascript and HTML. What
> else should I learn? What do you guys think I should be making?
>




RE: test script

2001-07-11 Thread Bradley M. Handy

#!/path/to/perl

use CGI;

print CGI->param();
print "I'm Working";


I believe the above lines of code should work just fine.

> -Original Message-
> From: john.twycross [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, July 11, 2001 10:25 AM
> To: [EMAIL PROTECTED]
> Subject: test script
> 
> 
> Can anyone tell me what is the most basic script that I can load onto a 
> server to test that it is working?
> 
> Thanks
> John Twycross
> 



RE: getch()

2001-07-11 Thread Bradley M. Handy

I believe that you can get the same functionality from the 'getc' function
in PERL.  Although I believe that 'getch' returned the 'character' you
pressed not a variable.

Brad Handy

--www.jack-of-all-trades.net
[EMAIL PROTECTED]


> -Original Message-
> From: Thomas Jakub [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, July 11, 2001 10:15 AM
> To: [EMAIL PROTECTED]
> Subject: getch()
>
>
> In c++, there is a functio, getch(), which returns the
> variable of the key you pressed - like enter would be
> 13.  How could I do this in perl?
>
> __
> Do You Yahoo!?
> Get personalized email addresses from Yahoo! Mail
> http://personal.mail.yahoo.com/
>




RE: cookies

2001-07-11 Thread Bradley M. Handy



> -Original Message-
> From: Jerry Preston [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, July 11, 2001 7:29 AM
> To: cgi
> Subject: cookies
>
>
> Hi!
>
> I guess I am missing the boat.  I have read CGI::Cookie and
> played with the code, but I would think that I should be able to
> read the netscape cookies
> file in by NT system.  My script is running on a unix server.  Is
> this possible.  I have tried to set a cookie and the read it,  no luck.
>
> print "env $ENV{'HTTP_COOKIE'} ";
>
>
>  $c = new CGI::Cookie( -name=>  'Testing',
>-value   =>  [ "jwp", '[EMAIL PROTECTED]' ],
>-expires =>  '+3M',
>-domain  =>  '.xxx',
>-path=>  '/'
>-secure  =>  0
>   );
>
>   print "Set-Cookie: $c\n";
>   print $query->header(-cookie=>$c);
>   print "Set-Cookie: ",$c->as_string,"\n";
>
> #Recovering Previous Cookies
>
>  @defaults=$query->cookie('dm5apps.de.sc.ti.com');#'www.kitchenetc.com');

The above line should be:
@defaults = $query->cookie('Testing');  # always fetch a cookie with the
name you gave it.

>
> print "defaults *@defaults*";
>
>  %cookies = fetch CGI::Cookie;
>  foreach (keys %cookies) {
>print "$_ - ($cookies{$_})";


The above line should be:
print "$_ - " . $cookie{$_}->value . "";

fetch CGI::Cookie returns a hash of CGI::Cookie objects with the key as the
name of the cookie.

>  }
>
> Thanks for YOUR help,
>
> Jerry
>




RE: cgi-bin directory

2001-07-10 Thread Bradley M. Handy

I generally put my cgi-bin directory in the same level as my root www
directory.

For example:

root www -> /usr/local/www/htdocs
cgi-bin -> /usr/local/www/cgi-bin

Then you need to add a ScriptAlias Directive (if you're using Apache) into
your httpd.conf file

ScriptAlias /cgi-bin /usr/local/www/cgi-bin

Brad Handy

--www.jack-of-all-trades.net
[EMAIL PROTECTED]



> -Original Message-
> From: Frank J. Schmuck [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, July 10, 2001 2:12 PM
> To: Aaron Craig; [EMAIL PROTECTED]
> Subject: RE: cgi-bin directory
>
>
> Yes of course.  My question is where in the linux box;
>
> \usr\cgi-bin
> \root\cgi-bin
> \cgi-bin
>
> that's what I meant to say...
>
> Thanks
> Frank
>
> -Original Message-
> From: Aaron Craig [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, July 10, 2001 12:10 PM
> To: [EMAIL PROTECTED]
> Subject: Re: cgi-bin directory
>
> At 11:10 10.07.2001 -0400, Frank J. Schmuck wrote:
> >I have a home network set-up to test cgi scripts.  I have a Win2k box
> hooked
> >up to a linux box.  The intent is to write on the Win2k box and
> test on the
> >Linuxbox.  My question is where should the cgi-bin directory reside?
> >
> >My intent is to open a browser from the Win2k box and look at
> >http://192.168.xxx.xxx/cgi-bin/test.cgi to open the script.
> >
> >Thanks
> >Frank
>
> It depends on which box will be the server.  It sounds like you want that
> to be on Linux -- so that's where you'll put your cgi-bin.
> Aaron Craig
> Programming
> iSoftitler.com
>




RE: Script written HTML won

2001-07-10 Thread Bradley M. Handy

It can happen.  Generally the reason is an unclosed literal string somewhere
in the HTML source.  At least that's been my experience with that problem.

Brad Handy

--www.jack-of-all-trades.net
[EMAIL PROTECTED]


> -Original Message-
> From: Mark Bergeron [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, July 10, 2001 1:48 PM
> To: Samuel Brown; [EMAIL PROTECTED]
> Subject: Re: Script written HTML won
>
>
> Let me get this straight. You can see the source but not the HTML
> output in the browser?
>
> Mark Bergeron
>
> -Original Message-
> From: "Samuel Brown"<[EMAIL PROTECTED]>
> To: [EMAIL PROTECTED]
> Date: Tue Jul 10 10:20:57 PDT 2001
> Subject: Script written HTML won't display
>
> >
> >  Here's a wierd problem for the gurus:
> >
> >  I've just set up a fresh install of Active State
> >Perl on this Win2k box, and have written a quick test
> >script for the web server.  The script runs correctly
> >from the command prompt, without reporting errors.
> >The script runs for a web browser without reporting
> >errors, likewise.  I can 'view source' and see that it
> >returned everything correctly, even. (Well, I can't
> >see the header in the source, natch.  But yes, i did
> >make sure to include one; yes, one with TWO carriage
> >returns.)
> >  The issue is that of the computers and web browsers
> >I've tried to run this script from, none of them
> >display the text!  Netscape displays a portion of the
> >first body character, and nothing else.  IE doesn't
> >even display that.  Again, a 'view source' in either
> >will show a perfectly mundanely formatted little block
> >of HTML text.
> >  Because i try not to go whining to mailing lists, I
> >have taken the time to read over a half dozen FAQs,
> >and short of chasing down every 400 page book they
> >cross reference, I think I've fulfilled the
> >obligations of researching this one on my own before
> >taking up you all's valuable time and bandwidth.
> >Anybody with more experience than me know the answer
> >to my little connundrum?
> >
> >S.
> >
> >__
> >Do You Yahoo!?
> >Get personalized email addresses from Yahoo! Mail
> >http://personal.mail.yahoo.com/
>
> /~_. _ | _ _  _  _
> \_/|(_||| | |(_)| |
>  _|
> ___
> GO.com Mail
> Get Your Free, Private E-mail at http://mail.go.com
>
>




RE: Errors

2001-07-10 Thread Bradley M. Handy

Well that answers my question.  I was going to ask if the ^M chars were
still in the file or not.  I use a simple text editor called 'Super Notetab'
I has the option to save in either 'Windows' or 'Unix' formats.  That's why
I like it.  No external tools to strip those annoying Microsoft
incantations.

Brad Handy

--www.jack-of-all-trades.net
[EMAIL PROTECTED]

> -Original Message-
> From: Jason Purdy [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, July 10, 2001 1:46 PM
> To: Bradley M. Handy; [EMAIL PROTECTED]; [EMAIL PROTECTED]
> Subject: Re: Errors
>
>
> I'm using ActiveState Komodo & sometime's Lemmy (VI) ... if I know where
> you're going, I also used a tool that ValueWeb provides to strip out ^M
> characters.
>
> Jason
>
> - Original Message -
> From: "Bradley M. Handy" <[EMAIL PROTECTED]>
> To: "Jason Purdy" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>;
> <[EMAIL PROTECTED]>
> Sent: Tuesday, July 10, 2001 1:42 PM
> Subject: RE: Errors
>
>
> > This may sound silly, but what text editor are you using on your Windows
> > machine to edit the script file?
> >
> > Brad Handy
> >
> > --www.jack-of-all-trades.net
> > [EMAIL PROTECTED]
> >
> >
> > > -Original Message-
> > > From: Jason Purdy [mailto:[EMAIL PROTECTED]]
> > > Sent: Tuesday, July 10, 2001 1:33 PM
> > > To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
> > > Subject: Re: Errors
> > >
> > >
> > > Got 2 & 3 covered - rwxr-xr-x and /usr/local/bin/perl'd the
> > > scripts (that's
> > > one annoying thing I have to update whenever I upload code
> from my Win32
> > > machine to their Linux box).
> > >
> > > #1 - tried that and still getting the ISE, so it must be a compiler
> error
> > > ... I didn't know all of those tips - that will help me with this
> problem
> > > (and w/ future ones, too) - now if I could just find out what the
> compiler
> > > problem is ... the syntax checks out ... I can't telnet & execute
> > > the script
> > > in their environment.
> > >
> > > So you can't just have the normal STDERR that goes to the error_log
> > > redirected to a file of your choice?
> > >
> > > Jason
> > >
> > > - Original Message -
> > > From: "Curtis Poe" <[EMAIL PROTECTED]>
> > > To: "CGI Beginners" <[EMAIL PROTECTED]>
> > > Sent: Tuesday, July 10, 2001 1:13 PM
> > > Subject: Re: Errors
> > >
> > >
> > > > --- Jason Purdy <[EMAIL PROTECTED]> wrote:
> > > > > I'm working on a web site that's hosted by ValueWeb (not
> > > important, but
> > > they give you CGI access
> > > > > but they don't give you access to the error log).  So I feel like
> I'm
> > > flying (coding) blind
> > > > > sometimes.  Especially when I get the Internal Server Error.  The
> > > scripts in question are
> > > > > inherited code and a bit complicated, so it would be MUCH
> > > better to see
> > > what's going on instead
> > > > > of commenting in/out code to track down the problem.
> > > > >
> > > > > I've tried:
> > > > >
> > > > > BEGIN {
> > > > > open (STDERR, ">>/path/to/error_log");# also tried
> > > ">/path/to/error_log"  *shrug* ;)
> > > > > }
> > > > >
> > > > > Also added on (thought maybe the output wasn't flushing
> or something
> > > like that):
> > > > >
> > > > > END {
> > > > > close (STDERR);
> > > > > }
> > > > >
> > > > > And that creates a 0-byte file that doesn't have any contents.
> > > > >
> > > > > My question is: How can I track down what's going on, on
> this remote
> > > server (with it's own
> > > > > unique setup/environment [it works great on my computer])?
> > > > >
> > > > > Thanks in advance!
> > > > >
> > > > > Jason
> > > > Here are a couple of things you can check:
> > > >
> > > > 1.  Top of script:
> > > >
> > > > use CGI::Carp qw/fatalsToBrowser/;
> > > > $|++;
> > > >
> > > > That should route many error messages directly from the
> error log
> to
> > > the browser.  If that
> > > > doesn't work, it may mean that your script is not compiling.
> > > The second,
> > > cryptic, command will
> > > > disable output buffering which should increase the likelyhood of
> getting
> > > *some* output to the
> > > > browser, so long as your script is compiling.
> > > >
> > > > 2.  Are your permissions set correctly?
> > > >
> > > > 3.  Does your shebang line point to the Perl interpreter?
> > > >
> > > > Cheers,
> > > > Curtis Poe
> > > >
> > > > =
> > > > Senior Programmer
> > > > Onsite! Technology (http://www.onsitetech.com/)
> > > > "Ovid" on http://www.perlmonks.org/
> > > >
> > > > __
> > > > Do You Yahoo!?
> > > > Get personalized email addresses from Yahoo! Mail
> > > > http://personal.mail.yahoo.com/
> > >
> >
>




RE: Errors

2001-07-10 Thread Bradley M. Handy

This may sound silly, but what text editor are you using on your Windows
machine to edit the script file?

Brad Handy

--www.jack-of-all-trades.net
[EMAIL PROTECTED]


> -Original Message-
> From: Jason Purdy [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, July 10, 2001 1:33 PM
> To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
> Subject: Re: Errors
>
>
> Got 2 & 3 covered - rwxr-xr-x and /usr/local/bin/perl'd the
> scripts (that's
> one annoying thing I have to update whenever I upload code from my Win32
> machine to their Linux box).
>
> #1 - tried that and still getting the ISE, so it must be a compiler error
> ... I didn't know all of those tips - that will help me with this problem
> (and w/ future ones, too) - now if I could just find out what the compiler
> problem is ... the syntax checks out ... I can't telnet & execute
> the script
> in their environment.
>
> So you can't just have the normal STDERR that goes to the error_log
> redirected to a file of your choice?
>
> Jason
>
> - Original Message -
> From: "Curtis Poe" <[EMAIL PROTECTED]>
> To: "CGI Beginners" <[EMAIL PROTECTED]>
> Sent: Tuesday, July 10, 2001 1:13 PM
> Subject: Re: Errors
>
>
> > --- Jason Purdy <[EMAIL PROTECTED]> wrote:
> > > I'm working on a web site that's hosted by ValueWeb (not
> important, but
> they give you CGI access
> > > but they don't give you access to the error log).  So I feel like I'm
> flying (coding) blind
> > > sometimes.  Especially when I get the Internal Server Error.  The
> scripts in question are
> > > inherited code and a bit complicated, so it would be MUCH
> better to see
> what's going on instead
> > > of commenting in/out code to track down the problem.
> > >
> > > I've tried:
> > >
> > > BEGIN {
> > > open (STDERR, ">>/path/to/error_log");# also tried
> ">/path/to/error_log"  *shrug* ;)
> > > }
> > >
> > > Also added on (thought maybe the output wasn't flushing or something
> like that):
> > >
> > > END {
> > > close (STDERR);
> > > }
> > >
> > > And that creates a 0-byte file that doesn't have any contents.
> > >
> > > My question is: How can I track down what's going on, on this remote
> server (with it's own
> > > unique setup/environment [it works great on my computer])?
> > >
> > > Thanks in advance!
> > >
> > > Jason
> > Here are a couple of things you can check:
> >
> > 1.  Top of script:
> >
> > use CGI::Carp qw/fatalsToBrowser/;
> > $|++;
> >
> > That should route many error messages directly from the error log to
> the browser.  If that
> > doesn't work, it may mean that your script is not compiling.
> The second,
> cryptic, command will
> > disable output buffering which should increase the likelyhood of getting
> *some* output to the
> > browser, so long as your script is compiling.
> >
> > 2.  Are your permissions set correctly?
> >
> > 3.  Does your shebang line point to the Perl interpreter?
> >
> > Cheers,
> > Curtis Poe
> >
> > =
> > Senior Programmer
> > Onsite! Technology (http://www.onsitetech.com/)
> > "Ovid" on http://www.perlmonks.org/
> >
> > __
> > Do You Yahoo!?
> > Get personalized email addresses from Yahoo! Mail
> > http://personal.mail.yahoo.com/
>




RE: Script written HTML won't display

2001-07-10 Thread Bradley M. Handy

Can you send a copy of the HTML source to the list?

Brad Handy


> -Original Message-
> From: Samuel Brown [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, July 10, 2001 1:21 PM
> To: [EMAIL PROTECTED]
> Subject: Script written HTML won't display
> 
> 
> 
>   Here's a wierd problem for the gurus:
> 
>   I've just set up a fresh install of Active State
> Perl on this Win2k box, and have written a quick test
> script for the web server.  The script runs correctly
> from the command prompt, without reporting errors. 
> The script runs for a web browser without reporting
> errors, likewise.  I can 'view source' and see that it
> returned everything correctly, even. (Well, I can't
> see the header in the source, natch.  But yes, i did
> make sure to include one; yes, one with TWO carriage
> returns.)
>   The issue is that of the computers and web browsers
> I've tried to run this script from, none of them
> display the text!  Netscape displays a portion of the
> first body character, and nothing else.  IE doesn't
> even display that.  Again, a 'view source' in either
> will show a perfectly mundanely formatted little block
> of HTML text.
>   Because i try not to go whining to mailing lists, I
> have taken the time to read over a half dozen FAQs,
> and short of chasing down every 400 page book they
> cross reference, I think I've fulfilled the
> obligations of researching this one on my own before
> taking up you all's valuable time and bandwidth. 
> Anybody with more experience than me know the answer
> to my little connundrum?
> 
> S.
> 
> __
> Do You Yahoo!?
> Get personalized email addresses from Yahoo! Mail
> http://personal.mail.yahoo.com/
>