Sponsored Content
Full Discussion: Perl Net::IP not working
Top Forums Shell Programming and Scripting Perl Net::IP not working Post 302964471 by timj123 on Friday 15th of January 2016 12:03:24 AM
Old 01-15-2016
Perl Net::IP not working

Experts - I have a snippet of code I can't figure out. I was hoping someone could help me here.
I have a file of IPv6 address that I need to format correct.
Example in:
Code:
2620:0:2d0:200::7
2620:0:2d0:200:a0:c
2620:0a:3f0:200:a0:c

I need to convert them to:
Code:
2620:0000:02d0:0200:0000:0000:0000:0007
2620:0000:02d0:0200:00a0:0000:0000:000c
2620:000a:03f0:0200:00a0:0000:0000:000c

I'm reading the file into @tstIPs and then I'm trying to loop through them and update accordingly into @testIPs using Net::IP per below.

Code:
open(FH, "<", $fh) or die "Can't open file: $fh$!\n";
my @tstIPs=<FH>;
close(FH);

foreach my $i (@tstIPs) {
   my $tstip = new Net::IP ($i,6);
   push @testIPs, $tstip->ip();

}

I'm getting the following error:

Code:
Can't call method "ip" on an undefined value at ./dbi.pl line 43.

I can't figure out what's going on here and need help.

Thanks
Moderator's Comments:
Mod Comment Please use CODE tags for sample input and sample output as well as for sample code.

Last edited by Don Cragun; 01-15-2016 at 01:45 AM.. Reason: Add CODE and ICODE tags.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

perl + Net::FTP::Recursive

Problem: It will not advance to the next user in the list. It always dies right after it sends the 2/2 files from the first users dir. $USERLIST="/export/home/mxdooley/perl_ftp/userlist"; $USER_DIR="/export/home/mxdooley/perl_ftp/homes";... (2 Replies)
Discussion started by: Optimus_P
2 Replies

2. Shell Programming and Scripting

Best place on the net to get Perl tutorials ?

I am looking for a full Perl course on internet (tutorial) to learn everything about Perl. I already know a bunch of programing languages. I have started Unix interests this year ever since I installed Ubuntu Linux on my PC AND I also got a job at IBM doing software distributions with... (1 Reply)
Discussion started by: Browser_ice
1 Replies

3. Shell Programming and Scripting

PERL: NET::FTP..>Debug Messages

HI All, NET::FTP->new($server, DEBUG=>1); I need to get all the Debug Messages in an array or a file.... Please suggest!! (0 Replies)
Discussion started by: angad.makkar
0 Replies

4. Shell Programming and Scripting

Corrupted Download with Net::FTP (perl)

Hello, I am trying to download several files from a remote FTP server using Net::FTP from within a perl script. The files download alright, except they appear to be corrupted. I know this because once after downloading, I use bzcat to pipe the files to a split command, and bzcat complains saying... (3 Replies)
Discussion started by: amcrisan
3 Replies

5. Shell Programming and Scripting

Net::SMTP via PERL is not working in few cases

We are getting some special scenarios where Net::SMTP is not working for some mails. we are sending a similar kind of data via mails but some of the mails are not received. After checking the Net::SMTP in debug mode we found below difference: Good One - (Mail sent properlly) --- -----... (0 Replies)
Discussion started by: NIMISH AGARWAL
0 Replies

6. Shell Programming and Scripting

Net::Ftp in perl

I am trying to execute a script in another server, i used Net::Ftp module How to execute unix command in another server by using Net::Ftp module.. #!/usr/bin.perl ### Perl script to $ftp->login($user_name,'password') or die "Cannot login ", $ftp->message;... (2 Replies)
Discussion started by: pritish.sas
2 Replies

7. Shell Programming and Scripting

Perl - Net::FTP issue

Wondering if anyone can help or advise on following issue. The below script should simply connect to a different server and retrieve certain files for me. use lib "/xxxxx/xxxxx/xxxxx/xxxx"; use Net::FTP; my $directory = "xxxxxxxx"; my $destinationDir = "xxxxxxxxx"; my $filePrefix =... (1 Reply)
Discussion started by: meevagh
1 Replies

8. Shell Programming and Scripting

Net::OpenSSH not working on Unix machine.

So, I installed the Net::OpenSSH module and I am having trouble getting it to work. It appears to be failing on this code: my $ssh = Net::OpenSSH->new('user:passwd@host.com'); $ssh->error and die "Couldn't establish SSH connection: ". $ssh->error; It's pretty simple code. I keep... (0 Replies)
Discussion started by: mrwatkin
0 Replies

9. Shell Programming and Scripting

Net::SSH::Perl slow to login.

I have some sample code that's supposed to ssh to another machine using Net::SSH::Perl, execute a command, and print the output of that command. It's very basic, and it works. However, I noticed that upon logging in: $ssh->login('username','password'); It takes roughly 10-13 seconds to... (2 Replies)
Discussion started by: mrwatkin
2 Replies

10. Web Development

Ssh authentication from .NET webpage to UNIX is not working

My .NET website invokes a perl script to perform GIT operations on Gerrit server running UBuntu. In the perl script I connect using passwordless authentication to Gerrit server as below: system ( "ssh gitadmin@gerritserver.com 'cd /xyz && git clone xxx' "); I verified that ssh authentication... (3 Replies)
Discussion started by: tkota
3 Replies
mlib_VideoColorYUV444int_to_ARGBint(3MLIB)		    mediaLib Library Functions			mlib_VideoColorYUV444int_to_ARGBint(3MLIB)

NAME
mlib_VideoColorYUV444int_to_ARGBint - color convert YUV interleaved to ARGB interleaved SYNOPSIS
cc [ flag... ] file... -lmlib [ library... ] #include <mlib.h> void mlib_VideoColorYUV444int_to_ARGBint(mlib_u32 *ARGB, const mlib_u8 *YUV, const mlib_u8 *A_array, mlib_u8 A_const, mlib_s32 w, mlib_s32 h, mlib_s32 dlb, mlib_s32 slb, mlib_s32 alb); DESCRIPTION
The YUV pixel stream is converted into an ARGB pixel stream. All pixel components are 8-bit unsigned integers. All buffers have dimensions w and h. The alpha values for this function work in the following fashion: o If A_array pointer is not NULL, the values are taken from there. It has to have the same dimensions as the Y buffer. o If A_array pointer is NULL, the alpha values for every pixel are set to A_const. The following equation is used: |R| |1.1644 0.0000 1.5966| [|Y| | 16.0000|] |G| = |1.1644 -0.3920 -0.8132| * [|U| - |128.0000|] |B| |1.1644 2.0184 0.0000| [|V| |128.0000|] PARAMETERS
The function takes the following arguments: ARGB Pointer to output buffer. YUV Pointer to Y input buffer. A_array Array of alpha values. A_const Constant alpha value. w Image width in pixels. h Image height in lines. dlb Linebytes for output buffer. slb Linebytes for input buffer. alb Linebytes for alpha buffer. RETURN VALUES
None. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Interface Stability |Committed | +-----------------------------+-----------------------------+ |MT-Level |MT-Safe | +-----------------------------+-----------------------------+ SEE ALSO
mlib_VideoColorYUV420seq_to_ARGBint(3MLIB), mlib_VideoColorYUV411seq_to_ARGBint(3MLIB), mlib_VideoColorYUV422seq_to_ARGBint(3MLIB), mlib_VideoColorYUV444seq_to_ARGBint(3MLIB), mlib_VideoColorYUV420seq_to_ABGRint(3MLIB), mlib_VideoColorYUV411seq_to_ABGRint(3MLIB), mlib_VideoColorYUV422seq_to_ABGRint(3MLIB), mlib_VideoColorYUV444seq_to_ABGRint(3MLIB), mlib_VideoColorYUYV422int_to_ARGBint(3MLIB), mlib_VideoColorYUYV422int_to_ABGRint(3MLIB), mlib_VideoColorYUV444int_to_ABGRint(3MLIB), mlib_VideoColorUYVY422int_to_ARGBint(3MLIB), mlib_VideoColorUYVY422int_to_ABGRint(3MLIB), mlib_VideoColorUYV444int_to_ARGBint(3MLIB), mlib_VideoColorUYV444int_to_ABGRint(3MLIB), attributes(5) SunOS 5.11 2 Mar 2007 mlib_VideoColorYUV444int_to_ARGBint(3MLIB)
All times are GMT -4. The time now is 11:01 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy