9 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi
I am looking to automate the process in PERL of allocating IP addresses from a set range of addresses (for example a /22 network 10.10.224.1 - 10.10.227.254)
I am able to query the IP addresses that are already in use in the above range, which will produce me a list like this for example... (3 Replies)
Discussion started by: hcclnoodles
3 Replies
2. Shell Programming and Scripting
Hello everyone,
I've got some problem intalling a perl module.
The installation is well done as you can see below.
gueg@ux31:~$ sudo apt-get install libwww-mechanize-perl
Lecture des listes de paquets... Fait
Construction de l'arbre des dépendances
Lecture des informations d'état...... (4 Replies)
Discussion started by: tot94
4 Replies
3. Shell Programming and Scripting
Hello,
I'm trying to find an nice solution for the following:
1) I have ranges of numbers (begin-end): 10-15, 20-30, 45-50
2) I have begin limit=0 and end limit=60.
3) I need to find out number ranges between begin limit and end limit that do not overlap with the ranges in item1.
In this... (6 Replies)
Discussion started by: pn8830
6 Replies
4. Programming
hi Experts
just wondering if you can help me check a number between a specific range
if i have an ip address , how can i say the valid number for ip between 1 to 254
something like this
if ($ip ) =~ /.../
{
}
what the pattern i need to type
thanks (3 Replies)
Discussion started by: doubando
3 Replies
5. Shell Programming and Scripting
Hi all,
I am new to perl programming. However i have a script that connects to the database and spools that into an output file.
Strange thing is that sometimes this script works and sometimes the ouput spool file is always 0 byte.
I have verified the sql query and the query always returns... (5 Replies)
Discussion started by: amit1_x
5 Replies
6. Shell Programming and Scripting
I am new to Unix so will really appreciate if someone can guide me on this.
What I want to do is:
Step1: Read binary file - pick first 2 bytes, convert from hex to decimal. Read the next 3 bytes as well.
2 bytes will specify the number of bytes 'n' that I want to read and write... (1 Reply)
Discussion started by: Kbenipel
1 Replies
7. Shell Programming and Scripting
Hi All
Can anyone please suggest me how to remove the last byte from a falt file .This is from the last line's last BYTE.
Please suggest me something.
Thank's and regards
Vinay (1 Reply)
Discussion started by: vinayrao
1 Replies
8. Shell Programming and Scripting
In my server migration requirement, I need to compare if one file on old server is exactly the same as the corresponding file on the new server.
For diff and comm, the inputs need to be sorted. But I do not want to disturb the content of the file and need to find byte-to-byte match.
Please... (4 Replies)
Discussion started by: krishmaths
4 Replies
9. Shell Programming and Scripting
Hi. I have a file with asterisk field separators and backslash line terminators. The first field in each line names the line type. I am trying to process each range separately. Here's what the data looks like:
BA*DATA\
LS*DATA1*DATA2*00020*\
TA*DATA1*DATA2*DATA3*\
TA*DATA1*DATA2*DATA3*\... (1 Reply)
Discussion started by: yoi2hot4ya
1 Replies
apache_mod_perl-108~358::mod_perl-2.0.7::docs::api::ModPUser:Contributed Perl apache_mod_perl-108~358::mod_perl-2.0.7::docs::api::ModPerl::Util(3)
NAME
ModPerl::Util - Helper mod_perl Functions
Synopsis
use ModPerl::Util;
# e.g. PerlResponseHandler
$callback = ModPerl::Util::current_callback;
# exit w/o killing the interpreter
ModPerl::Util::exit();
# untaint a string (do not use it! see the doc)
ModPerl::Util::untaint($string);
# removes a stash (.so, %INC{$stash}, etc.) as best as it can
ModPerl::Util::unload_package($stash);
# current perl's address (0x92ac760 or 0x0 under non-threaded perl)
ModPerl::Util::current_perl_id();
Description
"ModPerl::Util" provides mod_perl utilities API.
API
"ModPerl::Util" provides the following functions and/or methods:
"current_callback"
Returns the currently running callback name, e.g. 'PerlResponseHandler'.
$callback = ModPerl::Util::current_callback();
ret: $callback ( string )
since: 2.0.00
"current_perl_id"
Return the memory address of the perl interpreter
$perl_id = ModPerl::Util::current_perl_id();
ret: $perl_id ( string )
Under threaded perl returns something like: 0x92ac760
Under non-thread perl returns 0x0
since: 2.0.00
Mainly useful for debugging applications running under threaded-perl.
"exit"
Terminate the request, but not the current process (or not the current Perl interpreter with threaded mpms).
ModPerl::Util::exit($status);
opt arg1: $status ( integer )
The exit status, which as of this writing is ignored. (it's accepted to be compatible with the core "exit" function.)
ret: no return value
since: 2.0.00
Normally you will use the plain "exit()" in your code. You don't need to use "ModPerl::Util::exit" explicitly, since mod_perl overrides
"exit()" by setting "CORE::GLOBAL::exit" to "ModPerl::Util::exit". Only if you redefine "CORE::GLOBAL::exit" once mod_perl is running, you
may want to use this function.
The original "exit()" is still available via "CORE::exit()".
"ModPerl::Util::exit" is implemented as a special "die()" call, therefore if you call it inside "eval BLOCK" or "eval "STRING"", while an
exception is being thrown, it is caught by "eval". For example:
exit;
print "Still running";
will not print anything. But:
eval {
exit;
}
print "Still running";
will print Still running. So you either need to check whether the exception is specific to "exit" and call "exit()" again:
use ModPerl::Const -compile => 'EXIT';
eval {
exit;
}
exit if $@ && ref $@ eq 'APR::Error' && $@ == ModPerl::EXIT;
print "Still running";
or use "CORE::exit()":
eval {
CORE::exit;
}
print "Still running";
and nothing will be printed. The problem with the latter is the current process (or a Perl Interpreter) will be killed; something that you
really want to avoid under mod_perl.
"unload_package"
Unloads a stash from the current Perl interpreter in the safest way possible.
ModPerl::Util::unload_package($stash);
arg1: $stash ( string )
The Perl stash to unload. e.g. "MyApache2::MyData".
ret: no return value
since: 2.0.00
Unloading a Perl stash (package) is a complicated business. This function tries very hard to do the right thing. After calling this
function, it should be safe to "use()" a new version of the module that loads the wiped package.
References to stash elements (functions, variables, etc.) taken from outside the unloaded package will still be valid.
This function may wipe off things loaded by other modules, if the latter have inserted things into the $stash it was told to unload.
If a stash had a corresponding XS shared object (.so) loaded it will be unloaded as well.
If the stash had a corresponding entry in %INC, it will be removed from there.
"unload_package()" takes care to leave sub-stashes intact while deleting the requested stash. So for example if "CGI" and "CGI::Carp" are
loaded, calling "unload_package('CGI')" won't affect "CGI::Carp".
"untaint"
Untaint the variable, by turning its tainted SV flag off (used internally).
ModPerl::Util::untaint($tainted_var);
arg1: $tainted_var (scalar)
ret: no return value
$tainted_var is untainted.
since: 2.0.00
Do not use this function unless you know what you are doing. To learn how to properly untaint variables refer to the perlsec manpage.
See Also
mod_perl 2.0 documentation.
Copyright
mod_perl 2.0 and its core modules are copyrighted under The Apache Software License, Version 2.0.
Authors
The mod_perl development team and numerous contributors.
perl v5.16.2 2011-02-07apache_mod_perl-108~358::mod_perl-2.0.7::docs::api::ModPerl::Util(3)