Re: Feedback, please

2009-12-08 Thread Uri Guttman
> "SB" == Steve Bertrand writes: SB> Uri Guttman wrote: >>> "t" == trapd00r writes: >> t> I would like to have someone looking over my script, which is a t> basic frontend for playing radio with mplayer. In particular, I'm t> wondering how I could get rid of all those elsif

Re: Feedback, please

2009-12-08 Thread Steve Bertrand
Uri Guttman wrote: >> "t" == trapd00r writes: > > t> I would like to have someone looking over my script, which is a > t> basic frontend for playing radio with mplayer. In particular, I'm > t> wondering how I could get rid of all those elsif's when parsing the > t> arguments; as you

Re: Feedback, please

2009-12-08 Thread Uri Guttman
> "t" == trapd00r writes: t> I would like to have someone looking over my script, which is a t> basic frontend for playing radio with mplayer. In particular, I'm t> wondering how I could get rid of all those elsif's when parsing the t> arguments; as you can see, there's lots of them,

Feedback, please

2009-12-08 Thread trapd00r
Hello, I would like to have someone looking over my script, which is a basic frontend for playing radio with mplayer. In particular, I'm wondering how I could get rid of all those elsif's when parsing the arguments; as you can see, there's lots of them, and I suspect that there's a better way of

Re: passing Hash to subroutine help please

2009-12-08 Thread Jeff Pang
John W. Krahn: Jeff Pang wrote: Noah: sub exiting { my ($hostname, %login) = @_; Passing arguments like this has no such problem. But you'd better pass the hash as a reference to the subroutine. exitint($hostname, \%login); sub exiting { my $hostname = shift; my %login = %{+shi

Re: passing Hash to subroutine help please

2009-12-08 Thread John W. Krahn
Jeff Pang wrote: Noah: sub exiting { my ($hostname, %login) = @_; Passing arguments like this has no such problem. But you'd better pass the hash as a reference to the subroutine. exitint($hostname, \%login); sub exiting { my $hostname = shift; my %login = %{+shift}; What is t

Re: passing Hash to subroutine help please

2009-12-08 Thread Steve Bertrand
Jeff Pang wrote: > Noah: > >> >> sub exiting { >> my ($hostname, %login) = @_; > > Passing arguments like this has no such problem. > But you'd better pass the hash as a reference to the subroutine. ...or bundle _all_ parameters into a hashref, which I've found to be oh so extensible, wi

Re: passing Hash to subroutine help please

2009-12-08 Thread Jeff Pang
Noah: sub exiting { my ($hostname, %login) = @_; Passing arguments like this has no such problem. But you'd better pass the hash as a reference to the subroutine. exitint($hostname, \%login); sub exiting { my $hostname = shift; my %login = %{+shift}; ... } print "logi

Re: passing Hash to subroutine help please

2009-12-08 Thread Jim Gibson
On 12/8/09 Tue Dec 8, 2009 5:41 PM, "Noah" scribbled: > > Hi there List people, > > I am hoping to send a hash and a scalar to a subroutine but the variable > is not completely being sent. Below is the error message below is > showing something is not getting passed that well to the subrouti

passing Hash to subroutine help please

2009-12-08 Thread Noah
Hi there List people, I am hoping to send a hash and a scalar to a subroutine but the variable is not completely being sent. Below is the error message below is showing something is not getting passed that well to the subroutine. Looks like %login is empty. --- snip --- $ret{$hostnames[0]

Re: Custom install target in Makefile.PL

2009-12-08 Thread Steve Bertrand
Steve Bertrand wrote: > Hi all, > > I'm trying to customize a Makefile.PL with a custom install target. > > What I'd like is to have a 'make install', but have it ONLY install the > .pm files. It's becoming a pain to have to install everything with every > small change ;) > > I don't quite under

Re: Email does not send attachment ...

2009-12-08 Thread Robert H
On 12/8/09 3:56 PM, Tony Esposito wrote: Hello, I am using Perl 5.8 on WindowsXP and Windows Server 2003. I can not get the following attachment to arrive/attach even though I get the email with no issues. Any ideas? use MIME::Lite; use Net::SMTP; unless (-e 'C:/my_file.log'&& -s '

Re: Email does not send attachment ...

2009-12-08 Thread Robert H
On 12/8/09 3:56 PM, Tony Esposito wrote: Hello, I am using Perl 5.8 on WindowsXP and Windows Server 2003. I can not get the following attachment to arrive/attach even though I get the email with no issues. Any ideas? use MIME::Lite; use Net::SMTP; unless (-e 'C:/my_file.log'&& -s '

Custom install target in Makefile.PL

2009-12-08 Thread Steve Bertrand
Hi all, I'm trying to customize a Makefile.PL with a custom install target. What I'd like is to have a 'make install', but have it ONLY install the .pm files. It's becoming a pain to have to install everything with every small change ;) I don't quite understand how I can override the install tar

Email does not send attachment ...

2009-12-08 Thread Tony Esposito
Hello, I am using Perl 5.8 on WindowsXP and Windows Server 2003.  I can not get the following attachment to arrive/attach even though I get the email with no issues.  Any ideas?   use MIME::Lite;  use Net::SMTP;    unless (-e 'C:/my_file.log' && -s 'C:/my_file.log' ) { print "file not found\n"

Re: Aw: Re: Eval scoping question

2009-12-08 Thread Shawn H Corey
pa...@arcor.de wrote: > Well, the OP said the method name is changing during the running time, so he > want to eval the method name. > So a AUTOLOAD method is right for him as far as I can think. AUTOLOAD introduces the possibility of code injection. So does eval. If the code is running on a ser

Aw: Re: Eval scoping question

2009-12-08 Thread pangj
- Original Nachricht Von: Shlomi Fish An: beginners@perl.org Datum: 08.12.2009 12:08 Betreff: Re: Eval scoping question > On Tuesday 08 Dec 2009 12:18:10 Jeff Pang wrote: > > Shlomi Fish: > > > On Tuesday 08 Dec 2009 11:46:59 Jeff Pang wrote: > > >> Shlomi Fish: > > >>> Re

Re: Eval scoping question

2009-12-08 Thread Shlomi Fish
On Tuesday 08 Dec 2009 12:18:10 Jeff Pang wrote: > Shlomi Fish: > > On Tuesday 08 Dec 2009 11:46:59 Jeff Pang wrote: > >> Shlomi Fish: > >>> Regarding using string eval "" - you can do the same using > >>> UNIVERSAL::can, which would be safer in this case: > >>> > >>> > >>> __PACKAGE__->can("a

Re: About the perl index function question

2009-12-08 Thread Majian
Thanks Dermot and erez.schatz I got it ~ On Tue, Dec 8, 2009 at 4:59 PM, Erez Schatz wrote: > 2009/12/8 Majian : > > my $s = "The black cat jumped from the green tree"; > > print index $s, "e", 3 The result is 18 > > It's slightly confusing, but if you get the idea behind it, it's > actuall

Re: Eval scoping question

2009-12-08 Thread Jeff Pang
Shlomi Fish: On Tuesday 08 Dec 2009 11:46:59 Jeff Pang wrote: Shlomi Fish: Regarding using string eval "" - you can do the same using UNIVERSAL::can, which would be safer in this case: __PACKAGE__->can("asub")->(@params); or define a package and use AUTOLOAD method? How will the AUTOL

Re: Eval scoping question

2009-12-08 Thread Shlomi Fish
On Tuesday 08 Dec 2009 11:46:59 Jeff Pang wrote: > Shlomi Fish: > > Regarding using string eval "" - you can do the same using > > UNIVERSAL::can, which would be safer in this case: > > > > > > __PACKAGE__->can("asub")->(@params); > > or define a package and use AUTOLOAD method? > How will

Re: Eval scoping question

2009-12-08 Thread Jeff Pang
Shlomi Fish: Regarding using string eval "" - you can do the same using UNIVERSAL::can, which would be safer in this case: __PACKAGE__->can("asub")->(@params); or define a package and use AUTOLOAD method? -- Jeff Pang http://home.arcor.de/pangj/ -- To unsubscribe, e-mail: beginner

Re: Eval scoping question

2009-12-08 Thread Erez Schatz
2009/12/8 Anders Hartman : >>> Hello, >>> I which to use eval to execute subroutines dynamically. >>> The following code snippet fails: >>> >>> #!/usr/bin/perl >>> >>> use strict; >>> use warnings; >>> >>> sub asub { >>>  our $abc; >>>  print $abc; >>> } >>> >>> my $abc = "abc\n"; >>> eval "asub";

Re: Eval scoping question

2009-12-08 Thread Shlomi Fish
On Tuesday 08 Dec 2009 11:03:44 Anders Hartman wrote: > Jeff Pang skrev: > > Anders Hartman: > >> Hello, > >> > >> I which to use eval to execute subroutines dynamically. > >> > >> The following code snippet fails: > >> > >> > >> #!/usr/bin/perl > >> > >> use strict; > >> use warnings; > >> > >> su

Re: Eval scoping question

2009-12-08 Thread Anders Hartman
Jeff Pang skrev: Anders Hartman: Hello, I which to use eval to execute subroutines dynamically. The following code snippet fails: #!/usr/bin/perl use strict; use warnings; sub asub { our $abc; print $abc; } my $abc = "abc\n"; eval "asub"; exit 0; I don't think you want an eval here

Re: About the perl index function question

2009-12-08 Thread Erez Schatz
2009/12/8 Majian : > my $s = "The black cat jumped from the green tree"; > print index $s, "e", 3 The result is 18 It's slightly confusing, but if you get the idea behind it, it's actually very simple: counting from 0, the string "The black cat jumped from the green tree" has an 'e' at the 2

Re: Eval scoping question

2009-12-08 Thread Jeff Pang
Anders Hartman: Hello, I which to use eval to execute subroutines dynamically. The following code snippet fails: #!/usr/bin/perl use strict; use warnings; sub asub { our $abc; print $abc; } my $abc = "abc\n"; eval "asub"; exit 0; I don't think you want an eval here. use strict; use

Eval scoping question

2009-12-08 Thread Anders Hartman
Hello, I which to use eval to execute subroutines dynamically. The following code snippet fails: #!/usr/bin/perl use strict; use warnings; sub asub { our $abc; print $abc; } my $abc = "abc\n"; eval "asub"; exit 0; with the error: Use of uninitialized value in print at ... asub shoul

About the perl index function question

2009-12-08 Thread Majian
Hi,all : I have a problem about the perl index function , the problem is the following : #!/usr/bin/perl use strict ; my $s = "The black cat jumped from the green tree"; print index $s, "e", 3 The result is 18 I don't understand the result clearly ,Could someone help me to explain