Re: editing script

2001-09-13 Thread Gunther Birznieks

At 08:44 AM 9/13/2001 -0300, Wagner wrote:
Hello,

I'm editing a script that produces a .png image, i want it to turn it into a
.html doc.

My first doubt is that i can't put the image in the html doc. The image is
stored in $im and i don't know how to put it in the doc.

ex:
print Content-type text/html\n\n;
print HTMLimg src=$im/HTML;

Not unless $im is a URL and even then you may want to consider quoting it. 
You can't just dump binary data inside an HTML document. So $im must be a 
URL not the binary data of an image.

I'm also trying to put this image in a file this way:

$file = 'c:\image.png';
open (INFO, $file);
print INFO $im-png;
close (INFO);

But it doesn't work...

It's possible that you want to turn binmode on INFO...

binmode(INFO) before printing a binary image to it.

The second doubt is how can i put the content of a variable in the doc. For
example, if i have a valiable:

$file = 'c:\dir\asdf.asd',

Then i try to put in the doc this way:

print HTMLFONT$file/FONT/HTML;

But when i run it apears $file in the .html doc and i wanted to see
c:\dir\asdf.asd

$file should interpolate fine if you truly did use double-quotes in your 
print statement, but I think it is possible that you should cut and paste 
exactly what you used because you seem a bit confused, and I am afraid that 
it's possible that you're information is not relayed exactly as you say you 
typed your tests out.



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




gui development

2001-09-13 Thread charles

sorry that this question isnt directly cgi associated. up until recently,
i've been developing my cgi scripts straight away using vi or a clone. i
just came upon activestate's visual perl a few days ago and wondered if
anyone knew of a similar product available for the *nix platform?

regards -charles


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




problem using script as ssi

2001-09-13 Thread charles

i have the following script:

#!/usr/bin/perl -w

use strict;

my $file = /path/to/pancho-unstable;

print pre;
open(FH, $file);
while(FH) {
  s/\\\@/@/g;
  s//\gt;/g;
  s//\lt;/g;
  print if /USE/.../USE/ and !/USE/;
}
close(FH);
print /pre;


when i include this script as an ssi through:

!-- #exec cgi=cgi-bin/parse.pl --

nothing prints except for the html included in the .shtml file.
however, when i rewrite the above script as follows:

#!/usr/bin/perl -w

use strict;
use CGI ':standard';

my $file = /path/to/pancho-unstable;

print header;
print start_html(Pancho Man Page);
print pre;
open(FH, $file);
while(FH) {
  s/\\\@/@/g;
  s//\gt;/g;
  s//\lt;/g;
  print if /USE/.../USE/ and !/USE/;
}
close(FH);
print /pre;
print end_html;


the desired results occur. can someone explain why i am seeing these
results?

thanks -c


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




RE: problem using script as ssi

2001-09-13 Thread Bob Showalter

 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, September 13, 2001 11:23 AM
 To: CGI Beginners
 Subject: problem using script as ssi
 
 
 i have the following script:
 
 #!/usr/bin/perl -w
 
 use strict;
 
 my $file = /path/to/pancho-unstable;
 
 print pre;
 open(FH, $file);
 while(FH) {
   s/\\\@/@/g;
   s//\gt;/g;
   s//\lt;/g;
   print if /USE/.../USE/ and !/USE/;
 }
 close(FH);
 print /pre;
 
 
 when i include this script as an ssi through:
 
 !-- #exec cgi=cgi-bin/parse.pl --
 
 nothing prints except for the html included in the .shtml file.
 however, when i rewrite the above script as follows:
 
 #!/usr/bin/perl -w
 
 use strict;
 use CGI ':standard';
 
 my $file = /path/to/pancho-unstable;
 
 print header;
 print start_html(Pancho Man Page);
 print pre;
 open(FH, $file);
 while(FH) {
   s/\\\@/@/g;
   s//\gt;/g;
   s//\lt;/g;
   print if /USE/.../USE/ and !/USE/;
 }
 close(FH);
 print /pre;
 print end_html;
 
 
 the desired results occur. can someone explain why i am seeing these
 results?

Because the former is not a valid CGI script, while the latter is?

You can use the directive:

   !-- #exec cmd=cgi-bin/parse.pl --

To execute the script with /bin/sh, which would allow your first
script to work as you intend.

(Also note that mod_include docs recommend using #include virtual
instead of #exec cgi)

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




Complete beginner can't get Sendmail to work

2001-09-13 Thread Andrew Cocks

my sendmail.pm file (stored in the SYS\Perl\lib\Mail directory) has the following line:

$default_smtp_server = '192.9.200.222';

my formmail.pl file refers to the sendmail file with the following line:

$mailprog = '/perl/lib/Mail';

Can anyone see anything wrong with these lines of code?

Is it possible to test sendmail.pm without using another script?







**
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.

This footnote also confirms that this email message has been swept by
MIMEsweeper for the presence of computer viruses.

[EMAIL PROTECTED]
**

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




Re: Complete beginner can't get Sendmail to work

2001-09-13 Thread Gunther Birznieks

Please do a search on the archives of this list from the past couple weeks 
having to do with mail and you'll see many good, verbose suggestions on 
some good alternatives

At 04:49 PM 9/13/2001 +0100, Andrew Cocks wrote:
my sendmail.pm file (stored in the SYS\Perl\lib\Mail directory) has the 
following line:

$default_smtp_server = '192.9.200.222';

my formmail.pl file refers to the sendmail file with the following line:

$mailprog = '/perl/lib/Mail';

Can anyone see anything wrong with these lines of code?

Is it possible to test sendmail.pm without using another script?







**
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.

This footnote also confirms that this email message has been swept by
MIMEsweeper for the presence of computer viruses.

[EMAIL PROTECTED]
**

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

__
Gunther Birznieks ([EMAIL PROTECTED])
eXtropia - The Open Web Technology Company
http://www.eXtropia.com/


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




Re: Trying to close a port with perl

2001-09-13 Thread Randy5235

Sorry needed to reset my clock !!
Randy5235 [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Ok I am sure this is not the best way to do it (esoecially since it
doesn't
 seem to work for me!) any ideas???
 Randy5235





 #!/usr/bin/perl

 use IO::Socket;
 #get port number
 printwhat port do you want to close?\n;
 $port=STDIN;

 $local = IO::Socket::INET-new(Proto=tcp, LocalPort= $port,
Listen=1)
  or die Can't setup\n;
 $remote = $local-accept;
 # output the address and the port we are connected to
 print Connection from , $remote-peerhost, :, $remote-peerport;
 close $remote, $local;





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




Search and replace using variables

2001-09-13 Thread Jimson Lee

Here's my problem.  I'm using InstallShield to install a custom app at
several different sites.  Each app at each location has their own cfg
file with distinct IP addresses.  During the InstallShield, I'd like to
preserve that IP info and insert that info into the new cfg file that
InstallShield installs.

I've already written a dos batch file that does this but my manager
wants it done in Perl.

As far as Perl goes, I know how to search for a string(IP address).  I
know how to do a search and replace.  What I don't know how to do is
search for string, assign that string to a variable and then use that
variable in a search and replace statement.

Here's what I'm using to search for the string...

open FILE, config.cfg or die can't open config.cfg: $!;
my @lines = FILE;
print grep /OAM/i, @lines;

This returns the string OAM...  Can I assign this to a variable?


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




Search and replace using a variable

2001-09-13 Thread Jimson Lee

I'm using InstallShield to install a custom app at several locations.
On each target machine, is a custom cfg file with unique IP addresses.
InstallShield will overwrite this file during installation, but I'd like
to extract these addresses and insert them into the newly installed cfg
file.  I wrote a dos batch file that extracts this data from the old cfg
text file and inserts it into the new cfg text file but my manager wants
it in perl.

Being new to perl, I know how to search for strings.  I know how to
explicitly search and replace a string.  What I don't know how to do is
search for a string, make that string a variable, and then use that
variable in a search and replace statement so that I can run this script
at all my sites.

Here's what I'm using to search for a string...

open FILE, config.cfg or die can't open config.cfg: $!;
my @lines = FILE;
print grep /OAM/i, @lines;

When I run this against config.cfg, it gives me the string OAM...  Can I
make that a variable?



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




Re: Parse a file

2001-09-13 Thread Jorge Goncalvez


- Begin Forwarded Message -

Date: Thu, 13 Sep 2001 10:45:03 +0200 (MEST)
From: Jorge Goncalvez goncal11@cabs40
Subject: Re: Parse a file

Mime-Version: 1.0
Content-MD5: DZmPkpqQxHxJV6ZMZxyK0Q==

Hi folks, I wanted to parse a file which is always growing.
If this file contains first the word DHCPDISCOVER, I wanted to display a 
progress bar with 4 square and the first square is checked.
Then if the file contains DHCPOFFER, I wanted to display the second square.
Then if the file contains DHCREQUEST, I wanted to display the third square.
and finally if the file contains DHCPACK, I wanted to display the fourth square.

How can I do this in Perl Tk?

Thanks.  

- End Forwarded Message -



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




Condolences to US readers

2001-09-13 Thread Andy McDowell

This is to all Americans as a nation, and to foriegners who lost loved ones on 
September 13. My heartfelt condolences go out to you, and my sincerest wish that you 
find peace soon.

Andy


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




to remove the file extension

2001-09-13 Thread jaya kumaran


hi,

  In a directory there exist *.c and *.out files. Here *.out is created for every *.c 
file. I need to check whether .out is generated for all the .c file.
How to achive this.

Thanks in advance,
Jaya
-- 

___
Get your free email from http://www.indiya.com


Powered by Outblaze

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




Re: Search and replace using a variable

2001-09-13 Thread Maxim Berlin

Hello Jimson,

Thursday, September 13, 2001, Jimson Lee [EMAIL PROTECTED] wrote:

[..]
JL Being new to perl, I know how to search for strings.  I know how to
JL explicitly search and replace a string.
you always can use variable instead of exact string.

JL   What I don't know how to do is
JL search for a string,
in array - grep, as you wrote below.
in string - match, see
perldoc -f m

JL  make that string a variable,
grep function return array of results.
my @results = grep /OAM/i, @lines;

JL  and then use that
JL variable in a search and replace statement so that I can run this script
JL at all my sites.
see
perldoc -f grep
(grep can do replace for you), or
perldoc -f s
perldoc perlop
JL Here's what I'm using to search for a string...

JL open FILE, config.cfg or die can't open config.cfg: $!;
JL my @lines = FILE;
JL print grep /OAM/i, @lines;

JL When I run this against config.cfg, it gives me the string OAM...  Can I
JL make that a variable?
yes :)

Best wishes,
 Maximmailto:[EMAIL PROTECTED]



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




Re:seek a string

2001-09-13 Thread Jorge Goncalvez

Hi, I would like to open a file and know if a string exists.
How can I do this?
Thanks


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




Re: Condolences to US readers

2001-09-13 Thread Mark Maunder

Likewise from us in London. We have been glued to the news for the last two days, 
haven't really been able to focus on anything productive. Our thoughts are with you 
during this trying
time.

--
Mark Maunder
Senior Architect
SwiftCamel Software
http://www.swiftcamel.com
mailto:[EMAIL PROTECTED]

Andy McDowell wrote:

 This is to all Americans as a nation, and to foriegners who lost loved ones on 
September 13. My heartfelt condolences go out to you, and my sincerest wish that you 
find peace soon.

 Andy

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

--
Mark Maunder
Senior Architect
SwiftCamel Software
http://www.swiftcamel.com
mailto:[EMAIL PROTECTED]



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




Re: to remove the file extension (fwd)

2001-09-13 Thread jaya kumaran


Hi,

 I found the solution... Thanks

--
opendir (DIR_NAME, .);
@fnames = readdir (DIR_NAME);
closedir(DIR_NAME);

foreach $file (@fnames)
{
 if ($file =~ /\.c$/)
  {
  $datfname=$`;
  print $datfname\n;
   stat($outfname);

 if( -e $outfname)
 {
print $outfname exists\n;
 }
else
  {
  print $outfname doesn't exists\n;
  }
}
}
-   
Thanks,
jaya  


Regards,
Jaya 


 Date: Thu, 13 Sep 2001 17:18:14 +0800
 From: jaya kumaran [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Cc: [EMAIL PROTECTED]
 Subject: to remove the file extension
 
 
 hi,
 
   In a directory there exist *.c and *.out files. Here *.out is created for every 
*.c file. I need to check whether .out is generated for all the .c file.
 How to achive this.
 
 Thanks in advance,
 Jaya
 -- 
 
 ___
 Get your free email from http://www.indiya.com
 
 
 Powered by Outblaze
 
 

-- 

___
Get your free email from http://www.indiya.com


Powered by Outblaze

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




RE: to remove the file extension

2001-09-13 Thread Bob Showalter

 -Original Message-
 From: jaya kumaran [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, September 13, 2001 5:18 AM
 To: [EMAIL PROTECTED]
 Cc: [EMAIL PROTECTED]
 Subject: to remove the file extension
 
 
 
 hi,
 
   In a directory there exist *.c and *.out files. Here *.out 
 is created for every *.c file. I need to check whether .out 
 is generated for all the .c file.
 How to achive this.

perl -e '-f $_ || print Missing $_\n for map {/^(.*)\.c$/; $1.out}
@ARGV' *.c

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




RE: line end problems - help #2

2001-09-13 Thread Schoeman, Remco

hi ron

you are dealing with the difference between dos/win and unix line endings

there are plenty of tools to be found on the net to convert
unix-text-dos-text
this should get rid of your problems

p.s. wordpad.exe should display the file correctly
 notepad.exe does not(this is the program that is run when you do 'view
source' in IE)


WKG 

Remco Schoeman

The Lodge




-Original Message-
From: Ron Woodall [mailto:[EMAIL PROTECTED]]
Sent: woensdag 12 september 2001 3:14
To: [EMAIL PROTECTED]
Subject: line end problems - help #2


Hi All:

I asked a similar question before and got no response. I guess I
didn't 
explain myself.

Here's the problem. I'm using a perl script to create an html page.
The 
editor is located on a Windows '98 machine and the file resides on a Linux 
machine. The file is edited across the network. Part of the script contains 
a heredoc that contains the head of the page. The remainder of the page is 
made up of lines added to the buffer and subsequently written to the output 
file. I've tried \r\n and \n as line ends both in the heredoc and the 
output array.

When I view the page in Netscape 4.73 (on the Windows '98 machine),
it 
displays perfectly. Viewing the source of the file and none of the 
line-ends are honoured. I take a look at the hex construction of the file 
and every line end in the *.htm file is 0D 0A. Microsoft Internet 
Explorer displays the page properly. Again, the line ends are not honoured 
when I view the source.

I'm open to any suggestions as to why and what I can do about it.

Thanks for all your help.

Ron Woodall
---
Ron Woodall
[EMAIL PROTECTED]

The Compendium of HTML Elements
your essential web publishing resource

- available at/disponible à:
http://au.htmlcompendium.org/index.htm (Australia)
http://www.htmlcompendium.org/index.htm (Europe and North America)


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




Variable interpolation in a format

2001-09-13 Thread Kim Green

Below is my format:

format FILE_TOP = 
New Customers Since  


Customer Name   Creation DateActivation Date 
.
format FILE =
@  @
@ 
$node_name,$created_date,$active_date

.


My script is accepting a date parameter, and I want to print that date in
the title. I tried that by adding $active_date to the New Customers Since
title, and the variable was not interpolated.
What's the best way to print my parameter inside of the output file?




Kim Green
Billing Systems Developer
Madison River Communications
919.563.8385
[EMAIL PROTECTED]


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




FW: Variable interpolation in a format - Disregard

2001-09-13 Thread Kim Green

never mind.

  -Original Message-
 From: Kim Green  
 Sent: Thursday, September 13, 2001 9:11 AM
 To:   '[EMAIL PROTECTED]'
 Subject:  Variable interpolation in a format
 
 Below is my format:
 
 format FILE_TOP = 
 New Customers Since  
 --
 --
 
 Customer Name   Creation DateActivation Date 
 .
 format FILE =
 @  @
 @ 
 $node_name,$created_date,  $active_date
 
 .
 
 
 My script is accepting a date parameter, and I want to print that date in
 the title. I tried that by adding $active_date to the New Customers Since
 title, and the variable was not interpolated.
 What's the best way to print my parameter inside of the output file?
 
 
 
 
 Kim Green
 Billing Systems Developer
 Madison River Communications
 919.563.8385
 [EMAIL PROTECTED]
 

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




how to write a password generator

2001-09-13 Thread Mike Singleton

What resources can I look at to start writing a password generator from a complete 
newbie level of knowledge??

===
Mike Singleton CCNA, CNE, MCSE
Network Analyst
(253) 272-1916  x1259
(253) 405-1968 (cellular)
[EMAIL PROTECTED]

DaVita Inc.



Re: how to write a password generator

2001-09-13 Thread Morbus Iff

 What resources can I look at to start writing a password generator from a
 complete newbie level of knowledge??

If you want to mimic Unix passwd, do something like:

$seed = (some randomly generated bit of something);
$plaintext_password = password;
$encrypted_password = crypt($plaintext_password, $seed);


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




RE: how to write a password generator

2001-09-13 Thread Sally

Mike,

There's a good example of a password script in Learning Perl on Win32
Systems page 17, not very pretty and a bit tedious, but easy to understand.

Regards,

Sally

-Original Message-
From: Mike Singleton [mailto:[EMAIL PROTECTED]]
Sent: 13 September 2001 14:32
To: [EMAIL PROTECTED]
Subject: how to write a password generator


What resources can I look at to start writing a password generator from a
complete newbie level of knowledge??

===
Mike Singleton CCNA, CNE, MCSE
Network Analyst
(253) 272-1916  x1259
(253) 405-1968 (cellular)
[EMAIL PROTECTED]

DaVita Inc.


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




Re: Gathering output from a program

2001-09-13 Thread Robert Citek


Hello Sofia,

What is happening is that only STDOUT is being saved in the @output array.
STDERR is still going to the console (your screen).  If on a UNIX/Linux
system, try adding 21 in front of your command like this:
  @output = `21 infoerr_parse.pl`;

The 21 redirects any output to file descriptor 2 (STDERR) to file
descriptor 1 (STDOUT).  You may also want to add $| = 1; towards the
beginning of your script so that the script automatically flushes the output.

You can also extend this concept of redirection to the example that Ronald
gave:
  At 01:24 PM 9/10/2001 -0400, Yacketta, Ronald wrote:
  open(COM, parse.pl |) || die(fork failed: \l$!\n); 
  while ( COM ) {
   blah
  }
  close COM

Simply add 21 to the front of the command:
  open(COM, 21 parse.pl |) || die(fork failed: \l$!\n); 

Does either of these methods work for what you are doing?  

Note: I get slightly different results between using backticks and the open
command.  The backticks method did not capture all output to STDERR.  

A question for those more knowledgeable than I: This is the UNIX way of
redirecting STDERR.  Is there an alternate Perl way?

Regards,
- Robert


At 10:21 AM 9/10/2001 -0700, Sofia wrote:
@output = `infoerr_parse.pl`;
print LOG @output\n;

Now, infoerr_parse.pl pings some machines and creates
the following output:
infoerr: info_get_data() timed out for node 27
infoerr: info_get_data() timed out for node 37
Message errors for node(s) 0..50
There seems to be 0 nodes propagating errors.

When I gather this output on @output array, I don't
get the lines that say ..timed out for node.. 

Does anybody know how I can gather all the output?


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




Re:File Array

2001-09-13 Thread Jorge Goncalvez

Hi, How in Perl you can store each line of a file in an array?

Thanks


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




Re:File Array

2001-09-13 Thread Robert Citek

At 05:27 PM 9/13/2001 +0200, Jorge Goncalvez wrote:
Hi, How in Perl you can store each line of a file in an array?

From section 4.1 in the Perl Cookbook
(http://www.oreilly.com/catalog/cookbook/):

@bigarray = ();
open(DATA,  mydatafile)   or die Couldn't read from datafile: $!\n;
while (DATA) {
chomp;
push(@bigarray, $_);
}

Regards,
- Robert


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




Re:File Array

2001-09-13 Thread Curtis Poe

--- Robert Citek [EMAIL PROTECTED] wrote:
 At 05:27 PM 9/13/2001 +0200, Jorge Goncalvez wrote:
 Hi, How in Perl you can store each line of a file in an array?
 
 From section 4.1 in the Perl Cookbook
 (http://www.oreilly.com/catalog/cookbook/):
 
 @bigarray = ();
 open(DATA,  mydatafile)   or die Couldn't read from datafile: $!\n;
 while (DATA) {
 chomp;
 push(@bigarray, $_);
 }
 
 Regards,
 - Robert

A couple of comments.

I would try to avoid using DATA as the filehandle as this may cause confusion with the 
__DATA__
token.  Also, if you're going to read the entire file into an array, this is faster 
and (IMHO)
easier to understand:

open INDATA,  $file or die Couldn't open $file for reading: $!;
chomp ( my @bigarray = INDATA );

Cheers,
Curtis Ovid Poe

=
Senior Programmer
Onsite! Technology (http://www.onsitetech.com/)
Ovid on http://www.perlmonks.org/

__
Terrorist Attacks on U.S. - How can you help?
Donate cash, emergency relief information
http://dailynews.yahoo.com/fc/US/Emergency_Information/

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




RE: Is there a better way to do this

2001-09-13 Thread Bradshaw, Brian

That mostly worked. I had to use a while to get the array from the DB
return. 

I wound up with this to get all the values I needed: 

while (%result = $finalSet-fetchhash())
{ 
  push @arr_DBanswers, values %result;
}

Is that good code practice? The the camel book (is it a camel) really
doesn;t help much with the array stuff.

brian

-Original Message-
From: Jason Tiller [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, September 12, 2001 9:04 PM
To: [EMAIL PROTECTED]
Subject: Re: Is there a better way to do this


Hi, Again, Brian, :)

On Wed, 12 Sep 2001, Bradshaw, Brian wrote:

 I have the code:
   $z = 0;
   foreach(@key = keys(%result))
   {
$arr_DBanswers[$z] = $result{$_};
$z=$z+1;
   }

 Is there a better way to break out the values in a hash list to a
 single array?

How about

@arr_DBanswers = values %result;

?

---Jason

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




RE: Is there a better way to do this

2001-09-13 Thread Jeff 'japhy/Marillion' Pinyan

On Sep 13, Bradshaw, Brian said:

while (%result = $finalSet-fetchhash())
{ 
  push @arr_DBanswers, values %result;
}

That code looks fine.  You might want to use 'my' on the %result hash,
since you don't need it existing later.

  while (my %result = $finalSet-fetchhash()) {
push @arr_DBanswers, values %result;
  }

(P.S. where is your McGraw-Hill office?  My dad works on 34th St. in NYC.)

-- 
Jeff japhy Pinyan  [EMAIL PROTECTED]  http://www.pobox.com/~japhy/
RPI Acacia brother #734   http://www.perlmonks.org/   http://www.cpan.org/
** Look for Regular Expressions in Perl published by Manning, in 2002 **


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




perl's system() function question.

2001-09-13 Thread Michael Burnside

Using the code below works great if STDOUT is the terminal, but when trying to pipe it 
to a file the two system() functions run first and the print() statements run second, 
illustrated below as well.  Anyone have a clue why?

--BEGIN excerpt from code--

foreach $elem (@test_list)
  {
print Test: $elem\n;
print Behavioral :\n;
system 
('/usr/bin/find',hammer/$test_dir/test/test$elem,-name,behv*.err,-print,-exec,grep,-i,$test_dir/test,{},\;);
print Gates min :\n;
system '/usr/bin/find',hammer/$test_dir/test/test$elem,-name, 
gates_min*.err,-print,-exec,grep,-i,$test_dir/test,{},\;;
print Gates max :\n;
system '/usr/bin/find',hammer/$test_dir/test/test$elem,-name, 
gates_max*.err,-print,-exec,grep,-i,$test_dir/test,{},\;;
  }

--END excerpt from code--

--BEGIN output of code when piped to a file--

hammer/sync_servo/test/test0/behv_test0_result.err
hammer/sync_servo/test/test0 PASSED
hammer/sync_servo/test/test0/gates_min_test0_result.err
hammer/sync_servo/test/test0 FAILED
hammer/sync_servo/test/test0/gates_max_test0_result.err
hammer/sync_servo/test/test0 FAILED
--
Scanning sync_servo error files...  
--
Test: 0
Behavioral :
Gates min :
Gates max :

--END output of code when piped to a file--

Regards,
Mike

Michael Burnside 
Research  Development 
Iomega Corporation 
801-332-5484 

- Support bacteria - They're the only culture some people have.



RE: Condolences to US readers

2001-09-13 Thread Paskal DRAPIER

I'm very sad of what happened. I'm not able to describe my sadness. I think
I'm not far from the truth when I write that all the french people is with
you, US nation. It's not very easy to find the good words to say how we
feel. I hope you'll find peace in your mind.

Best regards,
Paskal DRAPIER
System  Network Engineer
http://www.audientia.com/

-Original Message-
From: Mark Maunder [mailto:[EMAIL PROTECTED]]
Sent: Thursday, September 13, 2001 11:32 AM
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: Re: Condolences to US readers


Likewise from us in London. We have been glued to the news for the last two
days, haven't really been able to focus on anything productive. Our thoughts
are with you during this trying
time.

--
Mark Maunder
Senior Architect
SwiftCamel Software
http://www.swiftcamel.com
mailto:[EMAIL PROTECTED]

Andy McDowell wrote:

 This is to all Americans as a nation, and to foriegners who lost loved
ones on September 13. My heartfelt condolences go out to you, and my
sincerest wish that you find peace soon.

 Andy

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

--
Mark Maunder
Senior Architect
SwiftCamel Software
http://www.swiftcamel.com
mailto:[EMAIL PROTECTED]



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


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




RE: Condolences to US readers

2001-09-13 Thread Crandell, Daniel (TIFPC)

This is from an American, we are very thankful that we have friends and
allies like you.  Especially now!
thanks for your well wishes, I think I can speak for all Americans.  Thank
you!

-Original Message-
From: Paskal DRAPIER [mailto:[EMAIL PROTECTED]]
Sent: Thursday, September 13, 2001 11:23 AM
To: 'Mark Maunder'; [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: RE: Condolences to US readers


I'm very sad of what happened. I'm not able to describe my sadness. I think
I'm not far from the truth when I write that all the french people is with
you, US nation. It's not very easy to find the good words to say how we
feel. I hope you'll find peace in your mind.

Best regards,
Paskal DRAPIER
System  Network Engineer
http://www.audientia.com/

-Original Message-
From: Mark Maunder [mailto:[EMAIL PROTECTED]]
Sent: Thursday, September 13, 2001 11:32 AM
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: Re: Condolences to US readers


Likewise from us in London. We have been glued to the news for the last two
days, haven't really been able to focus on anything productive. Our thoughts
are with you during this trying
time.

--
Mark Maunder
Senior Architect
SwiftCamel Software
http://www.swiftcamel.com
mailto:[EMAIL PROTECTED]

Andy McDowell wrote:

 This is to all Americans as a nation, and to foriegners who lost loved
ones on September 13. My heartfelt condolences go out to you, and my
sincerest wish that you find peace soon.

 Andy

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

--
Mark Maunder
Senior Architect
SwiftCamel Software
http://www.swiftcamel.com
mailto:[EMAIL PROTECTED]



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


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

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




Re: to remove the file extension

2001-09-13 Thread _brian_d_foy

In article [EMAIL PROTECTED], [EMAIL PROTECTED] 
(Jaya Kumaran) wrote:


   In a directory there exist *.c and *.out files. Here *.out is 
   created for every *.c file. I need to check whether .out is 
   generated for all the .c file. How to achive this.


you can do something like so.  remember that glob and -e are going
to operate in the current working directory so you need to either
be in the directory of interest (perhaps with chdir()) or you
need to use the full path.

#!/usr/bin/perl

foreach( glob('*.c') )
{
my $out = $_;
$out =~ s/\.c$/.obj/;

print Object file does not exist for $_\n
unless -e $out;
}
-- 
brian d foy [EMAIL PROTECTED] - Perl services for hire
CGI Meta FAQ - http://www.perl.org/CGI_MetaFAQ.html
Troubleshooting CGI scripts - http://www.perl.org/troubleshooting_CGI.html

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




Underline

2001-09-13 Thread John Ertl

Hi

I am useing a foremat to print information but I would like to
underline
some of the information.  I have not found a way to do this, does anyone
know how?

Thanks


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




Re:File Array

2001-09-13 Thread Robert Citek


Hello Curtis,

At 09:12 AM 9/13/2001 -0700, Curtis Poe wrote:
I would try to avoid using DATA as the filehandle as this 
may cause confusion with the __DATA__ token.  

Excellent stylistic point.

Also, if you're going to read the entire file into an array, this 
is faster and (IMHO) easier to understand:

open INDATA,  $file or die Couldn't open $file for reading: $!;
chomp ( my @bigarray = INDATA );

True.  I wanted to give a good reference, the Cookbook, which explains
manipulating arrays and a lot of other things.

Regards,
- Robert


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




Sending a user id and password

2001-09-13 Thread Buffy Press

Hello,

I am very new to Perl and I have a question for the list.

I have a script that collects URL's from a web site.   This web site
requires a name and password to access it.  When I run the script using
Perl -w I get this message:

HTTP: Access authorization required.
   Use the -auth=id:pw parameter.

I have looked in my Programming Perl book and other online Perl
resources and I cannot find any information on -auth.

Does anyone know the syntax of the above command or is there a better
way to send a user id and password to the host?

Thanks.
-- 
Buffy Payne Press 
mailto:[EMAIL PROTECTED]
http://www.mfm.com

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




Weekly list FAQ posting

2001-09-13 Thread casey

NAME
beginners-faq - FAQ for the beginners mailing list

1 -  Administriva
  1.1 - I'm not subscribed - how do I subscribe?

Send mail to [EMAIL PROTECTED]

You can also specify your subscription email address by sending email to
(assuming [EMAIL PROTECTED] is your email address):

[EMAIL PROTECTED].

  1.2 -  How do I unsubscribe?

Now, why would you want to do that? Send mail to
[EMAIL PROTECTED], and wait for a response. Once you
reply to the response, you'll be unsubscribed. If that doesn't work,
find the email address which you are subscribed from and send an email
like the following (let's assume your email is [EMAIL PROTECTED]):

[EMAIL PROTECTED]

  1.3 - There is too much traffic on this list. Is there a digest?

Yes. To subscribe to the digest version of this list send an email to:

[EMAIL PROTECTED]

To unsubscribe from the digest, send an email to:

[EMAIL PROTECTED]

This is a high traffic list (100+ messages per day), so please subscribe
in the way which is best for you.

  1.4 - Is there an archive on the web?

Yes, there is. It is located at:

http://archive.develooper.com/beginners%40perl.org/

  1.5 - How can I get this FAQ?

This document will be emailed to the list once a week, and will be
available online in the archives, and at http://learn.perl.org/

  1.6 - I don't see something in the FAQ, how can I make a suggestion?

Send an email to [EMAIL PROTECTED] with your suggestion.

  1.7 - Is there a supporting website for this list?

Yes, there is. It is located at:

http://beginners.perl.org/

  1.8 - Who owns this list?  Who do I complain to?

Casey West owns the beginners list. You can contact him at
[EMAIL PROTECTED]

  1.9 - Who currently maintains the FAQ?

Kevin Meltzer, who can be reached at the email address (for FAQ
suggestions only) in question 1.6

  1.10 - Who will maintain peace and flow on the list?

Casey West, Kevin Meltzer and Ask Bjoern Hansen currently carry large,
yet padded, clue-sticks to maintain peace and order on the list. If you
are privately emailed by one of these folks for flaming, being
off-topic, etc... please listen to what they say. If you see a message
sent to the list by one of these people saying that a thread is closed,
do not continue to post to the list on that thread! If you do, you will
not only meet face to face with a XQJ-37 nuclear powered pansexual
roto-plooker, but you may also be taken off of the list. These people
simply want to make sure the list stays topical, and above-all, useful
to Perl beginners.

  1.11 - When was this FAQ last updated?

Sept 07, 2001

2 -  Questions about the 'beginners' list.
  2.1 - What is the list for?

A list for beginning Perl programmers to ask questions in a friendly
atmosphere.

  2.2 - What is this list _not_ for?

* SPAM
* Homework
* Solicitation
* Things that aren't Perl related
* Monkeys
* Monkeys solicitating homework on non-Perl related SPAM.
  2.3 - Are there any rules?

Yes. As with most communities, there are rules. Not many, and ones that
shouldn't need to be mentioned, but they are.

* Be nice
* No flaming
* Have fun
  2.4 - What topics are allowed on this list?

Basically, if it has to do with Perl, then it is allowed. You can ask
CGI, networking, syntax, style, etc... types of questions. If your
question has nothing at all to do with Perl, it will likely be ignored.
If it has anything to do with Perl, it will likely be answered.

  2.5 - I want to help, what should I do?

Subscribe to the list! If you see a question which you can give an
idiomatic and Good answer to, answer away! If you do not know the
answer, wait for someone to answer, and learn a little.

  2.6 - Is there anything I should keep in mind while answering?

We don't want to see 'RTFM'. That isn't very helpful. Instead, guide the
beginner to the place in the FM they should R :)

Please do not quote the documentation unless you have something to add
to it. It is better to direct someone to the documentation so they
hopefully will read documentation above and beyond that which answers
their question. It also helps teach them how to use the documentation.

  2.7 - I don't want to post a question if it is in an FAQ. Where should I
look first?

Look in the FAQ! Get acquainted with the 'perldoc' utility, and use it.
It can save everyone time if you look in the Perl FAQs first, instead of
having a list of people refer you to the Perl FAQs :) You can learn
about 'perldoc' by typing:

`perldoc perldoc'

At your command prompt. You can also view documentation online at:

http://www.perldoc.com and http://www.perl.com

  2.8 Is this a high traffic list?

YES! You have been warned! If you don't want to get ~100 emails per day
from this list, 

Re: perl's system() function question.

2001-09-13 Thread Robert Citek


Hello Michael,

I tried to duplicate your error, but was unable to.  This is my test script
which is modelled on your origninal script:

#!/usr/bin/perl -w
use strict;
foreach my $foo qw(a b) {
  print $foo\n;
  system (echo hi $foo);
  print hello $foo\n;
  print \n;
}

Regardless of whether I redirect to a file or terminal, I get the same output:

a
hi a
hello a

b
hi b
hello b


If you run this test script, what results do you get?

Regards,
- Robert

At 08:23 AM 9/13/2001 -0600, Michael Burnside wrote:
Using the code below works great if STDOUT is the terminal, but 
when trying to pipe it to a file the two system() functions run 
first and the print() statements run second, illustrated below as well.  
Anyone have a clue why?


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




Re: Set locales independent of OS-System

2001-09-13 Thread Michael Fowler

On Thu, Sep 13, 2001 at 02:00:56AM +0200, Andrea Holstein wrote:
 I write modules for the german language.
 At the moment, I simply tell perl at the beginning
 use locale;
 
 That run's because my Linux is a german one.
 At a french one i would'nt run any longer.
 
 A better way could be (from the Cookbook)
 use locale;
 use POSIX 'locale_h';
 setlocale(LC_TYPE, 'de_DE.ISO_8859-1');

As far as I understand it you shouldn't be setting the locale within your
script.  Instead, you should set the relevant environment variables.  See
perldoc perllocale.

 
Michael
--
Administrator  www.shoebox.net
Programmer, System Administrator   www.gallanttech.com
--

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




Re: perl's system() function question.

2001-09-13 Thread Michael Fowler

On Thu, Sep 13, 2001 at 08:23:10AM -0600, Michael Burnside wrote:
 Using the code below works great if STDOUT is the terminal, but when
 trying to pipe it to a file the two system() functions run first and the
 print() statements run second, illustrated below as well.  Anyone have a
 clue why?

You appear to be suffering from buffering.  See
http://perl.plover.com/FAQs/Buffering.html.  It's not that the print
statements run second, it's that the printed data is buffered and only
output when the buffer is full, or the program exits.  The difference
between STDOUT and a file is that STDOUT is a terminal, and thus line
buffered, whereas a file is simply block buffered.  The moral of the story
is, you need to flush output between prints, either manually with
IO::Handle's flush() method, or automatically, by setting $| to a true
value.


Michael
--
Administrator  www.shoebox.net
Programmer, System Administrator   www.gallanttech.com
--

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




RE: File Array

2001-09-13 Thread Kipp, James

@array = FILE;

 -Original Message-
 From: Jorge Goncalvez [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, September 13, 2001 11:28 AM
 To: [EMAIL PROTECTED]
 Subject: Re:File  Array
 
 
 Hi, How in Perl you can store each line of a file in an array?
 
 Thanks
 
 
 -- 
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 


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




Re: Underline

2001-09-13 Thread randy Peterman

I know everything.
OK, not really, in fact I don't even know what format you are putting the
document in.  If you can tell us what format you are putting it in, someone
may be able to help you. if its HTML you would surround the text with
utext/u to get underlined text.  Give us some details.

Randy Peterman


John Ertl [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Hi

 I am useing a foremat to print information but I would like to
 underline
 some of the information.  I have not found a way to do this, does anyone
 know how?

 Thanks




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




Re: Sending a user id and password

2001-09-13 Thread Michael Fowler

On Thu, Sep 13, 2001 at 10:10:01AM -0700, Buffy Press wrote:
 HTTP: Access authorization required.
Use the -auth=id:pw parameter.
 
 I have looked in my Programming Perl book and other online Perl
 resources and I cannot find any information on -auth.

That error message must have been output by whatever you're using to
retrieve the web pages.  What is it you're using?  Have you read the
documentation for it?
 

Michael
--
Administrator  www.shoebox.net
Programmer, System Administrator   www.gallanttech.com
--

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




Re: Search and replace using a variable

2001-09-13 Thread Jimson Lee

Thanks!

Maxim Berlin wrote:

 Hello Jimson,

 Thursday, September 13, 2001, Jimson Lee [EMAIL PROTECTED] wrote:

 [..]
 JL Being new to perl, I know how to search for strings.  I know how to
 JL explicitly search and replace a string.
 you always can use variable instead of exact string.

 JL   What I don't know how to do is
 JL search for a string,
 in array - grep, as you wrote below.
 in string - match, see
 perldoc -f m

 JL  make that string a variable,
 grep function return array of results.
 my @results = grep /OAM/i, @lines;

 JL  and then use that
 JL variable in a search and replace statement so that I can run this script
 JL at all my sites.
 see
 perldoc -f grep
 (grep can do replace for you), or
 perldoc -f s
 perldoc perlop
 JL Here's what I'm using to search for a string...

 JL open FILE, config.cfg or die can't open config.cfg: $!;
 JL my @lines = FILE;
 JL print grep /OAM/i, @lines;

 JL When I run this against config.cfg, it gives me the string OAM...  Can I
 JL make that a variable?
 yes :)

 Best wishes,
  Maximmailto:[EMAIL PROTECTED]


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




Re: Condolences to US readers

2001-09-13 Thread Francis Henry

Yes, thanks all of you very much.  I'm in New York City and my present and
former companies have suffered mind-numbing loss.  Please keep the victims and
their families in your thoughts.  It means a great deal to us.

There was a chaplain for the NYC Fire Department killed at the World Trade
Center named Mychal Clark.  One of his favorite sayings, according to friends,
was-

'You want to make God laugh?  Tell him what you're doing tomorrow.'

Thanks again to all of you, from Iran to France to the Netherlands.

Crandell, Daniel (TIFPC) wrote:

 This is from an American, we are very thankful that we have friends and
 allies like you.  Especially now!
 thanks for your well wishes, I think I can speak for all Americans.  Thank
 you!

 -Original Message-
 From: Paskal DRAPIER [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, September 13, 2001 11:23 AM
 To: 'Mark Maunder'; [EMAIL PROTECTED]
 Cc: [EMAIL PROTECTED]
 Subject: RE: Condolences to US readers

 I'm very sad of what happened. I'm not able to describe my sadness. I think
 I'm not far from the truth when I write that all the french people is with
 you, US nation. It's not very easy to find the good words to say how we
 feel. I hope you'll find peace in your mind.

 Best regards,
 Paskal DRAPIER
 System  Network Engineer
 http://www.audientia.com/

 -Original Message-
 From: Mark Maunder [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, September 13, 2001 11:32 AM
 To: [EMAIL PROTECTED]
 Cc: [EMAIL PROTECTED]
 Subject: Re: Condolences to US readers

 Likewise from us in London. We have been glued to the news for the last two
 days, haven't really been able to focus on anything productive. Our thoughts
 are with you during this trying
 time.

 --
 Mark Maunder
 Senior Architect
 SwiftCamel Software
 http://www.swiftcamel.com
 mailto:[EMAIL PROTECTED]

 Andy McDowell wrote:

  This is to all Americans as a nation, and to foriegners who lost loved
 ones on September 13. My heartfelt condolences go out to you, and my
 sincerest wish that you find peace soon.
 
  Andy
 
  --
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]

 --
 Mark Maunder
 Senior Architect
 SwiftCamel Software
 http://www.swiftcamel.com
 mailto:[EMAIL PROTECTED]

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

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

 --
 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: Sending a user id and password

2001-09-13 Thread Curtis Poe

--- Buffy Press [EMAIL PROTECTED] wrote:
 Hello,
 
 I am very new to Perl and I have a question for the list.
 
 I have a script that collects URL's from a web site.   This web site
 requires a name and password to access it.  When I run the script using
 Perl -w I get this message:
 
 HTTP: Access authorization required.
Use the -auth=id:pw parameter.
 
 I have looked in my Programming Perl book and other online Perl
 resources and I cannot find any information on -auth.
 
 Does anyone know the syntax of the above command or is there a better
 way to send a user id and password to the host?
 
 Thanks.
 -- 
 Buffy Payne Press 
 mailto:[EMAIL PROTECTED]
 http://www.mfm.com

Buffy,

It's not terribly well-known, but there is an alternative method of using Basic 
Authentication. 
Let's say your username is Ovid and your password is Naso and the URL that you 
need to send
your authentication information to is http://www.someserver.com/cgi-bin/ascript.cgi.  
You should
be able to authenticate with the following syntax:

http://Ovid:[EMAIL PROTECTED]/cgi-bin/ascript.cgi

Essentially, you add your URI escaped username and password, separated by a colon and 
followed by
an at '@' sign, immediately after the protocol.

It should also be noted that Basic Authentication, by itself, is terribly insecure.  
It encodes
your credentials with Base64 encoding, which is a one-for-one character substitution.  
This is why
it is often said that Basic Authentication sends this information as plain text.  
Hopefully, the
actual site that you want to authenticate to uses https.

Cheers,
Curtis Ovid Poe

=
Senior Programmer
Onsite! Technology (http://www.onsitetech.com/)
Ovid on http://www.perlmonks.org/

__
Terrorist Attacks on U.S. - How can you help?
Donate cash, emergency relief information
http://dailynews.yahoo.com/fc/US/Emergency_Information/

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




Math::BigInt

2001-09-13 Thread Richard J. Barbalace

Hi.

I'm trying to perform the following calculation:
$value = ($float + $integer) * 10;
$string = $value:test;

Here, I know $float has a resolution of millionths.  That is, $float
multiplied by 1,000,000 should be an integer.  However, $float is very
large, and multiplying by 1,000,000 causes it to exceed perl's integer
range.  Thus I would like to use Math::BigInt, but I am having trouble
getting it to work with the floating point value.

For example, if $value is 1234567890123456.123456, and $integer is
1, then I want the final resulting string $string to be
1234567890123457123456:test.

When I tried using BigInt with floating point numbers like $float, I
end up with NaN and then get errors like:
Can't locate object method badd via package NaN...

Any ideas on how to do this conversion simply?  Thanks.

+ Richard J. Barbalace
  [EMAIL PROTECTED]



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




RE: Math::BigInt

2001-09-13 Thread Gibbs Tanton - tgibbs

 You might want to try Math::BigFloat instead.

-Original Message-
From: Richard J. Barbalace
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: 9/13/2001 2:17 PM
Subject: Math::BigInt

Hi.

I'm trying to perform the following calculation:
$value = ($float + $integer) * 10;
$string = $value:test;

Here, I know $float has a resolution of millionths.  That is, $float
multiplied by 1,000,000 should be an integer.  However, $float is very
large, and multiplying by 1,000,000 causes it to exceed perl's integer
range.  Thus I would like to use Math::BigInt, but I am having trouble
getting it to work with the floating point value.

For example, if $value is 1234567890123456.123456, and $integer is
1, then I want the final resulting string $string to be
1234567890123457123456:test.

When I tried using BigInt with floating point numbers like $float, I
end up with NaN and then get errors like:
Can't locate object method badd via package NaN...

Any ideas on how to do this conversion simply?  Thanks.

+ Richard J. Barbalace
  [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]




Installing Module

2001-09-13 Thread Najamuddin, Junaid

Hi,
I am using win NT
Trying to install Perl module Config::Inifiles
I followed every instruction posted on cpan but unable to do it correctly
since my script is erroring out
can someone please help me with detailed instructions
thanks
junaid

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




Re: line end problems - help #2

2001-09-13 Thread Ron Woodall

Hi All:

Curtis Ovid Poe wrote:

Just had this problem.  To solve:

 cat -vE somescript.pl

 Remember in all of this that it is not the script that is giving 
me problems, it is the output of the script in two ways, a heredoc written 
to an array and a scalar written to an array. I'm taking an *.htm file 
created on the Windows box and completely reformatting it on the Linux box 
and creating a new file with new and old information.

 I ran this (cat ...) on the perl script and all of the line ends 
are $. (pardon the bad grammar) However, when I ran it on the output of 
the perl script, (Aaddress.htm for example) it's another story. Those lines 
created by the heredoc show no line ends. The lines created by the Linux 
scripts (scalars with \r\n line ends) show $. Lines copied from the 
original file show line ends as ^M$.

 In the script itself I'm using \r\n as the line end for the 
scalar variables that are then written to the array. The heredoc is another 
matter. Here's the heredoc syntax I'm using:

 @outbuffer = split /\n/, head;
 html$
 head$

 Is it possible that split /\n/, is throwing away the line ends?

Maxim wrote:

1. change your editor. i prefer me (www.multiedit.com), correctly handles
many problems, but, i'm afraid, not a beginners tool.

 I'm trying to move all my production editing over to the Linux 
box. I'm stuck at a multiple monitor support issue at the moment but when 
that is solved I'll be making the move. That precludes spending bucks on 
yet another Windows application.

2. you can use
perl -p -i -e 's/\r//g' filename# dos-unix
perl -p -i -e 's/\n/\r\n/g' filename# unix-dos
on your linux.

 I've used \r\n with no effect.

3. you can setup X server on your windows computer, and run linux
editor's (emacs, nvi, ... ) from linux. this is a long song, but i
can sing, if anyone is interested :)

 I was running Xfree86 but blew it up while trying to implement 
multi-head operations. No more time to fix it. I've got to live with the 
current situation for a while yet.

 I'm sorry that I'm not explaining this very well but I am learning 
from all of this. Thanks for all your help.

 Ron Woodall

---
Ron Woodall
[EMAIL PROTECTED]

The Compendium of HTML Elements
your essential web publishing resource

- available at/disponible à:
http://au.htmlcompendium.org/index.htm (Australia)
http://www.htmlcompendium.org/index.htm (Europe and North America)


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




Re: Underline

2001-09-13 Thread brian d foy

In article [EMAIL PROTECTED], [EMAIL PROTECTED] (John Ertl) 
wrote:

 I am useing a foremat to print information but I would like to
 underline
 some of the information. 

there is nothing in Perl formats that underlines text.  if you
need such a thing you'll need to use some sort of typesetting
or markup language.

-- 
brian d foy [EMAIL PROTECTED] - Perl services for hire
CGI Meta FAQ - http://www.perl.org/CGI_MetaFAQ.html
Troubleshooting CGI scripts - http://www.perl.org/troubleshooting_CGI.html


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




Re: Sending a user id and password

2001-09-13 Thread _brian_d_foy

In article [EMAIL PROTECTED], 
[EMAIL PROTECTED] wrote:

 It's not terribly well-known, but there is an alternative method of 
 using Basic Authentication. 
  

 You should be able to authenticate with the following syntax:

 http://Ovid:[EMAIL PROTECTED]/cgi-bin/ascript.cgi

this isn't any more secure.  the password information is still sent
in the clear.

if you need to protect this stuff, use SSL. :)
-- 
brian d foy [EMAIL PROTECTED] - Perl services for hire
CGI Meta FAQ - http://www.perl.org/CGI_MetaFAQ.html
Troubleshooting CGI scripts - http://www.perl.org/troubleshooting_CGI.html

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




Re: Sending a user id and password

2001-09-13 Thread Curtis Poe


--- _brian_d_foy [EMAIL PROTECTED] wrote:
 In article [EMAIL PROTECTED], 
 [EMAIL PROTECTED] wrote:
 
  It's not terribly well-known, but there is an alternative method of 
  using Basic Authentication. 
   
 
  You should be able to authenticate with the following syntax:
 
  http://Ovid:[EMAIL PROTECTED]/cgi-bin/ascript.cgi
 
 this isn't any more secure.  the password information is still sent
 in the clear.
 
 if you need to protect this stuff, use SSL. :)

Oops!  I hope I didn't imply that this was more secure.  Like most http transactions, 
it's
intercept this data.

Cheers,
Curtis Ovid Poe

=
Senior Programmer
Onsite! Technology (http://www.onsitetech.com/)
Ovid on http://www.perlmonks.org/

__
Terrorist Attacks on U.S. - How can you help?
Donate cash, emergency relief information
http://dailynews.yahoo.com/fc/US/Emergency_Information/

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




Re: Re:seek a string

2001-09-13 Thread Nestor Dutko

How about:

my $cmd='grep string file';
unless (defined $cmd) {
 die string not found;
}

 Original Message ---
From: Jorge Goncalvez [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Cc: 
Subject: Re:seek a string

Hi, I would like to open a file and know if a string exists.
How can I do this?
Thanks


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





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




RE: to remove the file extension

2001-09-13 Thread Jason Tiller

Hi, Bob, :)

This is so great!

On Thu, 13 Sep 2001, Bob Showalter wrote:
  -Original Message-

In a directory there exist *.c and *.out files. Here *.out is
  created for every *.c file. I need to check whether .out is
  generated for all the .c file.  How to achive this.

 perl -e '-f $_ || print Missing $_\n for map {/^(.*)\.c$/; $1.out}
 @ARGV' *.c

Cool!  I had never heard of the 'map' function before (sounds
stdlib'ish).  New (to me) stuff!  Guess that's why I'm on the
beginners list. :)

After I read the perlfunc page on 'map', I discovered you could
rewrite the above even more minimally:

perl -e 'map { /^(.*)\.c$/; -f $1.out || print Missing $1.out\n; } @ARGV;' *.c

Man, perl has so many different ways to say the same thing...

Thanks!

---Jason


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




Re: Re:seek a string

2001-09-13 Thread Curtis Poe

  Original Message ---
 From: Jorge Goncalvez [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Cc: 
 Subject: Re:seek a string
 
 Hi, I would like to open a file and know if a string exists.
 How can I do this?
 Thanks
--- Nestor Dutko [EMAIL PROTECTED] wrote:
 How about:
 
 my $cmd='grep string file';
 unless (defined $cmd) {
  die string not found;
 }
 

There are a few problems with that.

1.  It requires backticks, not single quotes.  Of course, perhaps that is simply a bit 
of munging
done by an email client somewhere.

2.  It's not cross-platform compatible.  What if Jorge Goncalvez is using Windows?

3.  It could be horrible insecure, depending upon how the string and filename is 
passed to the
command.

If string your looking for is broken over lines or the string you're trying to match 
has an
embedded newline, the solution that I put forward is not going to work:

my $string = quotemeta **test**;
my $line = 0;
open INFILE,  $infile or die Cannot open $infile for reading: $!;
while(INFILE) {
$line = $., last if /$string/;
}
close INFILE;

If the string **test** (without the quotes) is in the file you're reading, then 
$line will be
set to the first line number the string is on.  Otherwise, $line will be zero.

This may not meet your exact needs, but it should give you an idea of where to start.

Note that $. is the current input line number of the last file read.

Cheers,
Curtis Ovid Poe

=
Senior Programmer
Onsite! Technology (http://www.onsitetech.com/)
Ovid on http://www.perlmonks.org/

__
Terrorist Attacks on U.S. - How can you help?
Donate cash, emergency relief information
http://dailynews.yahoo.com/fc/US/Emergency_Information/

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




Re: to remove the file extension

2001-09-13 Thread Jason Tiller

Hi, Randall! :)

(BTW, great book. :-D  In case you hadn't been told enough!)

On 13 Sep 2001 [EMAIL PROTECTED] wrote:

  Bob == Bob Showalter [EMAIL PROTECTED] writes:

 Bob perl -e '-f $_ || print Missing $_\n for map {/^(.*)\.c$/; $1.out}
 Bob @ARGV' *.c

 No.  You've used $1 without verifying the match matched (in which
 case it would get the PREVIOUS match).  For example, I can touch
 foo\nbar.c and run your script, and you'll get the wrong answer.

What's wrong with this?  Note that he's passing the *.c glob, so you'd
expect to only find .c files in @ARGV, right?  And if there're no *.c
files in the current directory, then the script just prints nothing.
Isn't that the correct behavior?

 IMPORTANT RULE - Never ever ever use $1 except in a conditional
 context!!!

That makes sense if you don't feel completely confident about your
inputs... but all the time?

---Jason


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




substitution

2001-09-13 Thread thad

given this:

$sampletext = the quick brown fox jumps over the lazy dog.
flhdsAFLhaDFLhsldhgflshdvglhsdghsfdgsldfhgsd.

ldfhlsadhfajshdkjgshdkjhdskjgvhsfdkjvgkjsvgd
sldhgfsd;kqsjflhdvfljhdsahjdsf.

lasdFHcalkjsdhfljaHDvgf;lsahdsA
;lsdjflkdsavgl;sadhglskjhdvglhs;

notice that the sample text is a paragraph (of course
it is tokenized by \n in java)

my problem is how i can i make the above sample
in this form using perl: Can anyone in the group help me with the
correct substitution using regular expression to come up with a format
like below.

paragraph
the quick brown fox jumps over the lazy dog.
flhdsAFLhaDFLhsldhgflshdvglhsdghsfdgsldfhgsd.
/paragraph

paragraph
ldfhlsadhfajshdkjgshdkjhdskjgvhsfdkjvgkjsvgd
sldhgfsd;kqsjflhdvfljhdsahjdsf.
/paragraph

paragraph
lasdFHcalkjsdhfljaHDvgf;lsahdsA
;lsdjflkdsavgl;sadhglskjhdvglhs
/paragraph

tia.

-- 

+ Thad Lozada  +
+ [EMAIL PROTECTED]  +
+ [EMAIL PROTECTED]  +
+ =+
+ Nobody knows what's going to happen to everybody+
+  except the forlorn rag of growing old.-Jack Kerouac+



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




How to change the @INC contain

2001-09-13 Thread seng-keen . lau

Hi all
 
Can somebody help me how to manually change the @INC contain ?
What is the command line to change the @INC Contain ?
 
Thanks
 
Regards
SK


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




Re: substitution

2001-09-13 Thread Curtis Poe

--- thad [EMAIL PROTECTED] wrote:
 given this:
 
 $sampletext = the quick brown fox jumps over the lazy dog.
 flhdsAFLhaDFLhsldhgflshdvglhsdghsfdgsldfhgsd.
 
 ldfhlsadhfajshdkjgshdkjhdskjgvhsfdkjvgkjsvgd
 sldhgfsd;kqsjflhdvfljhdsahjdsf.
 
 lasdFHcalkjsdhfljaHDvgf;lsahdsA
 ;lsdjflkdsavgl;sadhglskjhdvglhs;
 
 notice that the sample text is a paragraph (of course
 it is tokenized by \n in java)
 
 my problem is how i can i make the above sample
 in this form using perl: Can anyone in the group help me with the
 correct substitution using regular expression to come up with a format
 like below.
 
 paragraph
 the quick brown fox jumps over the lazy dog.
 flhdsAFLhaDFLhsldhgflshdvglhsdghsfdgsldfhgsd.
 /paragraph
 
 paragraph
 ldfhlsadhfajshdkjgshdkjhdskjgvhsfdkjvgkjsvgd
 sldhgfsd;kqsjflhdvfljhdsahjdsf.
 /paragraph
 
 paragraph
 lasdFHcalkjsdhfljaHDvgf;lsahdsA
 ;lsdjflkdsavgl;sadhglskjhdvglhs
 /paragraph
 
 tia.

Notice that in your original text, you have two newlines separating each section.  I 
would use
split to stuff the elements in an array and then loop over the elements and add the 
tags that you
need:

my @data = split /\n\n/, $sampletext;

foreach ( @data ) {
print paragraph\n$_\n/paragraph\n\n;
}

To do this with a regular expression would be less efficient and, in my opinion, less 
clear:

$sampletext =~ s{\n\n}
{\nparagraph\n\n/paragraph\n}g;

print paragraph\n$sampletext\n/paragraph;

Cheers,
Curtis Ovid Poe

=
Senior Programmer
Onsite! Technology (http://www.onsitetech.com/)
Ovid on http://www.perlmonks.org/

__
Terrorist Attacks on U.S. - How can you help?
Donate cash, emergency relief information
http://dailynews.yahoo.com/fc/US/Emergency_Information/

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




Re: IO::Socket

2001-09-13 Thread Newton, Philip

Veeraraju_Mareddi wrote:
 Dear List,

Which list? You sent this to two lists, as far as I can tell. In Usenet,
that would be the equivalent of crossposting, and then I consider it good
etiquette to set a Followup-To header directing answers to one group only.
Setting a Reply-To header here might have been appropriate as well, or only
selecting one list in the first place.

 Please update me any links towards creating  SCOKETs, Communicatin on
 sockets and Communication between processes using Socket communication

Update? What have you got at the moment?

At any rate, I suggest `perldoc perlipc` and the Perl Cookbook, which has
several examples on sockets.

 my script need to contact a process which is on remote machine.

Did you write the remote process yourself, or is it already there and you
have to interact with it? If the latter, consult its documentation, since
you'll have to play by its rules. If we say that method X is great for
inter-process communication is great, but the remote process doesn't support
method X, it's not going to be very helpful.

 Any documentation with Examples are Quite helpful..

See the Perl Cookbook, then.

Cheers,
Philip
-- 
Philip Newton [EMAIL PROTECTED]
All opinions are my own, not my employer's.
If you're not part of the solution, you're part of the precipitate.

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




Remote process

2001-09-13 Thread Veeraraju_Mareddi

Dear List   

How do we execute some script on  REMOTE machine. That means I wanna create
a process on a remote machine which is my perl script. Is there any module
written for this purpose. Can we do it with Win32::AdminMIsc

your help and suggestion would be highly appriciated 

With Regards
Rajuveera


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




IO::Socket

2001-09-13 Thread Veeraraju_Mareddi

Dear List,

Please update me any links towards creating  SCOKETs, Communicatin on
sockets and Communication between processes using Socket communication

my script need to contact a process which is on remote machine.

Please give me some URLs or IDEAS regarding this.

Any documentation with Examples are Quite helpful..


Thanking you ,,

With Regards
Raju
___
Perl-Win32-Admin mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-admin



RE: Remote process

2001-09-13 Thread DePriest, Jason R.
Title: RE: Remote process





I currently use an ugly practice...
I create a batch file locally, upload it to the remote system using robocopy (from the NT Resource Kit), then use psexec (from sysinternals) to force it to run on the other system.

This isn't pleasant, but it works.


-Jason


-Original Message-
From: Veeraraju_Mareddi [mailto:[EMAIL PROTECTED]]
Sent: Thursday, September 13, 2001 1:34 AM
To: '[EMAIL PROTECTED]'
Cc: '[EMAIL PROTECTED]'
Subject: Remote process



Dear List 


How do we execute some script on REMOTE machine. That means I wanna create
a process on a remote machine which is my perl script. Is there any module
written for this purpose. Can we do it with Win32::AdminMIsc


your help and suggestion would be highly appriciated 


With Regards
Rajuveera


___
Perl-Win32-Admin mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-admin





RE: Password Generators

2001-09-13 Thread Cornish, Merrill

At one time (I no longer work there) Texas Instruments, used a password
generator.  Their take on the unrememberable problem was to generate a dozen
or more, then ask you to pick one.

Merrill


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