Re: The very un-useful 'premature end of script headers' error me ssage

2003-03-28 Thread Cool Hand Luke
 1. You *MUST* examine the server's error log. Prematue end of script
 headers is just a generic message put out by Apache when it couldn't find
 the response header your script should have put out. Any error messages
 output by Perl or your script will be found in the error log. Until you
can
 see those logs, we're just guessing.

Hi just thought I'd let y'all know I've figured out how to get more
effective error messages. I decided to start from scratch with the original
sample script I postedhere's my error message now.

Missing $ on loop variable at SimLib.pm line 57.
BEGIN failed--compilation aborted at sim.pl line 25.
Obviously it's the SimLib.pm module that the perl interpreter is having
probs with. I checked the SimLib.pm module and here's what I've got for
lines 38 on. I've put a comment on line 57. I can't seem to find the
problem. I don't see where it's missing the $.
Thanks any and all for your help.
Luke

sub get_submission {
my %ENTRY = ();
my $GetPost = '';
my $GetGet = $ENV{'QUERY_STRING'};

my $cl = $ENV{'CONTENT_LENGTH'};
if (defined{$cl}) {
binmode(STDIN);
while ($cl  0  read(STDIN, $_, $cl)  0) {
$GetPost .= $_;
$cl -= length($_);
}
close STDIN;
}

my $submission = $GetGet . $GetPost;
chomp $submission;

# Split the name-value pairs
foreach my $pair (split(/[;]/, $submission)) {   #LINE 57 - the one
that has a poor loop variable that needs $
# Convert plus to space
$pair =~ y/+/ /;

# Split into key and value.
my ($name, $value) = split(/=/, $pair, 2); # splits on the first =.

# Convert %XX from hex numbers to character
$name  =~ s/%([A-Fa-f0-9]{2})/pack(c, hex($1))/ge;
$value =~ s/%([A-Fa-f0-9]{2})/pack(c, hex($1))/ge;

# Associate key and value
$ENTRY{$name} .= \0 if (defined($ENTRY{$name}));
$ENTRY{$name} .= $value;
}
return %ENTRY;
}


 1. You *MUST* examine the server's error log. Prematue end of script
 headers is just a generic message put out by Apache when it couldn't find
 the response header your script should have put out. Any error messages
 output by Perl or your script will be found in the error log. Until you
can
 see those logs, we're just guessing.


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



Re: accessing excel!

2003-03-28 Thread Lenonardo
[EMAIL PROTECTED] (Tim Fletcher) wrote in 
news:[EMAIL PROTECTED]:

 hi all,
 does anyone know how to access an excel sheet?
 
 $thanks

On windows - use Win32:Ole.

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



IIS saves '.pl' file - not execute

2003-03-28 Thread Lenonardo
I have a simple Perl CGI script that reads a directory, displays two file 
lists filtered on extension.
The user then selects a file from either list and the script calls 
another CGI script to process the file.
The CGI script is working with POST method.

I activate the request using a javascript 'onClick'.
The code for the two file lists is below.
//-
function fn_go_csv(e)   {
var f=e.form
if (f.csv_list.value == '') {
alert(No CSV File selected)
return
}
f.action='docsig_file.pl'
f.MODE.value='CSV'
f.FULLFILENAME.value=f.FILEDIR.value + f.csv_list.value
f.submit();
}
//-
function fn_go_xls(e)   {
var f=e.form
if (f.xls_list.value == '') {
alert(No XLS File selected)
return
}
f.action='docsig_file.pl'
f.MODE.value='XLS'
f.FULLFILENAME.value=f.FILEDIR.value + f.xls_list.value
f.submit();
}
//--

The CSV option works perfectly, but the XLS option causes the IIS server 
to  prompt for saving 'docsig_file.pl' to disk!!!

I acn't work out why the two functions result in different behaviour from 
IIS.
The scripts work fine on Apache + Xitami.

The IIS server is set-up to load and display XLS files automatically.
This is the only thing that I can think of that can be causing the 
problem - but I can't work out how it knows that I'm trying to process an 
Excel file - if that is the problem.

Any suggestions would be greatly appreciated.



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



Re: The very un-useful 'premature end of script headers' error message

2003-03-28 Thread Cool Hand Luke
Hello All,
  I think I figured it out, (so far). I 'm pretty sure that it has to do
with perl 5.003 disliking the looping with the my $pair syntax.
As a work around, I changed this

  foreach my $pair (split(/[;]/, $submission)) {
# Convert plus to space
$pair =~ y/+/ /;

 # Split into key and value.
 my ($name, $value) = split(/=/, $pair, 2); # splits on the first =.

 # Convert %XX from hex numbers to character
 $name  =~ s/%([A-Fa-f0-9]{2})/pack(c, hex($1))/ge;
 $value =~ s/%([A-Fa-f0-9]{2})/pack(c, hex($1))/ge;

 # Associate key and value
 $ENTRY{$name} .= \0 if (defined($ENTRY{$name}));
 $ENTRY{$name} .= $value;
 }

Into this(with slight style differences)
{

# Split the name-value pairs
my $pair;
for $pair (split(/[;]/, $submission)) {
# Convert plus to space
$pair =~ y/+/ /;

# Split into key and value.
my ($name, $value) = split(/=/, $pair, 2); # splits on the first
=.

# Convert %XX from hex numbers to character
$name  =~ s/%([A-Fa-f0-9]{2})/pack(c, hex($1))/ge;
$value =~ s/%([A-Fa-f0-9]{2})/pack(c, hex($1))/ge;

# Associate key and value
$ENTRY{$name} .= \0 if (defined($ENTRY{$name}));
$ENTRY{$name} .= $value;
}
}

And it worked! Thanks to Bob, Scott, and Tim for all the help! Now all
that's left is to bug the right people so that an actual up to date version
of perl gets installed. :)
Luke

- Original Message -
From: Cool Hand Luke [EMAIL PROTECTED]
To: Bob Showalter [EMAIL PROTECTED];
[EMAIL PROTECTED]; [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Friday, March 28, 2003 1:02 AM
Subject: Re: The very un-useful 'premature end of script headers' error me
ssage


  1. You *MUST* examine the server's error log. Prematue end of script
  headers is just a generic message put out by Apache when it couldn't
find
  the response header your script should have put out. Any error messages
  output by Perl or your script will be found in the error log. Until you
 can
  see those logs, we're just guessing.

 Hi just thought I'd let y'all know I've figured out how to get more
 effective error messages. I decided to start from scratch with the
original
 sample script I postedhere's my error message now.

 Missing $ on loop variable at SimLib.pm line 57.
 BEGIN failed--compilation aborted at sim.pl line 25.
 Obviously it's the SimLib.pm module that the perl interpreter is having
 probs with. I checked the SimLib.pm module and here's what I've got for
 lines 38 on. I've put a comment on line 57. I can't seem to find the
 problem. I don't see where it's missing the $.
 Thanks any and all for your help.
 Luke

 sub get_submission {
 my %ENTRY = ();
 my $GetPost = '';
 my $GetGet = $ENV{'QUERY_STRING'};

 my $cl = $ENV{'CONTENT_LENGTH'};
 if (defined{$cl}) {
 binmode(STDIN);
 while ($cl  0  read(STDIN, $_, $cl)  0) {
 $GetPost .= $_;
 $cl -= length($_);
 }
 close STDIN;
 }

 my $submission = $GetGet . $GetPost;
 chomp $submission;

 # Split the name-value pairs
 foreach my $pair (split(/[;]/, $submission)) {   #LINE 57 - the one
 that has a poor loop variable that needs $
 # Convert plus to space
 $pair =~ y/+/ /;

 # Split into key and value.
 my ($name, $value) = split(/=/, $pair, 2); # splits on the first
=.

 # Convert %XX from hex numbers to character
 $name  =~ s/%([A-Fa-f0-9]{2})/pack(c, hex($1))/ge;
 $value =~ s/%([A-Fa-f0-9]{2})/pack(c, hex($1))/ge;

 # Associate key and value
 $ENTRY{$name} .= \0 if (defined($ENTRY{$name}));
 $ENTRY{$name} .= $value;
 }
 return %ENTRY;
 }


  1. You *MUST* examine the server's error log. Prematue end of script
  headers is just a generic message put out by Apache when it couldn't
find
  the response header your script should have put out. Any error messages
  output by Perl or your script will be found in the error log. Until you
 can
  see those logs, we're just guessing.


 --
 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: safe system()?

2003-03-28 Thread drieux
On Friday, Mar 28, 2003, at 11:01 US/Pacific, Jerry LeVan wrote:

Let's say that I want to use a command (e.g., md5) on a file.  No
problem; just use:
 system(md5 $file);
[..]
Yeah, this probably has some holes...

# to be safe, quote shell metacharacters
$command =~ s/([;\*\|`\$!#\(\)\[\]\{\}:'])/\\$1/g;
Parse($command);
--Jerry
while the above regEx may not catch them all, IT
will get most of the purely dope ones.
I use a simpler test strategy

sub safe_input
{
( $_[0] !~ m/[()|;]+/); #? 0:1;
} # end of safe_input

since I am looking for the simpler set of issues,
where the user has tried to 'pile on' to the command
line I am about to use - and hence will NOT execute
the command if I get 'questionable bits' - and will
of course throw it back at the user with an 'error_page($whine)'
that points out that I do not consider the input safe.
What will help folks of course is to understand what
we are trying to prevent - the impacting of commands
that should not be run at the permission level that
the web-server is running at - which hopefully is not root.
think about the case of

$file = '/path/to/file ; ( find / -print | xargs rm -r -f )';
system(md5 $file);
DO NOT TRY THAT ONE AT HOME KIDDIES

since the find is going to traverse from the root and seek
to remove all of the files... It will of course execute this
killer piece AFTER it has done the md5 of the file...
{ note that this would contaminate any of the basic
options, including backticks, open() and exec() }
And BEFORE wiggins whines at me for not pointing at
putting stuff that could be in a Module INTO a Module,
y'all do know about
	Digest::MD5

that is available from the CPAN that would mean not
having to invoke it remotely...
ciao
drieux
we Blog, therefore we exist:

http://www.wetware.com/drieux/PR/blog/

--

This space left intentionally blank.

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


RE: Replacing/deleting text in a text file, part deux

2003-03-28 Thread Scot Robnett
Anything I can do to make this an easier question? No responses...maybe I
didn't ask the question the right way or made it confusing as to what I am
trying to do? Would it help to split it up? Thanks for any advice...

Scot R.



-Original Message-
From: Scot Robnett [mailto:[EMAIL PROTECTED]
Sent: Thursday, March 27, 2003 4:26 PM
To: [EMAIL PROTECTED]
Subject: Replacing/deleting text in a text file, part deux


Looking at the code below, can anyone help me figure out how to compare the
e-mail addresses in @addresses with the e-mail addresses in @emails and
print out to the new file as shown, but minus the matching addresses?

Scot R.
inSite


#!/usr/bin/perl -w

use CGI;
use CGI::Carp qw(fatalsToBrowser);

$q = new CGI;

$datafile  = '/usr/apache/htdocs/path/to/.tracker';
$datafile2 = '/usr/apache/htdocs/path/to/.tracker2';
$company = $q-param('customercomp'); # scalar comes from form param
@addresses = $q-param('customeremail'); # list comes from form param

$/ = '*'; # split file records on '*'

print $q-header;

open(FILE,$datafile) or die Couldn\'t open data file.;
@records = FILE;
close(FILE);

open(FILE2,$datafile2) or die Couldn\'t open data file 2.;

foreach $record(sort(@records)) {
 chomp($record);
 ($comp,$addr) = split(/\|/, $record);
  @emails = split /:/, $addr;

# Right here, I want to see if any of the addresses
# in @addresses match an address in @emails for this
# particular $record.

# Now, if $comp eq $company, I want to print join ':'
# the e-mail addresses MINUS any $address[$_] that
# matched $emails[$_].

  print FILE2 $comp\|;
  print FILE2 join(':', @emails); # minus any matching $address[$_]
  print FILE2 $/;
}

close(FILE2);




--
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: safe system()?

2003-03-28 Thread Bob Showalter
drieux wrote:
 ...
 think about the case of
 
   $file = '/path/to/file ; ( find / -print | xargs rm -r -f )';
 system(md5 $file); 
 
 DO NOT TRY THAT ONE AT HOME KIDDIES

Wouldn't

   system('md5', $file);

Be safer, since the list form of system() bypasses the shell? Consider:

  $ perl -e system('md5 /etc/passwd; echo Hello')
  MD5 (/etc/passwd) = 232522a1340d0956071c7b8b005a627b
  Hello

versus:

  $ perl -e system('md5','/etc/passwd; echo Hello')
  md5: /etc/passwd; echo Hello: No such file or directory

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



RE: Replacing/deleting text in a text file, part deux

2003-03-28 Thread Bob Showalter
Scot Robnett wrote:
 Anything I can do to make this an easier question? No
 responses...maybe I didn't ask the question the right way or made it
 confusing as to what I am trying to do? Would it help to split it up?
 Thanks for any advice... 
 
 ...
 foreach $record(sort(@records)) {
  chomp($record);
  ($comp,$addr) = split(/\|/, $record);
   @emails = split /:/, $addr;
 
 # Right here, I want to see if any of the addresses
 # in @addresses match an address in @emails for this # particular
 $record. 

Turn @addresses into a hash (do this ouside the loop of course):

   my %addresses = map ($_, 1), @addresses;

Then, to remove entries in @emails that exist in @addresses:

   @emails = grep !exists($addresses{$_}), @emails;

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



RE: Replacing/deleting text in a text file, part deux

2003-03-28 Thread Scot Robnett
Ahhh, the famous 'map' function - haven't tried it, so I guess it's about
time to give it a try. I wasn't too familiar with 'exists' either...thanks
for the advice.

-
Scot Robnett



-Original Message-
From: Bob Showalter [mailto:[EMAIL PROTECTED]
Sent: Friday, March 28, 2003 2:23 PM
To: 'Scot Robnett'; [EMAIL PROTECTED]
Subject: RE: Replacing/deleting text in a text file, part deux


Scot Robnett wrote:
 Anything I can do to make this an easier question? No
 responses...maybe I didn't ask the question the right way or made it
 confusing as to what I am trying to do? Would it help to split it up?
 Thanks for any advice...

 ...
 foreach $record(sort(@records)) {
  chomp($record);
  ($comp,$addr) = split(/\|/, $record);
   @emails = split /:/, $addr;

 # Right here, I want to see if any of the addresses
 # in @addresses match an address in @emails for this # particular
 $record.

Turn @addresses into a hash (do this ouside the loop of course):

   my %addresses = map ($_, 1), @addresses;

Then, to remove entries in @emails that exist in @addresses:

   @emails = grep !exists($addresses{$_}), @emails;

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

Printing all values except. . .

2003-03-28 Thread Kim Forbes
Hello all,
I want to first give a group thanks to everyone who helped me with my first
script.  I used CGI.pm and everything works fine.

Now, I want to display on the screen all form parameters except 2.  I tried
using:

my $query = CGI-new();
my @names = $query-param;
foreach my $name ( @names ) {
my @values = $query-param( $name );
$query -delete ('emailreq','submit');
print $name .  =  . (join , , @values) . br;

}
and that gave me this output:

name: Kim Forbes
email: [EMAIL PROTECTED]
emailreq:
submit:

The output I want is:
name: Kim Forbes
email: [EMAIL PROTECTED]




Thanks
Kim



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



RE: Printing all values except. . .

2003-03-28 Thread Scot Robnett
This is untested


my $query = new CGI;
my %names = $query-Vars;
foreach my $key(keys(%names)) {
  print $key\: $names{$key}\n if (($key eq 'name') or ($key eq 'email'));
}



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

Re: safe system()?

2003-03-28 Thread wiggins


On Fri, 28 Mar 2003 12:00:09 -0800, drieux [EMAIL PROTECTED] wrote:

 
 On Friday, Mar 28, 2003, at 11:01 US/Pacific, Jerry LeVan wrote:

 
 And BEFORE wiggins whines at me for not pointing at
 putting stuff that could be in a Module INTO a Module,
 y'all do know about
 
   Digest::MD5
 
 that is available from the CPAN that would mean not
 having to invoke it remotely...
 

Good thing I still read your whole rants as that was going to be my next post 
;-).. besides, I learned from the best, et tu brute.

http://danconia.org


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



RE: The very un-useful 'premature end of script headers' error message

2003-03-28 Thread Bill Burke
I added a chat room at my site http://www.speakerscorner.us . You are
welcome there and we can discuss PERL in real time. Don't quit the user
group though, you won't want to miss anything

-Original Message-
From: Randal L. Schwartz [mailto:[EMAIL PROTECTED]
Sent: Friday, March 28, 2003 8:44 PM
To: [EMAIL PROTECTED]; Cool Hand Luke
Subject: Re: The very un-useful 'premature end of script headers' error
message


 Cool == Cool Hand Luke [EMAIL PROTECTED] writes:

Cool Hello All,
Cool   I think I figured it out, (so far). I 'm pretty sure that it has
to do
Cool with perl 5.003 disliking the looping with the my $pair syntax.
Cool As a work around, I changed this

Cool   foreach my $pair (split(/[;]/, $submission)) {
Cool # Convert plus to space
Cool $pair =~ y/+/ /;

Please don't use this code.  use CGI qw(param).

--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
[EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl
training!

--
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: The very un-useful 'premature end of script headers' error message

2003-03-28 Thread Bill Burke
Thanks for the edification. You have been one of the most prolific
contributors to the group, so I take no umbrage. Truly, you write it as
perl, but the books label it PERL (Practical Extraction and Reporting
Language). Please remember this is a beginners group which shares your
enthusiasm, but not your expertise.

-Original Message-
From: Randal L. Schwartz [mailto:[EMAIL PROTECTED]
Sent: Friday, March 28, 2003 9:29 PM
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]; Cool Hand Luke
Subject: Re: The very un-useful 'premature end of script headers' error
message


 Bill == Bill Burke [EMAIL PROTECTED] writes:

Bill I added a chat room at my site http://www.speakerscorner.us . You are
Bill welcome there and we can discuss PERL in real time. Don't quit the
user
Bill group though, you won't want to miss anything

And there's no such thing as PERL.
It's Perl for the language, perl for the engine.

--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
[EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl
training!

--
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: INFO PLEASE

2003-03-28 Thread Scott R. Godin
Eric Walker wrote:

 how can I see where modules are installed no matter if they are personal
 or come with perl also how can I tell what functions are available for
 them. Thanks

There's my ModuleReport script -- http://www.webdragon.net/mr/

There's still a few things I'd like to do with it, but it's fully functional 
as-is, and will let you know which modules have updated counterparts on 
CPAN (http://www.cpan.org/)


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



Re: perl DBI and mysql

2003-03-28 Thread jaws
when i run the program like this:

[EMAIL PROTECTED] util]# ./addvpdnuser.pl
sampleusername, samplepassword,sampledescription,sampleattr
DBD::mysql::st execute failed: Duplicate entry 'sample' for key 1 at 
./addvpdnuser.pl line 17,  line 1.
DBD::mysql::st execute failed: Duplicate entry 'sample' for key 1 at 
./addvpdnuser.pl line 17,  line 1.
[EMAIL PROTECTED] util]#

That's the error message of the program.

At 08:54 AM 3/28/2003 +, Rob Anderson wrote:
Hi Jaws (!?),

You don't say where your script is failing, or what errors it's reporting,
which is going to make it hard for anyone to help. You could add some better
error checking. Here's a couple of lines lifted from one of my CGI's.
my $dbh;
eval { $dbh = DBI-connect( $DATA_SOURCE, $DB_USER, $DB_PASSWORD, {
RaiseError = 1, AutoCommit = 1 } ) };
if ($@) {
print Failed in connecting to database, see following errorbr/\n;
print $@ . br/\n;
return;
}
Perhaps you could add something like this to your script to get a better
idea of what's not working. You can put this type of error checking around
your compare and execute statements as well.
Good Luck

Rob



Jaws [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Hi all,

 i am new to perl and i want to use it with DBI:mysql module. I want to
 connect to my sql server and do some data manipulation like , insert,
 update and delete. I read the DBI documention but i cant get through to
get
 my script working. any help is needed. below is my script.

 #!/usr/bin/perl

 use DBI;

 $database=sampledb;
 $host=localhost;
 $user=db;
 $pw=mysql;

 $dbh=DBI-connect(DBI:mysql:database=$database;host=$host,$user,$pw,
 {RaiseError = 1});

 my $sth = $dbh-prepare(q{INSERT INTO USERS
 (USERNAME,PASSWORD,DESCRIPTION,ATTRIBUTES) VALUES (?, ?, ?, ?)
   }) or die $dbh-errstr;
   while () {
   chomp;
   my ($USERNAME,$PASSWORD,$DESCRIPTION,$ATTRIBUTE) = split
/,/;
   $sth-execute($USERNAME,$PASSWORD,$DESCRIPTION,$ATTRIBUTE)
or
 die $dbh-errstr;
   }
   $dbh-commit or die $dbh-errstr;
 $dbh-disconnect;


 --

 Thanks.

 Jaws





--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---
cheers,
jaws
If there's one thing you need to remember it's this...
ALL SYSTEMS ARE VULNERABLE!


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


Re: perl DBI and mysql

2003-03-28 Thread Dave K
Jaws,

 DBD::mysql::st execute failed: Duplicate entry 'sample' for key 1 at
 ./addvpdnuser.pl line 17,  line 1.
 DBD::mysql::st execute failed: Duplicate entry 'sample' for key 1 at
 ./addvpdnuser.pl line 17,  line 1.
 [EMAIL PROTECTED] util]#

This is probably happening because the table has a primary key or unique
constraint set.




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



Re: perl DBI and mysql

2003-03-28 Thread jaws
What will I do to get my script working properly?

Thanks for your help.

At 04:17 AM 3/28/2003 -0500, Dave K wrote:
Jaws,

 DBD::mysql::st execute failed: Duplicate entry 'sample' for key 1 at
 ./addvpdnuser.pl line 17,  line 1.
 DBD::mysql::st execute failed: Duplicate entry 'sample' for key 1 at
 ./addvpdnuser.pl line 17,  line 1.
 [EMAIL PROTECTED] util]#
This is probably happening because the table has a primary key or unique
constraint set.


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---
cheers,
jaws
If there's one thing you need to remember it's this...
ALL SYSTEMS ARE VULNERABLE!


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


Re: perl DBI and mysql

2003-03-28 Thread Rob Anderson
Jaws,

This looks like your script is working fine, but the insert your trying to
do is in error. I'd guess that your just trying to add a row with a
duplicate key, and that's what DBI is complaining about, because of a
contraint on the database. You could try different keys, or the INSERT
statement from somewhere else (SQLPLUS?) to see if you get the same error.

Hope this helps.

Rob


Jaws [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 when i run the program like this:

 [EMAIL PROTECTED] util]# ./addvpdnuser.pl
 sampleusername, samplepassword,sampledescription,sampleattr

 DBD::mysql::st execute failed: Duplicate entry 'sample' for key 1 at
 ./addvpdnuser.pl line 17,  line 1.
 DBD::mysql::st execute failed: Duplicate entry 'sample' for key 1 at
 ./addvpdnuser.pl line 17,  line 1.
 [EMAIL PROTECTED] util]#

 That's the error message of the program.


 At 08:54 AM 3/28/2003 +, Rob Anderson wrote:
 Hi Jaws (!?),
 
 You don't say where your script is failing, or what errors it's
reporting,
 which is going to make it hard for anyone to help. You could add some
better
 error checking. Here's a couple of lines lifted from one of my CGI's.
 
 my $dbh;
 eval { $dbh = DBI-connect( $DATA_SOURCE, $DB_USER, $DB_PASSWORD, {
 RaiseError = 1, AutoCommit = 1 } ) };
 
 if ($@) {
  print Failed in connecting to database, see following
errorbr/\n;
  print $@ . br/\n;
  return;
 }
 
 Perhaps you could add something like this to your script to get a better
 idea of what's not working. You can put this type of error checking
around
 your compare and execute statements as well.
 
 Good Luck
 
 Rob
 
 
 
 Jaws [EMAIL PROTECTED] wrote in message
 news:[EMAIL PROTECTED]
   Hi all,
  
   i am new to perl and i want to use it with DBI:mysql module. I want to
   connect to my sql server and do some data manipulation like , insert,
   update and delete. I read the DBI documention but i cant get through
to
 get
   my script working. any help is needed. below is my script.
  
   #!/usr/bin/perl
  
   use DBI;
  
   $database=sampledb;
   $host=localhost;
   $user=db;
   $pw=mysql;
  
   $dbh=DBI-connect(DBI:mysql:database=$database;host=$host,$user,$pw,
   {RaiseError = 1});
  
   my $sth = $dbh-prepare(q{INSERT INTO USERS
   (USERNAME,PASSWORD,DESCRIPTION,ATTRIBUTES) VALUES (?, ?, ?, ?)
 }) or die $dbh-errstr;
 while () {
 chomp;
 my ($USERNAME,$PASSWORD,$DESCRIPTION,$ATTRIBUTE) = split
 /,/;
  
$sth-execute($USERNAME,$PASSWORD,$DESCRIPTION,$ATTRIBUTE)
 or
   die $dbh-errstr;
 }
 $dbh-commit or die $dbh-errstr;
   $dbh-disconnect;
  
  
   --
  
   Thanks.
  
   Jaws
  
  
  
 
 
 
 --
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]

 ---
 cheers,
 jaws

 If there's one thing you need to remember it's this...
 ALL SYSTEMS ARE VULNERABLE!






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



Re: perl DBI and mysql

2003-03-28 Thread jaws
Thanks Ill try that.

At 09:26 AM 3/28/2003 +, Rob Anderson wrote:
Jaws,

This looks like your script is working fine, but the insert your trying to
do is in error. I'd guess that your just trying to add a row with a
duplicate key, and that's what DBI is complaining about, because of a
contraint on the database. You could try different keys, or the INSERT
statement from somewhere else (SQLPLUS?) to see if you get the same error.
Hope this helps.

Rob

Jaws [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 when i run the program like this:

 [EMAIL PROTECTED] util]# ./addvpdnuser.pl
 sampleusername, samplepassword,sampledescription,sampleattr

 DBD::mysql::st execute failed: Duplicate entry 'sample' for key 1 at
 ./addvpdnuser.pl line 17,  line 1.
 DBD::mysql::st execute failed: Duplicate entry 'sample' for key 1 at
 ./addvpdnuser.pl line 17,  line 1.
 [EMAIL PROTECTED] util]#

 That's the error message of the program.


 At 08:54 AM 3/28/2003 +, Rob Anderson wrote:
 Hi Jaws (!?),
 
 You don't say where your script is failing, or what errors it's
reporting,
 which is going to make it hard for anyone to help. You could add some
better
 error checking. Here's a couple of lines lifted from one of my CGI's.
 
 my $dbh;
 eval { $dbh = DBI-connect( $DATA_SOURCE, $DB_USER, $DB_PASSWORD, {
 RaiseError = 1, AutoCommit = 1 } ) };
 
 if ($@) {
  print Failed in connecting to database, see following
errorbr/\n;
  print $@ . br/\n;
  return;
 }
 
 Perhaps you could add something like this to your script to get a better
 idea of what's not working. You can put this type of error checking
around
 your compare and execute statements as well.
 
 Good Luck
 
 Rob
 
 
 
 Jaws [EMAIL PROTECTED] wrote in message
 news:[EMAIL PROTECTED]
   Hi all,
  
   i am new to perl and i want to use it with DBI:mysql module. I want to
   connect to my sql server and do some data manipulation like , insert,
   update and delete. I read the DBI documention but i cant get through
to
 get
   my script working. any help is needed. below is my script.
  
   #!/usr/bin/perl
  
   use DBI;
  
   $database=sampledb;
   $host=localhost;
   $user=db;
   $pw=mysql;
  
   $dbh=DBI-connect(DBI:mysql:database=$database;host=$host,$user,$pw,
   {RaiseError = 1});
  
   my $sth = $dbh-prepare(q{INSERT INTO USERS
   (USERNAME,PASSWORD,DESCRIPTION,ATTRIBUTES) VALUES (?, ?, ?, ?)
 }) or die $dbh-errstr;
 while () {
 chomp;
 my ($USERNAME,$PASSWORD,$DESCRIPTION,$ATTRIBUTE) = split
 /,/;
  
$sth-execute($USERNAME,$PASSWORD,$DESCRIPTION,$ATTRIBUTE)
 or
   die $dbh-errstr;
 }
 $dbh-commit or die $dbh-errstr;
   $dbh-disconnect;
  
  
   --
  
   Thanks.
  
   Jaws
  
  
  
 
 
 
 --
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]

 ---
 cheers,
 jaws

 If there's one thing you need to remember it's this...
 ALL SYSTEMS ARE VULNERABLE!





--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---
cheers,
jaws
If there's one thing you need to remember it's this...
ALL SYSTEMS ARE VULNERABLE!


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


Re: String removal

2003-03-28 Thread Aim
Hi,

A very helpful member of this list assisted me in coming up with the
following:

substr ($fastaseq{$key}, rand (length $fastaseq{$key}), 3) = ;

This bit of code removes a single character, randomly, but not from the
very first 3. it does the removing from the values of %fastaseq.

I hope it helps you in some way, but I think you should definitely look
at the docs.

Regards, Aim.

===
Kipp, James wrote:

 
 
  Hello.
  I need to know how to remove a substring from a string and a how
  to remove a simple character occurrence from a string. Thanks
  in advance!
  Christian.
 

 perldoc -f substr
 perldoc -f splice
 perldoc perlre


 --
 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: Synchronization of FTP servers

2003-03-28 Thread Jenda Krynicky
From: Aman Thind [EMAIL PROTECTED]
 This is a typical situation in companies with development teams spread
 around the globe.
 
 I have FTP servers - in India , US  Switzerland.
 
 Builds are being made in India and being put on the Indian server.
 
 Any tips how I could transfer the contents to the remote servers ?
 
 I've been using Net::FTP for this but sometimes I get a timeout using
 it and so want to move onto something more robust which could be
 automated as well.

What could be more automatable than Net::FTP? I mean you do get the 
status information, you can reestablish the connection, you can ...
It's just a module, your script can do any automation you may wish.

Anyway ... for something like this (though the connection is good 
enough so I did not really have to solve the timeouts much) I created 
a service (it would be daemon if you are using a *nix. We are running 
windows.) driven by an INI file that occassionaly scans the 
directories (using DB_File to store the last-modification time of 
each file) and uploads the new or modified ones.

To make it quicker you can ask the service to ZIP up the files and 
send the archive (we use this mostly for web pages and ASPs). On the 
other side there is another service that takes the ZIP file, 
validates the signature (sent as a separate file containing MD5 hash 
of the ZIP and a secret string) and unpacks the files to wherever we 
need them.

I can get into more details if you are interested, but I' afraid I 
can't give you the programs themselves.

Jenda
= [EMAIL PROTECTED] === http://Jenda.Krynicky.cz =
When it comes to wine, women and song, wizards are allowed 
to get drunk and croon as much as they like.
-- Terry Pratchett in Sourcery


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



redirection to various html files based on IP list

2003-03-28 Thread Martin Hudec
Hello,

I need to make script which will go through file with IP addresses (one IP per 
line), and then compare each line to $ENV{'REMOTE_ADDR'}, and if it is equal 
then it will load first html to browser, otherwise it will load second html. 
Can anyone help me with this please?

-- 
Martin Hudec
--
:@: [EMAIL PROTECTED]
:w: http://www.corwin.sk
:m: +421.907.303.393

In google non est, ergo non est.
- unknown IRC operator
--

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



RE: CGI:Push

2003-03-28 Thread wiggins


On Thu, 27 Mar 2003 15:00:39 -0800, David Cheng [EMAIL PROTECTED] wrote:

 Hi all,
 
 1. Is Server Push feature only supported by Netscape but not by IE? If yes, is there 
 anyway we can do similar tricks with IE? I know I can achieve the same goal by using 
 Client Pull, HTML refresh tag, but the flashing screen is kind of annoying.
 

I have been out of the push loop for a while, but a couple of years ago Netscape was 
the only browser supporting it.  I would imagine other techniques that might work 
include, ActiveX but then your clients must be on windows (grrr), Java (not 
Javascript) through applets, and possibly Flash has some way to connect back to the 
server, but my knowledge is beginning to stretch real thin...

 2. I ran a couple of CGI scripts through Netscape doing server push updating a 
 counter value every second, but they only ran for less than a minute then stopped. 
 However, if I ran these scripts as a Perl script on the server, perl filename.cgi, 
 they ran continuously no problem. What might be the problem here?


I would imagine this has to do with the keep-alive timing out, either on the client or 
server end, but again I could be off base.
 
 Thanks for your advice and your time.
  

Afraid I may not have been much help, but maybe something in these thoughts will point 
you in the right direction. 

http://danconia.org

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



writing in UTF8

2003-03-28 Thread Laurent_Coudeur
Hi all,

I have to print a report in UTF8

Is there any options to format the file to UTF8 while creationg it
then print into it safely?

like 

open (XLIFF,$path1\\$_);
print XLIFF $header$header2$filename ;

is there a module to do this or am i lost in limbo and missed the doc?

Laurent coudeur

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



Variable scoping, static variable

2003-03-28 Thread Rob Anderson
I'm trying cache a function to help speed it up. My function lives inside a
module, and is being called from a seperate script. It works if I do the
following.

foreach my $count (1..10) {
print $count . test(one) . \n;
}
print \n;

-- module sub routine 

sub test {
my $param = shift;
my $cache_key = param=$param;
if (exists $cache{$cache_key}) {
return $cache{$cache_key};
}
sleep 1;
$cache{$cache_key} = $param . done; # save the value
}


My problem with this is that I can't use strict, because I'm not declaring
%cache. If I do use strict, I'm forced to declare %cache, and when the sub
ends, the hash goes out of scope. So, my question is, can I create a
'static' hash for this fuctions that'll work with warnings and strict? I
know that there are modules for caching functions, but I don't have much
control of the environment and would rather not install extra modules.

Any help appreciated.

Thanks,

Rob



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



Re: Variable scoping, static variable

2003-03-28 Thread Janek Schleicher
Rob Anderson wrote at Fri, 28 Mar 2003 14:45:07 +:

 -- module sub routine 
 
 sub test {
 my $param = shift;
 my $cache_key = param=$param;
 if (exists $cache{$cache_key}) {
 return $cache{$cache_key};
 }
 sleep 1;
 $cache{$cache_key} = $param . done; # save the value
 }
 
 
 My problem with this is that I can't use strict, because I'm not declaring
 %cache. If I do use strict, I'm forced to declare %cache, and when the sub
 ends, the hash goes out of scope. So, my question is, can I create a
 'static' hash for this fuctions that'll work with warnings and strict? I
 know that there are modules for caching functions, but I don't have much
 control of the environment and would rather not install extra modules.

Try a closure:

{
  my %cache;
  sub test {
  my $param = shift;
  my $cache_key = param=$param;
  if (exists $cache{$cache_key}) {
  return $cache{$cache_key};
  }
  sleep 1;
  $cache{$cache_key} = $param . done; # save the value
  }
}


Greetings,
Janek

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



Net::Ping Cannot redirect output !

2003-03-28 Thread Ramprasad
I have written a simple script that runs file when I run on command line
but fails when I redirect its output
I cant beleive this , it seems so impossible can anyone help me

$!=1;
use Net::Ping;
@host_array = DATA;
$p = Net::Ping-new(icmp);
$p-bind(192.168.2.211); # Specify source interface of pings
foreach $host (@host_array)  {
  chomp($host);
  print $host is ;
  print NOT  unless $p-ping($host, 2);
  print reachable.\n;
}
$p-close();
__DATA__
192.168.2.1
192.168.2.21
192.168.2.25
192.168.2.212
192.168.2.213
192.168.2.214
192.168.2.215
192.168.2.211
127.0.0.1
192.168.2.144
192.168.2.100
192.168.2.101
When I run the above script it runs fine like this
 perl ping1.pl
when I do
perl ping1.pl output
I get nothing on screen
the file output  is also empty 8-(
Now How can this happen

Thanks
Ram




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


Re: Variable scoping, static variable

2003-03-28 Thread Rob Anderson
Thanks but I don't see how this could work. I've tried using it, but to no
avail


Janek Schleicher [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Rob Anderson wrote at Fri, 28 Mar 2003 14:45:07 +:

  -- module sub routine 
 
  sub test {
  my $param = shift;
  my $cache_key = param=$param;
  if (exists $cache{$cache_key}) {
  return $cache{$cache_key};
  }
  sleep 1;
  $cache{$cache_key} = $param . done; # save the value
  }
 
 
  My problem with this is that I can't use strict, because I'm not
declaring
  %cache. If I do use strict, I'm forced to declare %cache, and when the
sub
  ends, the hash goes out of scope. So, my question is, can I create a
  'static' hash for this fuctions that'll work with warnings and strict? I
  know that there are modules for caching functions, but I don't have much
  control of the environment and would rather not install extra modules.

 Try a closure:

 {
   my %cache;
   sub test {
   my $param = shift;
   my $cache_key = param=$param;
   if (exists $cache{$cache_key}) {
   return $cache{$cache_key};
   }
   sleep 1;
   $cache{$cache_key} = $param . done; # save the value
   }
 }


 Greetings,
 Janek



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



RE: Variable scoping, static variable

2003-03-28 Thread Shishir K. Singh
Try using it like this 



-
use strict;


my $cache = {};

 test(hello0,$cache);
 test(hello1,$cache);
 test(hello0,$cache);
 test(hello3,$cache);




 sub test {
 my $param = shift;
 my $cache = shift;

 my $cache_key = param=$param;
 if (exists $cache-{$cache_key}) {
 print Exists\n;
 return $cache-{$cache_key};
 }
 sleep 1;
 $cache-{$cache_key} = $param . done; # save the value
 print does not exists\n;
 }

--


















-Original Message-
From: Rob Anderson [mailto:[EMAIL PROTECTED]
Sent: Friday, March 28, 2003 10:36 AM
To: [EMAIL PROTECTED]
Subject: Re: Variable scoping, static variable


Thanks but I don't see how this could work. I've tried using it, but to no
avail


Janek Schleicher [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Rob Anderson wrote at Fri, 28 Mar 2003 14:45:07 +:

  -- module sub routine 
 
  sub test {
  my $param = shift;
  my $cache_key = param=$param;
  if (exists $cache{$cache_key}) {
  return $cache{$cache_key};
  }
  sleep 1;
  $cache{$cache_key} = $param . done; # save the value
  }
 
 
  My problem with this is that I can't use strict, because I'm not
declaring
  %cache. If I do use strict, I'm forced to declare %cache, and when the
sub
  ends, the hash goes out of scope. So, my question is, can I create a
  'static' hash for this fuctions that'll work with warnings and strict? I
  know that there are modules for caching functions, but I don't have much
  control of the environment and would rather not install extra modules.

 Try a closure:

 {
   my %cache;
   sub test {
   my $param = shift;
   my $cache_key = param=$param;
   if (exists $cache{$cache_key}) {
   return $cache{$cache_key};
   }
   sleep 1;
   $cache{$cache_key} = $param . done; # save the value
   }
 }


 Greetings,
 Janek



-- 
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: strange chacaters

2003-03-28 Thread Dan Muey

Are you serious?

How in the world can we help if there's no context at all?

What does this  have to do with perl?

I would assume '2 dimensional' and '3 dimensional' since it 
looks like graphic stuff but, again, see above and this link ::

http://www.catb.org/~esr/faqs/smart-questions.html

 I came accross some characters, while process various files 
 that contain 
 characters like this:
 
 Animations/2D/Animals
 Camers/3D/videos
 
 
 what exactly are the '2D' and '3D' designate... an extra 
 space of some sort ??

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



strange chacaters

2003-03-28 Thread Mike Blezien
I came accross some characters, while process various files that contain 
characters like this:

Animations/2D/Animals
Camers/3D/videos

what exactly are the '2D' and '3D' designate... an extra space of some sort ??

TIA ;)

--
MikemickaloBlezien
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Thunder Rain Internet Publishing
Providing Internet Solutions that work!
http://www.thunder-rain.com
Web Hosting
http://www.justlightening.net
Tel:  1(985)902-8484
MSN: [EMAIL PROTECTED]
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: strange chacaters

2003-03-28 Thread Mike Blezien
My mistake, I got the wrong information.

 Dan Muey wrote:
Are you serious?

How in the world can we help if there's no context at all?

What does this  have to do with perl?

I would assume '2 dimensional' and '3 dimensional' since it 
looks like graphic stuff but, again, see above and this link ::

http://www.catb.org/~esr/faqs/smart-questions.html


I came accross some characters, while process various files 
that contain 
characters like this:

Animations/2D/Animals
Camers/3D/videos

what exactly are the '2D' and '3D' designate... an extra 
space of some sort ??




--
MikemickaloBlezien
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Thunder Rain Internet Publishing
Providing Internet Solutions that work!
http://www.thunder-rain.com
Web Hosting
http://www.justlightening.net
Tel:  1(985)902-8484
MSN: [EMAIL PROTECTED]
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Enumerating available modules

2003-03-28 Thread Steve Gilbert
Does anyone know of a way to enumerate all the
available modules on a system?

TIA
Steve

__
Do you Yahoo!?
Yahoo! Platinum - Watch CBS' NCAA March Madness, live on your desktop!
http://platinum.yahoo.com

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



Re: Enumerating available modules

2003-03-28 Thread Frank Wiles
 .--[ Steve Gilbert wrote (2003/03/28 at 09:28:17) ]--
 | 
 |  Does anyone know of a way to enumerate all the
 |  available modules on a system?
 |  
 `-

I'm not sure why you'd want to do it, but does it. 

#!/usr/bin/perl 

use File::Find; 
my $count = 0; 

find(\wanted, @INC); 

sub wanted { 
if( $_ =~ /\.pm$/ ) { 
print $count: $File::Find::name\n; 
$count++; 
}
}

 -
   Frank Wiles [EMAIL PROTECTED]
   http://frank.wiles.org
 -


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



RE: :Ping Cannot redirect output !

2003-03-28 Thread Bakken, Luke
 $!=1;

$! contains error text, if I remember correctly off the top of my head.

Use $| = 1 instead for autoflush. This shouldn't cause redirect
problems, tho.

 use Net::Ping;
 @host_array = DATA;
 $p = Net::Ping-new(icmp);
 $p-bind(192.168.2.211); # Specify source interface of pings
 foreach $host (@host_array)  {
chomp($host);
print $host is ;
print NOT  unless $p-ping($host, 2);
print reachable.\n;
 }
 $p-close();

Are you running this on Windows? I've noticed redirect weirdness with
Windows at times.

Otherwise everything looks OK.

Luke

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



Re: Enumerating available modules

2003-03-28 Thread Rob Dixon
Frank Wiles wrote:
 .--[ Steve Gilbert wrote (2003/03/28 at 09:28:17) ]--
  
Does anyone know of a way to enumerate all the
available modules on a system?

 I'm not sure why you'd want to do it, but does it.

 #!/usr/bin/perl

 use File::Find;
 my $count = 0;

 find(\wanted, @INC);

 sub wanted {
 if( $_ =~ /\.pm$/ ) {
 print $count: $File::Find::name\n;
 $count++;
 }
 }

That will effectively produce a list of the Perl module files
in the @INC directories, but they aren't necessarily modules
that you can usefully put in a 'use' statement.

I posted this a while ago, which may be what you want.

Rob Dixon wrote:

 This is a FAQ.

 As far as I'm concerned, by far the best way is to use
 ExtUtils::Installed like this:

 use ExtUtils::Installed;
 print $_\n foreach ExtUtils::Installed-new-modules;

Cheers,

Rob




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



Re: Net::Ping Cannot redirect output !

2003-03-28 Thread Rob Dixon
Ramprasad wrote:
 I have written a simple script that runs file when I run on command line
 but fails when I redirect its output

 I cant beleive this , it seems so impossible can anyone help me

 $!=1;

Should be $| = 1 for autoflush. Or, more neatly:

use IO::Handle;
autoflush STDOUT;

 use Net::Ping;
 @host_array = DATA;
 $p = Net::Ping-new(icmp);
 $p-bind(192.168.2.211); # Specify source interface of pings

I don't know of a 'bind' method for this module. I may be new, of course.

 foreach $host (@host_array)  {
chomp($host);
print $host is ;
print NOT  unless $p-ping($host, 2);

I'd try the program with the ping line commented out, so that all it's
doing is dumping your data. Then see if you can redirect that.

print reachable.\n;
 }
 $p-close();
 __DATA__
[snip data]


 When I run the above script it runs fine like this
   perl ping1.pl

 when I do
 perl ping1.pl output
 I get nothing on screen
 the file output  is also empty 8-(

 Now How can this happen

I can't imagine! But try writing a simple 'Hello World!' program
and making sure you can redirect from that, then enhance it
stepwise until it does what this one does!

DO let us know when you find the answer!

Cheers,

Rob




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



$from_address

2003-03-28 Thread Robbie Staufer
Hi,

I have a perl script that takes in form data and generates and email 
with the data to be sent to me.  I'm getting the error message   
Error:Bad or missing From address: '$from_address'.  The webmaster says 
I'm using the correct from address, so, any ideas about this error message?

Thanks.
Robbie
Here's what I have:

### send mail #

$from_address = [EMAIL PROTECTED];
$to_address = [EMAIL PROTECTED];
$subject = ESMF Registration Form;
%mail = (
   SMTP= 'finster.scd.ucar.edu',
   from= '$from_address',
   to  = '$to_address',
   subject = '$subject',
   );
$mail{body} = END_OF_BODY;

First Name: $fname
Last Name: $lname
Email: $email
Organization: $org
Scientific Interest: $sci_int
Mailing List? $check
sendmail(%mail) || print Error: $Mail::Sendmail::error\n;

--
-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
Robbie Staufer
NCAR/SCD
1850 Table Mesa Dr. Rm. 42
Boulder, CO. 80305
(303) 497-1836


Worm

2003-03-28 Thread Rob Dixon
Guys.

Watch out for a mail with 'Microsoft Mail Service' as a subject. It has
an executable attachment which I'm sure isn't benign.

/R




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



RE: $from_address

2003-03-28 Thread Bakken, Luke
 $from_address = [EMAIL PROTECTED];
 $to_address = [EMAIL PROTECTED];
 $subject = ESMF Registration Form;
 
 %mail = (
 SMTP= 'finster.scd.ucar.edu',
 from= '$from_address',
 to  = '$to_address',
 subject = '$subject',
 );
 
 $mail{body} = END_OF_BODY;

Don't put single quotes around your variables:


%mail = (
 SMTP= 'finster.scd.ucar.edu',
 from= $from_address,
 to  = $to_address,
 subject = $subject,
 );

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



Re: $from_address

2003-03-28 Thread Pete Emerson
You need to leave off the single quotes around $from_address, $to_address, 
and $subject. 

%mail = (
SMTP= 'finster.scd.ucar.edu',
from= $from_address,
to  = $to_address,
subject = $subject,
);


Mar 28, 2003 at 12:12pm from Robbie Staufer:

RS Hi,
RS 
RS I have a perl script that takes in form data and generates and email 
RS with the data to be sent to me.  I'm getting the error message   
RS  Error:Bad or missing From address: '$from_address'.  The webmaster says 
RS I'm using the correct from address, so, any ideas about this error message?
RS 
RS Thanks.
RS Robbie
RS 
RS Here's what I have:
RS 
RS ### send mail #
RS 
RS $from_address = [EMAIL PROTECTED];
RS $to_address = [EMAIL PROTECTED];
RS $subject = ESMF Registration Form;
RS 
RS %mail = (
RS SMTP= 'finster.scd.ucar.edu',
RS from= '$from_address',
RS to  = '$to_address',
RS subject = '$subject',
RS );
RS 
RS $mail{body} = END_OF_BODY;
RS 
RS First Name: $fname
RS Last Name: $lname
RS Email: $email
RS Organization: $org
RS Scientific Interest: $sci_int
RS Mailing List? $check
RS 
RS sendmail(%mail) || print Error: $Mail::Sendmail::error\n;
RS 
RS 
RS 

-- 
http://emerson.wss.yale.edu/perl
Pete Emerson
WSS AMT Yale University


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



Re: $from_address

2003-03-28 Thread Rob Dixon
Robbie Staufer wrote:
 Hi,

 I have a perl script that takes in form data and generates and email
 with the data to be sent to me.  I'm getting the error message
  Error:Bad or missing From address: '$from_address'.  The webmaster says
 I'm using the correct from address, so, any ideas about this error message?

Hi Robbie.

You have a from address of literally '$from_address'. I think your webmaster
is wrong! See below.

 Here's what I have:

 ### send mail #

 $from_address = [EMAIL PROTECTED];
 $to_address = [EMAIL PROTECTED];
 $subject = ESMF Registration Form;

 %mail = (
 SMTP= 'finster.scd.ucar.edu',
 from= '$from_address',
 to  = '$to_address',
 subject = '$subject',
 );

Using single quotes will prevent the scalar variables from being
expanded. These lines should be:

%mail = (
SMTP= 'finster.scd.ucar.edu',
from= $from_address,
to  = $to_address,
subject = $subject,
);

The name of the SMTP server will be OK with either single
or double quotes as there's nothing to expand in there.

 $mail{body} = END_OF_BODY;

 First Name: $fname
 Last Name: $lname
 Email: $email
 Organization: $org
 Scientific Interest: $sci_int
 Mailing List? $check

A 'here' document (which this is) works as if it is in double
quotes by default. You could change it to single-quote
working by putting the end tag in single quotes:

$mail{body} = 'END_OF_BODY';

But don't, because that's not what yuo want!


 sendmail(%mail) || print Error: $Mail::Sendmail::error\n;

HTH,

Rob




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



Re: $from_address

2003-03-28 Thread Rob Dixon
Robbie Staufer wrote:
 Here's what I have:

 $from_address = [EMAIL PROTECTED];
 $to_address = [EMAIL PROTECTED];
 $subject = ESMF Registration Form;

I should have pointed out that here single quotes
are just what you want, to stop it expanding
arrays @sweb and @scd. That way you wouldn't need
to escape them with backslashes.

$from_address = '[EMAIL PROTECTED]';
$to_address = '[EMAIL PROTECTED]';
$subject = 'ESMF Registration Form';

/R




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



newbie module question

2003-03-28 Thread Leon

Hi everyone,

I am really really new to perl.   I know this is dumb but I am using perl in the win 
32 environement (perl 5.8.0 build 804) from active state.  I am trying to figure out 
how to install modules.  Where do you get them from?  How do you install them?  Other 
things I need to know?

Thx again and please no flames I am new to this whole perl thing.

 



-
Do you Yahoo!?
Yahoo! Platinum - Watch CBS' NCAA March Madness, live on your desktop!

Re: $from_address

2003-03-28 Thread Kevin Meltzer
$from _address will not interpolate in single quotes. No quotes needed
around $from_address, $to_address or $subject.

Cheers,
Kevin

On Fri, Mar 28, 2003 at 12:12:44PM -0700, Robbie Staufer ([EMAIL PROTECTED]) said 
something similar to:
 Hi,
 
 I have a perl script that takes in form data and generates and email 
 with the data to be sent to me.  I'm getting the error message   
  Error:Bad or missing From address: '$from_address'.  The webmaster says 
 I'm using the correct from address, so, any ideas about this error message?
 
 Thanks.
 Robbie
 
 Here's what I have:
 
 ### send mail #
 
 $from_address = [EMAIL PROTECTED];
 $to_address = [EMAIL PROTECTED];
 $subject = ESMF Registration Form;
 
 %mail = (
 SMTP= 'finster.scd.ucar.edu',
 from= '$from_address',
 to  = '$to_address',
 subject = '$subject',
 );
 
 $mail{body} = END_OF_BODY;
 
 First Name: $fname
 Last Name: $lname
 Email: $email
 Organization: $org
 Scientific Interest: $sci_int
 Mailing List? $check
 
 sendmail(%mail) || print Error: $Mail::Sendmail::error\n;
 
 
 -- 
 -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
 Robbie Staufer
 NCAR/SCD
 1850 Table Mesa Dr. Rm. 42
 Boulder, CO. 80305
 (303) 497-1836
 

-- 
[Writing CGI Applications with Perl - http://perlcgi-book.com]
I know the human being and fish can coexist peacefully.
-- G.W. Bush, Saginaw, MI 09/29/2000

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



cobol - perl ??

2003-03-28 Thread Jeff Westman
Hi,

I've got some files, that were written with a COBOL program, so I have fields
that have been created with COMP (binary) picture clauses.  The problem is
now I need to read this file into a perl program.  Here's what I have:

05 RECORD-TYPEPIC X.
05 LOC-ID PIC S9(4)  COMP.
05 PO-ID  PIC S9(8)  COMP.
05 SHIP-IDPIC X(8).
05 SHIP-DTPIC S9(8)  COMP.
(etc)

Is there a way to break-down the COMP fields into a readable format?  If I
recall from my COBOL days, a signed-COMP(4)  will take up 3 bytes.  How can I
read this file?? 


-Jeff

__
Do you Yahoo!?
Yahoo! Platinum - Watch CBS' NCAA March Madness, live on your desktop!
http://platinum.yahoo.com

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



RE: newbie module question

2003-03-28 Thread Hanson, Rob
Tricky question...

Try using PPM first, it is a utility that comes with ActiveState Perl.  It
installs from the ActiveState module repository.

From the command line...
 C:\ppm

Once in PPM you can search and install...
 search Foo
 install Foo::Bar
 help

...But not all modules are available this way.

All Perl modules can be found on CPAN (www.cpan.org) and installing them on
Windows may or may not be an issue.  Try PPM first, and if you have problems
where a certain module isn't available via PPM, then ask.

Rob


-Original Message-
From: Leon [mailto:[EMAIL PROTECTED]
Sent: Friday, March 28, 2003 1:23 PM
To: [EMAIL PROTECTED]
Subject: newbie module question



Hi everyone,

I am really really new to perl.   I know this is dumb but I am using perl in
the win 32 environement (perl 5.8.0 build 804) from active state.  I am
trying to figure out how to install modules.  Where do you get them from?
How do you install them?  Other things I need to know?

Thx again and please no flames I am new to this whole perl thing.

 



-
Do you Yahoo!?
Yahoo! Platinum - Watch CBS' NCAA March Madness, live on your desktop!

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



RE: cobol - perl ??

2003-03-28 Thread Wagner, David --- Senior Programmer Analyst --- WGO
Jeff Westman wrote:
 Hi,
 
 I've got some files, that were written with a COBOL program, so I
 have fields that have been created with COMP (binary) picture
 clauses.  The problem is now I need to read this file into a perl
 program.  Here's what I have: 
 
 05 RECORD-TYPEPIC X.
 05 LOC-ID PIC S9(4)  COMP.
 05 PO-ID  PIC S9(8)  COMP.
 05 SHIP-IDPIC X(8).
 05 SHIP-DTPIC S9(8)  COMP.
 (etc)
 
 Is there a way to break-down the COMP fields into a readable format? 
 If I recall from my COBOL days, a signed-COMP(4)  will take up 3
 bytes.  How can I read this file??
 
 
 -Jeff
 
Really depends what machine you are getting the data from.  I have fields for 
comp which run like:
a)  comp [s]9(4)two bytes
b)  comp [s]9(9)four bytes
where [s] implies optional

For me I use from the pack/unpack template characters:
  a) - n which is Short in network (big endian) byte order
  b) - N which is long  in network (big endian) byte order

   Also for a) I have used s for Signed short value and the values have come out as 
expected.

Look at the pack/unpack info to assist.

Wags ;)


**
This message contains information that is confidential
and proprietary to FedEx Freight or its affiliates.
It is intended only for the recipient named and for
the express purpose(s) described therein.
Any other use is prohibited.



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



How to pull all attachments from an email and save as unique ids?

2003-03-28 Thread Wagner, David --- Senior Programmer Analyst --- WGO
I have one email which has 100 attachments (mail ids) which are not unique and 
when I save attachments via Outlook and it comes back repeatedly saying that this file 
already exists, do you want to replace.

I am not even sure where to start, just know that Perl will have a way to 
solve it. I looked through the options under Outlook and did see anythgin that stood 
out as a way to solve the problem. The mail message is sitting in my inbox.

I am running AS 5.6.0 build 623 ( I know it is older, but have some things 
running which are functioning and doing work in a Prod environment).

An example that I can expand upon. Anything that will allow me to save because 
I am going to have do it again.

Thanks.

Wags ;)



**
This message contains information that is confidential
and proprietary to FedEx Freight or its affiliates.
It is intended only for the recipient named and for
the express purpose(s) described therein.
Any other use is prohibited.



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



RE: cobol - perl ??

2003-03-28 Thread Jeff Westman
David,

Thanks, I was just now finding out the same thing (architecture is 2 bytes
for PIC S9(1) through PIC S9(5).

Much thanks!

-Jeff


--- Wagner, David --- Senior Programmer Analyst --- WGO
[EMAIL PROTECTED] wrote:
 Jeff Westman wrote:
  Hi,
  
  I've got some files, that were written with a COBOL program, so I
  have fields that have been created with COMP (binary) picture
  clauses.  The problem is now I need to read this file into a perl
  program.  Here's what I have: 
  
  05 RECORD-TYPEPIC X.
  05 LOC-ID PIC S9(4)  COMP.
  05 PO-ID  PIC S9(8)  COMP.
  05 SHIP-IDPIC X(8).
  05 SHIP-DTPIC S9(8)  COMP.
  (etc)
  
  Is there a way to break-down the COMP fields into a readable format? 
  If I recall from my COBOL days, a signed-COMP(4)  will take up 3
  bytes.  How can I read this file??
  
  
  -Jeff
  
   Really depends what machine you are getting the data from.  I have fields
 for comp which run like:
   a)  comp [s]9(4)two bytes
   b)  comp [s]9(9)four bytes
   where [s] implies optional
 
   For me I use from the pack/unpack template characters:
 a) - n which is Short in network (big endian) byte order
 b) - N which is long  in network (big endian) byte order
 
Also for a) I have used s for Signed short value and the values have
 come out as expected.
 
 Look at the pack/unpack info to assist.
 
 Wags ;)
 
 
 **
 This message contains information that is confidential
 and proprietary to FedEx Freight or its affiliates.
 It is intended only for the recipient named and for
 the express purpose(s) described therein.
 Any other use is prohibited.
 
 
 
 --
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 


__
Do you Yahoo!?
Yahoo! Platinum - Watch CBS' NCAA March Madness, live on your desktop!
http://platinum.yahoo.com

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



Re: Enumerating available modules

2003-03-28 Thread Janek Schleicher
Steve Gilbert wrote at Fri, 28 Mar 2003 09:28:17 -0800:

 Does anyone know of a way to enumerate all the
 available modules on a system?

Have a look to the CPAN module
ExtUtils::Installed


Greetings,
Janek

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



db query help!

2003-03-28 Thread Jasmine
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Hi perl gurus,

I m afraid I need some help here urgently. Could anyone see whats wrong with 
the way I query the database? Whats DBI::st=HASH(0x8240a10) ? Any help is 
appreciated Thanks! 

the $query variable returns -- DBI::st=HASH(0x8240a10)
$results variable returns -- 0
RESULTS OF QUERY: 0


my $sql = select status_id from status;
my $query = $dbh - prepare($sql) or die  error $! \n;
print  $query \n;
# execute the query
$query - execute or die cannot execute $! \n;

# return the results
my $results = $query - fetchrow_array;
print $results \n;
print RESULTS OF QUERY: $results \n;



- -- 
Jasmine Chua
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.2.1 (GNU/Linux)

iD8DBQE+hLYhNgvTa7Hj2AURAvL9AJ90fr2RisoxpXw8RidnU2zyc146PACgi/fD
FNZxEIfvAlNTLaSniQBgsYM=
=WrTJ
-END PGP SIGNATURE-


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



RE: How to pull all attachments from an email and save as unique ids?

2003-03-28 Thread David Olbersen
David,

Take a look at perlmonks.org, somebody wrote a script that does something very similar 
to what you're looking for.

Specifically, http://www.perlmonks.com/index.pl?node_id=12287 has a good starting 
point!

It uses the MIME tools if memory serves me...

--
David Olbersen 
iGuard Engineer
11415 West Bernardo Court 
San Diego, CA 92127 
1-858-676-2277 x2152


 -Original Message-
 From: Wagner, David --- Senior Programmer Analyst --- WGO
 [mailto:[EMAIL PROTECTED]
 Sent: Friday, March 28, 2003 12:23 PM
 To: Beginner Perl
 Subject: How to pull all attachments from an email and save as unique
 ids?
 
 
   I have one email which has 100 attachments (mail ids) 
 which are not unique and when I save attachments via Outlook 
 and it comes back repeatedly saying that this file already 
 exists, do you want to replace.
 
   I am not even sure where to start, just know that Perl 
 will have a way to solve it. I looked through the options 
 under Outlook and did see anythgin that stood out as a way to 
 solve the problem. The mail message is sitting in my inbox.
 
   I am running AS 5.6.0 build 623 ( I know it is older, 
 but have some things running which are functioning and doing 
 work in a Prod environment).
 
   An example that I can expand upon. Anything that will 
 allow me to save because I am going to have do it again.
 
   Thanks.
 
 Wags ;)
 
 
 
 **
 This message contains information that is confidential
 and proprietary to FedEx Freight or its affiliates.
 It is intended only for the recipient named and for
 the express purpose(s) described therein.
 Any other use is prohibited.
 
 
 
 -- 
 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: db query help!

2003-03-28 Thread Bob Showalter
Jasmine wrote:
 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA1
 
 Hi perl gurus,
 
 I m afraid I need some help here urgently. Could anyone see whats
 wrong with the way I query the database? Whats
 DBI::st=HASH(0x8240a10) ? Any help is appreciated Thanks!

DBI::st=HASH(0x8240a10) is the way Perl prints an object reference. $query
is a DBI statement handle (member of class DBI::st). Printing it is not
terribly useful.

 
 the $query variable returns -- DBI::st=HASH(0x8240a10)
 $results variable returns -- 0
 RESULTS OF QUERY: 0
 
 
 my $sql = select status_id from status;
 my $query = $dbh - prepare($sql) or die  error $! \n; 

DBI doesn't put it's error message in $!. You need to print $DBI::errstr, or
use the PrintError or RaiseError attributes on the DBI-connect call.

 print $query \n; # execute the query
 $query - execute or die cannot execute $! \n;

Same as above.

 
 # return the results
 my $results = $query - fetchrow_array;

fetchrow_array returns an array, but you're calling in scalar context. If
there's only one column, you need to call it like:

   my ($results) = $query-fetchrow_array;

$results will be undef if there are no more rows to fetch, or if the column
value is null. If want to be able to tell which it was, use
fetchrow_arrayref, which returns an array reference if a row was fetched, or
undef if no more rows (or error).

 print $results \n;
 print RESULTS OF QUERY: $results \n;

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



grab input from a stdout

2003-03-28 Thread Leon

Hi again,

I have a questions regarding stdout.

Basically I have a script that looks like this:

system(reg DELETE HKCR\\AppID\\OvEpSeMain.EXE /f)  die no $!;
system(reg DELETE HKCR\\AppID\\OvEpSeMain.EXE /f)  die no $!;
system(reg DELETE HKCR\\AppID\\OvEpSeMServer.EXE /f)  die no $!;
system(reg DELETE HKCR\\AppID\\OvMsmAccessManager.EXE /f)  die no $!;
system(reg DELETE HKCR\\AppID\\OvPmdPolicyEditorFrame.EXE /f)  die no $!;\

The script removes those keys from the registry if they are there however if the keys 
are not there I get this error:

C:\scriptzperl -w clean.pl

Error:  The system was unable to find the specified registry key or value
no  at clean.pl line 7.

What i want to know is how I could go about writing the logic to grab what is being 
sent to the screen to test it and if it says error to just have the script keep going 
ignoring the error.

Thx,

Leon



-
Do you Yahoo!?
Yahoo! Platinum - Watch CBS' NCAA March Madness, live on your desktop!

RE: How to pull all attachments from an email and save as unique ids?

2003-03-28 Thread Wagner, David --- Senior Programmer Analyst --- WGO
David Olbersen wrote:
 David,
 
 Take a look at perlmonks.org, somebody wrote a script that does
 something very similar to what you're looking for. 
 
 Specifically, http://www.perlmonks.com/index.pl?node_id=12287 has a
 good starting point! 
 
 It uses the MIME tools if memory serves me...
 
 --
 David Olbersen
 iGuard Engineer
 11415 West Bernardo Court
 San Diego, CA 92127
 1-858-676-2277 x2152
 

Thanks, David, but the repository is Outlook and hence need either through OLE or CDO 
or ??? the ability to get at the mail within Outlook and work from there.  I am going 
to save the info you sent, since I do or may have the need for something like that in 
the near future.

Wags ;)


**
This message contains information that is confidential
and proprietary to FedEx Freight or its affiliates.
It is intended only for the recipient named and for
the express purpose(s) described therein.
Any other use is prohibited.



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



RE: grab input from a stdout

2003-03-28 Thread Wagner, David --- Senior Programmer Analyst --- WGO
Leon wrote:
 Hi again,
 
 I have a questions regarding stdout.
 
 Basically I have a script that looks like this:
 
 system(reg DELETE HKCR\\AppID\\OvEpSeMain.EXE /f)  die no $!;
 system(reg DELETE HKCR\\AppID\\OvEpSeMain.EXE /f)  die no $!;
 system(reg DELETE HKCR\\AppID\\OvEpSeMServer.EXE /f)  die no $!;
 system(reg DELETE HKCR\\AppID\\OvMsmAccessManager.EXE /f)  die
 no $!; system(reg DELETE HKCR\\AppID\\OvPmdPolicyEditorFrame.EXE
 /f)  die no $!;\ 
 
 The script removes those keys from the registry if they are there
 however if the keys are not there I get this error: 
 
 C:\scriptzperl -w clean.pl
 
 Error:  The system was unable to find the specified registry key or
 value no  at clean.pl line 7.
 
 What i want to know is how I could go about writing the logic to grab
 what is being sent to the screen to test it and if it says error to
 just have the script keep going ignoring the error.  
 
 Thx,
 
 Leon
 
  use `` and setup like :

my $MyOutput = `reg DELETE HKCR\\AppID\\OvMsmAccessManager.EXE /f`;
Now you can parse the $MyOutput to see if there was an error or not.  I mean 
you are controlling the output already by using die. If you want you could exchange 
the die with warn and it should function like you want with warnings.

Wags ;)


**
This message contains information that is confidential
and proprietary to FedEx Freight or its affiliates.
It is intended only for the recipient named and for
the express purpose(s) described therein.
Any other use is prohibited.



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



db query help! - part 2

2003-03-28 Thread Jasmine
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Hi thanks .. for telling me tht DBI dont accept $! 
erm i still have problems though. Theres actually data in the this table made 
up of 2 columns. But, apparently my query keep returning 0 and new which 
I cant understand why. 

#!/usr/bin/perl -w

use DBI;


# connect to the db server
my $dbh = DBI - connect('dbi:mysql:database:hostname:3306', 'xxx');
my $error = $dbh - errstr;
my $sql = select status_id, description from status;
my $query = $dbh - prepare($sql);
# execute the query
$query - execute ;

# return the results
my ($results) = $query - fetchrow_array;
print $results \n;
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.2.1 (GNU/Linux)

iD8DBQE+hL2JNgvTa7Hj2AURAgsCAJ9xk4wkpDUB1U6vZyE4TZUQg6pCCwCfU2AL
UOyjIwsO7yij9Gjb1n9OQmI=
=/EUQ
-END PGP SIGNATURE-


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



howto: open/create a file as executable

2003-03-28 Thread Ken Lehman
Is it possible to open/create a file with open that does not exist and give
it a umask that makes it executable, say for the purpose of generating shell
scripts?

For example, say

open OUT_FILE, MAGIC_UMASK, /scripts/new_script;

where the current umask is 2.
Is the only option to chmod the file after it has been created?

Thanks for any help.
-Ken



The views and opinions expressed in this email message are the sender's
own, and do not necessarily represent the views and opinions of Summit
Systems Inc.


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



Re: $from_address

2003-03-28 Thread John W. Krahn
Robbie Staufer wrote:
 
 Hi,

Hello,

 I have a perl script that takes in form data and generates and email
 with the data to be sent to me.  I'm getting the error message
  Error:Bad or missing From address: '$from_address'.  The webmaster says
 I'm using the correct from address, so, any ideas about this error message?
 
 Here's what I have:
 
 ### send mail #
 
 $from_address = [EMAIL PROTECTED];
 $to_address = [EMAIL PROTECTED];
 $subject = ESMF Registration Form;
 
 %mail = (
 SMTP= 'finster.scd.ucar.edu',
 from= '$from_address',
 to  = '$to_address',
 subject = '$subject',

Variables inside single quoted strings do not interpolate.

 SMTP= 'finster.scd.ucar.edu',
 from= $from_address,
 to  = $to_address,
 subject = $subject,


John
-- 
use Perl;
program
fulfillment

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



Re: Variable scoping, static variable

2003-03-28 Thread John W. Krahn
Rob Anderson wrote:
 
 I'm trying cache a function to help speed it up.

Have a look at the Memoize module at CPAN.


John
-- 
use Perl;
program
fulfillment

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



Newbie Help Needed! Mail Problem!

2003-03-28 Thread Palm Optins
Hello All.

I have a admin script for a protected members area. In it, I can email all the members
to let them know the Updates of the program.

For some unknown reason, it keeps sending out double emails for each address.
Can someone tell me what I did wrong?

Here's the code I used for the mailer:

sub mmail {

$pid = fork();
print Content-type: text/html \n\n fork failed: $! unless defined 

$pid;
if ($pid) {
mailsent;

exit(0);
 }
else {
 close (STDOUT);

# SEND OUT EMAILS HERE 

open (DAT,$memberinfo/amdata.db);
if ($LOCK_EX){ 
  flock(DAT, $LOCK_EX); #Locks the file
 }
 @database_array = DAT;
close (DAT);

foreach $lines(@database_array) {
  @edit_array = split(/\:/,$lines);
  

open (MAIL, |$mailprog -t)
 || print Can't start mail program; 
 
print MAIL To: $edit_array[2]\n;
print MAIL From: $orgmail ($orgname)\n;
print MAIL Subject: $INPUT{'mail_subject'}\n;
print MAIL Important Admin Message Below\n;
print MAIL - x 75 . \n\n;
print MAIL $INPUT{'message'}\n\n; 
print MAIL ==\n; 
print MAIL Admin:\n\n;
print MAIL $orgname\n;
print MAIL Email: $orgmail\n;
print MAIL ==\n;
   close (MAIL);
 
}
-
sub mailsent {
print Content-type: text/html\n\n;
header;
printEOF;
FORM ACTION=$cgiurl METHOD=POSTCENTERBR
TABLE BORDER=0 WIDTH=500TBODYCOLDEFSCOLDEF/COLDEFSROWSTRTD
COLSTART=1PBFONT FACE=verdana, arial, helveticaFONT
COLOR=#FFAccount
Manager/FONT Status:  Success!/FONT/B/P
PFONT SIZE=-1 FACE=verdana, arial, helveticaMass Mailing has been 
sent!/FONT/P
PFONT SIZE=-1 FACE=verdana, arial, helveticaPlease contact
A HREF=mailto:$orgmail;$orgname Support/A if you need any further
assistance./FONTBRBR/P/TD/TR/ROWS/TBODY/TABLE/CENTERHR
SIZE=1 WIDTH=450CENTERTABLE BORDER=1 WIDTH=500TBODYCOLDEFSCOLDEF
COLDEF/COLDEFSROWSTRTD
VALIGN=MIDDLE ALIGN=CENTER WIDTH=50% BGCOLOR=#C0C0C0 COLSTART=1INPUT
TYPE=SUBMIT VALUE=Main Menu Return NAME=admin2/TDTD
VALIGN=MIDDLE ALIGN=CENTER WIDTH=50% BGCOLOR=#C0C0C0 COLSTART=2FONT
SIZE=+1 FACE=verdana, arial, helveticaBFONT SIZE=-1Main Menu
Return/FONT/B/FONT/TD/TR/ROWS/TBODY/TABLE/CENTERCENTERTABLE
BORDER=0 WIDTH=500TBODYCOLDEFSCOLDEF/COLDEFSROWSTRTD
COLSTART=1HR SIZE=1
CENTERFONT SIZE=-2 FACE=verdana, arial, helveticaB$orgname
copy; $copy/A/B/FONT 
/CENTER/TD/TR/ROWS/TBODY/TABLE/CENTER/FORM
EOF
footer;
exit;
}

Thanks and God Bless
Linda
ICQ #: 179542247

¤§¤=¤§¤=¤§¤¤§¤=¤§¤=¤§¤

For God so loved the world, that He gave his only begotten
Son, that whosoever believeth in him should not perish, but
have everlasting life.

¤§¤=¤§¤=¤§¤¤§¤=¤§¤=¤§¤

running a script thru a webpage

2003-03-28 Thread Christopher M Burger
Hello everyone.
 
I have written a perl program that will take a tar file and untar it then
move file from the untarred direcories to it's directory on the webserver.
However, when I run the program thru a webpage it does not untar the file.
If I run the program localy it works fine.  I have even run the program
localy as www the user the webserver uses and it works fine, but when turn
around and run the program thru my web browser it does not work.   
 
If anyone has any reasons why this would happen I would appreciate it.
 
I'm running in strict mode, and am using the following system command to
untar.
 
  eval { system(/usr/local/bin/gtar -C /$temp_directory -xzf
/$temp_directory/$short_name) == 0 or die sorry! Could not extract file
$temp_directory/$short_name };
 
where $temp_directory is the full path to the tar file, and $short_name is
the name of the tar file.
 
Thanks
 
Christopher Burger



Re: howto: open/create a file as executable

2003-03-28 Thread John W. Krahn
Ken Lehman wrote:
 
 Is it possible to open/create a file with open that does not exist and give
 it a umask that makes it executable, say for the purpose of generating shell
 scripts?

Yes.

 For example, say
 
 open OUT_FILE, MAGIC_UMASK, /scripts/new_script;
 
 where the current umask is 2.
 Is the only option to chmod the file after it has been created?

use Fcntl;

umask( 022 );
sysopen( OUT_FILE, '/scripts/new_script', O_WRONLY | O_EXCL | O_CREAT,
0777 )
or die Cannot open '/scripts/new_script' $!;


perldoc -f sysopen
perldoc -f open
perldoc perlopentut



John
-- 
use Perl;
program
fulfillment

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



RE: How to pull all attachments from an email and save as unique ids?

2003-03-28 Thread Wagner, David --- Senior Programmer Analyst --- WGO
Wagner, David --- Senior Programmer Analyst --- WGO wrote:
 David Olbersen wrote:
 David,
 
 Take a look at perlmonks.org, somebody wrote a script that does
 something very similar to what you're looking for.
 
 Specifically, http://www.perlmonks.com/index.pl?node_id=12287 has a
 good starting point! 
 
 It uses the MIME tools if memory serves me...
 
 --
 David Olbersen
 iGuard Engineer
 11415 West Bernardo Court
 San Diego, CA 92127
 1-858-676-2277 x2152
 
 
 Thanks, David, but the repository is Outlook and hence need either
 through OLE or CDO or ??? the ability to get at the mail within
 Outlook and work from there.  I am going to save the info you sent,
 since I do or may have the need for something like that in the near
 future.
 
 Wags ;)
 
 
From what David gave me, I went and looked at what was at perlmonks and found 
someone who was doing the save of attachments.  Here is the basic code:

foreach my $attachment ( in {$item-Attachments} ) {
do {
$MyFileOut = $MyDir . sprintf email_%05d.txt, $MyCnt++;
 } until ( ! -e $MyFileOut );

$attachment-SaveAsFile( $MyFileOut , olTXT ) ;
if ( Win32::OLE-LastError() ) {
printf %-s\n, Win32::OLE-LastError();
 }

but it does not like the data after the , within the SaveAsFile
Win32::OLE(0.15) error 0x8002000e: Invalid number of parameters
in METHOD/PROPERTYGET SaveAsFile

The attachments are from ezmlm program and there are a hundred of them. 

I went back to the OLE browser and finally found the right spot and sure enough there 
can ONLY be the filename to save as. How do you convert them or get them to be text 
only messages.

I'm lost??

Wags ;)


**
This message contains information that is confidential
and proprietary to FedEx Freight or its affiliates.
It is intended only for the recipient named and for
the express purpose(s) described therein.
Any other use is prohibited.



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



Re: Net::Ping Cannot redirect output !

2003-03-28 Thread Ramprasad
Rob Dixon wrote:
Ramprasad wrote:

I have written a simple script that runs file when I run on command line
but fails when I redirect its output
I cant beleive this , it seems so impossible can anyone help me

$!=1;


Should be $| = 1 for autoflush. Or, more neatly:

use IO::Handle;
autoflush STDOUT;

use Net::Ping;
@host_array = DATA;
$p = Net::Ping-new(icmp);
$p-bind(192.168.2.211); # Specify source interface of pings


I don't know of a 'bind' method for this module. I may be new, of course.


foreach $host (@host_array)  {
  chomp($host);
  print $host is ;
  print NOT  unless $p-ping($host, 2);


I'd try the program with the ping line commented out, so that all it's
doing is dumping your data. Then see if you can redirect that.

  print reachable.\n;
}
$p-close();
__DATA__
[snip data]

When I run the above script it runs fine like this
 perl ping1.pl
when I do
perl ping1.pl output
I get nothing on screen
the file output  is also empty 8-(
Now How can this happen


I can't imagine! But try writing a simple 'Hello World!' program
and making sure you can redirect from that, then enhance it
stepwise until it does what this one does!
DO let us know when you find the answer!

Cheers,

Rob



Thanks all ,
 It was a problem of buffering after all most probably.
my typo $!=1 instead of $|=1 was the culprit.
I just went straight home yesterday and today morning i did $| =1 and 
all's well

But I am not very sure about the problem
If the program is buffering ( assume I do not put $|=1 )
then the program must flush the buffer when it exits . So when I do a 
Ctrl-C the output file must get created !?! , or is it that the buffer 
is cleared only if the program reaches the end



BTW using IO::Handle is a clean way but an overkill, My code takes a 
full second extra if I put a use IO::Handle ( I am using redhat linux 
7.2 and perl 5.8.0 )

Thanks
Ram


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