03-25-2010
change of plan :P
I need help with the regular expressions instead as I have tweaked my script
if $cookie =~ /^cookie(.)\/(.)\/(.)/
$cookietype="$1.$2.$3"
so if my $cookie is cookie1/0/0
my $cookietype will be 1.0.0
Problem is, if my $cookie is cookie1/0,
it doesnt match any of the pattern so it'll set the value to 0 by default
(defined in my final else statement).
I added elsif statement as below
elsif $cookie =~ /^cookie(.)\/(.)/
$cookietype="$1.$2"
and the value became 0, as if it doesnt match the pattern
please help.
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi All,
I pass a Perl script variable, whch is passed to a query to be prepared. But the problem is I have special character like '&' in this variable which are handled in a special way by the Oracle query parser. How do I get over this?
my $cust_name='A&B';
my $sql="Select cust_short_name... (1 Reply)
Discussion started by: rahulrathod
1 Replies
2. Shell Programming and Scripting
Hi All.
I need help for the below logic.
I ve a file like following
input file:
NopTX(5) // should be remain same as input
----Nop(@100); //1
Nop(90); //2
--Nop(80); //3
@Nop(70); //4
--@Nop(60); //5
@Nop@(@50); //6
--Nop@( 40); ... (3 Replies)
Discussion started by: user_prady
3 Replies
3. Shell Programming and Scripting
I am writing a script to cross check the dbscript. For that I am searching the SQL manipulators in the dbscript as shown below. But my problem is the variable $pattern is coming as null when comes out of the foreach loop.
File content:
=========
vi /home2/niroj_p/dbscript.sql
-------... (1 Reply)
Discussion started by: Niroj
1 Replies
4. Shell Programming and Scripting
HI ,
Is there any way to return a value of variable from shell to perl script.
Code:
===
Perl file
my $diff1=system("sh diff.sh");
my $diff2=system("sh diff1.sh");
I need exit status of below commands
i.e 0 and 1 respectively.
Since in both the cases diff is working so system... (3 Replies)
Discussion started by: srkelect
3 Replies
5. Shell Programming and Scripting
Hi,
I have a perl script which prints epoch value of date in milliseconds as the output.
My reuirement is that once the output is printed,the day variable shld increment by 1 and when i execute the script for the second time the output shld be for the new day value.
My script looks as... (11 Replies)
Discussion started by: jyothi_wipro
11 Replies
6. Shell Programming and Scripting
I am working on a perl script that is used to update a list of hosts to a certain file but I am having an issue when I try to perform a check to make sure the user enters valid information. The following is what I have currently written for the script:
IPINPUT:
print "Enter IP Address: ";... (2 Replies)
Discussion started by: Takau
2 Replies
7. Shell Programming and Scripting
HI all,
These are examples of the original value from a variable
$abc can be
FastEthernet1/0
GigabitEthernet3/1
Serial1/0
If $abc is FastEthernet*/* (where * can be any number), replace $abc value to fa*/* (same number as the original value). GigabitEthernet becomes ga*/* and Serial... (2 Replies)
Discussion started by: tententen
2 Replies
8. Shell Programming and Scripting
Hey,
So I have a shell script that outputs some variables, call them $a and $b. I know in shell scripting if I wanted to use the variables in another shell script I'd do
sh code.sh "$a" "$b"
How can I do something similar with perl? (2 Replies)
Discussion started by: viored
2 Replies
9. Shell Programming and Scripting
Hi All,
I need to pass a variable from bash script to perl script and in the perl script i am using those variables in the sql query but its giving
error :
Use of uninitialized value $ENV{"COUNTRYCD"} in concatenation (.) or string at /GIS_ROOT/custom/tables/DBread_vendor.pl line 50.
Can ... (6 Replies)
Discussion started by: NileshJ
6 Replies
10. UNIX for Beginners Questions & Answers
Hi
I want to replace time stamp in the following line
PROCNAME.Merge.exchMon.CODE.T_QSTART 08:45 read
assuming the new time stamp is 09:45 ; the line is getting replaced as below
:45 read
I'm trying to use the perl one liner in bash script
perl -pi... (4 Replies)
Discussion started by: charlie87
4 Replies
LEARN ABOUT MOJAVE
net::ldap::control::paged
Net::LDAP::Control::Paged(3) User Contributed Perl Documentation Net::LDAP::Control::Paged(3)
NAME
Net::LDAP::Control::Paged - LDAPv3 Paged results control object
SYNOPSIS
use Net::LDAP;
use Net::LDAP::Control::Paged;
use Net::LDAP::Constant qw( LDAP_CONTROL_PAGED );
$ldap = Net::LDAP->new( "ldap.mydomain.eg" );
$page = Net::LDAP::Control::Paged->new( size => 100 );
@args = ( base => "cn=subnets,cn=sites,cn=configuration,$BASE_DN",
scope => "subtree",
filter => "(objectClass=subnet)",
callback => &process_entry, # Call this sub for each entry
control => [ $page ],
);
my $cookie;
while (1) {
# Perform search
my $mesg = $ldap->search( @args );
# Only continue on LDAP_SUCCESS
$mesg->code and last;
# Get cookie from paged control
my($resp) = $mesg->control( LDAP_CONTROL_PAGED ) or last;
$cookie = $resp->cookie;
# Only continue if cookie is nonempty (= we're not done)
last if (!defined($cookie) || !length($cookie));
# Set cookie in paged control
$page->cookie($cookie);
}
if (defined($cookie) && (length($cookie)) {
# We had an abnormal exit, so let the server know we do not want any more
$page->cookie($cookie);
$page->size(0);
$ldap->search( @args );
}
DESCRIPTION
"Net::LDAP::Control::Paged" provides an interface for the creation and manipulation of objects that represent the "pagedResultsControl" as
described by RFC 2696.
The control is allowed on LDAP search requests ("search" in Net::LDAP) only. On other operations it will - depending on the value of the
parameter "critical" - either be ignored or lead to errors.
CONSTRUCTOR ARGUMENTS
In addition to the constructor arguments described in Net::LDAP::Control the following are provided.
cookie
The value to use as the cookie. This is not normally set when an object is created, but is set from the cookie value returned by the
server. This associates a search with a previous search, so the server knows to return the page of entries following the entries it
returned the previous time.
size
The page size that is required. This is the maximum number of entries that the server will return to the search request.
METHODS
As with Net::LDAP::Control each constructor argument described above is also available as a method on the object which will return the
current value for the attribute if called without an argument, and set a new value for the attribute if called with an argument.
SEE ALSO
Net::LDAP, Net::LDAP::Control, http://www.ietf.org/rfc/rfc2696.txt
AUTHOR
Graham Barr <gbarr@pobox.com>
Please report any bugs, or post any suggestions, to the perl-ldap mailing list <perl-ldap@perl.org>
COPYRIGHT
Copyright (c) 2000-2004 Graham Barr. All rights reserved. This program is free software; you can redistribute it and/or modify it under the
same terms as Perl itself.
perl v5.18.2 2013-12-23 Net::LDAP::Control::Paged(3)