Re: manipulating configuration files package, object oriented? moose?

2011-02-03 Thread Octavian Rasnita
From: "Jim Green" Hello: I am confronted with a task of creating a package to manipulate a set of configuration files. for example I need to setup up a server and need to change lots of configuration files and create necessary sections, change values in the file etc. Also sometimes I modify th

Re: Renaming with a specific spec

2011-02-03 Thread Brandon McCaig
On Thu, Feb 3, 2011 at 4:59 PM, Harry Putnam wrote: > May I ask how that formulation servers the purpose better?  Is it > processed more easily or quicker in that formulation as against the > one I posted? > > Or does mine leave too many possibilities for poor results? Yours just wasn't very prec

manipulating configuration files package, object oriented? moose?

2011-02-03 Thread Jim Green
Hello: I am confronted with a task of creating a package to manipulate a set of configuration files. for example I need to setup up a server and need to change lots of configuration files and create necessary sections, change values in the file etc. Also sometimes I modify the server set up and n

Re: Renaming with a specific spec

2011-02-03 Thread Harry Putnam
Jim Gibson writes: > This line assigns an upper-case letter to $d if $d has a value greater > than or equal to 10. A value of 10 is replaced by 'A', 11 by 'B', etc. > > $d = chr($d + ord('A') - 10) if $d >= 10; > > You can try changing that 'A' to 'a' and see what you get. I haven't > tried t

Re: Renaming with a specific spec

2011-02-03 Thread Harry Putnam
Brandon McCaig writes: > On Thu, Feb 3, 2011 at 10:47 AM, Harry Putnam wrote: >> I used this in my crude little starter program as one part of a >> foreach loop: >> >>  if ( !/^.*\.[bjgtp][gimnps][gfadp]$/) { >>    print "<$_> is not a properly named image file .. skipping\n"; >>    next; >>  }

Re: reference noob

2011-02-03 Thread Uri Guttman
> "PK" == Parag Kalra writes: PK> print "$field\n" what would that supposedly do to help with the question? and please bottom post. this is a good example. your one line of code should be BELOW the code it replaces or purports to fix. thanx, uri -- Uri Guttman -- u...@stemsyst

Re: reference noob

2011-02-03 Thread Jim Gibson
On 2/3/11 Thu Feb 3, 2011 5:05 AM, "Téssio Fechine" scribbled: > The program: > -- > #use strict; > use warnings; > > my $field = shift @ARGV; > my $regex = '(\w+)\s*' x $field; > > while () { > if (/$regex/) { > print "$$field\n"; # refers to a match variable > } > } > -- > > Example Usage:

Re: reference noob

2011-02-03 Thread Parag Kalra
print "$field\n" ~Parag 2011/2/3 Téssio Fechine > The program: > -- > #use strict; > use warnings; > > my $field = shift @ARGV; > my $regex = '(\w+)\s*' x $field; > > while () { >if (/$regex/) { >print "$$field\n"; # refers to a match variable >} > } > --

Re: reference noob

2011-02-03 Thread Uri Guttman
> "TF" == Téssio Fechine writes: TF> The program: TF> -- TF> #use strict; TF> use warnings; TF> my $field = shift @ARGV; TF> my $regex = '(\w+)\s*' x $field; TF> while () { TF> if (/$regex/) { TF> print "$$field\n"; # refers to a match variable TF> }

Re: reference noob

2011-02-03 Thread Shawn H Corey
On 11-02-03 08:05 AM, Téssio Fechine wrote: The program: -- #use strict; use warnings; my $field = shift @ARGV; my $regex = '(\w+)\s*' x $field; while () { if (/$regex/) { print "$$field\n";# refers to a match variable } } -- Example Usage: -- $ echo 'Strang

reference noob

2011-02-03 Thread Téssio Fechine
The program: -- #use strict; use warnings; my $field = shift @ARGV; my $regex = '(\w+)\s*' x $field; while () { if (/$regex/) { print "$$field\n"; # refers to a match variable } } -- Example Usage: -- $ echo 'Strange New World!' | ./this_program 3 $ World --

repost : installing CPAN modules as part of application stack

2011-02-03 Thread Mark Meyer
Hello all, I need to include CPAN modules as part of our custom "application stack" installation. I was thinking that I would just include the tar gz files as part of the application stack, then have my install scripts un-archive the modules, then call make. is this too simple of an

Re: Renaming with a specific spec

2011-02-03 Thread Brandon McCaig
On Thu, Feb 3, 2011 at 10:47 AM, Harry Putnam wrote: > I used this in my crude little starter program as one part of a > foreach loop: > >  if ( !/^.*\.[bjgtp][gimnps][gfadp]$/) { >    print "<$_> is not a properly named image file .. skipping\n"; >    next; >  } > > Just so I'd have output so as

Re: Renaming with a specific spec

2011-02-03 Thread Jim Gibson
At 9:47 AM -0600 2/3/11, Harry Putnam wrote: Rob Dixon writes: Hey Harry As Jim says, there is very little chance that you will find an existing module that conforms to such a tight specification, but such a facility is trivial to write. Take a look at the program below and see if it >

Re: custom module and lib

2011-02-03 Thread Octavian Rasnita
If you got a solution, it could be helpful for those who will find this thread on the web if you would explain what you did. Octavian -- From: "a b" > Thanks a lot all for your views!! i got my solution > > Regards, > a b > > On Mon, Jan 31, 2011 at 10:48 PM, Rob Dixon wrote: > >> On 31/01/2

Re: Renaming with a specific spec

2011-02-03 Thread Harry Putnam
Rob Dixon writes: > Hey Harry > > As Jim says, there is very little chance that you will find an existing > module that conforms to such a tight specification, but such a facility > is trivial to write. Take a look at the program below and see if it > helps you with a solution. [...] Skipped nif

Win32::Job, wait until timeout, but capture all output

2011-02-03 Thread Filip Sneppe
Hi, I am writing a script that executes external command that may hang. I want to capture all output produced by the external command and continue with my perl code after a certain execution timeout for the external program. Since I am running the script on Windows, I cannot use any ALARM mechanis

Re: regular expression for special html characters

2011-02-03 Thread John Delacour
At 18:52 +0800 03/02/2011, Jeff Pang wrote: 2011/2/2 Shlomit Afgin : > I tried to convert html special characters to their real character. > For example, converting    ”      to     "   . > > I had the string > $str = "“ test ” ÈÒÈÂÔ†¢ª > The string contain also Hebrew letters. Could E

Re: custom module and lib

2011-02-03 Thread a b
Thanks a lot all for your views!! i got my solution Regards, a b On Mon, Jan 31, 2011 at 10:48 PM, Rob Dixon wrote: > On 31/01/2011 09:27, a b wrote: > >> >> Making it more clear. >> >> I want to make tar ball which contains my perl scripts and no other >> dependencies required. like Net::Rsh,

Re: regular expression for special html characters

2011-02-03 Thread Shawn H Corey
On 11-02-02 04:25 AM, Shlomit Afgin wrote: I tried to convert html special characters to their real character. For example, converting” to " . I had the string $str = "“ test” ניסיון "; The string contain also Hebrew letters. This seems to work: #!/usr/bin/perl use strict; use war

Re: regular expression for special html characters

2011-02-03 Thread Jeff Pang
2011/2/2 Shlomit Afgin : > > > Hello, > > I tried to convert html special characters to their real character. > For example, converting    ”      to     "   . > > I had the string > $str = "“ test ” ניסיון "; > The string contain also Hebrew letters. > Could Encode work on it? use Encode; $new =

Re: Need help in Expect Module

2011-02-03 Thread Zaheer Abbas
Thanks a lot Parag.. That was indeed helpful... On Thu, Jan 20, 2011 at 11:50 AM, Parag Kalra wrote: > Snippet of what I understand from your requirement: > > parag@ubuntu-studio:~$ cat app > #!/bin/bash > if [ $# -ne 1 ] > then >echo -e "Invalid number of input\nUsage: app " >exit 1 > e

regular expression for special html characters

2011-02-03 Thread Shlomit Afgin
Hello, I tried to convert html special characters to their real character. For example, converting” to " . I had the string $str = "“ test ” ניסיון "; The string contain also Hebrew letters. 1. first I did: $str = decode_entities($str); It convert the special characters