Extracting value from regex

2016-06-09 Thread Punit Jain
Hi , Below is the problem I am facing : #!/usr/bin/perl my @str = ('mailto:y...@gmail.com','ldap:///uid=user1,ou=People,o=test.com '); foreach (@str) { # split off ldaps and mailtos my @addr = $_ =~ /ldap:\/\/\/(.+)|mailto:(.+)/; print $1; } When i run

XML Sructure creation not working

2015-11-20 Thread Punit Jain
Hi, I am facing an issue with my script while creating a XML . Below is required structure :- xyz true Distri 123 However I am getting below o/p xyz true Distri 123 My current code is :- #!/usr/bin/perl

Re: Problem with regex

2014-10-06 Thread punit jain
Thanks Paul. However I think I couldnot explain the problem. The issue is when I have mailid's as well as a part of input stream. Input stream ---> $str="ldap:///uid=user1,ou=People,o=test.com,a...@test.com ,t...@test.com,r...@test.com,ldap:///uid=user2,ou=People,o=test.com ,ldap:///uid=user3,ou

Problem with regex

2014-10-06 Thread punit jain
Hi, I have a regex problem. My current working program is like this :- #!/usr/bin/perl *$str='ldap:///uid=user1,ou=People,o=test.com ,mailto:us...@test.com ,ldap:///uid=user2,ou=People,o=test.com ,ldap:///uid=user3,ou=People,o=test.com ';* whi

Log4Perl query

2014-03-28 Thread punit jain
Hi, I have a requirement where I need different appenders writing to same log file for different layout patterns. Below is my log4Perl config file :- log4perl.logger.timestamp = INFO, LOG1 log4perl.appender.LOG1 = Log::Log4perl::Appender::File log4perl.appender.LOG1.filename

Re: Regex not working correctly

2013-12-11 Thread punit jain
That answers my question. Thanks Robert

Re: Regex not working correctly

2013-12-11 Thread punit jain
Thanks Shlomi, thats a good idea. However at the same time I was trying to understand if something is wrong in my regex. Why would $2 capture the number as I have used :- (?:(91\d{10}|0\d{10}|[7-9]\d{9}|0\d{11})|(?:(?:ph|cal)(\d+))) This would in my understanding match either number with regex 91

Regex not working correctly

2013-12-11 Thread punit jain
Hi, I have a requirement where I need to capture phone number from different strings. The strings could be :- 1. COMP TEL NO 919369721113 for computer science 2. For Best Discount reach 092108493, from 6-9 3. Your booking Confirmed, 9210833321 4. price for free consultation call92504060 5.

Re: File:: Find help

2013-01-10 Thread punit jain
I think the issue is as you mentioned exporting find from File::Find::Rule. However File::Find I am not sure I will get that flexibility to search only 1 level depth. On Thu, Jan 10, 2013 at 6:07 PM, David Precious wrote: > On Thu, 10 Jan 2013 17:56:18 +0530 > punit jain wrote: > &

File:: Find help

2013-01-10 Thread punit jain
Hi, I have a requirement where I have directory structure like : - test --> test/user1/files/, test/user2/files/, test/user3/files/ etc. under sub-directories with usernames I have file with name usersettings. So the final structure as : - test / user1 / usersettings /files/

File::Find help

2013-01-10 Thread punit jain
Hi, I have a requirement where I have directory structure like : - test --> test/user1/files, test/user2/files, test/user3/files etc. under sub-directories with usernames I have file with name usersettings. So the final structure as : - test / user1 / usersettings user2 / usersettings

Regex help needed

2013-01-08 Thread punit jain
Hi , I have a file as below : - { test = ("test123"); test = ("test123","abc"); test = ("test123","abc","xyz"); } { test1 = ("passfile"); test1 = ("passfile","pasfile1"); test1 = ("passfile","pasfile1","user"); } and so on The requirement is to have the file parsing so that final output is

Regex issue

2013-01-03 Thread punit jain
Hi, I am facing issues in parsing using Regex. The problem definition is as below : - A file with data :- BEGIN country Japan passcode 1123 listname sales contact ch...@example.com contact m...@example.com END BEGIN country Namibia passcode 9801 listname dept contact l...@example.com END BEGIN

grouping in regex

2012-12-23 Thread punit jain
Hi, I am doing grouping but seeing some weird behavior :- the strings in a file are like :- AccessModes = (18,Mail,POP,IMAP,PWD,WebMail,WebSite,Relay,Mobile,FTP,MAPI,TLS,LDAP,WebCAL); ... . multiple lines I am seeing which lines have both POP and Webmail as below :- if( $line =~ /AccessMod

Regex help

2012-12-22 Thread punit jain
Hi, I have a file like below : - BEGIN:VCARD VERSION:2.1 EMAIL:te...@test.com FN:test1 REV:20101116T030833Z UID:644938456.1419. END:VCARD >From <>(S___-0003) Tue Nov 16 03:10:15 2010 content-class: urn:content-classes:person Date: Tue, 16 Nov 2010 11:10:15 +0800 Subject: test Message

Re: DBM::Deep dilemma

2012-08-08 Thread punit jain
Thanks Rob, I was using wrong syntax. I now have another issue :- my $db = new DBM::Deep( file => "hash.db", locking => 1, autoflush => 1 ); I want to reuse the same hash.db next time I run rather than recreate hash.db from scratch using new. Is it

Using existing db in DBM::Deep

2012-08-08 Thread punit jain
Hi , I am using DBM::Deep to store my HoH. my $db = new DBM::Deep( file => "hash.db", locking => 1, autoflush => 1 ); I want to reuse the same hash.db next time I run rather than recreate hash.db from scratch using new. Is it possible to do so ? R

DBM::Deep dilemma

2012-08-07 Thread punit jain
I am using DBM::Deep for the reason it support multilevel hashes, however I ended up in situation where I am getting error while retrieving values from keys :- Can't use string ("test1") as a HASH ref while "strict refs" use Parallel::ForkManager; use DBM::Deep; my $db = new DBM::Deep(

Re: tie an existing hash with BerkleyDB

2012-08-06 Thread punit jain
>First of all, one should note that BerkeleyDB can only handle hashes where the keys and the values are all strings I saw DBM::Deep but not sure it would be a better option for such situation. Anyone recommends using that module for such situations ?

tie an existing hash with BerkleyDB

2012-08-06 Thread punit jain
Hi, I have a program where a subroutine creates a hash. I want to later tie it to BerkleyDB. my $users = {}; my $entry = {}; my $env = new BerkeleyDB::Env -Home => $tmp_dir, -Flags => DB_CREATE|DB_INIT_CDB|DB_INIT_MPOOL or die "cannot open environment: $BerkeleyDB::Error\

updating variable in Parent using Parallel::ForkManager

2012-07-30 Thread punit jain
Hi, I am facing an issue. Below is code snippet : - my $pm = new Parallel::ForkManager(10); my $count=0; foreach my $user (@users) { $pm->start($user) and next; my $result; --- do some processing --- $pm->finish(0, \$result); }

Re: Multiprocessing script

2012-07-26 Thread punit jain
Thanks everyone. This is really helpful. Major concern was in situation where we use multiprocessing I don't end up creating zombies. If the logic is correct I think I can go ahead with Shlomi's advice to fix other parts. Best Regards.

Multiprocessing script

2012-07-25 Thread punit jain
Hi, Below is my script where alarm is generated after 15 sec and changes the global variable in parent from 0 to 1. Is there any mistake in my multiprocess approach with time-based stop ? #!/usr/bin/perl use strict; use warnings; use Parallel::ForkManager; my $MAX_PROC=2; $|++; my $stopFlag=0;

Re: Time based processes

2012-07-25 Thread punit jain
Hi Below is my script where alarm is generated after 15 sec and changes the global variable in parent from 0 to 1. Is there any mistake in my multiprocess approach with time-based stop ? #!/usr/bin/perl use strict; use warnings; use Parallel::ForkManager; my $MAX_PROC=2; $|++; my $stopFlag=0; m

Re: Storage using Storable

2012-07-23 Thread punit jain
Another query, might sound stupid, however if my sub-processes are changing different key values for a hash where one subprocess key is different from the other, does it still cound under multiple writer ? Dov we need to worry on multiple writers to same datastructure or same field in a datastructu

Re: Time based processes

2012-07-21 Thread punit jain
> > > for my $step ( @steps ) { >last if $STOP; > > > I would think the issue here is if the list is 30K long and we are still > at 2K why would be really like to process whole list ? > We can die or handle exit of the script gracefully in my understanding. > > Is my understanding correct here

Re: Time based processes

2012-07-21 Thread punit jain
Also for :- > for my $step ( @steps ) { last if $STOP; I would think the issue here is if the list is 30K long and we are still at 2K why would be really like to process whole list ? We can die or handle exit of the script gracefully in my understanding.

Re: Time based processes

2012-07-21 Thread punit jain
For the case which you mentioned :- >You can let the ALRM-sub simply set a global variable, like $STOP. Your process should check this before starting a next iteration. I suppose this needs to be set in parent process which means Signal needs to be invoked in parent. Is my understanding correct ?

Time based processes

2012-07-21 Thread punit jain
Hi, I have a requirement where I need to run my perl script for x hours ( which should be configurable ). Since the script processes thousand's of accounts, it will definitely take more than x hrs. There are 2 parts of question : - *(A) How to stop after x hours. I cannot run under crontab as X

Re: Storage using Storable

2012-07-21 Thread punit jain
Thanks!!! really helpful

Storage using Storable

2012-07-20 Thread punit jain
Hi , I have a multiple processes which are modifying hash of hash of array. For multiprocessing I am using Parallel::ForkManager The requirement is I set Max processes to say 5. Each process is fired by the script and max 5 parallel process runs and it performs some actions on a complex datastruc

Concatenation in Perl

2012-07-19 Thread punit jain
Hi , I am doing a concat operation in Perl for a string like below : - if( @folders ) { map {$query .= "not in:$_ and"; } @folders; print "\n $query \n"; } @folders contain - Inbox, Sent Output from above is - *not in:Inbox and not in:Sent and* Expected is = *not in:Inbox and not

Query regarding Parallel::ForkManager

2012-03-30 Thread punit jain
Hi , I am using ForkManager module for multiprocessing in my code below : - use Parallel::ForkManager; $pm = new Parallel::ForkManager($MAX_PROCESSES); foreach $data (@all_data) { # Forks and returns the pid for the child: my $pid = $pm->start and next; ... do some work with $d

Module error

2012-02-15 Thread Punit Jain
Hi, I am running my perl script and using some perl modules like below :- use File::Path qw(mkpath); use File::Rsync; my $rsync = '/opt/zimbra/rsync/bin/rsync'; when I run the script using perl scriptname --> then it runs fine, however when I run through crontab, it get this error : - Can't

Re: Rsync doesnot work

2012-02-14 Thread Punit Jain
? Regards, Punit - Original Message - From: "Jeff Peng" To: beginners@perl.org Sent: Tuesday, February 14, 2012 11:11:18 AM Subject: Re: Rsync doesnot work 于 2012-2-14 13:14, Punit Jain 写道: > This works manually if I run this script however under crontab it doesnot. >

Rsync doesnot work

2012-02-13 Thread Punit Jain
Hi , I have a quick question on Rsync. I am doing a rsync to remote server using code below : - use File::Rsync; my $source= "/backup/$TodaysDate"; my $ssh_server = '192.168.0.xxx'; my $destination = '/backup/data/'; my $rsync_obj = File::Rsync->new ( { 'rsync-path'=> $rsync, 'arch

Re: Unable to install module from CPAN

2011-10-27 Thread Punit Jain
> Looks good > Writing Makefile for ExtUtils::MakeMaker > Writing MYMETA.yml and MYMETA.json > -- NOT OK >This is not good. How are you running cpan? Are you running it as a non-root >user? What is your operating system, distribution and version? Are you using >the system's built-in perl? Are

Re: Unable to install module from CPAN

2011-10-24 Thread Punit Jain
Any help ? I am unable to install it. Regards, Punit - Original Message - From: "Punit Jain" To: "Rob Dixon" Cc: beginners@perl.org Sent: Monday, October 24, 2011 9:16:40 PM Subject: Re: Unable to install module from CPAN Yes I did. See the erorrs below:- Remo

Re: Unable to install module from CPAN

2011-10-24 Thread Punit Jain
Yes I did. See the erorrs below:- Removing previously used /root/.cpan/build/ExtUtils-MakeMaker-6.59 CPAN.pm: Going to build M/MS/MSTROUT/ExtUtils-MakeMaker-6.59.tar.gz Using included version of ExtUtils::Manifest (1.58) as it is newer than the installed version (1.46). Using included version

Unable to install module from CPAN

2011-10-23 Thread Punit Jain
Hi , I tried to install ExtUtils-CBuilder from CPAN however I get this error :- CPAN.pm: Going to build D/DA/DAGOLDEN/ExtUtils-CBuilder-0.280202.tar.gz ExtUtils::MakeMaker version 6.31 required--this is only version 6.30 at Makefile.PL line 7. BEGIN failed--compilation aborted at Makefile.PL