comp.lang.perl.misc
  Home FAQ Contact Sign in
comp.lang.perl.misc only
 
Advanced search
January 2008
motuwethfrsasuw
 123456 1
78910111213 2
14151617181920 3
21222324252627 4
28293031    5
2008
 Jan   Feb   Mar   Apr 
 May   Jun   Jul   Aug 
 Sep   Oct   Nov   Dec 
2008 2007 2006  
total
comp.lang.perl.misc Profile…
RELATED GROUPS

POPULAR GROUPS

more...

 Up
  Re: perl -pe substitution         


Author: Joe Smith
Date: Jan 20, 2008 20:48

Asim Suter wrote:
> `perl -pe 's/\@VERSION\@/1.2.3.4/g' -i $input_file` ;
>
> Which chnages the content in $input_file to
>
> ABC1.2.3.4VERSION1.2.3.4DEF
>
> Why the difference in the two cases ?
>
> What do I need to do to get bahavior like Case 1 in Case 2 ?
>
> I'd suspect some special interpretation of @ at play but it's escaped

It's not escaped to the shell nor to the second invocation of perl.

@VERSION = qw(aaa bbb);
$_ = `echo perl -pe 's/\@VERSION\@/1.2.3.4/g' -i $input_file`;
$_ = `echo perl -pe 's/\\@VERSION\\@/1.2.3.4/g' -i $input_file`;
$_ = `echo perl -pe 's/\\\@VERSION\\\@/1.2.3.4/g' -i $input_file`;
system qq{perl -pe 's/\\\@VERSION\\\@/1.2.3.4/g' -i $input_file};
Show full article (0.89Kb)
no comments
  Re: call back to my own script         


Author: Gunnar Hjalmarsson
Date: Jan 20, 2008 18:25

burrell.john@yahoo.com wrote:
> I have the following code

I notice that you are using CGI.pm's start_form() method.
> I want to call back to the same cgi code on the same server -

That's what should happen when start_form() is called without
parameters, as in your case.
> but on
> submit I merely get the relative path appended to the original URL.

I'm not able to reproduce that behaviour. Can you give us more details?

--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
4 Comments
  FAQ 8.39 How do I set CPU limits?         


Author: PerlFAQ Server
Date: Jan 20, 2008 18:03

This is an excerpt from the latest version perlfaq8.pod, which
comes with the standard Perl distribution. These postings aim to
reduce the number of repeated questions as well as allow the community
to review and update the answers. The latest version of the complete
perlfaq is at http://faq.perl.org .

--------------------------------------------------------------------

8.39: How do I set CPU limits?

(contributed by Xho)

Use the "BSD::Resource" module from CPAN. As an example:

use BSD::Resource;
setrlimit(RLIMIT_CPU,10,20) or die $!;

This sets the soft and hard limits to 10 and 20 seconds, respectively.
After 10 seconds of time spent running on the CPU (not "wall" time), the
process will be sent a signal (XCPU on some systems) which, if not
trapped, will cause the process to terminate. If that signal is trapped,
then after 10 more seconds (20 seconds in total) the process will be
killed with a non-trappable signal.

See the "BSD::Resource" and your systems documentation for the gory
details.
Show full article (1.68Kb)
no comments
  How do you use IPC::Open3....         


Author: grocery_stocker
Date: Jan 19, 2008 14:11

to start a process in the background? I'm drawing a total blank.
no comments
  xml-to-word document         


Author: Moti
Date: Jan 19, 2008 13:16

Hi all,
I would like to perform xml-to-word conversion. Is there a perl module
that can perform it?
If not, maybe there are other ways to do it ..
Thanks in advance, Moti.
1 Comment
  FAQ 8.8 How do I get the screen size?         


Author: PerlFAQ Server
Date: Jan 19, 2008 12:03

This is an excerpt from the latest version perlfaq8.pod, which
comes with the standard Perl distribution. These postings aim to
reduce the number of repeated questions as well as allow the community
to review and update the answers. The latest version of the complete
perlfaq is at http://faq.perl.org .

--------------------------------------------------------------------

8.8: How do I get the screen size?

If you have Term::ReadKey module installed from CPAN, you can use it to
fetch the width and height in characters and in pixels:

use Term::ReadKey;
($wchar, $hchar, $wpixels, $hpixels) = GetTerminalSize();

This is more portable than the raw "ioctl", but not as illustrative:
Show full article (1.87Kb)
no comments
  FAQ 8.21 Where do I get the include files to do ioctl() or syscall()?         


Author: PerlFAQ Server
Date: Jan 19, 2008 06:03

This is an excerpt from the latest version perlfaq8.pod, which
comes with the standard Perl distribution. These postings aim to
reduce the number of repeated questions as well as allow the community
to review and update the answers. The latest version of the complete
perlfaq is at http://faq.perl.org .

--------------------------------------------------------------------

8.21: Where do I get the include files to do ioctl() or syscall()?

Historically, these would be generated by the h2ph tool, part of the
standard perl distribution. This program converts cpp(1) directives in C
header files to files containing subroutine definitions, like
&SYS_getitimer, which you can use as arguments to your functions. It
doesn't work perfectly, but it usually gets most of the job done. Simple
files like errno.h, syscall.h, and socket.h were fine, but the hard ones
like ioctl.h nearly always need to hand-edited. Here's how to install
the *.ph files:

1. become super-user
2. cd /usr/include
3. h2ph *.h */*.h
Show full article (2.21Kb)
no comments
  the God that never was         


Author: small giant
Date: Jan 19, 2008 04:12

Islam is the only religion which teaches the existence of a PERFECT
God. A
perfect God means that there is no sharer in His Nature and His
Attributes:

"Say: He is God, the One and Only; God, the Eternal, Absolute; He
begetteth
not, nor is He begotten; and there is none like unto Him." (Holy
Qur'an,
112:1-4)
Show full article (15.33Kb)
3 Comments
  PERL MAP HELP         


Author: Subra
Date: Jan 19, 2008 04:03

Hi,

Can some one tell me how the below code works ???

605: @cherou= map {
606: ($nf,@narg)=split(/:/,$_);
607: &{$::{"setup_$nf"}}($type,@narg); #returns the
subformat above
608: } exists $setupstuff{$ap} ? @{$setupstuff{$ap}} :
() ;

And also pls let me know wts mean by &{$::{"setup_$nf"}}
($type,@narg).

Is $:: used to access the defs from the other packages ???

Best Regards,
Sburam
1 Comment
  FAQ 8.37 How do I find out if I'm running interactively or not?         


Author: PerlFAQ Server
Date: Jan 19, 2008 00:03

This is an excerpt from the latest version perlfaq8.pod, which
comes with the standard Perl distribution. These postings aim to
reduce the number of repeated questions as well as allow the community
to review and update the answers. The latest version of the complete
perlfaq is at http://faq.perl.org .

--------------------------------------------------------------------

8.37: How do I find out if I'm running interactively or not?

Good question. Sometimes "-t STDIN" and "-t STDOUT" can give clues,
sometimes not.

if (-t STDIN && -t STDOUT) {
print "Now what? ";
}

On POSIX systems, you can test whether your own process group matches
the current process group of your controlling terminal as follows:

use POSIX qw/getpgrp tcgetpgrp/;
Show full article (1.93Kb)
no comments
 
1 2 3 4 5 6 7