Re: Net::SFTP causes script to exit if connection can't be made

2002-12-16 Thread Dave Storrs
Zentara is right about what you need to do, but a fuller explanation of the solution would have been: Net::SFTP is throwing an exception when it cannot make the connection. If the exception is not caught, it will cause your program to exit. The way you catch exceptions in Perl is to wrap the

Re: Why does this code fail? - Sorry here are the line numbers..

2002-12-16 Thread Dave Storrs
On Sat, Dec 14, 2002 at 12:51:50PM -0500, [EMAIL PROTECTED] wrote: Can somebody tell what is wrong with this. I tried single quote (') in place of double quote() neither of them work. 184 for ($i = 0; $i @clm_types; $i++) 185 { 186@temp_str = grep (/$_/,@env_desc); 187@fields =

context of function calls

2002-03-28 Thread Dave Storrs
Hey folks, Executive summary: It looks like, no matter what context foo() is called in, its arguments are always evaluated in list context. Is this correct? I had always understood that: - a function's arguments were evaluated in the same context as the context of the function

Re: aritmetic operators

2002-03-25 Thread Dave Storrs
Hi Matthew, First of all, subtracting scalars is perfectly valid, so the actual error must be something else. Here are three things you should check. 1) First, you don't have a semicolon at the end of that line. 2) Second, if you are operating under 'use strict', you will need to predeclare

Re: Sort of Conceptual, Syntax, and modules related questions

2002-03-23 Thread Dave Storrs
Hi Connie, On Sat, Mar 23, 2002 at 05:30:25AM +0800, Connie Chan wrote: 1. When I open a text file with *lines, however, I just want to read the first line, would this be a good idea ? open (FILE, textfile.txt); $firstline = FILE; close (FILE); would this process run till EOF, or

Re: tie/bless interactions?

2002-03-14 Thread Dave Storrs
was giving the APC::Event a has-a relationship with the Tie::DBI, and then delegating (through AUTOLOAD) calls to the Tie::DBI. It ended up working great! Dave Storrs -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

tie/bless interactions?

2002-03-13 Thread Dave Storrs
, am I likely to have any problems with circular references? Thanks in advance, Dave Storrs PS If you wanted to rewrite the code snippet in question 4 without taking a reference, how would you do it? This doesn't seem right: unshift @self{ISA}, 'APC::Event'; -- To unsubscribe, e

Re: Test Automation

2001-11-27 Thread Dave Storrs
Check CPAN for: Test::Unit Test::Simple Test::More and a few others. Dave On Mon, 26 Nov 2001, Ahmed Moustafa Ibrahim Ahmed wrote: Hi Everybody, How can I automate the process of testing my Perl script? Is there a standard way to do? Is there a tool for testing Perl scripts? Your

Re: directories

2001-11-21 Thread Dave Storrs
Any of the following should work for you: if ( -e $dirpath -d $dirpath ) { ...stuff...} if ( -e $dirpath -d _ ) { ...stuff...} if ( -d $dirpath ) { ...stuff...} You can always substitute $dirpath for a literal string path in the above as well...e.g.: if ( -d '/usr/bin/home' ) { ... stuff

RE: Modules

2001-11-16 Thread Dave Storrs
In practical daily use, use(); is preferred as since it compiles the module as soon as it sees 'use Foo::Bar;' before moving on, this will catch errors and scope conflicts far sooner than if you use require(); There aren't many good reasons to use require, at least I can't think of

Re: capture song title

2001-11-16 Thread Dave Storrs
On Fri, 16 Nov 2001, KeN ClarK wrote: I want to capture the title of the current song I have running on my box through mpg123 and redirect it to a file. In this process, I don't want the /long/path/to/song but just the song.mp3. Is it possible to capture the song title this way? Ken

RE: What was your first PERL script (was Off-Topic (200%) - Whereare you from?)

2001-11-14 Thread Dave Storrs
Mine was to write a document-management system for Paine Webber. Of course, I had the advantage of working with two or three other Perl programmers, all of whom were substantially skilled. Still, that was how I first got exposed to the language. (AFAIK, PW is still using that system; they

Re: Updating a hash using a refernece?

2001-11-14 Thread Dave Storrs
On Tue, 13 Nov 2001, AMORE,JUAN (HP-Roseville,ex1) wrote: How do I update the value pointed to by key PAGER from more to pg. when using a reference only to the hash element for key PAGER. %Unix= (SHELL = /bin/csh, PAGER = more, DB = mysql); print Value: , $unix{PAGER}; Are

Re: Off-Topic (200%) - Where are you from?

2001-11-13 Thread Dave Storrs
At the moment, New York, a.k.a. Terrorist Target Number #1 :/ Dave -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: installing modules

2001-11-13 Thread Dave Storrs
On Tue, 13 Nov 2001, Rahul Garg wrote: i have actually got the solution. if i have the module Bar.pm in directory '/usr/home/rahul/myMod' then in the perl script that uses this module i have to include the statement use lib '/usr/home/rahul/myMod' ; use Bar ; Thanks, Rahul Yep,

Re: vars as key/value in a hash

2001-11-09 Thread Dave Storrs
FYI, Tyler, the reason that this will do what you want is because you're original program wasn't doing what you thought. %stations = ( $names[0] = $names[1] ); This creates a list of two elements and assigns it to the hash named %stations. Therefore, $names[0] becomes the one and only

Re: SecureCRT + Perl

2001-11-09 Thread Dave Storrs
Um...not sure what you're asking for here. I use SecureCRT all the time (using it right now, in fact), and I do in fact write Perl while securely telnetted into various machines. What do you want to do? Dave On Thu, 8 Nov 2001, A. Rivera wrote: Has anyone tried to use SecureCRT with

Re: installing modules

2001-11-09 Thread Dave Storrs
Since I suspect your next question would be Ok, then how do I install the CPAN module? let me head this one off. The CPAN module (CPAN.pm) comes with the basic distro of Perl, so you should already have it. Say you want to install the CGI.pm module from CPAN. At your command line, you type:

Re: regexp with $ARGV

2001-11-08 Thread Dave Storrs
On Mon, 5 Nov 2001, Martin Karlsson wrote: Thanks a lot for your help and your time! I think I've got it solved now. You're welcome. : Could any of you recommend a good book for (learning) Perl? There seems to be quite a few to choose from... Oddly enough, that's what

OT: dB pooling in Perl (was Re: Perl with Java)

2001-11-04 Thread Dave Storrs
On this subject: I am currently trying to sell Perl in my (highly Java-biased) shop, and having an uphill battle of it. One of the things that the brass wants to see is support for database connection pooling in a multi threaded environment. Now, I'm sure that Perl can do this, but it isn't

Re: regexp with $ARGV

2001-11-04 Thread Dave Storrs
Martin, I'm not entirely clear on what you're trying to do here, so if this doesn't help, let me know and I'll try again. I think the problem is that you're doing this: s/$ARGV[0]/\($ARGV[0]\)/g ...when you want to affect $ARGV[0]. But remember that s/// and m// are,

(Slightly OT) RE: terminating input

2001-11-04 Thread Dave Storrs
On Sun, 4 Nov 2001, Gary L. Armstrong wrote: I am amazed. How does someone figure out that you can do this sort of thing? chomp($value[++$i] = STDIN); I mean, $value[++$i]? That really works? Crazy. [...] Well, that's mostly a C-style issue (and yes, it is crazy). C

Re: merging two hashes together?

2001-11-03 Thread Dave Storrs
In the example you provide, this will work: -START %h1 = (one = 1, two = 2, three = 3); %h2 = (four = 4, five = 5, six = 6); # Note that the '' on function calls is optional, unlike $, @, and % $ref_h3 = mergehash(_, _); sub mergehash { my ($rh_first,

Re: HOw do I create a package:

2001-11-03 Thread Dave Storrs
With all due respect, this list is here to help beginner perl programmers deal with programming problems, not to do people's homework for them. (The 'hp.com' address (which prominently dispalys an ad for hp's online university) is a bit of a giveaway.) Read this: perldoc perlmod Dave On

Re: Access MS SQL using DBI / DBD

2001-11-01 Thread Dave Storrs
Hi Pathi, There is an excellent book from O'Reilly _Programming the Perl DBI_. It has a leopard on the cover, and it should answer every question you could possibly desire concerning the DBI. HTH, Dave On Tue, 30 Oct 2001, Erramilli, Pathi (P.) wrote: Hi, I am new to

RE: Anyone know to how use subroutines to add or multiply numbers :How would I modify my file:

2001-10-18 Thread Dave Storrs
; } sub add { my @list = @_; my $sum = 0; $sum += $_ foreach (@list); } # = This was missing sub multiply { my @list = @_; my $prod = 1; $prod *= $_ foreach (@list); } Dave Storrs -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL

Re: XMLParser and Perl

2001-10-18 Thread Dave Storrs
Go to http://search.cpan.org/ and type XML into the search box. There are a whole bunch of XML modules that will make your life much easier. In general, go to CPAN and look for a module is the answer to most problems in Perl...the number of modules is HUGE, and no matter what you need, there is

Re: Unable to display output

2001-10-18 Thread Dave Storrs
On Wed, 17 Oct 2001, nafiseh saberi wrote: in perl , if u want see in screen must write : print \n; before things you want to to print. I mean that you must print one empty line and then print things u wants __ Best regards .