Sponsored Content
Full Discussion: Perl debugger problem
Top Forums Shell Programming and Scripting Perl debugger problem Post 302712869 by wakatana on Wednesday 10th of October 2012 02:21:38 AM
Old 10-10-2012
It has been already done but you seen results in above post.

Code:
#!/usr/bin/perl
eval 'exec /usr/bin/perl -S $0 ${1+"$@"}'
    if $running_under_some_shell;
                        # this emulates #! processing on NIH machines.
                        # (remove #! line above if indigestible)

eval '$'.$1.'$2;' while $ARGV[0] =~ /^([A-Za-z_0-9]+=)(.*)/ && shift;
                        # process any FOO=bar switches

$[ = 1;                 # set array base to 1
$, = ' ';               # set output field separator
$\ = "\n";              # set output record separator

$state = 0;
$temp1 = "";
$temp2 = "";
$musr = qr/\(-,user3,[^,]+\.co\.uk\)\\$/;
$lusr = qr/\(-,user3,[^,]+\.co\.uk\)$/;
$strprn="";

while (<>) {
    chomp;      # strip record separator

    if (($state == 0) && ($_ !~ $musr) && ($_ !~ $lusr)) {
        if (length($temp1) != 0) {
            print $temp1;
        }

        $temp0 = $_;
        $state = 1;
    }
    elsif (($state == 1) && ($_ !~ $musr) && ($_ !~ $lusr)) {
        if (length($temp0) != 0) {
            print $temp0;
        }

        $temp1 = $_;
        $state = 0;
    }
    elsif (($state == 0) && ($_ =~ $musr)) {
        $state = 2;
    }
    elsif (($state == 2) && ($_ =~ $musr)) {
        $state = 3;
    }
    elsif (($state == 3) && ($_ !~ $musr) && ($_ !~ $lusr)) {
        print $temp1;
        print $_;
        $temp1 = "";
        $temp0 = "";
        $state = 1;
    }
    elsif (($state == 2) && ($_ =~ $lusr)) {
        $strprn=substr($temp1, 0, length($temp1) - 1);
	print $strprn . "\n";
        $temp1 = "";
        $state = 0;
    }
    else {
	print "Error at line " . $.; exit $.;
    }
}

if ($state == 0) {
    print $temp1;
}
elsif ($state == 1) {
    print $temp0;
}
else {
    exit $.;
}

#exit $ExitValue;

Input file:
Code:
netgroup1       (-,user1,one2one.co.uk)\
                (-,user1,t-mobile.co.uk)\
                (-,user2,one2one.co.uk)\
                (-,user2,t-mobile.co.uk)\
                (-,user3,one2one.co.uk)\
                (-,user3,t-mobile.co.uk)
netgroup2       (-,user4,one2one.co.uk)\
                (-,user4,t-mobile.co.uk)\
                (-,user5,one2one.co.uk)\
                (-,user5,t-mobile.co.uk)\
                (-,user6,one2one.co.uk)\
                (-,user6,t-mobile.co.uk)
netgroup3       (-,user7,one2one.co.uk)\
                (-,user7,t-mobile.co.uk)\
                (-,user8,one2one.co.uk)\
                (-,user8,t-mobile.co.uk)\
                (-,user9,one2one.co.uk)\
                (-,user9,t-mobile.co.uk)

 

10 More Discussions You Might Find Interesting

1. Programming

wdb debugger

Hi all, is it possible to skip a function with the wdb debugger ? could be helpful instead of compiling the whole bunch again does someone know how to do this ? thx Sven (4 Replies)
Discussion started by: Sven28
4 Replies

2. UNIX for Advanced & Expert Users

Kernel debugger

hi, I want to have a debugger for my kernel and I am using kernel-2.6.11 n i am having patches kdb-v4.4-2.6.11-common-1.bz2 kdb-v4.4-2.6.11-i386-1.bz2. I applied both. I did make menuconfig with options CONFIG_KDB n CONFIG_FRAME_POINTER being set. when i tried to compile kernel. I got an... (0 Replies)
Discussion started by: sriram.ec
0 Replies

3. Programming

multiprocess debugger

Hi, can somebody advise on a better multiprocess debugger? I heard with gdb we face lots of problems in multiprocess scenario currently i am using gdb debugger for a single process multithreaded project.. since i am supposed to work on a multiprocess now, i googled and came across... (1 Reply)
Discussion started by: rvan
1 Replies

4. Programming

Good C debugger ?

I'm a C newbie using gcc. I wrote a program but a part of it outputs gibberish onto the terminal. Its weird because identical parts of the program work correctly in another program I wrote :confused:. My program uses c99 + some POSIX headers. It compiles with no errors/warnings even though I have... (15 Replies)
Discussion started by: cyler
15 Replies

5. Programming

Dbx Debugger

I have tried lots of stuff but i can't get it working, i have also found a Thread in this Forum about it but it didn't describe how the program has to be run ect. My issue is that i want to run a program with multiple arguments eg. ./myprog arg1 arg2 arg3 arg4 arg5 with dbx, but i cant get... (8 Replies)
Discussion started by: alcatros
8 Replies

6. Solaris

Csharp Debugger

I want to debug my csharp project on solaris. Is anyone can tell me a program or anything else for this?? (0 Replies)
Discussion started by: dConstantine
0 Replies

7. Shell Programming and Scripting

Perl execution debugger

If this is the wrong forum, move it. It seemed like the best. Does anyone know of a perl thing that does the same thing as bash -x except for perl? I know I can output the information I want at the right times by actually putting that in the code, but it's harder... (2 Replies)
Discussion started by: killer54291
2 Replies

8. Programming

Alternative debugger to GNU insight debugger

GNU insight debugger is not available now a days and it is required to debug/inspect assembly code as written in the book Assembly Language Programming step by step in Linux so my question is; is there any alternative to insight that I can use instead of insight in which I can get the same... (5 Replies)
Discussion started by: vectrum
5 Replies

9. Programming

ddd/gdb debugger problem

I hope this is the right thread - not sure if it belongs in the Linux forum. Anyway, I'm having an issue with ddd and gdb. When using ddd to run gdb, there are extra parameters being appended, and my program is picking them up. I'm running on Ubuntu 11.04... Here's my command line entry - ... (1 Reply)
Discussion started by: jalburger
1 Replies

10. Web Development

problem with exporting vairable from one perl cgi to another perl cgi script while redirecting.

Can anyone tell me how to export a variable from one perl CGI script to another perl cgi script when using a redirect. Upon running the login.pl the user is prompted to enter user name and password. Upon entering the correct credentials (admin/admin) the user is redirected to welcome page. My... (3 Replies)
Discussion started by: Arun_Linux
3 Replies
Device::Gsm::Pdu(3pm)					User Contributed Perl Documentation				     Device::Gsm::Pdu(3pm)

NAME
Device::Gsm::Pdu - library to manage PDU encoded data for GSM messaging WARNING
This is C<BETA> software, still needs extensive testing and support for custom GSM commands, so use it at your own risk, and without C<ANY> warranty! Have fun. NOTICE
This module is meant to be used internally by C<Device::Gsm> class, so you probably do not want to use it directly. SYNOPSIS
use Device::Gsm::Pdu; # DA is destination address $DA = Device::Gsm::Pdu::encode_address('+39347101010'); $number = Device::Gsm::Pdu::decode_address( $DA ); # Encode 7 bit text to send messages $text = Device::Gsm::Pdu::encode_text7('hello'); DESCRIPTION
"Device::Gsm::Pdu" module includes a few basic functions to deal with SMS in PDU mode, such as encoding GSM addresses (phone numbers) and, for now only, 7 bit text. FUNCTIONS
decode_address( pdu_encoded_address ) Takes a PDU encoded address and decodes into human-readable mobile number. If number type is international, result will be prepended with a `+' sign. Clearly, it is intended as an internal function. Example print Device::Gsm::Pdu::decode_address( '0B919343171010F0' ); # prints `+39347101010'; encode_address( mobile_number ) Takes a mobile number and encodes it as DA (destination address). If it begins with a `+', as in `+39328101010', it is treated as an international number. Example print Device::Gsm::Pdu::encode_address( '+39347101010' ); # prints `0B919343171010F0' encode_text7( text_string ) Encodes some text ASCII string in 7 bits PDU format, including a header byte which tells the length is septets. This is the only 100% supported mode to encode text. Example print Device::Gsm::Pdu::encode_text7( 'hellohello' ); # prints `0AE832...' pdu_to_latin1($pdu) Converts a PDU (without the initial length octet) into a latin1 string. Example my $pdu = 'CAFA9C0E0ABBDF7474590E8296E56C103A3C5E97E5'; print Device::Gsm::Pdu::pdu_to_latin1($pdu); # prints `Just another Perl hacker' latin1_to_pdu($text) Converts a text string in latin1 encoding (ISO-8859-1) into a PDU string. Example my $text = "Just another Perl hacker"; print Device::Gsm::Pdu::latin1_to_pdu($text); # prints `CAFA9C0E0ABBDF7474590E8296E56C103A3C5E97E5' AUTHOR
Cosimo Streppone, cosimo@cpan.org COPYRIGHT
This library is free software; you can redistribute it and/or modify it only under the terms of Perl itself. SEE ALSO
Device::Gsm(3), perl(1) perl v5.14.2 2012-03-08 Device::Gsm::Pdu(3pm)
All times are GMT -4. The time now is 07:33 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy