Storable error - Magic number checking on storable file failed

2006-05-15 Thread nithya.ramanathan

Hi,



On execution of the following code snippet, I get an error as



Magic number checking on storable file failed at blib/lib/Storable.pm
(autosplit into blib/lib/auto/Storable/fd_retrieve.al) line 297



The code snippet is like:



while(1)

{

my ($rouName, $argsRef);



eval

{

$rouName = Storable::fd_retrieve($self-{readFd});   #  Error
line



if (!defined($rouName))

{

die IO Error;

}

};



if ($EVAL_ERROR =~ /IO Error/)

{

$errorHandle = CreateError( $COSPRC_IO_ERR


,$cosprcErrorTexts{$COSPRC_IO_ERR}

   ,$errorHandle

   ,Storable::fd_retrieve
failed in child for pipe $self-{readFd}

  );

WriteAndClearError($errorHandle);



exit(1);

}

.

.

.

.



I guess 'eval' should be used to avoid Magic number checking... error.
But the above code already contains 'eval' and still the error exists.



Any help on how to eliminate this error?



Thanks all in advance...



Nithya




The information contained in this electronic message and any attachments to 
this message are intended for the exclusive use of the addressee(s) and may 
contain proprietary, confidential or privileged information. If you are not the 
intended recipient, you should not disseminate, distribute or copy this e-mail. 
Please notify the sender immediately and destroy all copies of this message and 
any attachments.

WARNING: Computer viruses can be transmitted via email. The recipient should 
check this email and any attachments for the presence of viruses. The company 
accepts no liability for any damage caused by any virus transmitted by this 
email.

www.wipro.com

Re: ssi and Perl/CGI

2006-05-15 Thread Bjørge Solli
On Monday 15 May 2006 00:31, Chad Perrin wrote:
 I have Perl/CGI scripts whose output I'd like to include in an SHTML
 page.  For instance, foo.shtml should include output from bar.pl (which
 is located in the cgi-bin directory).  Server Side Includes (SSI) seem
 to be my only option for making this work, unless there's something I'm
 missing.  My reasons for wanting to do this are two-fold:

   1. I don't want to have cgi-bin/ in the URLs for the whole friggin'
   site.

   2. The base site already exists, and I don't want to have to change
   the URLs or rewrite everything to run from CGI scripts right away.

Have you considered trying mod_rewrite? Your host may have it if it runs 
apache.

Try using something like this in your .htaccess-file:
RewriteEngine on
RewriteRule ^some regex$ cgi-bin/foo.pl

I use this to avoid ugly urls likt this:
Rewriterule ^(script)/(var1)/(var2)/(var3)$ $1.php?var1=$2var2=$3var3=$4

This way this...
site.com/index/foo/bar/123
becomes
site.com/index.php?var1=foovar2=barvar3=123

-- 
Bjørge Solli - Office:+47 55205847 http://www.nersc.no
Nansen Environmental and Remote Sensing Center - Bergen, Norway
Dept.: Mohn-Sverdrup Center for Global Ocean Studies 
   and Operational Oceanography

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Re: ssi and Perl/CGI

2006-05-15 Thread Sumo Wrestler (or just ate too much)

Chad Perrin wrote:

[...]
I'm still curious about why exec cgi works for a page generated
entirely by the CGI script, but not for CGI script output that I want to
include in the middle of a page of otherwise fairly mundane markup.
Since that's really the most on-topic part of my question for this list,
as far as I'm aware, I'm hoping someone has an explanation for that bit
of trivia.



It could be that your CGI script is attempting to output headers, and it 
can't do that because they've already been output.




--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Different output when run from the debugger vs. the command line

2006-05-15 Thread Shimon Bollinger
When I run the following script from the command line, I get different
output than when I run it with the debugger.

#!/usr/bin/perl
use Config qw(myconfig);
print Config-myconfig;
1;

Here is the relevant differences in the output:

From the debugger:
 uname='linux lxcert-i386.cern.ch 2.4.21-27.0.2.el.cernsmp #1 smp thu
jan 20 01:37:09 cet 2005 i686 i686 i386 gnulinux '

From the command line:
 uname='linux lxc'

Why would this happen?

Perl and OS Info:
This is perl, v5.8.0 built for i386-linux-thread-multi (with 1
registered patch, see perl -V for more detail) 

Linux localhost.localdomain 2.4.21-37.ELsmp #1 SMP Wed Sep 7 13:28:55
EDT 2005 i686 i686 i386 GNU/Linux

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




New

2006-05-15 Thread Nenad

Hi i`m new in perl world

I use Glade(Gtk2) to design GUI and glede2perl to translate c code to 
perl code, but i can`t from TextFIeld imeTF get value and put to $ime.


Does somebody have some tutorial for this?

Sory english is not my strong side


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Unix pipes vs DOS pipes

2006-05-15 Thread Mock, George
Hello!

When I try this on Unix, it runs pretty fast ...

spew_10MB_or_more | perl my_script.pl

This finishes in seconds, even though the command spew_10MB_or_more
creates very large text files that often exceed 10 MB.  When I do the
same thing on a DOS shell under Windows XP, it takes minutes!

Note if I split the command up ...

   spew_10MB_or_more  temp.txt
   perl my_script.pl temp.txt

That runs in seconds on both Unix and DOS.

Why does the pipe method take *so* much longer on DOS?  Is there any way
to make it run faster that doesn't involve explicit temporary files?

In case it matters, spew_10MB_or_more is a program I cannot change.

Thanks!

-George

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Re: Hi

2006-05-15 Thread Ron Smith
--- Kaushal Shriyan [EMAIL PROTECTED] wrote:

 Hi All
 
 I am a novice to perl,I would like to learn perl in
 a systematic way,
 Whats the best way to start with,I dont have any
 experience of
 programming Language, But I came to know that perl
 is a Good
 Programming Language

Try Learning Perl, Fourth Edition (Paperback) by
Randal L. Schwartz, Tom Phoenix, brian d foy. Here's
one of many links:

http://www.amazon.com/gp/product/0596101058/sr=8-2/qid=1147704150/ref=pd_bbs_2/103-0184362-2216600?%5Fencoding=UTF8

Ron Smith
 
 Thanks
 
 Kaushal
 
 --
 To unsubscribe, e-mail:
 [EMAIL PROTECTED]
 For additional commands, e-mail:
 [EMAIL PROTECTED]
 http://learn.perl.org/
 http://learn.perl.org/first-response
 
 
 


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Re: ssi and Perl/CGI

2006-05-15 Thread Chad Perrin
On Mon, May 15, 2006 at 08:38:23AM +0200, Bjørge Solli wrote:
 
 Have you considered trying mod_rewrite? Your host may have it if it runs 
 apache.
 
 Try using something like this in your .htaccess-file:
 RewriteEngine on
 RewriteRule ^some regex$ cgi-bin/foo.pl
 
 I use this to avoid ugly urls likt this:
 Rewriterule ^(script)/(var1)/(var2)/(var3)$ $1.php?var1=$2var2=$3var3=$4
 
 This way this...
 site.com/index/foo/bar/123
 becomes
 site.com/index.php?var1=foovar2=barvar3=123

I'll look into that for possible future use.  I'm not as familiar with
the .htaccess file as I probably should be, and this gives me an angle
of attack for teaching myself more.

I got in touch with the webhost.  It turns out that the way I was trying
to do it should have been working, but something was misconfigured on
the server.  Darn them.  So now it's all working.  I appreciate the
advice and suggestions from the list, and learned some things even if it
turned out that they weren't relevant to the exact problem at hand
(which was: it should work, but the webhost screwed something up).

Someone actually sent me a message off-list (by accident?) stating that
he was doing exactly the same thing I was trying to do, and it was
working for him, so it should be working for me.  He was right.

I think that pretty much sums it up.

-- 
Chad Perrin [ CCD CopyWrite | http://ccd.apotheon.org ]
There comes a time in the history of any project when it becomes necessary
to shoot the engineers and begin production. - MacUser, November 1990

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Re: ssi and Perl/CGI

2006-05-15 Thread Chad Perrin
On Mon, May 15, 2006 at 12:07:42AM -0500, Sumo Wrestler (or just ate too much) 
wrote:
 Chad Perrin wrote:
 [...]
 I'm still curious about why exec cgi works for a page generated
 entirely by the CGI script, but not for CGI script output that I want to
 include in the middle of a page of otherwise fairly mundane markup.
 Since that's really the most on-topic part of my question for this list,
 as far as I'm aware, I'm hoping someone has an explanation for that bit
 of trivia.
 
 It could be that your CGI script is attempting to output headers, and it 
 can't do that because they've already been output.

Although I got it working by talking to the webhost and getting them to
fix their server configuration, I decided to look into that.  What I
discovered is that getting the script to output redundant headers just
caused it to dump some strange things into the output (parts of the
headers).  It was an interesting thought, though, and something I
probably should have thought of checking.  Thanks.

-- 
Chad Perrin [ CCD CopyWrite | http://ccd.apotheon.org ]
There comes a time in the history of any project when it becomes necessary
to shoot the engineers and begin production. - MacUser, November 1990

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Help needed to Execute CGI on a Apache Server?

2006-05-15 Thread sudeepta ganguly
Hello,

This is my first mail to the group. Let me introduce myself. I am Deep, 
currently working as a Tech Support Engineer in India. I am new to Perl and 
CGI.I have a few questions regarding the configuration of Apache Server on a 
Windows 2000 Server? I faced the following issues when I was trying to run a 
cgi-program on my apache server.

1. First of all, I have configured the Virtual Host as projects.perlpro.com and 
set the IP address as 10.10.10.1. I have already edited the Hosts file in 
C:\winnt\system32\drivers\etc.

2. I have also created a folder in D:drive and set the following path:
 D:/projects/perlpro. 
   I have given full access to everyone to run the script. I have created two 
folders inside the same folder perlpro and named as cgibin and htdocs. i 
have kept all my cgi scripts in cgi-bin folder and all the html files in 
htdocs.

   However, when I tried to access the webpage, it's displaying the first page, 
which contains the html document, however it gives me an error message Access 
denied, http error 500/404. I am the administrator of my PC and I am unable to 
configure that.

Could anyone please send me the configuration file(httpd.conf) to me so that 
I can configure the same and run my CGI-scripts on my local PC?

Waiting for a quick reply.

Warm regards,
Deep.


FREE 2GB Online Storage - Store data online  access them anywhere you go!
Visit http://www.inbox.com/storage to find out more!

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




windows process+memory info

2006-05-15 Thread brian bwarn
Hello,
Can someone please point me to a module that will
enable me to capture the process and memory info
normally displayed in the Windows task manager?
Thanks, BW

__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




not forking

2006-05-15 Thread Tom Allison

I've got a *bunch* of code that I've been rewriting recently and ran
into a rather weird problem.

it won't fork.

If I write the following:

foreach my $file ( @$files ) {
  my $pid = fork();
  print $pid -- $file\n;
  []
}

I will get an output of:
0 -- file_one
3242 -- file_one
0-- file_two

but no 3243--file_two.

Repeated print statements later on in the job continue to indicate that
this is not forking correctly.

I've been changing a number of things over to objects and references,
but I can't see anyway that this would interfere with something so
fundamental.

Unfortunately, perl -d doesn't work well for forks.

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




want regex to produce a scalar which is defined when no match

2006-05-15 Thread tom arnall
the following script:

my ($f,$g,$h);
$_= abcde;
($f,$g,$h)=/(a{0,1})(m{0,1})(b{0,1})/;
print scalar g defined after first regex\n if defined $g;
($f,$g,$h)=/(a{0,1})(m){0,1}(b{0,1})/;
print scalar g defined after second regex\n if defined $g;

produces:

scalar g defined after first regex

why does '(m{0,1})' produce an empty scalar, while '(m){0,1}' an undefined 
scalar?

and what i'm really after is to say:

($f,$g,$h)=/(a{0,1})(m|mn){0,1}(b{1,1})/;

and have $g come out a scalar which is defined.

thanks,

Tom Arnall
north spit, ca



-- 
thanks,

Tom Arnall
north spit, ca

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Re: not forking

2006-05-15 Thread Paul Johnson
On Mon, May 15, 2006 at 04:46:07PM -0400, Tom Allison wrote:

 I've got a *bunch* of code that I've been rewriting recently and ran
 into a rather weird problem.
 
 it won't fork.
 
 If I write the following:
 
 foreach my $file ( @$files ) {
   my $pid = fork();
   print $pid -- $file\n;
   []
 }
 
 I will get an output of:
 0 -- file_one
 3242 -- file_one
 0-- file_two
 
 but no 3243--file_two.

You don't say anything about what you are trying to do, but when I run
code such as:

$ perl -le 'for (1 .. 2) { my $p = fork; print [$_][$p] }'

I see the output just as I expected:

[1][0]
[2][0]
[2][29760]
[1][29759]
[2][0]
[2][29761]

How many files do you have?  And you do realise that this is going to
grow exponentially, don't you?  I'd be surprised if this is actually
what you want.  Perhaps you only want the parent to actually fork?  Have
you read perlipc?

-- 
Paul Johnson - [EMAIL PROTECTED]
http://www.pjcj.net

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Re: Unix pipes vs DOS pipes

2006-05-15 Thread Sumo Wrestler (or just ate too much)

Mock, George wrote:

Hello!

When I try this on Unix, it runs pretty fast ...

spew_10MB_or_more | perl my_script.pl

This finishes in seconds, even though the command spew_10MB_or_more
creates very large text files that often exceed 10 MB.  When I do the
same thing on a DOS shell under Windows XP, it takes minutes!
[...]


AFAIK, unix pipes have some functionality that DOS pipes don't have.



--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Re: want regex to produce a scalar which is defined when no match

2006-05-15 Thread John W. Krahn
tom arnall wrote:
 the following script:
 
   my ($f,$g,$h);
   $_= abcde;
   ($f,$g,$h)=/(a{0,1})(m{0,1})(b{0,1})/;
   print scalar g defined after first regex\n if defined $g;
   ($f,$g,$h)=/(a{0,1})(m){0,1}(b{0,1})/;
   print scalar g defined after second regex\n if defined $g;
 
 produces:
   
   scalar g defined after first regex
   
 why does '(m{0,1})' produce an empty scalar, while '(m){0,1}' an undefined 
 scalar?
 
 and what i'm really after is to say:
 
   ($f,$g,$h)=/(a{0,1})(m|mn){0,1}(b{1,1})/;
   
 and have $g come out a scalar which is defined.

First, '{0,1}' is a verbose way of saying '?' and {1,1} is superfluous so your
expression can be written as:

( $f, $g, $h ) = /(a?)(m|mn)?(b)/;

As to your problem of capturing and grouping, use non-capturing parentheses
for the grouping part:

( $f, $g, $h ) = /(a?)((?:m|mn)?)(b)/;




John
-- 
use Perl;
program
fulfillment

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




hash assignments

2006-05-15 Thread Smith, Derek
I have this system output 

 

--- Logical volumes ---

LV Name /dev/vg00/lvol1

VG Name /dev/vg00

LV Permission   read/write

LV Status   available/syncd

Mirror copies   1

Consistency RecoveryMWC

Scheduleparallel

LV Size (Mbytes)512

Current LE  64

Allocated PE128

Stripes 0

Stripe Size (Kbytes)0

Bad block   off

Allocation  strict/contiguous

IO Timeout (Seconds)default

 

And I have this multiple lvols populated into 2 arrays like printed like
so:

 

Mirror copies   1

Mirror copies   1

Mirror copies   1

Mirror copies   1

Mirror copies   1

Mirror copies   1

Mirror copies   1

Mirror copies   1

 

second array

LV Name /dev/vg00/lvol3

LV Name /dev/vg00/lvol1

LV Name /dev/vg00/lvol9

LV Name /dev/vg00/lvol7

LV Name /dev/vg00/lvol8

LV Name /dev/vg00/lvol6

LV Name /dev/vg00/lvol5

LV Name /dev/vg00/lvol4

 

But what I need to do is get rid of LV Name yet keep the
/dev/vg00/lvol entries. 

Problem is this data is on one line.

 

Here is my code:

I tried an push @mir2 = (unless /lv\d+/i, `lvdisplay $lv`); in place of
the third push

But that gave me an error: Uncaught exception from user code:

   syntax error at HPUX_verify_system.pl line 127, near (unless

 

my @lvs;

my @lvaray = qx(bdf);

foreach (@lvaray) {

if (/(?:)vg00/) {

   push @lvs, (split)[0]

}

}

 

my (%hash,@mir,@mir2)= ();

my ($key2,$value2)   = 0;

foreach my $lv (@lvs) {

push @mir = (grep /mirror/i, `lvdisplay $lv`);

push @mir2 = (grep /lvol\d+/i, `lvdisplay $lv`);

#chomp (@mir,@mir2);

}

 

#%hash = (@mir,@mir2);

 

#while (($key2,$value2) = each %hash) {

#   print $key2\t:$value2;

#}

 

print @mir; print \nsecond array\n;

print @mir2;

 

#($key1,$value1) = split/=/;

#$cc{$key1}= $value1;

 

Thanks

Derek

 

 

Derek Bellner Smith

Unix Systems Engineer

Cardinal Health Dublin, Ohio

614-757-5000 Main

614-757-8075 Direct

614-757-8120 Fax

[EMAIL PROTECTED]

 


Cardinal Health -- Working together. For life. (sm)
_

This message is for the designated recipient only and may contain privileged, 
proprietary, or otherwise private information. If you have received it in 
error, please notify the sender immediately and delete the original. Any other 
use of the email by you is prohibited.

Dansk - Deutsch - Espanol - Francais - Italiano - Japanese - Nederlands - Norsk 
- Portuguese - Svenska: www.cardinalhealth.com/legal/email


Re: not forking

2006-05-15 Thread Tom Phoenix

On 5/15/06, Tom Allison [EMAIL PROTECTED] wrote:


  my $pid = fork();
  print $pid -- $file\n;


Because your process table can become full and temporarily prevent
forking new processes, you should check the return value of fork
whenever you're making more than N processes. The value of N depends
upon a number of factors, so I generally assume N=0. Most of the time,
I just call this safe_fork routine in place of fork, since this
handles the retries for me automatically.

  sub safe_fork () {
  use Errno;
  my $retries = 10;
  while ($retries--) {
  my $rv = fork;
  return $rv if defined $rv;  # it worked
  return unless $retries;
  return unless $!{EAGAIN};
  sleep 3;
  }
  die Well, how did I get here?;
  }


I will get an output of:
0 -- file_one
3242 -- file_one
0-- file_two

but no 3243--file_two.


If that output is coming from several concurrent processes, any one
process's output can interrupt another: The data may be interleaved
in confusing ways. But maybe you simply couldn't fork another process?
How many processes were you starting at once?


Unfortunately, perl -d doesn't work well for forks.


There's actually some support for fork in the debugger, but I'm having
a hard time finding any documentation on it, other than the comments.
Search for 'fork' in your perl5db.pl file, if you need it.

Good luck with it!

--Tom Phoenix
Stonehenge Perl Training

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Re: want regex to produce a scalar which is defined when no match

2006-05-15 Thread Sumo Wrestler (or just ate too much)

tom arnall wrote:

[...]
why does '(m{0,1})' produce an empty scalar, while '(m){0,1}' an undefined 
scalar?


and what i'm really after is to say:

($f,$g,$h)=/(a{0,1})(m|mn){0,1}(b{1,1})/;

and have $g come out a scalar which is defined.



Use the grouping syntax to group together m and mn like so:
($f,$g,$h)=/(a{0,1})((?:m|mn){0,1})(b{1,1})/;


(?:) groups without capturing.
$ man perlre



thanks,



You're welcome.




--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Re: hash assignments

2006-05-15 Thread Tom Phoenix

On 5/15/06, Smith, Derek [EMAIL PROTECTED] wrote:


I tried an push @mir2 = (unless /lv\d+/i, `lvdisplay $lv`); in place of
the third push

But that gave me an error: Uncaught exception from user code:

   syntax error at HPUX_verify_system.pl line 127, near (unless


Yes; that's a syntax error. Did you mean something like this, perhaps?

 push @mir2,
   grep !/\|v\d+/i, # select lines that don't match pattern
   `vddisplay $lv`;

Hope this helps!

--Tom Phoenix
Stonehenge Perl Training

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Re: Hi

2006-05-15 Thread Leonid Grinberg

I am a novice to perl,I would like to learn perl in a systematic way,
Whats the best way to start with,I dont have any experience of
programming Language, But I came to know that perl is a Good
Programming Language


Whether or not you do choose to use a book or not, remember: always
try doing some excersizes. You *cannot* just read, you have to try it
firsthand. This is as simple as writing your first program that just
prints out ``Hello World'' to testing out the ugliest regular
expressions (you will eventually learn what these are). Remember, you
are just learning, and so you are free to experiment.

Good Luck!

--
Leonid Grinberg
[EMAIL PROTECTED]
http://www.lgrinberg.org

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




RE: :ftp with retry Big brother notifications from applications

2006-05-15 Thread Timothy Johnson

I had to deal with some of this when I recently wrote a BB agent to
Nagios translator in Perl.

You should be able to send the information you want directly to BB using
the IO::Socket module, connecting to port 1984( or whatever custom port)
on your BB server and sending a status message.



Big Brother status messages look like this (minus the hyphens, all one
line):


status hostname,domainname,com.cpu green Thu May 11 16:58:45 PDT 2006
[sfinfra1.ad.checkpoint.com] up: 21 days, 1 users, 46 procs, load=0%,
PhysicalMem: 2560MB(33%)


It basically breaks down to the following, separated by spaces on one
line:

status
FQDN of host(with periods converted to commas).test_name
color
time stamp
info (whatever's left of the line, including spaces)

After the first line you may see more lines of verbose information, but
for what you want to do you should only need the first line.






-Original Message-
From: Ken Foskey [mailto:[EMAIL PROTECTED] 
Sent: Sunday, May 14, 2006 4:45 AM
To: beginners@perl.org
Subject: net::ftp with retry  Big brother notifications from
applications

snip

Secondly is there an easy way to send messages to Big Brother to go
orange, red then go green again?  We are using a file and writing
messages and there is currently no way of deleting the messages once the
process is fine again.  There must be a better way.



--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




RE: hash assignments

2006-05-15 Thread Smith, Derek
 

On 5/15/06, Smith, Derek [EMAIL PROTECTED] wrote:

 I tried an push @mir2 = (unless /lv\d+/i, `lvdisplay $lv`); in place
of

 the third push

 

 But that gave me an error: Uncaught exception from user code:

 

syntax error at HPUX_verify_system.pl line 127, near (unless

 

 Yes; that's a syntax error. Did you mean something like this, perhaps?

 

  push @mir2,

   grep !/\|v\d+/i, # select lines that don't match pattern

`vddisplay $lv`;

 

 




Thank you Tom... your input is always appreciated! 

 

Tried your solution but I think you mis-typed as I only need the string
as an example /dev/vg00/lvol#

But the problem is LV Name /dev/vg00/lvol# is considered one array
element and on one line.

 

Have been working on this for about an hour tonight and cannot get
itAhhh

 

 

my (%hash,@mir,@mir2)= ();

my ($key2,$value2)   = 0;

foreach my $lv (@lvs) {

push @mir = (grep /mirror/i,  `lvdisplay $lv`);

#push @mir2 = (grep /lvol\d+/i, `lvdisplay $lv`);

push @mir2 = (split /lv name/i, grep /lvol\d+/i, `lvdisplay
$lv`); ## and tried w/out 2nd grep just using split.

#chomp (@mir,@mir2);

}

 

#%hash = (@mir,@mir2);

 

#while (($key2,$value2) = each %hash) {

#   print $key2\t:$value2;

#}

 

print @mir; print \nsecond array\n;

print @mir2;

 

__DATA__

 

I tried to use split but now and getting the output so then I added
another grep but that returned all 1's in the array.

 

Without the 2nd grep output and it is getting rid of LV Name

 

second array

--- Logical volumes ---

/dev/vg00/lvol3

VG Name /dev/vg00

LV Permission   read/write

LV Status   available/syncd

Mirror copies   1

Consistency RecoveryMWC

Scheduleparallel

LV Size (Mbytes)512

Current LE  64

Allocated PE128

Stripes 0

Stripe Size (Kbytes)0

Bad block   off

Allocation  strict/contiguous

IO Timeout (Seconds)default

 

With the 2nd grep output

second array




Cardinal Health -- Working together. For life. (sm)
_

This message is for the designated recipient only and may contain privileged, 
proprietary, or otherwise private information. If you have received it in 
error, please notify the sender immediately and delete the original. Any other 
use of the email by you is prohibited.

Dansk - Deutsch - Espanol - Francais - Italiano - Japanese - Nederlands - Norsk 
- Portuguese - Svenska: www.cardinalhealth.com/legal/email


format output from Data::Dumper

2006-05-15 Thread chen li
Hi all,

I get data from Data::Dumper in an array format.
I just wonder if there is a means to format the
content in alphabetic order, something like sort keys
or sort values.

Thanks,

Li 

__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




RE: :ftp with retry Big brother notifications from applications

2006-05-15 Thread Timothy Johnson

If you want to see the status messages coming in to get a better idea of
what to send, try running this on a computer and point a few of your Big
Brother agents at it for a while.  You should end up with a separate log
file for each incoming status message.

NOTE:  Watch for line wraps


#!/usr/bin/perl

use strict;
use warnings;
use IO::Socket;
use Time::HiRes qw(time);
$| = 1;

my $sock = new IO::Socket::INET(
LocalPort = '1984',
Proto = 'tcp',
Listen = SOMAXCONN,
Reuse = 1
) or die(Couldn't create socket on tcp
1984!\n);

while(my $bbclient = $sock-accept()){
my $host = inet_ntoa($bbclient-peeraddr);
open(OUTFILE,,./bblog/.time()..$host.log) or die(Couldn't
open '.$bbclient-peeraddr..bbclient.log' for append!\n);
select OUTFILE;
$| = 1;
select STDOUT;

print IP=$host\n;

while(my $recv = $bbclient){
print OUTFILE $recv;
#print $recv;
}
}





-Original Message-
From: Timothy Johnson 
Sent: Monday, May 15, 2006 5:20 PM
To: Ken Foskey; beginners@perl.org
Subject: RE: :ftp with retry  Big brother notifications from
applications


I had to deal with some of this when I recently wrote a BB agent to
Nagios translator in Perl.

You should be able to send the information you want directly to BB using
the IO::Socket module, connecting to port 1984( or whatever custom port)
on your BB server and sending a status message.



Big Brother status messages look like this (minus the hyphens, all one
line):


status hostname,domainname,com.cpu green Thu May 11 16:58:45 PDT 2006
[sfinfra1.ad.checkpoint.com] up: 21 days, 1 users, 46 procs, load=0%,
PhysicalMem: 2560MB(33%)


It basically breaks down to the following, separated by spaces on one
line:

status
FQDN of host(with periods converted to commas).test_name
color
time stamp
info (whatever's left of the line, including spaces)

After the first line you may see more lines of verbose information, but
for what you want to do you should only need the first line.






-Original Message-
From: Ken Foskey [mailto:[EMAIL PROTECTED] 
Sent: Sunday, May 14, 2006 4:45 AM
To: beginners@perl.org
Subject: net::ftp with retry  Big brother notifications from
applications

snip

Secondly is there an easy way to send messages to Big Brother to go
orange, red then go green again?  We are using a file and writing
messages and there is currently no way of deleting the messages once the
process is fine again.  There must be a better way.



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Re: format output from Data::Dumper

2006-05-15 Thread Jeff Pang


I get data from Data::Dumper in an array format.
I just wonder if there is a means to format the
content in alphabetic order, something like sort keys
or sort values.

I would give you a simple way,you can sort the array and put the results into 
another array,then print this array to Dumper.For example:

my @original=(...);
my @sort=sort {$a cmp $b} @original;
print Dumper @sort;

Hope this help.

--
Jeff Pang
NetEase AntiSpam Team
http://corp.netease.com

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Re: not forking

2006-05-15 Thread Jeff Pang


I've got a *bunch* of code that I've been rewriting recently and ran
into a rather weird problem.

it won't fork.

If I write the following:

foreach my $file ( @$files ) {
  my $pid = fork();
  print $pid -- $file\n;
  []
}

I will get an output of:
0 -- file_one
3242 -- file_one
0-- file_two

but no 3243--file_two.

Repeated print statements later on in the job continue to indicate that
this is not forking correctly.


Try this:

use strict;
my @files = qw/aa bb cc/;

foreach my $file ( @files ) {
  my $pid = fork();
  print $pid -- $file\n;
  exit 0 unless $pid;
}

and print the result:

0 -- aa
2391 -- aa
0 -- bb
2392 -- bb
0 -- cc
2393 -- cc

It works fine to me.Don't forget to get the childs exit if they are not needed.

--
Jeff Pang
NetEase AntiSpam Team
http://corp.netease.com

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




RE: format output from Data::Dumper

2006-05-15 Thread Charles K. Clarkson
Jeff Pang wrote:

: my @original=(...);
: my @sort=sort {$a cmp $b} @original;
: print Dumper @sort;

You might like the results better using an array reference.

print Dumper [EMAIL PROTECTED];


Or you could avoid the extra array with the anonymous array
constructor (or is it an operator? [shrug])

print Dumper [ sort {$a cmp $b} @original ];


HTH,

Charles K. Clarkson
-- 
Mobile Homes Specialist
Free Market Advocate
Web Programmer

254 968-8328

If it looks wrong convert it to plain text.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




RE: format output from Data::Dumper

2006-05-15 Thread Jeff Pang

Jeff Pang wrote:

: my @original=(...);
: my @sort=sort {$a cmp $b} @original;
: print Dumper @sort;

You might like the results better using an array reference.

print Dumper [EMAIL PROTECTED];


Sorry,my mistake.It's right really to use an array reference here.

--
Jeff Pang
NetEase AntiSpam Team
http://corp.netease.com

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response