RE: IF statements and modules - do they mix?

2005-07-27 Thread Charles K. Clarkson
Dave Adams mailto:[EMAIL PROTECTED] wrote: : Does perl allow you to conditionally include a module? In general, you can load a module at runtime by using 'require' and manually running its import() sub routine. require Module; Module::import( 'Import list' ); : For example: : :

Messenger

2005-07-27 Thread Octavian Rasnita
Hi, Does anyone know a perl module that can be used for creating a Messenger client that really works? I have tried Net::YahooMessenger but it doesn't work. Thank you. Teddy -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

RE: IF statements and modules - do they mix?

2005-07-27 Thread Bob Showalter
Charles K. Clarkson wrote: Dave Adams mailto:[EMAIL PROTECTED] wrote: Does perl allow you to conditionally include a module? In general, you can load a module at runtime by using 'require' and manually running its import() sub routine. require Module; Module::import( 'Import list'

Help: automated email forwarding similar to .forward

2005-07-27 Thread Rich Fernandez
Hi folks, I'm working on a project where I'm given a pool of users and I have to determine if there are any messages in their spool files, and if so, forward them on to a new user. I'm looking for functionality similar to what you get with a .forward file, only I don't want the messages

MySQL in a for loop

2005-07-27 Thread David Foley
Hi Guys, Can you please look at the below script. The SQL query works on it's own in separate script. But not when it is put into the for loop in this script . Any ideas?? Thanks, David

Re: Help: automated email forwarding similar to .forward

2005-07-27 Thread MNibble
.forward is fine for that kind of thing, if you modify it to a pipe where a perl skript reads from. Then pass the message throw it, while doing what ever you like with it - for example sleep(3600) in fork / or threaded spawn of you programm. MNibble Rich Fernandez wrote: Hi folks, I'm

Re: MySQL in a for loop

2005-07-27 Thread David Van Ginneken
Few things that I can see. I'm sure others will give you more ideas. On 7/27/05, David Foley [EMAIL PROTECTED] wrote: Hi Guys, Can you please look at the below script. The SQL query works on it's own in separate script. But not when it is put into the for loop in this script

RE: Help: automated email forwarding similar to .forward

2005-07-27 Thread Rich Fernandez
Thanks for the reply, but what I need to do is hang onto the messages for an indefinite period of time, maybe days, during which time the box might get rebooted, crash, etc. I can't rely on a process sleeping. richf -Original Message- From: MNibble [mailto:[EMAIL PROTECTED] Sent:

Indirect method invocation

2005-07-27 Thread Jan Eden
Hi, it does not seem to be possible to use indirect method invocation with anything but a scalar. While this works: my $mode = $parameters{mode}; $item-$mode(); I cannot seem to find a proper bracketing to make this work: $item-$parameters{mode}(); Is my assumption correct? My other problem

login shell?

2005-07-27 Thread Bryan R Harris
Is there a way to determine in perl whether the current script was run from a login shell or not? - B -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response

Re: Indirect method invocation

2005-07-27 Thread Jan Eden
Hi, Jan Eden wrote on 27.07.2005: In other words, I would like to have something like the %actions hash to construct a more flexible version of the $item-$mode() construct, where I can pass different additional parameters to each method. I finally came up with something myself: my %actions = (

Re: Help: automated email forwarding similar to .forward

2005-07-27 Thread Wiggins d'Anconia
Because it's up-side down. Why is that? It makes replies harder to read. Why not? Please don't top-post. - Sherm Pendley, Mac OS X list Rich Fernandez wrote: Thanks for the reply, but what I need to do is hang onto the messages for an indefinite period of time, maybe days, during which time the

Re: Indirect method invocation

2005-07-27 Thread Xavier Noria
On Jul 27, 2005, at 17:21, Jan Eden wrote: My other problem is that the cookbook quotes (something like) the following code as an example for storing method names: my %actions = ( display = $item-display(), move_picture = $item-move_picture($item-{id}, $item- {parameters}-{position}),

Re: login shell?

2005-07-27 Thread Jeff 'japhy' Pinyan
On Jul 27, Bryan R Harris said: Is there a way to determine in perl whether the current script was run from a login shell or not? As opposed to what, specifically? I'd say a good place to check is $ENV{SHELL}. If that's defined, chances are it was run from a shell. I would not expect it

Re: Indirect method invocation

2005-07-27 Thread Randal L. Schwartz
Jan == Jan Eden [EMAIL PROTECTED] writes: Jan I finally came up with something myself: But that's no longer a method call. You can do an indirect method call, but it needs to be a simple scalar: my $method = $parameters{mode}; $object-$methods(@args); -- Randal L. Schwartz - Stonehenge

Re: login shell?

2005-07-27 Thread Jay Savage
On 7/27/05, Bryan R Harris [EMAIL PROTECTED] wrote: Is there a way to determine in perl whether the current script was run from a login shell or not? - B that depends what you mean by login shell. You can use $ENV{SHELL} to find out what shell, if any, invoked the the current

Re: login shell?

2005-07-27 Thread Bryan R Harris
Thanks for the tips, guys. The %ENV hash suggestion worked -- I'm actually writing a filter for BBEdit (OS X) that I also want to work from the command line, and also on IRIX boxes. Turns out that all CLIs have $ENV{TERM} defined, but within BBEdit it's not. But turns out it doesn't matter

Adding a library to @INC

2005-07-27 Thread Jay Caviness
I have discovered that my Oracle installation has the DBI.pm module in it. I really want to use this, but don't know how to have the @INC see it when I do: oracle perl -e use DBI; Can't locate DBI.pm in @INC (@INC contains: /usr/perl5/5.6.1/lib/sun4-solaris-64int /usr/perl5/5.6.1/lib

Re: Adding a library to @INC

2005-07-27 Thread Stephen Mayer
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Jay, You need to set the PERL5LIB path to include the directory of the DBI.pm module. Steve Jay Caviness wrote: I have discovered that my Oracle installation has the DBI.pm module in it. I really want to use this, but don't know how to have

Re: Adding a library to @INC

2005-07-27 Thread Wiggins d'Anconia
Jay Caviness wrote: I have discovered that my Oracle installation has the DBI.pm module in it. I really want to use this, but don't know how to have the @INC see it when I do: oracle perl -e use DBI; Can't locate DBI.pm in @INC (@INC contains: /usr/perl5/5.6.1/lib/sun4-solaris-64int

open file s/ / /;

2005-07-27 Thread Brian Volk
Hi all, Can someone pls take a look at the script below and explain what I'm doing wrong.. The script runs w/out errors but the substitution is not working.. Hopefully the note below will be enough info.. I was able to print the file names that I wanted but once I tried to open the file

RE: Help: automated email forwarding similar to .forward

2005-07-27 Thread Rich Fernandez
Thanks Wiggins, As far as reading the message in, parsing it, and then forwarding it, I guarantee the Mail::Box suite can handle what you want, but it does have a learning curve. You are right, I did not read the doco carefully enough. Sorry. Sorry I can't provide source what I wrote was

Re: open file s/ / /;

2005-07-27 Thread John W. Krahn
Brian Volk wrote: Hi all, Hello, Can someone pls take a look at the script below and explain what I'm doing wrong.. The script runs w/out errors but the substitution is not working.. Hopefully the note below will be enough info.. I was able to print the file names that I wanted but

Re: IF statements and modules - do they mix?

2005-07-27 Thread Scott R. Godin
Dave Adams wrote: Does perl allow you to conditionally include a module? For example: #!/usr/bin/perl -w use strict; my $DEBUG = 0; if (DEBUG) { use diagnostics; } my $filename = test$$.txt; open (FH , $filename) || die error: $!; print (FH hi); close (FH); Although this is a simple and

Re: IF statements and modules - do they mix?

2005-07-27 Thread John W. Krahn
Scott R. Godin wrote: Dave Adams wrote: Does perl allow you to conditionally include a module? For example: #!/usr/bin/perl -w use strict; my $DEBUG = 0; if (DEBUG) { use diagnostics; } my $filename = test$$.txt; open (FH , $filename) || die error: $!; print (FH hi); close (FH);

RFC: functionality/features of an IRC client

2005-07-27 Thread Jeff 'japhy' Pinyan
I'm writing a module called IRC::Client which I expect to be The Next Big Thing when it comes to Perl and IRC (if not IRC altogether!). The module abstracts the concepts related to IRC into objects, such as Channel, User, Server, Client. The goal is to make an IRC module that can be used to

Re: Help: automated email forwarding similar to .forward

2005-07-27 Thread Jay Savage
On 7/27/05, Rich Fernandez [EMAIL PROTECTED] wrote: Thanks Wiggins, As far as reading the message in, parsing it, and then forwarding it, I guarantee the Mail::Box suite can handle what you want, but it does have a learning curve. You are right, I did not read the doco carefully

RE: MySQL in a for loop

2005-07-27 Thread Charles K. Clarkson
David Van Ginneken mailto:[EMAIL PROTECTED] wrote: : : #Get and process mail : : for my $messageID (90){ : What exactly is this supposed to do? If you just run this : for my $messageID (90){ : print $messageID . \n; : } : It outputs nothing.. Actually, it outputs 90\n. There is no reason

Re: login shell?

2005-07-27 Thread JupiterHost.Net
Bryan R Harris wrote: Is there a way to determine in perl whether the current script was run from a login shell or not? if(-t STDIN) { print Hello terminal\n; } else { print Content-type: text/html\n\n; print Hello bBrowser/b\n; } HTH :) -- To unsubscribe, e-mail: [EMAIL

Re: Messenger

2005-07-27 Thread JupiterHost.Net
Octavian Rasnita wrote: Hi, Does anyone know a perl module that can be used for creating a Messenger client that really works? I have tried Net::YahooMessenger but it doesn't work. Have you searched cpan for the messenger you want to use? -- To unsubscribe, e-mail: [EMAIL PROTECTED] For

system v backticks

2005-07-27 Thread Keenan, Greg John (Greg)** CTR **
Hi, Can someone explain the difference between backticks and system when evaluated in this if statement: sub getDate { print start date\n; if ( system(/bin/date) ) { print can't get date\n; exit(2); } print finish date\n; } Returns the following: start date Thu Jul 28 12:13:59 EST

Re: system v backticks

2005-07-27 Thread Wiggins d'Anconia
Keenan, Greg John (Greg)** CTR ** wrote: Hi, Can someone explain the difference between backticks and system when evaluated in this if statement: The difference really isn't specific to this context, it is the inherent difference between the two that is affecting the outcome. perldoc -f

Re: system v backticks

2005-07-27 Thread Jeff 'japhy' Pinyan
On Jul 28, Keenan, Greg John (Greg)** CTR ** said: sub getDate { print start date\n; if ( system(/bin/date) ) { print can't get date\n; exit(2); } print finish date\n; } system() executes a command, and returns the shell's error code. 0 indicates success, non-0 indicates failure. It

RE: skip/delete lines with dup keys

2005-07-27 Thread Jim
-- # file already sorted by $id my $cur_id = ''; while (F) { chomp; ($id,$score,$bal) = split (/,/, $_); next if $cur_id == $id; print OUT $id,$score,$bal\n; $cur_id = $id; } Don't fix it if it's not broken. :-) Thanks John and Jeff. Just