RE: What database would your recommend?

2002-06-07 Thread James Kelty

I would go for Postgres, if I were you. Relational, transactions, and
foreign key assignments. May be a little slower than MySQL, but pretty much
the same in stability.

-James


-Original Message-
From: Octavian Rasnita [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, June 05, 2002 7:59 PM
To: [EMAIL PROTECTED]
Subject: What database would your recommend?


Hi all,

I want to start learning a database that works with Perl but I would like to
learn a database that works under Windows and Unix also.

Is there such a thing?
Of course, I would like to  learn something as simple as possible because I
am a beginner in Perl.

Thank you.

Teddy,
[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: running perl with -w

2002-04-11 Thread James Kelty

This might help if you are using the CGI.pm module.

use CGI::Carp qw(fatalsToBrowser);

-James

-Original Message-
From: Nate Brunson [mailto:[EMAIL PROTECTED]]
Sent: Thursday, April 11, 2002 11:23 AM
To: [EMAIL PROTECTED]
Subject: running perl with -w


when you run perl with the -w flag does perl store all the warnings in a
variable, like $!?
or is $! only errors?

the reason I ask is I am using flash to run a .cgi script then print back
the scripts results to flash, but for testing I want to be able to see some
of the warnings I get, but because I am printing Content-type: text/html the
warnings don't get displayed, how can I display them?
any help would be appreciated

nate


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




File upload problems

2002-03-11 Thread James Kelty

Hello!

I have written the below script for file uploading, but the script seems to
be a little fickle.
Very small text files upload with no problem at all, but slightly larger
(76k) Word docs and Excel spread sheets
seem to make the script time out. I can see the /tmp/CGIxx2768 type
files being created, but I still get a timeout.

Not sure if this has be hashed out and re-hashed out, so, I apologize if
this mail is trite.

FYI - I am calling this cgi from an html for which I pasted in below the
perl script.


Thanks for any help in advance!

-James


#--Begin Perl Script#

#!/usr/bin/perl -w

use strict;
use CGI qw/:standard/;
use CGI::Carp qw(fatalsToBrowser);

$| =1;

# Create the CGI script
my $cgi = new CGI;

# Set the upload directory...

my $dir = qq(/usr/local/apache/htdocs/nuke/intranet);

# Set the cgi param for the file name...
my $file = $cgi-param('file');


# Start of main body of program...
$file =~ m/^.*(\\|\/)(.*)/;
my $name = $2;

open LOCAL, $dir/$name or die Cannot open file for writing: $!\n;
my ($bytesread,$buffer);
while($bytesread=read($file,$buffer,1024)) {
print LOCAL $buffer;
}
close(LOCAL);

print $cgi-header();
print $cgi-start_html(
   -title=Successful Upload,
   -bgcolor=#00,
   -text=#FF,
   -link='blue',
   -vlink='blue'
  );

print $file has bee successfully uploaded ... thank you!\n;
print $cgi-br;
print Go ;
print
$cgi-a({href=http://nuke.theashlandagency.com/intranet},'here');
print to view all files.;
print $cgi-br;
print Go ;
print $cgi-a({href=http://nuke.theashlandagency.com/upload.html},
'here');
print to upload more files.;
print $cgi-end_html;

#-End Perl Script-#

#-Begin HTML Form-#

html

head

title File upload page /title

/head

body bgcolor=#00 text=#FF


div align=center

h2File Upload section.../h2


form enctype=multipart/form-data action=fileup.cgi method=post

Please select a file to upload: br

input type=file name=file br
p
input type=submit
/form


/div

/body
/html

#--End HTML Form-#
James Kelty
Sr. Unix Systems Administrator
The Ashland Agency
541.488.0801
[EMAIL PROTECTED]


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




RE: File upload problems

2002-03-11 Thread James Kelty

Thanks!

-James

-Original Message-
From: fliptop [mailto:[EMAIL PROTECTED]]
Sent: Monday, March 11, 2002 4:48 PM
To: James Kelty
Cc: [EMAIL PROTECTED]
Subject: Re: File upload problems


James Kelty wrote:

 I have written the below script for file uploading, but the script seems
to
 be a little fickle.
 Very small text files upload with no problem at all, but slightly larger
 (76k) Word docs and Excel spread sheets
 seem to make the script time out. I can see the /tmp/CGIxx2768 type
 files being created, but I still get a timeout.


perldoc CGI

search for $CGI::POST_MAX

 # Set the cgi param for the file name...
 my $file = $cgi-param('file');


also read about the upload() method, which may give you more success
with uploading binary files.


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




RE: Easy way to get output from system()

2001-10-11 Thread James Kelty

You might want to try using readdir() and opendir() instead. 
Anyone using backticks in the cgi can cause security holes if
they do not use taint. Also, using backticks spawns a separate
shell, instead of running in the perl memory space.

-James




-Original Message-
From: Brett W. McCoy [mailto:[EMAIL PROTECTED]]
Sent: Thursday, October 11, 2001 1:56 PM
To: Chuck
Cc: PERL-CGI List
Subject: Re: Easy way to get output from system()


On Thu, 11 Oct 2001, Chuck wrote:

 I have several CGI's that use system() to get various OS details.

 What is the most reliable way to glean this information after using this
 command:

 For example:

 #!/bin/perl

 system(ls -l /tmp)

 How can I get that data?

Use backticks:

my $output = `ls -l /tmp`;

-- Brett
  http://www.chapelperilous.net/

bug, n:
A son of a glitch.


-- 
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: where to get modules? and any gui for win32?

2001-10-10 Thread James Kelty

http://www.bell-labs.com/project/nmake/

-James

-Original Message-
From: Eric Wang [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, October 10, 2001 2:47 PM
To: Brett W. McCoy
Cc: [EMAIL PROTECTED]
Subject: Re: where to get modules? and any gui for win32?


You know where I can get nmake? I used to have it and it works great! but
I just lost my HD on my labtop (w/o backup) and I forgot where I got it
from.

Thanks!
Eric


On Wed, 10 Oct 2001, Brett W. McCoy wrote:

  Where do I get some of these cool modules like www, DBI... etc?

 www.cpan.org is the definitive repository.  Many assume the availability
 of a C compiler and proper development tools like make or nmake.  On
 Win32, you can use VC++, or the CygWin environment, which gives you a lot
 of GNU tools.  ActiveState also has a repository for pre-built modules
 (PPMs) that you can install, but it is not comprehensive like CPAN is.

  and is there a module to write gui programs using perl in win32
  environmrnt? (WINNT or 2k)

 The Tk module works very well under Windows, and best of all, you can move
 the code to another platform (Mac, Linux, Solaris) and run it with little
 or no modification.

 -- Brett
   http://www.chapelperilous.net/
 
 Humor in the Court:
 Q: Now, you have investigated other murders, have you not, where there was
a victim?


 --
 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: where to get modules? and any gui for win32?

2001-10-10 Thread James Kelty

Ok, then try here next.

ftp://ftp.microsoft.com/Softlib/MSLFILES/nmake15.exe

Or you could just to:
www.google.com
www.dogpile.com
www.metacrawler.com

even

www.yahoo.com

-James


-Original Message-
From: Eric Wang [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, October 10, 2001 3:38 PM
To: James Kelty
Cc: Brett W. McCoy; [EMAIL PROTECTED]
Subject: RE: where to get modules? and any gui for win32?


that version only has no nmake for winnt systems.

Thanks for the help thou

eric
On Wed, 10 Oct 2001, James Kelty wrote:

 http://www.bell-labs.com/project/nmake/

 -James

 -Original Message-
 From: Eric Wang [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, October 10, 2001 2:47 PM
 To: Brett W. McCoy
 Cc: [EMAIL PROTECTED]
 Subject: Re: where to get modules? and any gui for win32?


 You know where I can get nmake? I used to have it and it works great! but
 I just lost my HD on my labtop (w/o backup) and I forgot where I got it
 from.

 Thanks!
 Eric


 On Wed, 10 Oct 2001, Brett W. McCoy wrote:

   Where do I get some of these cool modules like www, DBI... etc?
 
  www.cpan.org is the definitive repository.  Many assume the availability
  of a C compiler and proper development tools like make or nmake.  On
  Win32, you can use VC++, or the CygWin environment, which gives you a
lot
  of GNU tools.  ActiveState also has a repository for pre-built modules
  (PPMs) that you can install, but it is not comprehensive like CPAN is.
 
   and is there a module to write gui programs using perl in win32
   environmrnt? (WINNT or 2k)
 
  The Tk module works very well under Windows, and best of all, you can
move
  the code to another platform (Mac, Linux, Solaris) and run it with
little
  or no modification.
 
  -- Brett
http://www.chapelperilous.net/
  
  Humor in the Court:
  Q: Now, you have investigated other murders, have you not, where there
was
 a victim?
 
 
  --
  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]




nslookup via gethostbyname

2001-10-09 Thread James Kelty

I have serveral Project Managers that like to look up ip address (have me
tell them what they are) for a specific host on the internet. Tired of all
the calls I decided to scratch up a quick cgi for the intranet, and,
initially,
I was using the 'host' of 'nslookup' command on the system, but I wanted to
try to do it with gethostbyname() function. I found an old script of mine
that works from the command line, and incorporated it into my script, but I
don't actually get the result of the gethostbyname() functions at all. Here
is the cgi script:

Can someone tell me why I am not getting a list of ip's from this posted to
the page?

Thanks!

-James


#!/usr/bin/perl

# This is a web based nslookup tool
# for people who don't have the tools
# or knowledge to use them.

use strict;
use CGI qw/:standard/;

require(./header.cgi);
require(./footer.cgi);

my $cgi = CGI-new();
my $host = param('host');

if($host) {

get_header;
print $cgi-h2(Results...),
getadd;
get_footer;
}
else {

get_header;
print $cgi-h2(TAA nslookup utility);
print $cgi-start_form,
em(Enter the host name, i.e.,
\warbaby.ashlandagency.com\),br
,
textfield(-name='host'),br,
submit,reset;
get_footer;
}


sub getadd {
my $host = shift(@_);
my $cgi = $cgi;
use Socket;
my ($name,$aliases,$addrtype,$length,@addrs) = gethostbyname($host);
foreach $a (@addrs) {
my $ipaddress = inet_ntoa($a);
print $cgi-em($ipaddress);
}
}

sub cgidie {
my $message = shift(@_);
my $cgi = $cgi;
print $cgi-strong($message);
get_footer;
}



--
James Kelty
Sr. Unix Systems Administrator
The Ashland Agency
541.488.0801
[EMAIL PROTECTED]



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




String question...

2001-10-08 Thread James Kelty

What is the best, or workable, way to count the elements in a string? For instance, 
if someone enters a desired password through a form, I would like to be able to make 
sure that it is a certain length. I though about using the length() function, but I am 
not
sure if that us secure...

Thanks.

-James


--
James Kelty
Sr. Unix Systems Administrator
The Ashland Agency
[EMAIL PROTECTED]
541.488.0801

scribble on perlmonks



Sending someone to a new location...

2001-10-08 Thread James Kelty

I would like to be able to send someone automatically to another page when
requirements in a for are filled out correctly. Other that presenting a link
I can figure out how to do this.

Example:

Someone correctly fills out a user/pass form and is sent to the default
page,
otherwise they are sent to the login page again without having to give
them a link to back to the login screen...or to the default page.

-James


--
James Kelty
Sr. Unix Systems Administrator
The Ashland Agency
541.488.5248
[EMAIL PROTECTED]


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




System Health Checks...

2001-08-28 Thread James Kelty

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]




Configuration Files

2001-08-23 Thread James Kelty

Hello.

I would like to set up a configuration file for a CGI that I am writing
so that it will be portable without
editing the actual cgi. Stuff like administator email's, network
segments, and the like.

Is there a way to source the file for the cgi to read, or do I have to
add a require statment and make the file a user routine?

-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]




RE: executing a cgi-script continously

2001-08-16 Thread James Kelty

Why not use a crontab or atd type file?

-James


-Original Message-
From: Simon K. Chan [mailto:[EMAIL PROTECTED]]
Sent: Thursday, August 16, 2001 3:34 PM
To: [EMAIL PROTECTED]
Subject: executing a cgi-script continously


Hey all,

Is it possible to have a CGI script that, at the end of doing all the stuff
you want, re-executes
itself (executes itself again)?

I'm writing this for a CGI script that uses a DBI script to connect and
return queries from a
Mysql database.

Many thanks!



=
#
Simon K. Chan
[EMAIL PROTECTED]

Great spirits have always encountered violent opposition from mediocre
minds.

-Albert Einstein

__
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: executing a cgi-script continously

2001-08-16 Thread James Kelty

While I agree that having cron access does vary, your solution wouldn't
really handle the DB being
down either, unless of course there is some error detection going on it the
script in the first place.
In either case, they would both work, or having an at now command at the
bottom of the script would
work too. Basically, there are, at least, 3 ways of doing this, but one
isn't exactly better that the next.


-James


-Original Message-
From: Morbus Iff [mailto:[EMAIL PROTECTED]]
Sent: Thursday, August 16, 2001 4:28 PM
To: [EMAIL PROTECTED]
Subject: RE: executing a cgi-script continously


Is it possible to have a CGI script that, at the end of doing all the

James Keltys idea using a perl script in cron using LWP::Simple against the
CGI in question sounds the most obvious answer

How do you figure? He wants to run it after the script is done, not every X
minutes, like a cron. I mean, sure, you could throw a cron of every minute
or so, but that doesn't take into effect if the script has been completed,
if the DB is down, or anything of the sort. He may not have cron access,
either.

Ultimately, he wants a continuous loop, not a timed loop.
Enlighten me if I'm wrong, of course.

can you give me an example of Content-type header and then a Location:
header that referred back to the script ?  Should this be at or near the
end of the

You would throw it near the end of the script, after the script has done
everything you want it to do. This assumes that your script doesn't spit
out any HTML (or really anything else) to the web browser or user.

   print Location: http://path/to/cgi/script.pl\n\n;;

--
Morbus Iff ( i am your scary godmother )
http://www.disobey.com/  http://www.gamegrene.com/
please me: http://www.amazon.com/exec/obidos/wishlist/25USVJDH68554
icq: 2927491 / aim: akaMorbus / yahoo: morbus_iff / jabber.org: morbus

--
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]




Writing Dynamic tables

2001-07-03 Thread James Kelty

Ok,

I have connected to a MySQL database, and I am creating a table based on
the row fetched which is not a problem. But! How can I write a table
when multiple rows are fetched without writing a new table for each row?
Here is the code I am using at the moment. I had it wrapped with a while
statement, but that wrote a table for each row.


CURRENT CODE:
@row = $query-fetchrow_array();
print $cgi-table({-border='1'},
  Tr({-align=LEFT, -valign=MIDDLE},
  [

td({-bgcolor=green,-width='150'},[$row[0],$row[1],$row[2],$row[3]])

  ]
  )
 );
print $cgi-end_table;

CODE TO WRITE A TABLE FOR EACH ROW: (Not used at the moment)

while(@row = $query-fetchrow_array()) {
print $cgi-table({-border='1'},
  Tr({-align=LEFT, -valign=MIDDLE},
  [

td({-bgcolor=green,-width='150'},[$row[0],$row[1],$row[2],$row[3]])

  ]
  )
 );
print $cgi-end_table;
}
-- 
--
James Kelty
Sr. Unix Systems Administrator
The Ashland Agency
[EMAIL PROTECTED]



Strange Behavior

2001-06-29 Thread James Kelty

I was wondering if someone could help me with the following code bit. It
is acting strangely.


if($ARGV[0] =~ m/^-l$|^-list$/i) {
print What ports? (Press return after each port and CRTL-D when
done.);
chomp(@getem = );
print Who do you wanna hit, Homie?  ;
chomp($peer = );
foreach $item (@getem) {
pointscan($item);
}
}
else{
print $ARGV[0] bad flag. \-l|-list\ only good option\n;
exit(0);
}


I am trying to take -l or -list as a command line argument, but it
bombs out with this error when run.

james@warbaby:~/perl  ./sinner.pl -l
What ports? (Press return after each port and CRTL-D when done.)
Can't open -l: No such file or directory
Who do you wanna hit, Homie? 

I understand that the @ARGV array if for processing files added on the
command
line, but I thought that you could use it to process flags as well. I
mean, I have before, I've looked over some of my older code, and I just
can't see what I am doing differently, or incorrectly.

All help is very much appreciated. Thank you!

-James




-- 
--
James Kelty
Sr. Unix Systems Administrator
The Ashland Agency
[EMAIL PROTECTED]



Including other files

2001-06-27 Thread James Kelty

Can you include say a header and footer .cgi file that is just a
subroutine? The reason I ask, is that it seems to me that it might make
things (on a larger application) easier if all you had to do was mess
with the middle content of the pages.  Does this make sense at all?

-James



Re: Including other files

2001-06-27 Thread James Kelty

Sorry about the confusion. I did mean in the body of the main cgi and
subsequent cgis later. Not SSIs. Sorry about that.

-James


Brett W. McCoy wrote:
 
 On Wed, 27 Jun 2001, James Kelty wrote:
 
  Can you include say a header and footer .cgi file that is just a
  subroutine? The reason I ask, is that it seems to me that it might make
  things (on a larger application) easier if all you had to do was mess
  with the middle content of the pages.  Does this make sense at all?
 
 Include where?  Include head and footer subs in a main CGI script?  You
 can certainly do that, if you properly create a a module and import the
 subroutines.  If you are talking about using SSI in HTML, you can do that
 also, if your server supports SSI.
 
 You might want to take a look at Mason: http://masonhq.com.  It's a
 Perl-based component framework for building web applications, and can
 accomplish what you want to do, and much more on top of that.
 
 -- Brett
http://www.chapelperilous.net/btfwk/
 
 Breeding rabbits is a hare raising experience.