Any Good SCM tool to manage Perl Code locally
Hi All, Although it is not related to Perl directly and might be little strange question but still thought of consulting Perl gurus. Here is the thing - I mainly code in Perl and Bash and I don't use any SCM tool. And the reason I don't use it is because even if I configure a SCM server - I should be able to access it both from home and work place (which is unlikely to happen) So wanted to know if it is a possible to use any free opensource tool to manage code (only locally) where actual and current code resides in different local directory and I can checkout code locally in some other directory (in my working directory) Cheers, Parag
would like "pure" Perl solution to count of files in directory (nested subdirectories too)
Hi; Re: would like "pure" Perl solution to count of files in directory (nested subdirectories too) I would like to have a "pure" Perl solution to "find dir | wc -l" find2perl x * #! /usr/bin/perl -w eval 'exec /usr/bin/perl -S $0 ${1+"$@"}' if 0; #$running_under_some_shell use strict; use File::Find (); # Set the variable $File::Find::dont_use_nlink if you're using AFS, # since AFS cheats. # for the convenience of &wanted calls, including -eval statements: use vars qw/*name *dir *prune/; *name = *File::Find::name; *dir= *File::Find::dir; *prune = *File::Find::prune; sub wanted; # Traverse desired filesystems File::Find::find({wanted => \&wanted}, 'x'); exit; sub wanted { my ($dev,$ino,$mode,$nlink,$uid,$gid); (($dev,$ino,$mode,$nlink,$uid,$gid) = lstat($_)) && print("$name\n"); } * Ok that's cool... But maybe there's a way to change "print" to be "$count++" or something like that. So I tried that. I have strict and warnings on and I get: "$filecount won't stay shared". But it comes up with the same result as "find x | wc -l". Anybody got a platform-dependent pure-Perl recursive-descent file counter (I wanted symlinks and dirs too)? I didn't find anything like this on CPAN. Thanks, Ken Wolcott
Re: Read line by line from a file & search each line on another file
manu wrote: Want to do a perl program - Read from file 1 - line1, line2etc Search line1 on file2 (all lines) Then Search line 2 on file 2... Ouput results of search. perldoc -q "How can I read in an entire file all at once" perldoc -q "How do I efficiently match many regular expressions at once" John -- The programmer is fighting against the two most destructive forces in the universe: entropy and human stupidity. -- Damian Conway -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: process restriction
perlperl wrote: > Has anyone seen "not enough space" error while executing command in > perl scrip > > $processid = open OUT, "$cmd 2>&1 |" or die "$!" ; > > is there any restriction on maximum number of process running on > solaris? > > The normal error message is, "too many processes" This usually happens when your sysadmin sets the process quota. UNIX allows up to 32767 processes. Normally only a few hundred are running at one time so it's not likely to happen unless the quota has been set. "not enough space" usually refers to disk space. Try `df` and see if one of your disks is near 100% -- Just my 0.0002 million dollars worth, Shawn Programming is as much about organization and communication as it is about coding. I like Perl; it's the only language where you can bless your thingy. Eliminate software piracy: use only FLOSS. -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: Read line by line from a file & search each line on another file
manu wrote: > Want to do a perl program - > > Read from file 1 - line1, line2etc > Search line1 on file2 (all lines) > Then Search line 2 on file 2... > > Ouput results of search. > > What code do you have so far? -- Just my 0.0002 million dollars worth, Shawn Programming is as much about organization and communication as it is about coding. I like Perl; it's the only language where you can bless your thingy. Eliminate software piracy: use only FLOSS. -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
process restriction
Has anyone seen "not enough space" error while executing command in perl scrip $processid = open OUT, "$cmd 2>&1 |" or die "$!" ; is there any restriction on maximum number of process running on solaris? -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Read line by line from a file & search each line on another file
Want to do a perl program - Read from file 1 - line1, line2etc Search line1 on file2 (all lines) Then Search line 2 on file 2... Ouput results of search. -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: ':content_cb' give what to subroutine?
On Sat, Mar 13, 2010 at 12:31 AM, Uri Guttman wrote: > > "r" == raphael() writes: > > r> Hi, > r> -- CODE -- > > r> use strict; > r> use warnings; > r> use WWW::Mechanize; > r> use File::Basename; > r> use Number::Bytes::Human qw(format_bytes); > > r> # CODE GOES ON HERE TILL > > r> open( my $file2write, '>', "$base" ); > r> binmode $file2write; > > r> my $b; > r> $wmc->get( > r> "$link", > r> ':content_cb' => sub { > > r> my ($c, $r) = @_;# what are $c and $r > > well, what is $wmc? it is some object with a get method but we can't see > where it gets created. its docs should say what get() does and what args > it takes. the coder is doing a very bad thing by using single char var > names which are evil in almost all cases ($i being the exception but i > never use it either if i can help it). descriptive names would help here > but i can guess that $r is the result of a mechanize fetch and $c is the > actual content. i could be wrong. it feels like partial content being > passed to a callback sub (the 'cb' in content_cb stands for callback as > it does get a sub ref for an arg). > > r> $b += length($c); > r> if ($r->content_length) { > r> printf STDERR "${base}${extension} -> %.2f%% : %s of %s > \r", > r> 100. * $b / $r->content_length, > r> format_bytes($b), > r> format_bytes($r->content_length); > r> } > > r> I got this snippet on perlmonks. It's a kind of progress bar. I > r> want to know what is being passed to @_ by ':content_cb' ?? > > r> my ($c, $r) = @_; > > r> what are $c and $r? > > as i said, you need to backtrace the code to see what $wmc is, then > search its docs for what get does and the content_cb code ref arg looks > like and what args it takes. several levels back but all very > doable. this is a good skill to learn, how to trace back what code is > doing when the code isn't well written or documented. > > and this is why writing code that can be easily read by others is > important. the coder wrote for himself but you always should write code > for others! > > uri > > -- > Uri Guttman -- u...@stemsystems.com http://www.sysarch.com-- > - Perl Code Review , Architecture, Development, Training, Support > -- > - Gourmet Hot Cocoa Mix http://bestfriendscocoa.com- > Hello Uri, Sorry for the late reply! $wmc is just a WWW::Mechanize useragent. my $wmc = WWW::Mechanize->new ( agent => 'Mozilla/5.0', timeout => '15', requests_redirectable => ['GET', 'HEAD'], max_redirect => '9', autocheck => '0', ); I am still not getting it as to how this code works. I will read the LWP *docs* tonight. PS - I always comment my code though I am the only one reading it weeks later (duh)! Comments and good variable name are *damn important*. Reading another guy's commented code makes my blood pressure rise, talk about single char variable code! Also thanks Peter "LWP::UserAgent" manual it is tonight. Though to tell the truth reading all these docs make my head hazy!
Re: ':content_cb' give what to subroutine?
On Fri, 12 Mar 2010 17:38:30 +0530, raphael() wrote: > use WWW::Mechanize; > my $b; > $wmc->get( > "$link", > ':content_cb' => sub { > > I got this snippet on perlmonks. It's a kind of progress bar. I want to > know what is being passed to @_ by ':content_cb' ?? Look in the documentation for LWP::UserAgent. WWW::Mechanize inherits from it. -- Peter Scott http://www.perlmedic.com/ http://www.perldebugged.com/ http://www.informit.com/store/product.aspx?isbn=0137001274 http://www.oreillyschool.com/courses/perl1/ -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/