Filehandle for Output from System Command in Perl
Is there a filehandle/handle for the output of a system command I execute in Perl? ...
Is there a filehandle/handle for the output of a system command I execute in Perl? ...
I have a method calling localtime that I wrote a unit test for. I seed the call to localtime in my test so that I know the expected answers. So far, so good. I happen to run the unit test on a machine in a different timezone and, predictably, the tests fail, because they're some # of hours off. I suppose I could dynamically determine...
Hi, I am trying to do some process control in a script (bash). For this reason I output the process group id of the current process to a file. ps ax -o '%p %r'|perl -ne 'if ($_ =~ /\s*$$\s*(\d+)/) { print "$1"; exit; }' > $pgidfile nohup $JAVA_HOME/bin/java -cp somejar.jar some.java.Program & > /dev/null 2>&1 I have also tried: ps ...
Last year I dabbed in a bit of perl programming. The first thing I wrote was a simple script that took a web page and found out how many times a word or name was on that page. I refer to this as "crawling" is that correct?. I was wondering If this is a native process for other languages like PHP and ROR. Essentially I want to build my ow...
There are very good Perl libraries (e.g. Apache::Admin::Config) to operate on traditional unix config files like httpd.conf. Anyone know if there is good Java libraries to do the similar task? I know there is a c library called Augeas with Java binding. Has anyone used that before? Thanks! ...
EDIT: I will try a better explication this time, this is the exact code from my script (sorry for all them coments, they are a result of your sugestions, and apear in the video below). #use warnings; #use Data::Dumper; open(my $tmp_file, ">>", "/tmp/some_bad.log") or die "Can not open log file: $!\n"; #if( $id_client != "") @allowed_lo...
hi I need to find the complement of this: $_ = 'aaaaabaaabaaabacaaaa'; while( /([a][a][a][a])/gc){ next if pos()%4 != 0; my $b_pos = (pos()/4)-1; print " aaaa at :$b_pos\n"; } That is, a suite of 4 caracters that is not 'aaaa'. The following doesn't work $_ = 'aaaaabaaabaaabacaaaa'; while( /([^a][^a][^a][^a])/gc){ ...
I have used Spreadsheet::WriteExcel for creating spreadsheet report. I tried to merge some cells using merge_range() function. $worksheet->merge_range(3,5,9,4,$title, $format); [OR] $worksheet->merge_range('E3:I4',$title, $format); $worksheet->write('F6',"LANGUAGE",$format); it shows the error message like the foll...
Is there any function to import a C library (.so) file in the Solaris operating system? In Windows I can use Win32::API, how about Solaris? Thank you. ...
Could someone provide links for tutorial about libwhisker library? ...
This seems really simple but it is giving me a hard time figuring it out as I'm new to perl.. I've been looking through a lot of documentation now about loops and I am still stumped by this... I have a sub that contains a where loop and I want to use a variable value from within the loop outside of the loop (after the loop has run), howe...
For example : File 1: Apple Orange grapes File 2: Orange grapes Apple I am trying to check whether both files have the same data in different order. How to do it without using any external module? ...
I'm working on a world clock web application, and I'd like to add a function to note how and when each location will next undergo a DST change. I'm using the DateTime and DateTime::Timezone CPAN modules, which seem to provide every conceivable function apart from this one! DateTime::Timezone is an implementation of the tz/Olson database...
Is there a way to use NetBeans or Eclipse for an old Perl CGI application in a Windows environment? I currently have NetBeans for PHP. NOTE: I am a .NET dev and have done PHP back in the day. I know very little about CGI, I just need to modify an existing legacy app. ...
Hi, I have seen code like this package xyz; # putting the module inside its own pair of braces { public _foo => my %_foo; public _bar => my %_bar; # some subroutines.. } 1; My question is what exactly is the meaning of the declaration public _foo => my %_foo; I mean how is the public keyword used, and why are we using ...
I wrote the following Perl script (below) in order to create simple XML file. The generated output is valid, but I have specific formatting requirements for the generated XML source code. How can I change my script to add the whitespace I desire? #!/usr/bin/perl use warnings; use XML::LibXML; my $doc = XML::LibXML::Document->new; ...
Whats going on here? I thought SIGINT would be sent to the foreground process group. (I think, maybe, that system() is running a shell which is creating a new process group for the child process? Can anyone confirm this?) % perl local $SIG{INT} = sub { print "caught signal\n"; }; system('sleep', '10'); Then hit ctrl+d then ctrl+c im...
The following script print some characters. how to print the characters to file ( for example /var/tmp/file ) Yael #!/usr/bin/perl @myNames = ('one', 'two', 'three' , 'A' , 'B' , 'C' , 'D' , 'E'); foreach (@myNames) { print "$_\n"; } ...
ExtUtils::MakeMaker splits PERL_MM_OPT on whitespace, which means that something like the following will not work. export PERL_MM_OPT='LIBS="-L/usr/sfw/lib -lssl -lcrypto" INC=/usr/sfw/include' Is there a known workaround for this, or will I have to avoid using PERL_MM_OPT in this scenario? -- update -- mobrule came up with the exce...
I've been looking around but can't figure this out.. I figured out how to do a perl execution of a shell script, such as: #!/usr/bin/perl $cmd = "nautilus"; system $cmd; However, I want to do a shell script execution from perl that would do something like this on the command line: su $password nautilus So it would become root, then...