RE: Running Perl programs on a machine that does not have Perl installed

2003-06-24 Thread NYIMI Jose (BMB)
Check out ActiveState's PerlApp that comes with their Perl Dev Kit.
It does a very good job of packaging your Perl scripts in a compressed 
executable that will extract and then run the script without Perl having to be
installed on the target machine.

There is also a product called perl2exe which is similar.

José.

-Original Message-
From: Asif Iqbal [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, June 24, 2003 7:04 AM
To: Dave Mamanakis
Cc: [EMAIL PROTECTED]
Subject: Re: Running Perl programs on a machine that does not have Perl installed


I think there is something called perl2exe . Try googling it.

On Mon, 23 Jun 2003, Dave Mamanakis wrote:

 I have a perl program that I need to be able to run on all kinds of 
 machines. However, I cannot install perl on each of these machines. It 
 has to be run locally, not over a network (too many issues with 
 security) How can this be done? I know with several other languages, 
 you can make an EXE or copy 4-6 files to that machine and have your 
 program run.  How does Perl deal with this?

 I am currently using the latest build of Active Perl...

 Thanks for the help.

 --DM




-- 
Asif Iqbal http://pgpkeys.mit.edu:11371/pks/lookup?op=getsearch=0x8B686E08
There's no place like 127.0.0.1


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



 DISCLAIMER 

This e-mail and any attachment thereto may contain information which is confidential 
and/or protected by intellectual property rights and are intended for the sole use of 
the recipient(s) named above. 
Any use of the information contained herein (including, but not limited to, total or 
partial reproduction, communication or distribution in any form) by other persons than 
the designated recipient(s) is prohibited. 
If you have received this e-mail in error, please notify the sender either by 
telephone or by e-mail and delete the material from any computer.

Thank you for your cooperation.

For further information about Proximus mobile phone services please see our website at 
http://www.proximus.be or refer to any Proximus agent.


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



Perl Best Practices

2003-06-24 Thread NYIMI Jose (BMB)
Hello,

I'm looking for a link where i can find information about Perl's best practices 
programming.

Thanks in advance.

===
José Nyimi Mbambi
IT Analyst
http://www.proximus.be




 DISCLAIMER 

This e-mail and any attachment thereto may contain information which is confidential 
and/or protected by intellectual property rights and are intended for the sole use of 
the recipient(s) named above. 
Any use of the information contained herein (including, but not limited to, total or 
partial reproduction, communication or distribution in any form) by other persons than 
the designated recipient(s) is prohibited. 
If you have received this e-mail in error, please notify the sender either by 
telephone or by e-mail and delete the material from any computer.

Thank you for your cooperation.

For further information about Proximus mobile phone services please see our website at 
http://www.proximus.be or refer to any Proximus agent.



RE: Perl Best Practices

2003-06-24 Thread NYIMI Jose (BMB)
Here are some best practices i know:
1. use warnings or -w 
2. use strict;

Could you extends the list please ?

José. 

-Original Message-
From: NYIMI Jose (BMB) 
Sent: Tuesday, June 24, 2003 8:58 AM
To: [EMAIL PROTECTED]
Subject: Perl Best Practices


Hello,

I'm looking for a link where i can find information about Perl's best practices 
programming.

Thanks in advance.

===
José Nyimi Mbambi
IT Analyst
http://www.proximus.be




 DISCLAIMER 

This e-mail and any attachment thereto may contain information which is confidential 
and/or protected by intellectual property rights and are intended for the sole use of 
the recipient(s) named above. 
Any use of the information contained herein (including, but not limited to, total or 
partial reproduction, communication or distribution in any form) by other persons than 
the designated recipient(s) is prohibited. 
If you have received this e-mail in error, please notify the sender either by 
telephone or by e-mail and delete the material from any computer.

Thank you for your cooperation.

For further information about Proximus mobile phone services please see our website at 
http://www.proximus.be or refer to any Proximus agent.


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



Re: Perl Best Practices

2003-06-24 Thread Steve Grazzini
On Tue, Jun 24, 2003 at 09:17:10AM +0200, NYIMI Jose (BMB) wrote:
 Here are some best practices i know:
 1. use warnings or -w 
 2. use strict;
 
 Could you extends the list please ?

Those are probably the most important. :-)

And from the making-best-use-of-available-resources dept:

  3. use perldoc
  4. use CPAN

-- 
Steve

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



Calculating Disk Space and Freespace on Windows

2003-06-24 Thread Denham Eva
Hello,

I'd appreciate any suggestions on how to calculate Disk space and Free
Space.

Many Thanks
Denham Eva
Oracle DBA
Linux like TeePee... No Windows, No Gates and Apache inside!


_
This e-mail message has been scanned for Viruses and Content and cleared 
by MailMarshal

For more information please visit www.marshalsoftware.com
_

#
Note:
This message is for the named person's use only.  It may contain confidential,
proprietary or legally privileged information.  No confidentiality or privilege
is waived or lost by any mistransmission.  If you receive this message in error,
please immediately delete it and all copies of it from your system, destroy any
hard copies of it and notify the sender.  You must not, directly or indirectly,
use, disclose, distribute, print, or copy any part of this message if you are not
the intended recipient. TFMC and any of its subsidiaries each reserve
the right to monitor all e-mail communications through its networks.

Any views expressed in this message are those of the individual sender, except where
the message states otherwise and the sender is authorized to state them to be the
views of any such entity.

Thank You.

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



Re: Help needed on XML Files

2003-06-24 Thread Janek Schleicher
Sherwin Remo wrote at Tue, 24 Jun 2003 06:56:40 +0800:

 I would like to write a script that would check the correct syntax of an XML
 file.  Need to check if the file is XML compliant.  Is there a module that I
 can use to do this?  Thanks!

There are a lot of XML modules on CPAN:
http://search.cpan.org/search?query?XMLmode=module
e.g. also
XML::Checker


Greetings,
Janek

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



context, printing, and concatenation

2003-06-24 Thread Peter
I'm on the first few chapters of Learning Perl and came up with a
question. Given:

-

@array = qw ( one two three );
print @array . \n;
print @array;

-

Why does the first print statement print 3 (and a carriage return)
while the second prints onetwothree?  I'm guessing that the first
print sees the array in scalar context while the second sees it in list
context, but if so I don't understand why.  Can someone break it down
what the concatenation operator is doing here?

Thanks.

-- 
You can't waste a life hating people, because all they do is live their
life, laughing, doing more evil.
 -- Alpha Robertson, whose daughter was killed in a Birmingham church
 bombing in 1963. 

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



CPAN question: configuration of get mechanism?

2003-06-24 Thread Travis J.I. Corcoran

Hi.

I'm a new Perl programmer and CPAN user.

Here's my problem:

When I try to use CPAN to fetch something, all the normal mechanisms
time out, and then I get down to ncftpget, which works.

I'm not behind a firewall, so I would have thought that LWP would work
(as a matter of fact, I've written Perl scripts using LWP that run on
this machine and work fine).  

I'd like to know why the first fetch methods fail, but I'd settle for
being able to configure CPAN to use ncftpget immediately...

I've read CPAN.pm and don't see anything obvious.

Insights?

Thanks,

TJIC

 -- snip! --


cpan install JavaScript
CPAN: Storable loaded ok
Going to read /root/.cpan/Metadata
  Database was generated on Mon, 23 Jun 2003 21:43:28 GMT
Running install for module JavaScript
Running make for C/CL/CLAESJAC/JavaScript-0.52.tar.gz
CPAN: LWP::UserAgent loaded ok
Fetching with LWP:
  ftp://ftp.perl.org/pub/CPAN/authors/id/C/CL/CLAESJAC/JavaScript-0.52.tar.gz
LWP failed with code[400] message[FTP return code 000]
Fetching with Net::FTP:
  ftp://ftp.perl.org/pub/CPAN/authors/id/C/CL/CLAESJAC/JavaScript-0.52.tar.gz
Couldn't fetch JavaScript-0.52.tar.gz from ftp.perl.org

Trying with /usr/bin/ncftpget to get

ftp://ftp.perl.org/pub/CPAN/authors/id/C/CL/CLAESJAC/JavaScript-0.52.tar.gz
JavaScript-0.52.tar.gz: 
JavaScript-0.52.tar.gz:ETA:   0:002.83/ 14.72 kB  117.79 kB/s  
JavaScript-0.52.tar.gz:ETA:   0:00   14.72/ 14.72 kB   54.83 kB/s  
JavaScript-0.52.tar.gz: 14.72 kB   54.83 kB/s  
JavaScript-0.52.tar.gz: 14.72 kB   54.83 kB/s  
CPAN: Digest::MD5 loaded ok


...

 -- snip! --


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



Re: Perl Best Practices

2003-06-24 Thread Sudarshan Raghavan
Nyimi Jose wrote:
Hello,

I'm looking for a link where i can find information about Perl's best practices programming.

For starters you can take a look at these docs

perldoc perlstyle
perldoc perltrap
perldoc perlmodstyle #If you are interested in developing modules
Thanks in advance.

===
José Nyimi Mbambi
IT Analyst
http://www.proximus.be


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


RE: context, printing, and concatenation

2003-06-24 Thread NYIMI Jose (BMB)
Because in the first statement @array is used in scalar context so it's like you wrote 
something as
[EMAIL PROTECTED];
print $size.\n;

That's why you get the number of items contained in @array which is 3.

HTH,

José.

-Original Message-
From: Peter [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, June 24, 2003 6:13 AM
To: [EMAIL PROTECTED]
Subject: context, printing, and concatenation


I'm on the first few chapters of Learning Perl and came up with a question. Given:

-

@array = qw ( one two three );
print @array . \n;
print @array;

-

Why does the first print statement print 3 (and a carriage return) while the second 
prints onetwothree?  I'm guessing that the first print sees the array in scalar 
context while the second sees it in list context, but if so I don't understand why.  
Can someone break it down what the concatenation operator is doing here?

Thanks.

-- 
You can't waste a life hating people, because all they do is live their life, 
laughing, doing more evil.
 -- Alpha Robertson, whose daughter was killed in a Birmingham church  bombing in 
1963. 

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



 DISCLAIMER 

This e-mail and any attachment thereto may contain information which is confidential 
and/or protected by intellectual property rights and are intended for the sole use of 
the recipient(s) named above. 
Any use of the information contained herein (including, but not limited to, total or 
partial reproduction, communication or distribution in any form) by other persons than 
the designated recipient(s) is prohibited. 
If you have received this e-mail in error, please notify the sender either by 
telephone or by e-mail and delete the material from any computer.

Thank you for your cooperation.

For further information about Proximus mobile phone services please see our website at 
http://www.proximus.be or refer to any Proximus agent.


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



RE: Help needed on XML Files

2003-06-24 Thread EUROSPACE SZARINDAR
Hello, 

There are a lot of perl modules dealing with the XML. 
The most common is XML::Parser which will surely do whatever you want and
perhaps a litle more.

XML::Simple is also very useful for Simple XML treatment.
Just go to CPAN web site.


Michel

-Message d'origine-
De: Remo, Sherwin [mailto:[EMAIL PROTECTED]
Date: mardi 24 juin 2003 00:57
À: [EMAIL PROTECTED]
Objet: Help needed on XML Files


List,

 

I would like to write a script that would check the correct syntax of an XML
file.  Need to check if the file is XML compliant.  Is there a module that I
can use to do this?  Thanks!

 

 


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



Parsing .csv file

2003-06-24 Thread Sparrow, Dave
I'm reading an Excel .csv file.
Fields are separated by commas.
If a field contains a comma, the whole field is double-quoted (Excel does
this by default).
An example of an input line is as follows:

field1,field2,field3a, field3b, field3c,field4,field5a, field5c,field6

I want to get each field into an array.
Quoted fields should be in one element, containing commas, but without
quotes.

Code so far is shown below. 
It's a bit messy.
Anyone have a better way?
Thanks in advance,
Dave

# Note: $_ contains the whole (chomped) line at this point
while (m/,(.*?),/) {
  $a = $`;
  $b = $';
  ($m = $1) =~ s/,/¬/g;  # Just use some temporary character other than a
comma
  $_ = $a.,.$m.,.$b;
}
@arr = split(,);
foreach (@arr) {s/¬/,/g;}
# Done



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



Re: Parsing .csv file

2003-06-24 Thread Sudarshan Raghavan


Sparrow, Dave wrote:

I'm reading an Excel .csv file.
Fields are separated by commas.
If a field contains a comma, the whole field is double-quoted (Excel does
this by default).
An example of an input line is as follows:
field1,field2,field3a, field3b, field3c,field4,field5a, field5c,field6

I want to get each field into an array.
Quoted fields should be in one element, containing commas, but without
quotes.
Code so far is shown below. 
It's a bit messy.
Anyone have a better way?
Thanks in advance,
Dave

# Note: $_ contains the whole (chomped) line at this point
while (m/,(.*?),/) {
 $a = $`;
 $b = $';
 ($m = $1) =~ s/,/¬/g;  # Just use some temporary character other than a
comma
 $_ = $a.,.$m.,.$b;
}
@arr = split(,);
foreach (@arr) {s/¬/,/g;}
# Done
Take a look at Text::CSV or Text::CSV_XS
http://search.cpan.org/author/ALANCITT/Text-CSV-0.01/CSV.pm
http://search.cpan.org/author/JWIED/Text-CSV_XS-0.23/CSV_XS.pm


 



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


searching the solution

2003-06-24 Thread Gayatri
Hi 
I am writing a perl scipt in that I want to change the dir to some other and run a exe 
from there is it possible?
Because chdir is not working there.
Thanks and Regards
-Gayatri
  - Original Message - 
  From: Sparrow, Dave 
  To: [EMAIL PROTECTED] 
  Sent: Tuesday, June 24, 2003 3:46 PM
  Subject: Parsing .csv file


  I'm reading an Excel .csv file.
  Fields are separated by commas.
  If a field contains a comma, the whole field is double-quoted (Excel does
  this by default).
  An example of an input line is as follows:

  field1,field2,field3a, field3b, field3c,field4,field5a, field5c,field6

  I want to get each field into an array.
  Quoted fields should be in one element, containing commas, but without
  quotes.

  Code so far is shown below. 
  It's a bit messy.
  Anyone have a better way?
  Thanks in advance,
  Dave

  # Note: $_ contains the whole (chomped) line at this point
  while (m/,(.*?),/) {
$a = $`;
$b = $';
($m = $1) =~ s/,/¬/g;  # Just use some temporary character other than a
  comma
$_ = $a.,.$m.,.$b;
  }
  @arr = split(,);
  foreach (@arr) {s/¬/,/g;}
  # Done



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



DISCLAIMER**

This e-mail and any attachment is for authorised use by the intended
recipient(s) only. It may contain proprietary material, confidential
information and/or be subject to legal privilege of Deccanet Designs Ltd.
If you have received this message in error, please notify the originator
immediately. If you are not the intended recipient, you are notified that
you are strictly prohibited from retaining, using, copying, altering or
disclosing the contents of this message.



Re: searching the solution

2003-06-24 Thread Sudarshan Raghavan
Gayatri wrote:

Hi 

Please start a new thread to ask a question

I am writing a perl scipt in that I want to change the dir to some other and run a exe from there is it possible?

Yes it is possible, it is also possible to do that without changing to 
that directory

Because chdir is not working there.



Why do you say chdir is not working?  Does the call return false? What 
is the value stored in $!?
Change your code to
chdir ($your_dir) or die chdir failed, $!\n;
and see what happens

Thanks and Regards
-Gayatri



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


RE: Parsing .csv file

2003-06-24 Thread Rai,Dharmender

you can get modules from cpan.perl.org
 -- 
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 

Confidential:  This electronic message and all contents contain information
from Syntel, Inc. which may be privileged, confidential or otherwise
protected from disclosure. The information is intended to be for the
addressee only. If you are not the addressee, any disclosure, copy,
distribution or use of the contents of this message is prohibited.  If you
have received this electronic message in error, please notify the sender
immediately and destroy the original message and all copies.

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



Re: Parsing .csv file

2003-06-24 Thread George P.



On Tue, 24 Jun 2003, Sparrow, Dave wrote:

 I'm reading an Excel .csv file.
 Fields are separated by commas.
 If a field contains a comma, the whole field is double-quoted (Excel does
 this by default).
 An example of an input line is as follows:

 field1,field2,field3a, field3b, field3c,field4,field5a, field5c,field6

 I want to get each field into an array.
 Quoted fields should be in one element, containing commas, but without
 quotes.

 Code so far is shown below.
 It's a bit messy.
 Anyone have a better way?
 Thanks in advance,
 Dave


Have a look at

perldoc -q How can I split


George P.


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



Re: searching the solution

2003-06-24 Thread Sudarshan Raghavan
Gayatri wrote:

Please reply to the list

thanks for ur suggetions
I am sorry u told me to start new thread.
i donot know how to start in a new thread.


Just address your email with the question to [EMAIL PROTECTED]

 
I didnot mean chdir() is not working.
I am not able to run the file from that dir.After calling the chdir


Are you sure chdir succeeded? Check your current working directory 
(perldoc Cwd)
How are you trying to run the file? Which OS are you running this on?

Can you post your code (if it is not too big a file)?

.
U told it is possible without chdir can u give me some hints.
thanks in advance.
 
Thanks and Regards
-Gayatri

- Original Message -
From: Sudarshan Raghavan mailto:[EMAIL PROTECTED]
Cc: [EMAIL PROTECTED] mailto:[EMAIL PROTECTED]
Sent: Tuesday, June 24, 2003 4:37 PM
Subject: Re: searching the solution
Gayatri wrote:

Hi

Please start a new thread to ask a question

I am writing a perl scipt in that I want to change the dir to
some other and run a exe from there is it possible?

Yes it is possible, it is also possible to do that without
changing to
that directory
Because chdir is not working there.

Why do you say chdir is not working?  Does the call return false?
What
is the value stored in $!?
Change your code to
chdir ($your_dir) or die chdir failed, $!\n;
and see what happens
Thanks and Regards
-Gayatri




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

DISCLAIMER**

This e-mail and any attachment is for authorised use by the intended
recipient(s) only. It may contain proprietary material, confidential
information and/or be subject to legal privilege of Deccanet Designs Ltd.
If you have received this message in error, please notify the originator
immediately. If you are not the intended recipient, you are notified that
you are strictly prohibited from retaining, using, copying, altering or
disclosing the contents of this message.

 



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


Hi

2003-06-24 Thread Gayatri
Thanks I got a solution.
I was doing a silly mistake.
chdir I was executing thro' system command like cd.
Now it works.
thanks for solutions
Thanks and Regards
-Gayatri


DISCLAIMER**

This e-mail and any attachment is for authorised use by the intended
recipient(s) only. It may contain proprietary material, confidential
information and/or be subject to legal privilege of Deccanet Designs Ltd.
If you have received this message in error, please notify the originator
immediately. If you are not the intended recipient, you are notified that
you are strictly prohibited from retaining, using, copying, altering or
disclosing the contents of this message.



Re: Calculating Disk Space and Freespace on Windows

2003-06-24 Thread Jenda Krynicky
From: Denham Eva [EMAIL PROTECTED]
 I'd appreciate any suggestions on how to calculate Disk space and Free
 Space.

use Win32::FileOp;
($free_for_user, $total_space, $total_free) = GetDiskFreeSpace('C:');

You may install Win32::FileOp with PPM from 
http://Jenda.Krynicky.cz/perl

c:\ ppm
ppm rep add Jenda http://Jenda.Krynicky.cz/perl
ppm install Win32::FileOp

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



Re: Running Perl programs on a machine that does not have Perl installed

2003-06-24 Thread Jenda Krynicky
From: Dave Mamanakis [EMAIL PROTECTED]
 I have a perl program that I need to be able to run on all kinds of
 machines. However, I cannot install perl on each of these machines. It
 has to be run locally, not over a network (too many issues with
 security) How can this be done? I know with several other languages,
 you can make an EXE or copy 4-6 files to that machine and have your
 program run.  How does Perl deal with this?

PerlApp
or
Perl2Exe
or
PAR : http://search.cpan.org/search?query=PARmode=all

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



Cookies rejected

2003-06-24 Thread Aman Thind
Hi All

On receiving no reply to my previous post, I myself struggled a bit and came
up with the following code to login to the site :

--
use LWP::UserAgent;
use HTTP::Cookies;
  
$ua = LWP::UserAgent-new;
$ua-cookie_jar(HTTP::Cookies-new(file = lwpcookies.txt,autosave = 1));

my $req = HTTP::Request-new(POST = 'http://www.sms.ac/login.asp');
$req-content_type('application/x-www-form-urlencoded');
$req-content('loginuserid=myuseridloginpassword=mypassword');
my $res = $ua-request($req);
print $res-as_string; 
--

However, on running this script, a web page with the following message is
returned :

Unable to establish login (cookies rejected).

Could someone please guide me how to overcome this.

Thanks in anticipation,
aman


-Original Message-
From: Aman Thind [mailto:[EMAIL PROTECTED]
Sent: Monday, June 23, 2003 2:05 PM
To: [EMAIL PROTECTED]
Subject: Log into a site and do stuff


Hi

I am working on a module that occasionally needs to raise alarms by sending
sms to concerned ppl.

For this, I would like to login to the site : www.sms.ac

The login page is http://www.sms.ac/login.asp

Then I have to go to the main page , fill the To: and Message: textboxes and
send sms.

I have no prior experience with LWP and couldn't make much use of perldoc
lwpcook

Could someone please tell me how I can accomplish this feat.

A pointer towards a newbie resource on this perl feature or some sample code
will surely help.

Thanks
aman

-- 
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: reading file into hash?

2003-06-24 Thread Tim McGeary
This works great, except when I do:

for (keys %codes_hash) {
   print $_|$codes_hash{$_}\n;
}
for my own confirmation, I'm getting a blank line in the printout.  I
re-checked my config file and made sure there was not an extra blank
line at the end of the file.  Do you have any ideas why it would print
out a blank line?
Here's my entire test code:

my $test_file = test.codes;
my %codes_hash = ();
open (TEST, $test_file) or die Cannot open $test_file;
while (TEST) {
   my ($code, $id) = split /\|/;
   $codes_hash{$code} = $id;
}
for (keys %codes_hash) {
   print $_|$codes_hash{$_}\n;
}


 If you only need two fields, it's more efficient to assign split() to
 a list.

 my ($key, $value) = split /\|/; $alpha_hash{$key} = $value;

 The split() operator is clever/lazy enough to notice that you only
 need the first two chunks, and it does the least amount of work
 necessary to provide them.

 (Roughly speaking, it does split /\|/, $_, 3.)


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


Re: reading file into hash?

2003-06-24 Thread Sudarshan Raghavan


Tim McGeary wrote:

This works great, except when I do:

for (keys %codes_hash) {
   print $_|$codes_hash{$_}\n;
}
for my own confirmation, I'm getting a blank line in the printout.  I
re-checked my config file and made sure there was not an extra blank
line at the end of the file.  Do you have any ideas why it would print
out a blank line?
Here's my entire test code:

my $test_file = test.codes;
my %codes_hash = ();
open (TEST, $test_file) or die Cannot open $test_file;
while (TEST) { 


Add a chomp here to remove the newline (actually $/), perldoc -f chomp

   my ($code, $id) = split /\|/;
   $codes_hash{$code} = $id;
}
for (keys %codes_hash) {
   print $_|$codes_hash{$_}\n;
}


 If you only need two fields, it's more efficient to assign split() to
 a list.

 my ($key, $value) = split /\|/; $alpha_hash{$key} = $value;

 The split() operator is clever/lazy enough to notice that you only
 need the first two chunks, and it does the least amount of work
 necessary to provide them.

 (Roughly speaking, it does split /\|/, $_, 3.)




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


multi-line matches / named.conf parsing

2003-06-24 Thread Kevin Pfeiffer
Hi all,

In comp.unix.shell Alan Murrell posted this clever sed solution for removing 
entries from his named.conf file using only the domain name):

sed '/zone domain.com {/,/};/d' /etc/named.conf  newfile

Instead of using actual line numbers for the range of lines (such as 1,4) 
he uses two regexes that match to them.

How might one do this in Perl? Read in the whole file and then do a 
multi-line substitution? 

Or a 'bigger' solution would be to read the lines one at a time into a hash 
structure ($domain{domain.com} for ex.), starting a new hash key each time 
one matches /^\s*zone.*/ ? This would then let one sort, do whatever, and 
write out the entire file afterwards in proper format.

No solution needed, just wondering about approaches (small and large).

-K

__DATA__
zone domain.com {
type master;
file domain.com;
};
zone domain2.com {
type master;
file domain2.com;
};
##


-- 
Kevin Pfeiffer
International University Bremen

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



RE: Perl Best Practices

2003-06-24 Thread Tony Esposito
Maybe consider:

use diagnostics;

as well, at least while you are developing your code.
Thanks!  :-)

 Anthony (Tony) Esposito
 Senior Technical Consultant 
 Inovis(tm)
 2425 N. Central Expressway, Suite 900 
 Richardson, TX  75080 
 (972) 643-3115 
 [EMAIL PROTECTED] 
 


-Original Message-
From: Steve Grazzini [mailto:[EMAIL PROTECTED]
Sent: Tuesday, June 24, 2003 2:22 AM
To: NYIMI Jose (BMB)
Cc: [EMAIL PROTECTED]
Subject: Re: Perl Best Practices


On Tue, Jun 24, 2003 at 09:17:10AM +0200, NYIMI Jose (BMB) wrote:
 Here are some best practices i know:
 1. use warnings or -w 
 2. use strict;
 
 Could you extends the list please ?

Those are probably the most important. :-)

And from the making-best-use-of-available-resources dept:

  3. use perldoc
  4. use CPAN

-- 
Steve

-- 
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: multi-line matches / named.conf parsing

2003-06-24 Thread Paul Johnson

Kevin Pfeiffer said:

 In comp.unix.shell Alan Murrell posted this clever sed solution for
 removing entries from his named.conf file using only the domain name):

 sed '/zone domain.com {/,/};/d' /etc/named.conf  newfile

 Instead of using actual line numbers for the range of lines (such as
 1,4) he uses two regexes that match to them.

 How might one do this in Perl?

Just the same way:

perl -ne 'print unless /zone domain.com {/ .. /};/' \
/etc/named.conf  newfile

-- 
Paul Johnson - [EMAIL PROTECTED]
http://www.pjcj.net


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



RE: reading file into hash?

2003-06-24 Thread Paul Johnson

Dan Muey said:

 my %codes_hash = ();

 Change this to my %codes_hash;
 the = () is adding an empty key/value

Are you sure?

-- 
Paul Johnson - [EMAIL PROTECTED]
http://www.pjcj.net


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



Re: reading file into hash?

2003-06-24 Thread Tim McGeary
Yah - that didn't work.  It still would have needed the chomp;

Tim

Paul Johnson wrote:
Dan Muey said:


my %codes_hash = ();
Change this to my %codes_hash;
the = () is adding an empty key/value


Are you sure?





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


RE: multi-line matches / named.conf parsing

2003-06-24 Thread Dan Muey
 Hi all,

Howdy,

 
 In comp.unix.shell Alan Murrell posted this clever sed 
 solution for removing 
 entries from his named.conf file using only the domain name):
 
 sed '/zone domain.com {/,/};/d' /etc/named.conf  newfile
 
 Instead of using actual line numbers for the range of lines 
 (such as 1,4) 
 he uses two regexes that match to them.
 
 How might one do this in Perl? Read in the whole file and then do a 
 multi-line substitution? 
 
 Or a 'bigger' solution would be to read the lines one at a 
 time into a hash 
 structure ($domain{domain.com} for ex.), starting a new hash 
 key each time 
 one matches /^\s*zone.*/ ? This would then let one sort, do 
 whatever, and 
 write out the entire file afterwards in proper format.
 
 No solution needed, just wondering about approaches (small and large).

Well, assuming your conf file isn't too huge, IE the size you could use File::Slurp on.

use File::Slurp;
my %named_conf = parse_conf(read_file(/etc/namedb/named.conf));

Now parse_conf() takes the array that read_file() returned, and similar to what you 
said:

At a 'zone' file get domain then until it gets the };
It adds each attribute as a key and it's value as a value.

So you end up with a hash like this:

$named_conf{'domain.com'} = type = 'master',
 file = '/etc/named/master/domain.zone';
$named_conf{'domain2.net'} = type = 'slave',
file = '...',
masters = '1.1.1.1;2.2.2.2;
 
Or something like that, the syntax may be bad since I'm busy but that's the idea.

Although you said you simply want to remove a zone entry som that may be overkill now 
that I remmebere that.

How about :

 perl -e use File::Slurp; $n = read_file('/etc/named.conf');$n =~ s/zone 
\removeme.com\.*\}\;// 

HTH

Dmuey

 -K
 
 __DATA__
 zone domain.com {
 type master;
 file domain.com;
 };
 zone domain2.com {
 type master;
 file domain2.com;
 };
 ##

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



RE: multi-line matches / named.conf parsing

2003-06-24 Thread Dan Muey
  sed '/zone domain.com {/,/};/d' /etc/named.conf  newfile
 
  Instead of using actual line numbers for the range of lines (such as
  1,4) he uses two regexes that match to them.
 
  How might one do this in Perl?
 
 Just the same way:
 
 perl -ne 'print unless /zone domain.com {/ .. /};/' \
 /etc/named.conf  newfile

Way better than my clunky idea!

Dan

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



RE: Parsing .csv file

2003-06-24 Thread Sparrow, Dave
 Take a look at Text::CSV or Text::CSV_XS
Ah, but here's the kicker...
Most people who I will give this script to will be running Perl 5.6 and WILL
NOT have the ability to use any external modules, even those such as 'use
strict' !
This is because they will be running a cut-down version of Perl that ships
with the Rational toolset (ClearCase  ClearQuest). 
Therefore I need to do the parsing myself by hand - sorry I didn't make that
clear in the original posting.

Dave

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



RE: reading file into hash?

2003-06-24 Thread Dan Muey

 Yah - that didn't work.  It still would have needed the chomp;
 

Then it must be getting added from the a blank line (IE ^\n$ or somilar) in the file.

 Tim
 
 Paul Johnson wrote:
  Dan Muey said:
  
  
 my %codes_hash = ();
 
 Change this to my %codes_hash;
 the = () is adding an empty key/value
  
  
  Are you sure?
  
 
 
 
 
 

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



RE: reading file into hash?

2003-06-24 Thread Dan Muey
 Dan Muey said:
 
  my %codes_hash = ();
 
  Change this to my %codes_hash;
  the = () is adding an empty key/value
 
 Are you sure?

I assumed (I know I know one shouldn't assume ;p) that since I've had the same issue 
and once I changed 
my %hash = (); to my %hash; the empty key/value go away.
Could be that an empty key/value is being added by however data is getting into it 
also.
I'd have to run a test before and after to be 100% sure but can't now as I'm in the 
middle of a few thigns.

 
 -- 
 Paul Johnson - [EMAIL PROTECTED]
 http://www.pjcj.net
 
 

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



Re: multi-line matches / named.conf parsing

2003-06-24 Thread Kevin Pfeiffer
In article [EMAIL PROTECTED], Paul 
Johnson wrote:

 
 Kevin Pfeiffer said:
 
 In comp.unix.shell Alan Murrell posted this clever sed solution for
 removing entries from his named.conf file using only the domain name):

 sed '/zone domain.com {/,/};/d' /etc/named.conf  newfile

 Instead of using actual line numbers for the range of lines (such as
 1,4) he uses two regexes that match to them.

 How might one do this in Perl?
 
 Just the same way:
 
 perl -ne 'print unless /zone domain.com {/ .. /};/' \
 /etc/named.conf  newfile

Cool, I didn't think of Perl's range operator ...
 

-- 
Kevin Pfeiffer
International University Bremen

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



Use of Perl for global changes

2003-06-24 Thread Peter Goggin
I have two web sites with about 300 htm and php files. I wish to make a change so tht 
the database connect string in all of these files is changed for mysql_pconnect to 
mysql_connect. Can perl do this and if so can anyone show me how? 

Ideally I would like to feed a script or command line with a list of files using ls .

Regards

Peter Goggin


RE: basic question: handling input to TCP/IP server

2003-06-24 Thread McMahon, Christopher x66156

This worked great.  I had to tweak it a *little* bit because I'm
after a slightly different thing, but I am now happily printing data from
the client to STDOUT (and understanding how that works, too).  
BTW, this TCP/IP server is a test tool for some brokerage software.
A few more lines of code and I'll be impersonating the New York Stock
Exchange!  
-Chris  

-Original Message-
From: Gupta, Sharad [mailto:[EMAIL PROTECTED]
Sent: Monday, June 23, 2003 4:41 PM
To: McMahon, Christopher x66156; [EMAIL PROTECTED]
Subject: RE: basic question: handling input to TCP/IP server


Something like this worked for me in the past:

use strict;
use IO::Socket::INET;
my $sock = IO::Socket::INET();

while(1) {
my $output;
my $n = sysread($sock,$output,1000);
last if(!defined($n));
print STDOUT $output;
}

And using syswrite() for writing.

perldoc -f sysread
perldoc -f syswrite

-Sharad

-Original Message-
From: McMahon, Christopher x66156 [mailto:[EMAIL PROTECTED]
Sent: Monday, June 23, 2003 3:06 PM
To: [EMAIL PROTECTED]
Subject: basic question: handling input to TCP/IP server


Hello all...
I've implemented the TCP/IP server at the top of p.441 of The Camel (3rd
edition) Chapter 16, and it's working fine.  That is, it opens the port I
tell it to, and other processes connect to it and happily send it stuff.
(This is using IO::Socket::INET).  
But now I'm a little confused about how to handle I/O over the TCP/IP
connection.  The first thing I'd like to do is to print incoming data to
STDOUT.  It seems that I have to manipulate the accept() statement, and I
probably have to use the angle operators, but I'm struggling to truly
understand what's going on here in order to get the syntax correct.  (I
figure if I can get a handle on manipulating the input, output will be
easy.)   
I'm continuing to hack at this, but any pointers to (simple!) TCP/IP
server behavior to speed me on my way would be welcome.  
Thanks, 
-Chris   

_
This message and any attachments are intended only for the use of the
addressee and
may contain information that is privileged and confidential. If the reader
of the 
message is not the intended recipient or an authorized representative of the
intended recipient, you are hereby notified that any dissemination of this
communication is strictly prohibited. If you have received this
communication in
error, please notify us immediately by e-mail and delete the message and any
attachments from your system.


RE: Use of Perl for global changes

2003-06-24 Thread Bakken, Luke
cd /whatever dir
perl -i.bak -pe's/\bmysql_pconnect\b/mysql_connect/g' *

If everything is OK, delete the *.bak files.
Luke

 -Original Message-
 From: Peter Goggin [mailto:[EMAIL PROTECTED] 
 Sent: Tuesday, June 24, 2003 8:08 AM
 To: [EMAIL PROTECTED]
 Subject: Use of Perl for global changes
 
 
 I have two web sites with about 300 htm and php files. I wish 
 to make a change so tht the database connect string in all of 
 these files is changed for mysql_pconnect to mysql_connect. 
 Can perl do this and if so can anyone show me how? 
 
 Ideally I would like to feed a script or command line with a 
 list of files using ls .
 
 Regards
 
 Peter Goggin
 

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



RE: Parsing .csv file

2003-06-24 Thread Kevin Pfeiffer
In article [EMAIL PROTECTED], Dave Sparrow 
wrote:

 Take a look at Text::CSV or Text::CSV_XS
 Ah, but here's the kicker...
 Most people who I will give this script to will be running Perl 5.6 and
 WILL NOT have the ability to use any external modules, even those such as
 'use strict' !
 This is because they will be running a cut-down version of Perl that ships
 with the Rational toolset (ClearCase  ClearQuest).
 Therefore I need to do the parsing myself by hand - sorry I didn't make
 that clear in the original posting.

George gave you the answer you need:
 Have a look at
 perldoc -q How can I split

Since I looked, too, I know there is a regex version from Jeffrey Friedl 
there (I think it's the same one that's in the Cookbook).




-- 
Kevin Pfeiffer
International University Bremen
rantWhy is it that new threads here are posted in reply and replies are 
posted as new threads??  Does no one use threaded messaging? Argh./rant

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



Weekly list FAQ posting

2003-06-24 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, consider subscribing to 

RE: Calculating Disk Space and Freespace on Windows

2003-06-24 Thread Bakken, Luke
You want Win32::DriveInfo

 -Original Message-
 From: Denham Eva [mailto:[EMAIL PROTECTED] 
 Sent: Tuesday, June 24, 2003 12:42 AM
 To: BeginnersPerl (E-mail); Perl-Beginner (E-mail)
 Subject: Calculating Disk Space and Freespace on Windows
 
 
 Hello,
 
 I'd appreciate any suggestions on how to calculate Disk space and Free
 Space.
 
 Many Thanks
 Denham Eva
 Oracle DBA
 Linux like TeePee... No Windows, No Gates and Apache inside!
 
 
 __
 ___
 This e-mail message has been scanned for Viruses and Content 
 and cleared 
 by MailMarshal
 
 For more information please visit www.marshalsoftware.com
 __
 ___
 
 ##
 ###
 Note:
 This message is for the named person's use only.  It may 
 contain confidential,
 proprietary or legally privileged information.  No 
 confidentiality or privilege
 is waived or lost by any mistransmission.  If you receive 
 this message in error,
 please immediately delete it and all copies of it from your 
 system, destroy any
 hard copies of it and notify the sender.  You must not, 
 directly or indirectly,
 use, disclose, distribute, print, or copy any part of this 
 message if you are not
 the intended recipient. TFMC and any of its subsidiaries each reserve
 the right to monitor all e-mail communications through its networks.
 
 Any views expressed in this message are those of the 
 individual sender, except where
 the message states otherwise and the sender is authorized to 
 state them to be the
 views of any such entity.
 
 Thank You.
 
 -- 
 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: Use of Perl for global changes

2003-06-24 Thread Dan Muey

 I have two web sites with about 300 htm and php files. I wish 
 to make a change so tht the database connect string in all of 
 these files is changed for mysql_pconnect to mysql_connect. 
 Can perl do this and if so can anyone show me how? 
 
 Ideally I would like to feed a script or command line with a 
 list of files using ls .

perl -pi -e s/mysql_pconnect/mysql_connect/ list.htm of.php files.txt

You may even try `cat ./public_html` to get the list.

One thing you might want to try is replace the php files with perl ;p

HTH
DMuey

 
 Regards
 
 Peter Goggin
 

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



Help needed

2003-06-24 Thread Shishir K. Singh
Hello, 

I have to get the size and  last modified date of a remote file via URL without  
reading in the whole file. I have gone through LWP::UserAgent but couldn't make much 
headway.  Any pointers on how to do it would be appreciated.


TIA
Shishir

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



Odd Display using Perl5.8 in Debug

2003-06-24 Thread Jeff Westman
Hi,

I have sort of a strange problem, and if anyone has a fix for it, please let
me know.  I don't know if this is perl-related or my software package.

I am using 'Reflection X' for telneting.  It's a great communications
package, witht he exception of one annoying nuance.  When I am debugging a
perl script (using -d on the command line) AND using Perl 5.8, the first
character of the current line when I print that variable wraps to the
previous line, then displays the rest of the line where you would expect. 
This does not happen when I am running the same telnet software and using
Perl 5.6.1 (we have both).

Example of what I would see on the screen:

+--+
| DB6 p $myFile   /  |
| path/to/my/file  |
| ...  |
+--+

Note the leading '/' is on the same line as my print statement, and making it
appear that when I display the contents of the variable, that it is in error
(since it isn't obvious or intuitive to look at the preceeding line).

Again, this is only when using Perl 5.8 and in debug mode, and works fine
when I use 5.6.1.  

Sorry for the extra bandwidth, and thanks in advance for any ideas.

Jeff



__
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
http://sbc.yahoo.com

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



Re: using FIle::Find::name if regex to filter

2003-06-24 Thread David Storrs
On Mon, Jun 23, 2003 at 09:14:25PM +0200, [EMAIL PROTECTED] wrote:
 hi, how can i use a real regex with this:
 
 File::Find::name if -x?
 
 the filetestops are working fine, but how can i filter things like
 .gz$? i tried many ways, but all failed. any idea? thanks!!
 
 bye andreas

Andreas,

I'm not quite clear on what it is you want to do.  It sounds like you
want to use File::Find to run some code on all files in a particular
subtree, but you don't want to run the code on anything ending with
.gz.  If I'm correct, then you can do this:


#!/usr/bin/perl

use warnings;
use strict;
use File::Find;

my $start_dir = top of your subtree goes here;
find( \my_func, $start_dir );

sub my_func {
return if /\.gz$/;

# ...do whatever you want here...
}


--Dks

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



How do I find URL file size/last modified date

2003-06-24 Thread Shishir K. Singh
Hello, 

I have to get the size and  last modified date of a remote file via URL without  
reading in the whole file. I have gone through LWP::UserAgent but couldn't make much 
headway.  Any pointers on how to do it would be appreciated.


TIA
Shishir

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



help sending hex EOL chars

2003-06-24 Thread McMahon, Christopher x66156
Hi...
My TCP/IP server is printing input fine, now I'm trying to send the
right output.  
The client for my server expects an EndOfLine character that is a hex
0D0A.  (zero-dee-zero-ay) My code is doing this:  
 
my $eol = \x{0D0A};
 
but the client is seeing this: 
 
E0B4 8A
 
Any idea what I'm doing wrong?  
-Chris   

_
This message and any attachments are intended only for the use of the addressee and
may contain information that is privileged and confidential. If the reader of the 
message is not the intended recipient or an authorized representative of the
intended recipient, you are hereby notified that any dissemination of this
communication is strictly prohibited. If you have received this communication in
error, please notify us immediately by e-mail and delete the message and any
attachments from your system.


Binary file conversion

2003-06-24 Thread Ned Cunningham
HI all.

I have what appears to be a C++ file set (i.e. phone.dat, phone.idx).

My question is can Perl read these files and what modules do I need to do
it.

Any starting help would be great.

Thankx


Ned Cunningham
POS Systems Developer
Monro Muffler Brake  Service
200 Holleder Parkway
Rochester, New York 14615
 (585) 647-6400 ext 310
[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] 



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



Re: Help needed

2003-06-24 Thread Jenda Krynicky
From: Shishir K. Singh [EMAIL PROTECTED]
 I have to get the size and  last modified date of a remote file via
 URL without  reading in the whole file. I have gone through
 LWP::UserAgent but couldn't make much headway.  Any pointers on how to
 do it would be appreciated.

Try to use HEAD request instead of GET.

I'm not sure the server will send you all this info though.

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]



Cut, paste in Tk800.024

2003-06-24 Thread Doug Lentz
I'm doing a simple form using Tk. Things are going well, but I feel a
little lazy, so for once I will ask about this.

Perl/Tk script is running on linux box host. Users are on windows
boxes local, running the application via an X server (Hummingbird
Exceed) and the export DISPLAY command. . Application is a data entry
form.

What's a good way to allow users to cut from Windows apps and paste into
Entry fields created by Perl/Tk script? I guess I'm asking how to send
clipboard data from local to host.

Maybe the answer is in Chapter 15 of Mastering Perl/Tk, wherein
binding virtual events are discussed. BUT, in the real world, one must
get things done, and I have other tasks on the job that I have been
neglecting in favor of learning Tk.  I appreciate any assistance, or
pointers to where I might find answers.

Thanks, all.


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



RE: Help needed

2003-06-24 Thread Dan Muey

 From: Shishir K. Singh [EMAIL PROTECTED]
  I have to get the size and  last modified date of a remote file via 
  URL without  reading in the whole file. I have gone through 
  LWP::UserAgent but couldn't make much headway.  Any 
 pointers on how to 
  do it would be appreciated.
 
This could be tricky, The HEAD method would be the most likely canidate but
It may or may not give you this info.
Do you want the META tag info or the info you'd get from stat()?

You may need to look at Net::FTP;

Or you could set up a script on the remote site that can do stat() on the local file 
and return the dat in a usable format.

http://domain.com/file.cgi :
use CGI qw(:standard);

my $domain = 'domain.com';
my $www_root = '/home/foo/oublic_html';
my $req_file = param('url');

my($prot,$path) = split(/$domain/, $req_file);
my @stat = stat($www_root/$path);

print header();
if(@stat) { print $stat[7]:$stat[9]; } else { print File Err; }

On your site with LWP:

GET(http://domain.com/file.cgi?url=http://domain.com/home.html;);

if($res !~ /File Err/) { my($size,$modtime) = split(/:/, $res); }

HTH 

DMuey

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



Use Carp in package

2003-06-24 Thread Dan Muey
Howdy List!

I'm writing a simple module to return a few variables and functions.

The perldoc perlmod* stuff says I should use Carp; and call that instead of warn().
So..
1)
If I use Carp shoud I still use warnings; in the package?
2)
If I understand it correctly the preffered way would be to do:

use Carp;
...
carp(Watch your monkey);

Instead of:
...
warn(Watch your monkey);

Is that a correct assumption?

3)
Should I just do 

use Carp(carp);
Since I'll only be calling carp() ( assuming carp() is warn()'s replacement in Carp.pm 
)

TIA

Dan

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



CGI remote_user versus user_name

2003-06-24 Thread Dan Muey

CGI's remote_user()
rturns $ENV{'REMOTE_USER'};
While 
sub user_name {
my ($self) = self_or_CGI(@_);
return $self-http('from') || $ENV{'REMOTE_IDENT'} || $ENV{'REMOTE_USER'};
}

SO if I'm trying to get the login name I should use user_name since it will return 
REMOTE_USER or REMOTE_IDENT

My question is:

What is $self-http('from') ?
Is it possible/likely that $self-http('from') or REMOTE_IDENT will have a value that 
is not their authentication username while REMOTER_USER might be but it will never get 
to REMOTE_USER since one of the others are defined?

I ask because In Perl in aNutshell it's says user_name() is unreliable but doesn't say 
that about remote_user.


TIA

Dan

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



duh RE: help sending hex EOL chars

2003-06-24 Thread McMahon, Christopher x66156
Answering my own question: 
 
my $eol = \r\n;
 
\r\n becomes 0D0A.   
-C 
 
-Original Message-
From: McMahon, Christopher x66156 
Sent: Tuesday, June 24, 2003 10:35 AM
To: '[EMAIL PROTECTED]'
Subject: help sending hex EOL chars


Hi...
My TCP/IP server is printing input fine, now I'm trying to send the
right output.  
The client for my server expects an EndOfLine character that is a hex
0D0A.  (zero-dee-zero-ay) My code is doing this:  
 
my $eol = \x{0D0A};
 
but the client is seeing this: 
 
E0B4 8A
 
Any idea what I'm doing wrong?  
-Chris   

_
This message and any attachments are intended only for the use of the addressee and
may contain information that is privileged and confidential. If the reader of the 
message is not the intended recipient or an authorized representative of the
intended recipient, you are hereby notified that any dissemination of this
communication is strictly prohibited. If you have received this communication in
error, please notify us immediately by e-mail and delete the message and any
attachments from your system.


Re: Use Carp in package

2003-06-24 Thread Jenda Krynicky
From: Dan Muey [EMAIL PROTECTED]
 I'm writing a simple module to return a few variables and functions.
 
 The perldoc perlmod* stuff says I should use Carp; and call that
 instead of warn(). So.. 1) If I use Carp shoud I still use warnings;
 in the package? 

Definitely. use Carp and use warnings are not as related as it 
may seem. use warnings is a pragma that controls the warnings 
issued by Perl itself, and use Carp allows you to issue a warning 
(or die) from perspective of caller. That is the message will contain 
the filename and line number of the call to your function, not of 
some line in the function itself. 

 2) If I understand it correctly the preffered way
 would be to do:
 
 use Carp;
 ...
 carp(Watch your monkey);
 
 Instead of:
 ...
 warn(Watch your monkey);

Depends. If you want to say the user of your module did something you 
don't like you should use carp(), if you fail doing somethig you 
should warn().

Depends on where do you want the user of your module to look.

 3)
 Should I just do 
 
 use Carp(carp);
 Since I'll only be calling carp() ( assuming carp() is warn()'s
 replacement in Carp.pm )

I guess you mean
use Carp qw(carp);

yes, you may do that.

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]



Re: Hi

2003-06-24 Thread John W. Krahn
Gayatri wrote:
 
 Thanks I got a solution.

Please reply in the original thread that you started.

 I was doing a silly mistake.
 chdir I was executing thro' system command like cd.

When you do that system creates a new process and any changes you make
in that process do not affect your currently running program.


John
-- 
use Perl;
program
fulfillment

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



Re: Use Carp in package

2003-06-24 Thread Tassilo von Parseval
On Tue, Jun 24, 2003 at 01:52:20PM -0500 Dan Muey wrote:

 I'm writing a simple module to return a few variables and functions.
 
 The perldoc perlmod* stuff says I should use Carp; and call that
 instead of warn().
 So..
 1)
 If I use Carp shoud I still use warnings; in the package?

Those two are independent of each other. Carp provides ways for you, the
programmer, do emit warnings and error messages. They'll show up no
matter whether warnings are in effect. Warnings on the other hand will
make the Perl interpreter emit messages when it has encountered
something warnings-worthy. It's the same as with warn(): You use that
indepently from warnings, too.

 2)
 If I understand it correctly the preffered way would be to do:
 
 use Carp;
 ...
 carp(Watch your monkey);
 
 Instead of:
 ...
 warn(Watch your monkey);
 
 Is that a correct assumption?

Yes, this is correct.

 3)
 Should I just do 
 
 use Carp(carp);
 Since I'll only be calling carp() ( assuming carp() is warn()'s
 replacement in Carp.pm )

That's up to you. Carp exports carp() and croak(). I usually end up
needing both after a while. 

Tassilo
-- 
$_=q#,}])!JAPH!qq(tsuJ[{@tnirp}3..0}_$;//::niam/s~=)]3[))_$-3(rellac(=_$({
pam{rekcahbus})(rekcah{lrePbus})(lreP{rehtonabus})!JAPH!qq(rehtona{tsuJbus#;
$_=reverse,s+(?=sub).+q#q!'qq.\t$.'!#+sexisexiixesixeseg;y~\n~~;eval


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



Re: duh RE: help sending hex EOL chars

2003-06-24 Thread Kevin Pfeiffer
In article [EMAIL PROTECTED], 
Christopher X66156 McMahon wrote:
[top post moved down]

 -Original Message-
 From: McMahon, Christopher x66156
 Sent: Tuesday, June 24, 2003 10:35 AM
 To: '[EMAIL PROTECTED]'
 Subject: help sending hex EOL chars
 
 
 Hi...
 My TCP/IP server is printing input fine, now I'm trying to send the
 right output.
 The client for my server expects an EndOfLine character that is a hex
 0D0A.  (zero-dee-zero-ay) My code is doing this:
  
 my $eol = \x{0D0A};
[...]

 Answering my own question:
  
 my $eol = \r\n;
  
 \r\n becomes 0D0A.
 -C

I don't know what module(s) you are using, but this reminds me of an article 
by Randall Schwartz I saw today that talks about IO::Socket::INET. It (for 
example) has an EOL method (CRLF) which he recommends as being more 
portable. There was also a picture. It's clear to me that as with radio 
djs, photographs of Perl gurus just get in the way of the virtual image we 
carry in our minds. ;-))

-- 
Kevin Pfeiffer
International University Bremen

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



RE: Use Carp in package

2003-06-24 Thread Dan Muey
Excellent, Thanks Jenda and Tassilo

Yeah I did mean qw() instead of () oops.

Thanks for the info, I think I will just use Carp; and take your 
wisdom and apply it's functions appropriately

Thanks again!

What a great list!!!


Dan

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



Re: Binary file conversion

2003-06-24 Thread John W. Krahn
Ned Cunningham wrote:
 
 HI all.

Hello,

 I have what appears to be a C++ file set (i.e. phone.dat, phone.idx).

That looks like a database file set.  The file command should tell you
what they are:

$ file phone.dat phone.idx

 My question is can Perl read these files and what modules do I need to do
 it.

perldoc AnyDBM_File


John
-- 
use Perl;
program
fulfillment

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



RE: CGI remote_user versus user_name

2003-06-24 Thread Dan Muey
 CGI's remote_user()
 rturns $ENV{'REMOTE_USER'};
 While 
 sub user_name {
 my ($self) = self_or_CGI(@_);
 return $self-http('from') || $ENV{'REMOTE_IDENT'} || 
 $ENV{'REMOTE_USER'}; }
 
 SO if I'm trying to get the login name I should use user_name 
 since it will return REMOTE_USER or REMOTE_IDENT
 
 My question is:
 
 What is $self-http('from') ?
 Is it possible/likely that $self-http('from') or 
 REMOTE_IDENT will have a value that is not their 
 authentication username while REMOTER_USER might be but it 
 will never get to REMOTE_USER since one of the others are defined?
 
 I ask because In Perl in aNutshell it's says user_name() is 
 unreliable but doesn't say that about remote_user.

No takers huh? Ok, I'll shorten it ;p

Any opinions trying to get the Authentication User Name from CGI this way:

my $user = remote_user() || user_name();

If I'm thinking right that would give me the best chance of getting the Auth name 
if there is one and if there is none then $user would be empty right? 

What is $self-http('from') in the CGI user_name function above?


 
 
 TIA
 
 Dan
 
 -- 
 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: multi-line matches / named.conf parsing

2003-06-24 Thread Jeff 'japhy' Pinyan
On Jun 24, Kevin Pfeiffer said:

 sed '/zone domain.com {/,/};/d' /etc/named.conf  newfile

 How might one do this in Perl?

 perl -ne 'print unless /zone domain.com {/ .. /};/' \
 /etc/named.conf  newfile

Cool, I didn't think of Perl's range operator ...

Don't be fooled.  Just because it looks like a duck doesn't mean it's a
duck.  In this case, the .. operator is the flip-flop operator.  In scalar
context, .. is flip-flop, while in list context, .. is range.

perldoc perlop

-- 
Jeff japhy Pinyan  [EMAIL PROTECTED]  http://www.pobox.com/~japhy/
RPI Acacia brother #734   http://www.perlmonks.org/   http://www.cpan.org/
stu what does y/// stand for?  tenderpuss why, yansliterate of course.
[  I'm looking for programming work.  If you like my work, let me know.  ]


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



Last Post today I swear - use in package

2003-06-24 Thread Dan Muey
Suppose I have a module:

package MyConfig;

use strict;
use warnings;

use CGI qw(:standard); # or user_name or one then other if fail?
use DBI;

use base 'Exporter';
use Carp;


Now in the script I have 

#!/usr/bin/perl

use MyConfig;
..

Will use strict and warnings still be in effect for the script?
Will I be able to use CGI and DBI and Carp as if I had use statements for 
them in my script or do I need to have use Module in the script before or 
after the use MyConfig; ?

This is last post for me today I swear!!!

;p

Thanks

Dan

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



Re: Last Post today I swear - use in package

2003-06-24 Thread Jenda Krynicky
From: Dan Muey [EMAIL PROTECTED]
 Suppose I have a module:
 
 package MyConfig;
 
 use strict;
 use warnings;
 
 use CGI qw(:standard); # or user_name or one then other if fail?
 use DBI;
 
 use base 'Exporter';
 use Carp;
 
 
 Now in the script I have 
 
 #!/usr/bin/perl
 
 use MyConfig;
 ..
 
 Will use strict and warnings still be in effect for the script?

No.

 Will I be able to use CGI and DBI and Carp as if I had use statements
 for them in my script or do I need to have use Module in the script
 before or after the use MyConfig; ?

1) You will be able to do
my $query = new CGI;
because the module IS loaded.

2) You wount be able to call
carp(some message);
because the carp() function was exported to the MyConfig package, not 
to package main.
You would have to call it using either
Carp::carp()
or
MyConfig::carp()

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]



RE: Last Post today I swear - use in package

2003-06-24 Thread Dan Muey
Cool, Thanks again Jenda, it's coming slowly, bit by bit.

Have a good one!

 From: Dan Muey [EMAIL PROTECTED]
  Suppose I have a module:
  
  package MyConfig;
  
  use strict;
  use warnings;
  
  use CGI qw(:standard); # or user_name or one then other if 
 fail? use 
  DBI;
  
  use base 'Exporter';
  use Carp;
  
  
  Now in the script I have
  
  #!/usr/bin/perl
  
  use MyConfig;
  ..
  
  Will use strict and warnings still be in effect for the script?
 
 No.
 
  Will I be able to use CGI and DBI and Carp as if I had use 
 statements 
  for them in my script or do I need to have use Module in the script 
  before or after the use MyConfig; ?
 
 1) You will be able to do
   my $query = new CGI;
 because the module IS loaded.
 
 2) You wount be able to call
   carp(some message);
 because the carp() function was exported to the MyConfig package, not 
 to package main.
 You would have to call it using either
   Carp::carp()
 or
   MyConfig::carp()
 
 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]
 
 

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



Reading from STDIN from a pipe

2003-06-24 Thread Jeff Westman
Hi,

I am trying to get my script to be able to read from the command line
arguments as well as take input from a pipe.  This is what I have basically:

#--- (begin) #
#!/bin/perl
use warnings;

sub parseFile()
{
while (F) {
# do some processing to the file
#  ...
}
}

if (@ARGV) {
# this part works fine
$file = shift;
open(F,  $file) or die cannot open file $file: $!\n;
parseFile(\*F);
close(F);
}
else {
# trying to read from a pipe, such as 'cat file | thisScript.pl'
parseFile(\*STDIN);
}

#--- (end) #

When I run this, as in 'cat myFile | thisScript.pl', I get:
Too many arguments for main::parseFile at ./x line 16, near *F)
Too many arguments for main::parseFile at ./x line 21, near *STDIN)

Help please.

Jeff



__
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
http://sbc.yahoo.com

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



Re: Reading from STDIN from a pipe

2003-06-24 Thread John W. Krahn
Jeff Westman wrote:
 
 Hi,

Hello,

 I am trying to get my script to be able to read from the command line
 arguments as well as take input from a pipe.  This is what I have basically:
 
 #--- (begin) #
 #!/bin/perl
 use warnings;
 
 sub parseFile()
 {
 while (F) {
 # do some processing to the file
 #  ...
 }
 }
 
 if (@ARGV) {
 # this part works fine
 $file = shift;
 open(F,  $file) or die cannot open file $file: $!\n;
 parseFile(\*F);
 close(F);
 }
 else {
 # trying to read from a pipe, such as 'cat file | thisScript.pl'
 parseFile(\*STDIN);
 }
 
 #--- (end) #
 
 When I run this, as in 'cat myFile | thisScript.pl', I get:
 Too many arguments for main::parseFile at ./x line 16, near *F)
 Too many arguments for main::parseFile at ./x line 21, near *STDIN)


Use the special  operator, it will automagically read from command
line files or pipes.

while (  ) {



John
-- 
use Perl;
program
fulfillment

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



RE: Last Post today I swear - use in package

2003-06-24 Thread Charles K. Clarkson
On Tuesday, June 24, 2003 at 4:15 PM, Dan Muey stated:
: 
: This is last post for me today I swear!!!

But . . .

On Tuesday, June 24, 2003 at 4:38 PM, Dan Muey posted:

: Cool, Thanks again Jenda, it's coming slowly,
: bit by bit.


Just can't trust that guy!  :)


Charles K. Clarkson
-- 
Head Bottle Washer,
Clarkson Energy Homes, Inc.
Mobile Home Specialists
254 968-8328



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



Re: Binary file conversion

2003-06-24 Thread Josimar Nunes de Oliveira
Hi all,

May be Cobol files (data and index files) too.

Josimar


- Original Message - 
From: Ned Cunningham [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, June 24, 2003 1:45 PM
Subject: Binary file conversion


 HI all.
 
 I have what appears to be a C++ file set (i.e. phone.dat, phone.idx).
 
 My question is can Perl read these files and what modules do I need to do
 it.
 
 Any starting help would be great.
 
 Thankx
 
 
 Ned Cunningham
 POS Systems Developer
 Monro Muffler Brake  Service
 200 Holleder Parkway
 Rochester, New York 14615
  (585) 647-6400 ext 310
 [EMAIL PROTECTED] 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: Reading from STDIN from a pipe

2003-06-24 Thread Gupta, Sharad
try doing this:

sub {
while ...
}

Look for the removed () around the declaration for sub, and u won't tell the sub 
that it takes no arguments.

-Sharad

-Original Message-
From: Jeff Westman [mailto:[EMAIL PROTECTED]
Sent: Tuesday, June 24, 2003 3:23 PM
To: beginners
Subject: Reading from STDIN from a pipe


Hi,

I am trying to get my script to be able to read from the command line
arguments as well as take input from a pipe.  This is what I have basically:

#--- (begin) #
#!/bin/perl
use warnings;

sub parseFile()
{
while (F) {
# do some processing to the file
#  ...
}
}

if (@ARGV) {
# this part works fine
$file = shift;
open(F,  $file) or die cannot open file $file: $!\n;
parseFile(\*F);
close(F);
}
else {
# trying to read from a pipe, such as 'cat file | thisScript.pl'
parseFile(\*STDIN);
}

#--- (end) #

When I run this, as in 'cat myFile | thisScript.pl', I get:
Too many arguments for main::parseFile at ./x line 16, near *F)
Too many arguments for main::parseFile at ./x line 21, near *STDIN)

Help please.

Jeff



__
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
http://sbc.yahoo.com

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


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



RE: Reading from STDIN from a pipe

2003-06-24 Thread Gupta, Sharad
Sorry for the mistake. It should look like:

sub parse {
while ..
}

-Sharad

-Original Message-
From: Gupta, Sharad 
Sent: Tuesday, June 24, 2003 5:58 PM
To: Jeff Westman; beginners
Subject: RE: Reading from STDIN from a pipe


try doing this:

sub {
while ...
}

Look for the removed () around the declaration for sub, and u won't tell the sub 
that it takes no arguments.

-Sharad

-Original Message-
From: Jeff Westman [mailto:[EMAIL PROTECTED]
Sent: Tuesday, June 24, 2003 3:23 PM
To: beginners
Subject: Reading from STDIN from a pipe


Hi,

I am trying to get my script to be able to read from the command line
arguments as well as take input from a pipe.  This is what I have basically:

#--- (begin) #
#!/bin/perl
use warnings;

sub parseFile()
{
while (F) {
# do some processing to the file
#  ...
}
}

if (@ARGV) {
# this part works fine
$file = shift;
open(F,  $file) or die cannot open file $file: $!\n;
parseFile(\*F);
close(F);
}
else {
# trying to read from a pipe, such as 'cat file | thisScript.pl'
parseFile(\*STDIN);
}

#--- (end) #

When I run this, as in 'cat myFile | thisScript.pl', I get:
Too many arguments for main::parseFile at ./x line 16, near *F)
Too many arguments for main::parseFile at ./x line 21, near *STDIN)

Help please.

Jeff



__
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
http://sbc.yahoo.com

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


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


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



RE: basic question: handling input to TCP/IP server

2003-06-24 Thread Gupta, Sharad
I got caught by something today. So i thought it would be worth mentioning to u.
Just before u do any sysread and syswrite u may also wish to check whether that 
socket is even available for them.
Else ur call to sysread/write may just block.


see perldoc IO::Select.

-Sharad

-Original Message-
From: Gupta, Sharad 
Sent: Monday, June 23, 2003 3:36 PM
To: 'McMahon, Christopher x66156'; [EMAIL PROTECTED]
Subject: RE: basic question: handling input to TCP/IP server


Something like this worked for me in the past:

use strict;
use IO::Socket::INET;
my $sock = IO::Socket::INET();

while(1) {
my $output;
my $n = sysread($sock,$output,1000);
last if(!defined($n));
print STDOUT $output;
}

And using syswrite() for writing.

perldoc -f sysread
perldoc -f syswrite

-Sharad

-Original Message-
From: McMahon, Christopher x66156 [mailto:[EMAIL PROTECTED]
Sent: Monday, June 23, 2003 3:06 PM
To: [EMAIL PROTECTED]
Subject: basic question: handling input to TCP/IP server


Hello all...
I've implemented the TCP/IP server at the top of p.441 of The Camel (3rd
edition) Chapter 16, and it's working fine.  That is, it opens the port I
tell it to, and other processes connect to it and happily send it stuff.
(This is using IO::Socket::INET).  
But now I'm a little confused about how to handle I/O over the TCP/IP
connection.  The first thing I'd like to do is to print incoming data to
STDOUT.  It seems that I have to manipulate the accept() statement, and I
probably have to use the angle operators, but I'm struggling to truly
understand what's going on here in order to get the syntax correct.  (I
figure if I can get a handle on manipulating the input, output will be
easy.)   
I'm continuing to hack at this, but any pointers to (simple!) TCP/IP
server behavior to speed me on my way would be welcome.  
Thanks, 
-Chris   

_
This message and any attachments are intended only for the use of the addressee and
may contain information that is privileged and confidential. If the reader of the 
message is not the intended recipient or an authorized representative of the
intended recipient, you are hereby notified that any dissemination of this
communication is strictly prohibited. If you have received this communication in
error, please notify us immediately by e-mail and delete the message and any
attachments from your system.

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



Re: SSH Problem

2003-06-24 Thread Wiggins d'Anconia
Rudolf Kliemstein wrote:
Hi all,

i have the following problem with the following script:

#!/usr/bin/perl -w
# $Id: cmd.pl,v 1.4 2001/02/22 00:14:48 btrott Exp $
use strict;

use Net::SSH::Perl;
use Net::SSH::Perl::Cipher;
chomp(my $this_host = `hostname`);
print Enter a host name to connect to: [$this_host] ;
chomp(my $host = STDIN);
print \n;
print Enter the port number of the remote sshd: [ssh] ;
chomp(my $port = STDIN);
print \n;
print Choose a cipher from the list:\n;
my $supp = Net::SSH::Perl::Cipher::supported();
for my $ciph (sort @$supp) {
printf [%d] %s\n, $ciph, Net::SSH::Perl::Cipher::name($ciph);
}
printf Enter a number: [%d] , Net::SSH::Perl::Cipher::id('IDEA');
chomp(my $c = STDIN);
print \n;
my $ssh = Net::SSH::Perl-new($host || $this_host,
port = $port || 'ssh',
cipher = Net::SSH::Perl::Cipher::name($c),
debug = 1);
my $this_user = scalar getpwuid($);
print Enter your username on that host: [$this_user] ;
chomp(my $user = STDIN);
use Term::ReadKey;

print And your password: ;
ReadMode('noecho');
chomp(my $pass = ReadLine(0));
ReadMode('restore');
print \n;
$ssh-login($user || $this_user, $pass);

print Enter a command to execute: [ls -l] ;
chomp(my $cmd = STDIN);
my($out, $err) = $ssh-cmd($cmd || ls -l);
print $out;
each time i run the script it gets me the error that the input into the 
crypt-module must be 8 byte long.when i replace the $cmd with a plain 
command e.g.: ls -l it works.Pls help me out.ThxRudi

What is the exact error given?  Does it happen for different 'cipher's? 
   You don't check for a successful login, are you sure a connection 
has been established?  You have debugging turned on, can you give us the 
output from it?

http://danconia.org

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


Re: perl expect

2003-06-24 Thread Wiggins d'Anconia
Jose Malacara wrote:
I have put together a script using the Perl Expect module to log into multiple hosts and execute a list of commands. I would like to be able to capture the output from each host and pattern match against it. The script (login and and issue commands) works fine, but I need some help on the capturing output piece. Is there a way to redirect from the standard out, within the script, into an array or something for parsing?

Also, if anyone knows of any good Perl Expect tutorials or demo pages, that would a big help.

What you are asking is basically the exact reason Expect was developed. 
 You should have another look at the Expect documentation, in 
particular the FAQ which can be found here:

http://search.cpan.org/author/RGIERSIG/Expect-1.15/Expect.pod

You may also want to have a look through the Expect forum archives here:

http://sourceforge.net/mailarchive/forum.php?forum=expectperl-discuss

My question would be are you sure you need to be using Expect at all? 
how are you logging into multiple hosts, etc.  Are you sure there isn't 
a module better suited to the task, Net::Telnet, Net::SSH::Perl, Net::FTP??

http://danconia.org



I assume it would probably happen at the point I issue my commands:

 snippet 
open COMMAND_FILE, $command_file or die Cannot open $command_file!\n;
while (COMMAND_FILE) {
chomp;
my $command = $_;
   $exp-send($command\r);
   $exp-expect($timeout, $command\r\n);
}
 snippet 


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