RE: perl version for windows

2008-11-25 Thread Stewart Anderson


 -Original Message-
 From: Chas. Owens [mailto:[EMAIL PROTECTED]
 Sent: 24 November 2008 20:18
 To: Jenda Krynicky
 Cc: Perl Beginners
 Subject: Re: perl version for windows
 
 On Mon, Nov 24, 2008 at 10:34, Jenda Krynicky [EMAIL PROTECTED]
wrote:
  From: Chas. Owens [EMAIL PROTECTED]
  On Sun, Nov 23, 2008 at 19:39, Rob Dixon [EMAIL PROTECTED] wrote:
  snip
   All Perl functionality works on UNIX. Some Perl functionality
does
   not work on Windows.
  
   No, not all Perl functionality works on all Unix platforms. You
are
 as likely to
   find a compatibility issue moving from one Unix to another Unix
as
 from Unix to,
   say, VMS or Windows.
  
   It is misleading to suggest that Perl on Unix is fine, and Perl
 anywhere else is
   risky. It is usually a simple matter to write portable software,
as
 described in
  
perldoc perlport
  snip
 
  Alright, I have to call bull on this.  There are a total three
  functions that may not behave in the expected way between the
UNIXes:
  atan (HPUX does some non-standard things), sockatmark (it is fairly
  new and may not exist on some UNIXes), and system (Does not
  automatically flush output handles on some platforms).  Compare
that
  to Win32; I lost count of the caveats and warnings after thirty or
so.
   The big ones being fork, open, and kill.
 
  fork() and kill() is just as OS specific as Win32::Process is. One
  just got a builtin, the other did not. One presents itself as if it
  was general, the other says clearly it's OS specific. If you wrote a
  list of caveats from the point of a Win32 developer it would be just
  as long. And would list the same things, just with different
wording.
  fork() is not THE or even THE ONLY way to create processes, it's THE
  UNIX way to create processes.
 
 I wasn't claiming that UNIX was the only way.  I was calling bull on
 Rob's claim 
 No, not all Perl functionality works on all Unix platforms. You are as
 likely to
 find a compatibility issue moving from one Unix to another Unix as
from
 Unix to,
 say, VMS or Windows.
 
   Then start to look at what
  modules simply won't work on Win32 due to the lack of supporting
  libraries.
 
  If you start your development on Unix, you notice the modules that
  work under Unix and do not under Win32 and never even notice those
  that work under Win32 and not under Unix. Besides, those that are
  Win32 specific prettymuch always say so in the name. The unix ones
do
  not bother. Everyone's using Unix and if he doesn't he bloody well
  should!
 
 Well, I am a UNIX bigot, but the Win32 modules are tied to one OS
 (well, one that is still in common usage, three in total), the modules
 you are referring to work across many OSes; however, many of the them
 require third party libraries that are simply not available on the
 Win32 platform, that is not a problem with the module, it is a problem
 of lack of availability of the library.
 
 Now I need to see if some of the Win32::* modules work with wine.
 
 
  I have moved Perl scripts amongst HP-UX, AIX, Solaris, multiple
  flavors of Linux, various BSDs, OS X, and probably a couple I am
  forgetting and never had to change anything but a few arguments to
  external commands.  I have also ported Perl code to a few Win32
  platforms (Win9X, WinNT, and WinXP) and it was generally an uphill
  fight (mostly due to the lack of support for modules, but also
because
  of the whole drive letter crap).
 
  I've moved between California, Colorado, Kansas, North Carolina,
  Massachusetts and probably I couple I am forgetting and never had to
  change anything but a few addresse for snailmail. I have also
visited
  France and it was an uphill fight. My gosh them bastards speak
  french!
 
 Exactly.  Moving between UNIXes is easy (like moving between states in
 the US).  Moving outside of UNIX is much more difficult.  Even when it
 looks like it will be easy (US-UK), there are tons of gotchas (I need
 to look up why they call apartments flats).
 
 
 
 --
 Chas. Owens
 wonkden.net
 The most important skill a programmer can have is the ability to read.
 
 --
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 http://learn.perl.org/
 

Flat  as in no stairs

Lol  I made that up but it sounds crappy enough to be plausible



Information in this email including any attachments may be privileged, 
confidential and is intended exclusively for the addressee. The views expressed 
may not be official policy, but the personal views of the originator. If you 
have received it in error, please notify the sender by return e-mail and delete 
it from your system. You should not reproduce, distribute, store, retransmit, 
use or disclose its contents to anyone. Please note we reserve the right to 
monitor all e-mail communication through our internal and external networks. 
SKY and the SKY marks are trade marks of British Sky Broadcasting Group plc and 
are used under licence. British Sky Broadcasting Limited 

RE: Regarding conditional statement

2008-11-24 Thread Stewart Anderson

 -Original Message-
 From: suresh kumar [mailto:[EMAIL PROTECTED]
 Sent: 24 November 2008 10:41
 To: beginners@perl.org; [EMAIL PROTECTED]; Amit Saxena
 Subject: Regarding conditional statement
 
 Hi,
 
 Here is the sample code:
 
 sub a {
 print i am a\n;
 return 0;
 }
 
 sub b {
 print i am b\n;
 return 1;
 }
 
 if (a()  b()) {
 print yes\n;
 } else {
 print no\n;
 }
 
 
 
 I want both the subroutine to be executed, and then i want print some
 statements depending upon both the results.
 here if a() returns 0 then b() was not getting executed.
 
 is there any other way to do this check?


This siple change  has the effect you want I think.

#! /usr/bin/perl

use warnings;
use strict ; 
use Data::Dumper;

sub a {
print i am a\n;
return 1;
}

sub b {
print i am b\n;
return 1;
}

my $aresult = a();
my $bresult = b();

if ($aresult  $bresult) {
print yes\n;
} else {
print no\n;
}

Stu





Information in this email including any attachments may be privileged, 
confidential and is intended exclusively for the addressee. The views expressed 
may not be official policy, but the personal views of the originator. If you 
have received it in error, please notify the sender by return e-mail and delete 
it from your system. You should not reproduce, distribute, store, retransmit, 
use or disclose its contents to anyone. Please note we reserve the right to 
monitor all e-mail communication through our internal and external networks. 
SKY and the SKY marks are trade marks of British Sky Broadcasting Group plc and 
are used under licence. British Sky Broadcasting Limited (Registration No. 
2906991), Sky Interactive Limited (Registration No. 3554332), Sky-In-Home 
Service Limited (Registration No. 2067075) and Sky Subscribers Services Limited 
(Registration No. 2340150) are direct or indirect subsidiaries of British Sky 
Broadcasting Group plc (Registration No. 2247735). All of the companies 
mentioned in this paragraph are incorporated in England and Wales and share the 
same registered office at Grant Way, Isleworth, Middlesex TW7 5QD.

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




RE: need help with SpreadSheet::Parse perl module

2008-11-21 Thread Stewart Anderson


 -Original Message-
 From: Chas. Owens [mailto:[EMAIL PROTECTED]
 Sent: 21 November 2008 13:13
 To: Manasi Bopardikar
 Cc: beginners@perl.org
 Subject: Re: need help with SpreadSheet::Parse perl module
 
 On Fri, Nov 21, 2008 at 07:33, Manasi Bopardikar
 [EMAIL PROTECTED] wrote:
 snip
  in the above code I get the max row count of my sheet by reading it
 using
  the Spreadsheet::ParseExcel::Workbook module of cpan.
 
  then I want to open the same tablle2sheet.xls for writing.but
currently
 I am
  not able to find any module which allows me to do that.
 snip
 
 I don't believe there is a module that allows arbitrary editing of an
 Excel spreadsheet (but I have not done an exhaustive search of CPAN
 for one in a while).  Spreadsheet::ParseExcel allows you to read an
 existing file and Spreadsheet::WriteExcel allows you yo write a new
 file.  The only way I know of to create the illusion of an arbitrary
 edit is to use both together to copy the data from the old file to a
 new file making changes as needed, unlink'ing the old file, and
 rename'ing the new file to the old file's name.
 
 Well, that isn't 100% true; if you are on a Windows machine that has
 Excel installed you can use Win32::OLE to make Excel make your changes
 for you.
 
 --
 Chas. Owens
 wonkden.net
 The most important skill a programmer can have is the ability to read.
 
 --
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 http://learn.perl.org/
 
You can  use Spreadsheet::WriteExcel  to generate  an Excel workbook.
It has methods to add sheets and cell data and also  lots of methods
for formatting etc.

The CPAN  documentation is  very  clear and  you will be able to use
examples straight  off the  docs for a prototype.

HTH 


Stu

Information in this email including any attachments may be privileged, 
confidential and is intended exclusively for the addressee. The views expressed 
may not be official policy, but the personal views of the originator. If you 
have received it in error, please notify the sender by return e-mail and delete 
it from your system. You should not reproduce, distribute, store, retransmit, 
use or disclose its contents to anyone. Please note we reserve the right to 
monitor all e-mail communication through our internal and external networks. 
SKY and the SKY marks are trade marks of British Sky Broadcasting Group plc and 
are used under licence. British Sky Broadcasting Limited (Registration No. 
2906991), Sky Interactive Limited (Registration No. 3554332), Sky-In-Home 
Service Limited (Registration No. 2067075) and Sky Subscribers Services Limited 
(Registration No. 2340150) are direct or indirect subsidiaries of British Sky 
Broadcasting Group plc (Registration No. 2247735). All of the companies 
mentioned in this paragraph are incorporated in England and Wales and share the 
same registered office at Grant Way, Isleworth, Middlesex TW7 5QD.

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




RE: Determining if a file is more than so many days old

2008-11-20 Thread Stewart Anderson

 -Original Message-
 From: AndrewMcHorney [mailto:[EMAIL PROTECTED]
 Sent: 20 November 2008 15:19
 To: beginners@perl.org
 Subject: Determining if a file is more than so many days old
 
 Hello
 
 I am working on a perl script that will go through a directory and
 it's subdirectories and purge all the files that are more than a
 specified number of days old. I am using a Unix system so I do a find
 command to gather up the files I want. I then am going to do a stat
 command to find the date the file was created (it is never modified)
 and then determine if it is to be deleted. What is the easiest way to
 determine if a date is more than x number of days old.
 
 Andrew
 
 
 --
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 http://learn.perl.org/
 

Try the  -mtime   option on the find command ? 


Information in this email including any attachments may be privileged, 
confidential and is intended exclusively for the addressee. The views expressed 
may not be official policy, but the personal views of the originator. If you 
have received it in error, please notify the sender by return e-mail and delete 
it from your system. You should not reproduce, distribute, store, retransmit, 
use or disclose its contents to anyone. Please note we reserve the right to 
monitor all e-mail communication through our internal and external networks. 
SKY and the SKY marks are trade marks of British Sky Broadcasting Group plc and 
are used under licence. British Sky Broadcasting Limited (Registration No. 
2906991), Sky Interactive Limited (Registration No. 3554332), Sky-In-Home 
Service Limited (Registration No. 2067075) and Sky Subscribers Services Limited 
(Registration No. 2340150) are direct or indirect subsidiaries of British Sky 
Broadcasting Group plc (Registration No. 2247735). All of the companies 
mentioned in this paragraph are incorporated in England and Wales and share the 
same registered office at Grant Way, Isleworth, Middlesex TW7 5QD.

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




RE: CPAN question

2008-11-19 Thread Stewart Anderson
 -Original Message-
 From: Kevin Murphy [mailto:[EMAIL PROTECTED]
 Sent: 18 November 2008 19:14
 To: beginners@perl.org
 Subject: CPAN question
 
 Hi,
 
 I'm a system administrator, not a programmer, and my only experience
 with Perl is setting up and maintaining a Bugzilla installation on an
 Ubuntu LAMP server.  I am now attempting to integrate our Active
 Directory with Request-Tracker to give it a test run but have gotten
 stuck in the mud with the installation of the ExternalAuth module.
 
 What does one do when CPAN responds with: Warning: Cannot install
 RT::Authen::ExternalAuth, don't know what it is.?  CPAN suggested I
run
 i /RT::Authen::ExternalAuth/, which I did, but the response was:
 
 
 
 CPAN: Storable loaded ok (v2.15)
 
 Going to read /root/.cpan/Metadata
 
   Database was generated on Mon, 17 Nov 2008 12:26:48 GMT
 
 No objects found of any type for argument /RT::Authen::ExternalAuth/
 
 
 
 There are instructions to manually install the extension, but I would
 rather use CPAN and want to understand why it cannot find an extension
 that exists on the CPAN site.
 
 
 
 Thanks

The  module readme suggests it is a manual  install process.
Stu



Information in this email including any attachments may be privileged, 
confidential and is intended exclusively for the addressee. The views expressed 
may not be official policy, but the personal views of the originator. If you 
have received it in error, please notify the sender by return e-mail and delete 
it from your system. You should not reproduce, distribute, store, retransmit, 
use or disclose its contents to anyone. Please note we reserve the right to 
monitor all e-mail communication through our internal and external networks. 
SKY and the SKY marks are trade marks of British Sky Broadcasting Group plc and 
are used under licence. British Sky Broadcasting Limited (Registration No. 
2906991), Sky Interactive Limited (Registration No. 3554332), Sky-In-Home 
Service Limited (Registration No. 2067075) and Sky Subscribers Services Limited 
(Registration No. 2340150) are direct or indirect subsidiaries of British Sky 
Broadcasting Group plc (Registration No. 2247735). All of the companies 
mentioned in this paragraph are incorporated in England and Wales and share the 
same registered office at Grant Way, Isleworth, Middlesex TW7 5QD.

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




RE: Regular expression problem

2008-11-18 Thread Stewart Anderson
 -Original Message-
 From: howa [mailto:[EMAIL PROTECTED]
 Sent: 18 November 2008 08:53
 To: beginners@perl.org
 Subject: Regular expression problem
 
 Hello,
 
 I have two strings:
 
 1. abc
 2. abc
 
 
 The line of string might end with  or not, so I use the expression:
 
 (.*)[$]
 
 
 Why it didn't work out?
 
 
 Thanks.
 
 
 --
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 http://learn.perl.org/
 
Don't think there is anything wrong with the  regex per say  the script
below uses  ur regex and seems to work  ok,  in that it matches lines
with an   anchored to the end of the line.

HTH  

#! /usr/bin/perl
use warnings;
use strict;
while (DATA){
print String:\t . $_   ; 
if ( $_  =~ /(.*)[]$/) {
print match in line: $.\n;
}else {
print no match in line: $.\n;

}

}
__DATA__
 123
 123
123456
124545

Information in this email including any attachments may be privileged, 
confidential and is intended exclusively for the addressee. The views expressed 
may not be official policy, but the personal views of the originator. If you 
have received it in error, please notify the sender by return e-mail and delete 
it from your system. You should not reproduce, distribute, store, retransmit, 
use or disclose its contents to anyone. Please note we reserve the right to 
monitor all e-mail communication through our internal and external networks. 
SKY and the SKY marks are trade marks of British Sky Broadcasting Group plc and 
are used under licence. British Sky Broadcasting Limited (Registration No. 
2906991), Sky Interactive Limited (Registration No. 3554332), Sky-In-Home 
Service Limited (Registration No. 2067075) and Sky Subscribers Services Limited 
(Registration No. 2340150) are direct or indirect subsidiaries of British Sky 
Broadcasting Group plc (Registration No. 2247735). All of the companies 
mentioned in this paragraph are incorporated in England and Wales and share the 
same registered office at Grant Way, Isleworth, Middlesex TW7 5QD.

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




RE: Regular expression problem

2008-11-18 Thread Stewart Anderson
 -Original Message-
 From: Stewart Anderson
 Sent: 18 November 2008 12:20
 To: beginners@perl.org
 Cc: Stewart Anderson
 Subject: RE: Regular expression problem
 
  -Original Message-
  From: howa [mailto:[EMAIL PROTECTED]
  Sent: 18 November 2008 08:53
  To: beginners@perl.org
  Subject: Regular expression problem
 
  Hello,
 
  I have two strings:
 
  1. abc
  2. abc
 
 
  The line of string might end with  or not, so I use the
expression:
 
  (.*)[$]
 
 
  Why it didn't work out?
 
 
  Thanks.
 
 
  --
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
  http://learn.perl.org/
 
 Don't think there is anything wrong with the  regex per say  the
script
 below uses  ur regex and seems to work  ok,  in that it matches lines
with
 an   anchored to the end of the line.
 
 HTH
 
 #! /usr/bin/perl
 use warnings;
 use strict;
 while (DATA){
   print String:\t . $_   ;
 if ( $_  =~ /(.*)[]$/) {
 print match in line: $.\n;
 }else {
 print no match in line: $.\n;
 
 }
 
 }
 __DATA__
  123
  123
 123456
 124545

lol

Oops  I did not realise that I  actually changed  your regex slightly!! 



Information in this email including any attachments may be privileged, 
confidential and is intended exclusively for the addressee. The views expressed 
may not be official policy, but the personal views of the originator. If you 
have received it in error, please notify the sender by return e-mail and delete 
it from your system. You should not reproduce, distribute, store, retransmit, 
use or disclose its contents to anyone. Please note we reserve the right to 
monitor all e-mail communication through our internal and external networks. 
SKY and the SKY marks are trade marks of British Sky Broadcasting Group plc and 
are used under licence. British Sky Broadcasting Limited (Registration No. 
2906991), Sky Interactive Limited (Registration No. 3554332), Sky-In-Home 
Service Limited (Registration No. 2067075) and Sky Subscribers Services Limited 
(Registration No. 2340150) are direct or indirect subsidiaries of British Sky 
Broadcasting Group plc (Registration No. 2247735). All of the companies 
mentioned in this paragraph are incorporated in England and Wales and share the 
same registered office at Grant Way, Isleworth, Middlesex TW7 5QD.

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




RE: to read a line 2 lines above a line having a grepped string...

2008-11-11 Thread Stewart Anderson

 From: dilip [mailto:[EMAIL PROTECTED]
 Sent: 11 November 2008 11:18
 To: beginners@perl.org
 Subject: to read a line 2 lines above a line having a grepped
string...
 
 hi all,
 
 suppose i have a file having the following data..
 
 SN = TOM
 FDN = SALLY
 OPERATIONAL STATE = ENABLED
 
 Now suppose i grep the string ENABLED, i get the third line.But from
 this very line i need to go 2 lines above and get the SN value
 also.Please suggest .
 
 regards'
 
 Dilip
 
A simple approach would be to grep  for the  string but  return  the
line number, as opposed to the line and  then seek to the  line - 2.


Information in this email including any attachments may be privileged, 
confidential and is intended exclusively for the addressee. The views expressed 
may not be official policy, but the personal views of the originator. If you 
have received it in error, please notify the sender by return e-mail and delete 
it from your system. You should not reproduce, distribute, store, retransmit, 
use or disclose its contents to anyone. Please note we reserve the right to 
monitor all e-mail communication through our internal and external networks. 
SKY and the SKY marks are trade marks of British Sky Broadcasting Group plc and 
are used under licence. British Sky Broadcasting Limited (Registration No. 
2906991), Sky Interactive Limited (Registration No. 3554332), Sky-In-Home 
Service Limited (Registration No. 2067075) and Sky Subscribers Services Limited 
(Registration No. 2340150) are direct or indirect subsidiaries of British Sky 
Broadcasting Group plc (Registration No. 2247735). All of the companies 
mentioned in this paragraph are incorporated in England and Wales and share the 
same registered office at Grant Way, Isleworth, Middlesex TW7 5QD.

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




RE: to read a line 2 lines above a line having a grepped string...

2008-11-11 Thread Stewart Anderson
 -Original Message-
 From: John W. Krahn [mailto:[EMAIL PROTECTED]
 Sent: 11 November 2008 13:48
 To: Perl Beginners
 Subject: Re: to read a line 2 lines above a line having a grepped
 string...
 
 dilip wrote:
  hi all,
 
 Hello,
 
  suppose i have a file having the following data..
 
  SN = TOM
  FDN = SALLY
  OPERATIONAL STATE = ENABLED
 
  Now suppose i grep the string ENABLED, i get the third line.But
from
  this very line i need to go 2 lines above and get the SN value
  also.Please suggest .
 
 Something like this should work:
 
 my @buffer;
 while (  ) {
  push @buffer, $_;
  shift @buffer if @buffer == 4;
  if ( /ENABLED$/ ) {
  splice @buffer, 1, 1;
  last;
  }
  }
 print @buffer;
 
 
 

Neat,  thanks John :)

Stu


Information in this email including any attachments may be privileged, 
confidential and is intended exclusively for the addressee. The views expressed 
may not be official policy, but the personal views of the originator. If you 
have received it in error, please notify the sender by return e-mail and delete 
it from your system. You should not reproduce, distribute, store, retransmit, 
use or disclose its contents to anyone. Please note we reserve the right to 
monitor all e-mail communication through our internal and external networks. 
SKY and the SKY marks are trade marks of British Sky Broadcasting Group plc and 
are used under licence. British Sky Broadcasting Limited (Registration No. 
2906991), Sky Interactive Limited (Registration No. 3554332), Sky-In-Home 
Service Limited (Registration No. 2067075) and Sky Subscribers Services Limited 
(Registration No. 2340150) are direct or indirect subsidiaries of British Sky 
Broadcasting Group plc (Registration No. 2247735). All of the companies 
mentioned in this paragraph are incorporated in England and Wales and share the 
same registered office at Grant Way, Isleworth, Middlesex TW7 5QD.

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




RE: Using perl in a Bash-script to extract IP-addresses?

2008-11-10 Thread Stewart Anderson
 
 JC Janos wrote:
  Hi,
 
 Hello,
 
  I have a file containing IP addresses  ranges, their negations, and
  comments.  E.g.,
 
  1.1.1.1  # comment A
  2.2.2.2/29   # comment B
  !3.3.3.3 # comment C
  !4.4.4.4/28  # comment D
 
  I need to extract those IPs  ranges, rearrange them into a
  comma-separated list, e.g.,
 
  1.1.1.1,2.2.2/29,!3.3.3.3,!4.4.4.4/28
 
  I've read that Perl (which I don't know yet at all) is best for
Text
  processing like this.
 
  The thing is that I need to do this from within a Bash script, and
  assign the comma-separated list to a  variable in that Bash script.
 
 $ echo $TEST
 
 $ cat yourfile.txt
  1.1.1.1  # comment A
  2.2.2.2/29   # comment B
  !3.3.3.3 # comment C
  !4.4.4.4/28  # comment D
 $ TEST=$(perl -lp0777e'$_=join,,/!?[\d.]+(?:\/\d+)?/g'
yourfile.txt);
 echo $TEST
 1.1.1.1,2.2.2.2/29,!3.3.3.3,!4.4.4.4/28
 
Here  is an example of the same thing in shell speak just do whatever
you want with.  The  ipaddy  in the loop  to purduce the  string you
require.


cat ipin.txt |while read inline 
do ipaddy=`echo $inline |awk '{print $1 } '` 
echo $ipaddy 
done



put this in ipin.txt
1.1.1.1  # comment A
2.2.2.2/29   # comment B
!3.3.3.3 # comment C
!4.4.4.4/28  # comment D

Information in this email including any attachments may be privileged, 
confidential and is intended exclusively for the addressee. The views expressed 
may not be official policy, but the personal views of the originator. If you 
have received it in error, please notify the sender by return e-mail and delete 
it from your system. You should not reproduce, distribute, store, retransmit, 
use or disclose its contents to anyone. Please note we reserve the right to 
monitor all e-mail communication through our internal and external networks. 
SKY and the SKY marks are trade marks of British Sky Broadcasting Group plc and 
are used under licence. British Sky Broadcasting Limited (Registration No. 
2906991), Sky Interactive Limited (Registration No. 3554332), Sky-In-Home 
Service Limited (Registration No. 2067075) and Sky Subscribers Services Limited 
(Registration No. 2340150) are direct or indirect subsidiaries of British Sky 
Broadcasting Group plc (Registration No. 2247735). All of the companies 
mentioned in this paragraph are incorporated in England and Wales and share the 
same registered office at Grant Way, Isleworth, Middlesex TW7 5QD.

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




RE: Using perl in a Bash-script to extract IP-addresses?

2008-11-10 Thread Stewart Anderson

 From: John W. Krahn [mailto:[EMAIL PROTECTED]
 Sent: 10 November 2008 11:26
 To: Perl Beginners
 Subject: Re: Using perl in a Bash-script to extract IP-addresses?
 
 Stewart Anderson wrote:
  JC Janos wrote:
 
  I have a file containing IP addresses  ranges, their negations,
and
  comments.  E.g.,
 
1.1.1.1  # comment A
2.2.2.2/29   # comment B
!3.3.3.3 # comment C
!4.4.4.4/28  # comment D
 
  I need to extract those IPs  ranges, rearrange them into a
  comma-separated list, e.g.,
 
1.1.1.1,2.2.2/29,!3.3.3.3,!4.4.4.4/28
 
  I've read that Perl (which I don't know yet at all) is best for
  Text
  processing like this.
 
  The thing is that I need to do this from within a Bash script, and
  assign the comma-separated list to a  variable in that Bash
script.
 
  Here  is an example of the same thing in shell speak just do
whatever
  you want with.  The  ipaddy  in the loop  to purduce the  string you
  require.
 
 
  cat ipin.txt |while read inline
  do ipaddy=`echo $inline |awk '{print $1 } '`
  echo $ipaddy
  done
 
 Why not just:
 
 ipaddy=`awk '{ print $1 }' ipin.txt`
 
 
 But that still doesn't get you a comma-separated list.
 
 
 

Never said it did,  I did suggest to build  the  string in the loop  
  Here  is an example of the same thing in shell speak just do
whatever
  you want with.  The  ipaddy  in the loop  to purduce the  string you
  require.
 
:)


Information in this email including any attachments may be privileged, 
confidential and is intended exclusively for the addressee. The views expressed 
may not be official policy, but the personal views of the originator. If you 
have received it in error, please notify the sender by return e-mail and delete 
it from your system. You should not reproduce, distribute, store, retransmit, 
use or disclose its contents to anyone. Please note we reserve the right to 
monitor all e-mail communication through our internal and external networks. 
SKY and the SKY marks are trade marks of British Sky Broadcasting Group plc and 
are used under licence. British Sky Broadcasting Limited (Registration No. 
2906991), Sky Interactive Limited (Registration No. 3554332), Sky-In-Home 
Service Limited (Registration No. 2067075) and Sky Subscribers Services Limited 
(Registration No. 2340150) are direct or indirect subsidiaries of British Sky 
Broadcasting Group plc (Registration No. 2247735). All of the companies 
mentioned in this paragraph are incorporated in England and Wales and share the 
same registered office at Grant Way, Isleworth, Middlesex TW7 5QD.

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




RE: How to put a global variable in a package, accessible to users of that package?

2008-10-31 Thread Stewart Anderson
 -Original Message-
 From: Jeff Pang [mailto:[EMAIL PROTECTED]
 Sent: 31 October 2008 09:38
 To: Perl Beginners [Beginners Perl]
 Subject: RE: How to put a global variable in a package, accessible to
 users of that package?
 
 
   Message du 31/10/08 10:25
  De : Stewart Anderson
  A : mrstevegross , beginners@perl.org
 
   === foo.pl ===
   package foo;
   use constant VAR = someval;
  
   === bar.pl ===
   use foo;
   print $foo::VAR;
  
   It doesn't appear to be working; it compiles ok, but it prints
   nothing. I thought it would print someval.
  
  That looks interesting.  How do  people use that kind of constant
  assignment.
 That was not interesting. $foo::VAR is a wrong usage on his case. See
 Shawn's answer.
 
Thanks  Jeff,  I  had read  Shawn's answer,  I  was  asking about the
technique and how/where/why  it  gets used,  not whether the  person
asking for assistance had done it correctly.  


Information in this email including any attachments may be privileged, 
confidential and is intended exclusively for the addressee. The views expressed 
may not be official policy, but the personal views of the originator. If you 
have received it in error, please notify the sender by return e-mail and delete 
it from your system. You should not reproduce, distribute, store, retransmit, 
use or disclose its contents to anyone. Please note we reserve the right to 
monitor all e-mail communication through our internal and external networks. 
SKY and the SKY marks are trade marks of British Sky Broadcasting Group plc and 
are used under licence. British Sky Broadcasting Limited (Registration No. 
2906991), Sky Interactive Limited (Registration No. 3554332), Sky-In-Home 
Service Limited (Registration No. 2067075) and Sky Subscribers Services Limited 
(Registration No. 2340150) are direct or indirect subsidiaries of British Sky 
Broadcasting Group plc (Registration No. 2247735). All of the companies 
mentioned in this paragraph are incorporated in England and Wales and share the 
same registered office at Grant Way, Isleworth, Middlesex TW7 5QD.

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




RE: How to put a global variable in a package, accessible to users of that package?

2008-10-31 Thread Stewart Anderson
 -Original Message-
 From: Rob Dixon [mailto:[EMAIL PROTECTED]
 Sent: 31 October 2008 11:51
 To: Perl Beginners
 Cc: Stewart Anderson
 Subject: Re: How to put a global variable in a package, accessible to
 users of that package?
 
 Stewart Anderson wrote:
  From: mrstevegross [mailto:[EMAIL PROTECTED]
 
  I have a package named Foo in which I want to define some
package-
  level constants (such as $VAR=soemval). I want those constants
  available to users of package Foo, so the following code would
work:
 
  === foo.pl ===
  package foo;
  use constant VAR = someval;
 
  === bar.pl ===
  use foo;
  print $foo::VAR;
 
  It doesn't appear to be working; it compiles ok, but it prints
  nothing. I thought it would print someval.
 
  That looks interesting.  How do  people use that kind of constant
  assignment.  I can see uses for it, but would be interested to hear
what
  others use this technique for.
 
 Take a look at
 
   perldoc constant
 
 What the pragma creates is a prototyped subroutine with exactly zero
 parameters,
 so writing
 
   use constant PI = 3.14159265359;
 
 is equivalent to a subroutine
 
   sub PI() {
 3.14159265359;
   }
 
 However it has a few of advantages over just writing this directly:
 
 - It is self-documenting, i.e. it is clear that a named constant is
being
   defined.
 
 - The Perl compiler has a chance to optimise out the subroutine
definition
 and
   call
 
 - The implementation could change to something more optimal in the
future
   without needing to alter any code that uses the pragma
 
 I hope this helps,
 
 Rob
Thanks :)

Stu 


Information in this email including any attachments may be privileged, 
confidential and is intended exclusively for the addressee. The views expressed 
may not be official policy, but the personal views of the originator. If you 
have received it in error, please notify the sender by return e-mail and delete 
it from your system. You should not reproduce, distribute, store, retransmit, 
use or disclose its contents to anyone. Please note we reserve the right to 
monitor all e-mail communication through our internal and external networks. 
SKY and the SKY marks are trade marks of British Sky Broadcasting Group plc and 
are used under licence. British Sky Broadcasting Limited (Registration No. 
2906991), Sky Interactive Limited (Registration No. 3554332), Sky-In-Home 
Service Limited (Registration No. 2067075) and Sky Subscribers Services Limited 
(Registration No. 2340150) are direct or indirect subsidiaries of British Sky 
Broadcasting Group plc (Registration No. 2247735). All of the companies 
mentioned in this paragraph are incorporated in England and Wales and share the 
same registered office at Grant Way, Isleworth, Middlesex TW7 5QD.

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




RE: How to put a global variable in a package, accessible to users of that package?

2008-10-31 Thread Stewart Anderson
 From: mrstevegross [mailto:[EMAIL PROTECTED]
 Sent: 30 October 2008 18:43
 To: beginners@perl.org
 Subject: How to put a global variable in a package, accessible to
users of
 that package?
 
 I have a package named Foo in which I want to define some package-
 level constants (such as $VAR=soemval). I want those constants
 available to users of package Foo, so the following code would work:
 
 === foo.pl ===
 package foo;
 use constant VAR = someval;
 
 === bar.pl ===
 use foo;
 print $foo::VAR;
 
 It doesn't appear to be working; it compiles ok, but it prints
 nothing. I thought it would print someval.
 
That looks interesting.  How do  people use that kind of constant
assignment.  I can see uses for it, but would be interested to hear what
others use this technique for.

Ta 

Stu 


Information in this email including any attachments may be privileged, 
confidential and is intended exclusively for the addressee. The views expressed 
may not be official policy, but the personal views of the originator. If you 
have received it in error, please notify the sender by return e-mail and delete 
it from your system. You should not reproduce, distribute, store, retransmit, 
use or disclose its contents to anyone. Please note we reserve the right to 
monitor all e-mail communication through our internal and external networks. 
SKY and the SKY marks are trade marks of British Sky Broadcasting Group plc and 
are used under licence. British Sky Broadcasting Limited (Registration No. 
2906991), Sky Interactive Limited (Registration No. 3554332), Sky-In-Home 
Service Limited (Registration No. 2067075) and Sky Subscribers Services Limited 
(Registration No. 2340150) are direct or indirect subsidiaries of British Sky 
Broadcasting Group plc (Registration No. 2247735). All of the companies 
mentioned in this paragraph are incorporated in England and Wales and share the 
same registered office at Grant Way, Isleworth, Middlesex TW7 5QD.

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




RE: regex for

2008-10-30 Thread Stewart Anderson
 -Original Message-
 From: Brent Clark [mailto:[EMAIL PROTECTED]
 Sent: 30 October 2008 09:57
 To: beginners@perl.org
 Subject: regex for 
 
 Hiya
 
 I have three sentences.
 
 This is a nice hotel.
 The view  food is good.
 We are at the Victoria  Alfred Hotel.
 
 I need a perl regex / code to not print out sentence 2 (basically
fail).
 
 This is what I so far.
 
 print $_  if $_ !~ /\|Victoria \/ig;
 
 Im struggling to get this right.
 
 TIA.
 
#! /usr/bin/perl

use warnings;
use strict ; 

while (DATA) {
print $_  if $_ !~ /\|Victoria \/ig;
}

__DATA__
This is a nice hotel.
The view  food is good.
We are at the Victoria  Alfred Hotel.

Information in this email including any attachments may be privileged, 
confidential and is intended exclusively for the addressee. The views expressed 
may not be official policy, but the personal views of the originator. If you 
have received it in error, please notify the sender by return e-mail and delete 
it from your system. You should not reproduce, distribute, store, retransmit, 
use or disclose its contents to anyone. Please note we reserve the right to 
monitor all e-mail communication through our internal and external networks. 
SKY and the SKY marks are trade marks of British Sky Broadcasting Group plc and 
are used under licence. British Sky Broadcasting Limited (Registration No. 
2906991), Sky Interactive Limited (Registration No. 3554332), Sky-In-Home 
Service Limited (Registration No. 2067075) and Sky Subscribers Services Limited 
(Registration No. 2340150) are direct or indirect subsidiaries of British Sky 
Broadcasting Group plc (Registration No. 2247735). All of the companies 
mentioned in this paragraph are incorporated in England and Wales and share the 
same registered office at Grant Way, Isleworth, Middlesex TW7 5QD.

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




RE: Installing perl modules

2008-10-29 Thread Stewart Anderson
 Hi Andy,
 
 
 Andy Cravens wrote:
  Is there a way to have multiple users on a server using the perl at
  /usr/local/bin/perl and yet have their own personal perl modules
that
  the other users can't see?
 
 ...
  During module install you can specify an alternate location to
install
  the module using LIBS=/path/to/your/perlmods like this:
 
  perl Makefile.PL LIBS=/home/jdoe/perlmods
 
  but if I'm correct, I think these perl modules will be seen by
  everybody on the server.  Can someone clarify this?
 
 
 I'm not sure if this is of any help since it was a while ago that I
 tried this.  But I have done this before and if I recall, I did
 something like:
 
 perl Makefile.PL PREFIX=~/perl
 
 And then make;make test;make install.  I don't recall using LIBS.
And
 then, I had to do:  use lib '...path in my home directory...'; in my
 programs.  They were in my home directory, so no, no one could see
them.
 
 Ray

I think its even easier that that,  from what I have seen.

If you're a non  priviledged user perl  will decide a path to the
modules  based  on that so its quite likely to be ~/perl/ blah blah.

I wanted  to install modules globally so  I did it as root (or in a sudo
shell).

That's  only from my observations  though, but its   easy enough to
verify in your own environment.


Stu


Information in this email including any attachments may be privileged, 
confidential and is intended exclusively for the addressee. The views expressed 
may not be official policy, but the personal views of the originator. If you 
have received it in error, please notify the sender by return e-mail and delete 
it from your system. You should not reproduce, distribute, store, retransmit, 
use or disclose its contents to anyone. Please note we reserve the right to 
monitor all e-mail communication through our internal and external networks. 
SKY and the SKY marks are trade marks of British Sky Broadcasting Group plc and 
are used under licence. British Sky Broadcasting Limited (Registration No. 
2906991), Sky Interactive Limited (Registration No. 3554332), Sky-In-Home 
Service Limited (Registration No. 2067075) and Sky Subscribers Services Limited 
(Registration No. 2340150) are direct or indirect subsidiaries of British Sky 
Broadcasting Group plc (Registration No. 2247735). All of the companies 
mentioned in this paragraph are incorporated in England and Wales and share the 
same registered office at Grant Way, Isleworth, Middlesex TW7 5QD.

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




RE: Doubt in Spreadsheet::ParseExcel

2008-10-29 Thread Stewart Anderson
 

  _  

From: anitha victor [mailto:[EMAIL PROTECTED] 
Sent: 29 October 2008 08:54
To: beginners@perl.org
Subject: Doubt in Spreadsheet::ParseExcel

 

Hi Team,

  I want a code snippet for retrieving the content in xcel sheet in a
variable.

Thanks in advance 

The CPAN documentation for this module is  great.

 

I used it forst time without any major difficulties - except  being a
noob to Perl!!

 

Stu

 

Information in this email including any attachments may be privileged, 
confidential and is intended exclusively for the addressee. The views expressed 
may not be official policy, but the personal views of the originator. If you 
have received it in error, please notify the sender by return e-mail and delete 
it from your system. You should not reproduce, distribute, store, retransmit, 
use or disclose its contents to anyone. Please note we reserve the right to 
monitor all e-mail communication through our internal and external networks. 
SKY and the SKY marks are trade marks of British Sky Broadcasting Group plc and 
are used under licence. British Sky Broadcasting Limited (Registration No. 
2906991), Sky Interactive Limited (Registration No. 3554332), Sky-In-Home 
Service Limited (Registration No. 2067075) and Sky Subscribers Services Limited 
(Registration No. 2340150) are direct or indirect subsidiaries of British Sky 
Broadcasting Group plc (Registration No. 2247735). All of the companies 
mentioned in this paragraph are incorporated in England and Wales and share the 
same registered office at Grant Way, Isleworth, Middlesex TW7 5QD.
image001.gif

RE: Strip HTML from files in a directory

2008-10-29 Thread Stewart Anderson
 -Original Message-
 From: bdy [mailto:[EMAIL PROTECTED]
 Sent: 29 October 2008 15:14
 To: beginners@perl.org
 Subject: Strip HTML from files in a directory
 
 Does anyone know if there's a way to use an HTML stripper in Perl to
 scrub the HTML from all files in a specified directory? If so, would
 you point me in the correct direction.
 
 Thanks,
 
 


* pokes head above parapet * - Stripper?  



Information in this email including any attachments may be privileged, 
confidential and is intended exclusively for the addressee. The views expressed 
may not be official policy, but the personal views of the originator. If you 
have received it in error, please notify the sender by return e-mail and delete 
it from your system. You should not reproduce, distribute, store, retransmit, 
use or disclose its contents to anyone. Please note we reserve the right to 
monitor all e-mail communication through our internal and external networks. 
SKY and the SKY marks are trade marks of British Sky Broadcasting Group plc and 
are used under licence. British Sky Broadcasting Limited (Registration No. 
2906991), Sky Interactive Limited (Registration No. 3554332), Sky-In-Home 
Service Limited (Registration No. 2067075) and Sky Subscribers Services Limited 
(Registration No. 2340150) are direct or indirect subsidiaries of British Sky 
Broadcasting Group plc (Registration No. 2247735). All of the companies 
mentioned in this paragraph are incorporated in England and Wales and share the 
same registered office at Grant Way, Isleworth, Middlesex TW7 5QD.

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




RE: :Simple question

2008-10-22 Thread Stewart Anderson

 -Original Message-
 From: Richard Lee [mailto:[EMAIL PROTECTED]
 Sent: 22 October 2008 06:00
 To: Perl Beginners
 Subject: XML::Simple question
 
 while trying to study the article on perlmonks.org,
 
 http://perlmonks.org/?node_id=490846
 
 regarding XML parsing, I need bit of clarfication.
 
 how do I parse out
 
 image src=http://www.oreilly.com/catalog/covers/perlbp.s.gif;
  width=145 height=190 /
 
 
 I tried $book-{image}-{src}... but doesn't work.. I need some
 understanding on how these information is stored.
 
 
 
 parsing code
 
   use XML::Simple qw(:strict);
 
   my $library  = XMLin($filename,
 ForceArray = 1,
 KeyAttr= {},
   );
 
   foreach my $book (@{$library-{book}}) {
 print $book-{title}-[0], \n
 
   }
 
 XML file
 
 library
 book
   titlePerl Best Practices/title
   authorDamian Conway/author
   isbn0596001738/isbn
   pages542/pages
   image src=http://www.oreilly.com/catalog/covers/perlbp.s.gif;
  width=145 height=190 /
 /book
 book
   titlePerl Cookbook, Second Edition/title
   authorTom Christiansen/author
   authorNathan Torkington/author
   isbn0596003137/isbn
   pages964/pages
   image src=http://www.oreilly.com/catalog/covers/perlckbk2.s.gi
 +f
  width=145 height=190 /
 /book
 book
   titleGuitar for Dummies/title
   authorMark Phillips/author
   authorJohn Chappell/author
   isbn076455106X/isbn
   pages392/pages
   image src=http://media.wiley.com/product_data/coverImage/6X/07
 +645510/076455106X.jpg
  width=100 height=125 /
 /book
   /library
 
 
 
 --
I gave up with XML::Simple  it did not seem to  work  (well I could not
getit  to work)  in the way that  the documentation suggested.  

I  switched to XML::Smart and it works perfectly.  I use XML Spy to dig
out the XPath etc and work with that.

Stu




Information in this email including any attachments may be privileged, 
confidential and is intended exclusively for the addressee. The views expressed 
may not be official policy, but the personal views of the originator. If you 
have received it in error, please notify the sender by return e-mail and delete 
it from your system. You should not reproduce, distribute, store, retransmit, 
use or disclose its contents to anyone. Please note we reserve the right to 
monitor all e-mail communication through our internal and external networks. 
SKY and the SKY marks are trade marks of British Sky Broadcasting Group plc and 
are used under licence. British Sky Broadcasting Limited (Registration No. 
2906991), Sky Interactive Limited (Registration No. 3554332), Sky-In-Home 
Service Limited (Registration No. 2067075) and Sky Subscribers Services Limited 
(Registration No. 2340150) are direct or indirect subsidiaries of British Sky 
Broadcasting Group plc (Registration No. 2247735). All of the companies 
mentioned in this paragraph are incorporated in England and Wales and share the 
same registered office at Grant Way, Isleworth, Middlesex TW7 5QD.

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




RE: Send Mail with attachment

2008-10-22 Thread Stewart Anderson
 
 Hi All,
 
 I'm using perl module MIME::Lite to sent out email with attachments,
 may I know what Type should I define to attach any type of files,
 for instance .jpg, .xls, .doc, .pdf  and etc without checking the
 attached file type. Is there any global variable to define instead of
 Type = 'application/zip', Type = 'image/gif', Type = application/
 xls and etc?
 
   $msg-attach (
  Type = 'what type should I define without checking the
attached
 file type',
  Path = '$path',
  Filename = '$filename',
  Disposition = 'attachment'
   )
 
 Please helps.
 
I think  that  with MIME::Lite you can  just set the  type as BINARY or
TEXT.  I experimented with  lots of   types  for  zip files and xls/csv
files and whilst  is  may break the RFC  it  does not seem to break how
the item is attached  eg I send  xls files as text and  it made no
difference  when  the mail arrived in outlook with the attachement.

That's  probably heresy though :)

Stu



Information in this email including any attachments may be privileged, 
confidential and is intended exclusively for the addressee. The views expressed 
may not be official policy, but the personal views of the originator. If you 
have received it in error, please notify the sender by return e-mail and delete 
it from your system. You should not reproduce, distribute, store, retransmit, 
use or disclose its contents to anyone. Please note we reserve the right to 
monitor all e-mail communication through our internal and external networks. 
SKY and the SKY marks are trade marks of British Sky Broadcasting Group plc and 
are used under licence. British Sky Broadcasting Limited (Registration No. 
2906991), Sky Interactive Limited (Registration No. 3554332), Sky-In-Home 
Service Limited (Registration No. 2067075) and Sky Subscribers Services Limited 
(Registration No. 2340150) are direct or indirect subsidiaries of British Sky 
Broadcasting Group plc (Registration No. 2247735). All of the companies 
mentioned in this paragraph are incorporated in England and Wales and share the 
same registered office at Grant Way, Isleworth, Middlesex TW7 5QD.

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




RE: how to count line numbers in file quickly?

2008-10-08 Thread Stewart Anderson

 -Original Message-
 From: loody [mailto:[EMAIL PROTECTED]
 Sent: 08 October 2008 08:56
 To: Perl beginners
 Subject: Re: how to count line numbers in file quickly?
 
  Dear all:
  I try to write a perl to compare whether the line numbers of 2 files
  is equivalent.
  Below is my source code:
 
  tie my @src_file1,'Tie::File', $src_file1, mode = O_RDWR ,autochomp
=
  1 or die cannot open file $!;
  tie my @src_file2,'Tie::File', $src_file2, mode = O_RDWR ,autochomp
=
  1 or die cannot open file $!;
  if($#src_file1 != $#src_file2)
  {
 printf The 2 files line numbers are different\n;
 exit;
  }
 
  but I find the time will be quite long when these 2 files are large,
  each about 12MB.
  I there quicker way to meet the same requirement?
  appreciate your help,
  miloody
 
 --
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 http://learn.perl.org/
 
Spotted this,  it might   help you ?
Text::Diff

If all you need is confirmation that they are  different perhaps a
checksum might serve you better?

Also comparing  the  files with diff will probably be  quicker since  it
has been written to do exactly that.

Stu



Information in this email including any attachments may be privileged, 
confidential and is intended exclusively for the addressee. The views expressed 
may not be official policy, but the personal views of the originator. If you 
have received it in error, please notify the sender by return e-mail and delete 
it from your system. You should not reproduce, distribute, store, retransmit, 
use or disclose its contents to anyone. Please note we reserve the right to 
monitor all e-mail communication through our internal and external networks. 
SKY and the SKY marks are trade marks of British Sky Broadcasting Group plc and 
are used under licence. British Sky Broadcasting Limited (Registration No. 
2906991), Sky Interactive Limited (Registration No. 3554332), Sky-In-Home 
Service Limited (Registration No. 2067075) and Sky Subscribers Services Limited 
(Registration No. 2340150) are direct or indirect subsidiaries of British Sky 
Broadcasting Group plc (Registration No. 2247735). All of the companies 
mentioned in this paragraph are incorporated in England and Wales and share the 
same registered office at Grant Way, Isleworth, Middlesex TW7 5QD.

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




RE: certification for perl

2008-10-06 Thread Stewart Anderson
 From: Jeff Pang [mailto:[EMAIL PROTECTED]
 Sent: 06 October 2008 14:37
 To: Praveena Vittal
 Cc: beginners@perl.org
 Subject: Re: certification for perl
 
  Message du 06/10/08 15:31
  De : Praveena Vittal
  A : Jeff Pang
  Copie à : beginners@perl.org
  Objet : Re: certification for perl
 
Jeff,
 
   So many new books i heard.
 
   Do you have any idea that these books are available online?
 
 
 
 I don't know if they all are free online like here.
 For the commercial books you should pay for them.
 
 
 Regards,
 Jeff.
 
Safari  online has  loads  of Perl  books.  

Stu


Information in this email including any attachments may be privileged, 
confidential and is intended exclusively for the addressee. The views expressed 
may not be official policy, but the personal views of the originator. If you 
have received it in error, please notify the sender by return e-mail and delete 
it from your system. You should not reproduce, distribute, store, retransmit, 
use or disclose its contents to anyone. Please note we reserve the right to 
monitor all e-mail communication through our internal and external networks. 
SKY and the SKY marks are trade marks of British Sky Broadcasting Group plc and 
are used under licence. British Sky Broadcasting Limited (Registration No. 
2906991), Sky Interactive Limited (Registration No. 3554332), Sky-In-Home 
Service Limited (Registration No. 2067075) and Sky Subscribers Services Limited 
(Registration No. 2340150) are direct or indirect subsidiaries of British Sky 
Broadcasting Group plc (Registration No. 2247735). All of the companies 
mentioned in this paragraph are incorporated in England and Wales and share the 
same registered office at Grant Way, Isleworth, Middlesex TW7 5QD.

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




Generating Excel Charts from *nix

2008-10-01 Thread Stewart Anderson
Hi all,

 

I  am  looking to find a way to generate  an  excel sheet with charts
on   a *nix flavour (its MAC OSX  Actually).  

 

I  used  Spreadsheet:::WriteExcel   quite happily to gen a sheet and
fill   it with the data I want.  However the  chart facility has a
slight drawback in that you need to  build the chart and extend the
series to allow for room to cover the   largest number of  data  items
you want to chart.

 

The  items I want to chart range from a series   length of  1000
ranging to 7000.  So  I would need to allow 7000   for the   reporting
period that  has lots of data.

 

This means that the  chart  is either  squashed up  or could miss data
items from the chart altogether.

 

Unfortunately  Spreadsheet::WriteExcel  does not support named ranges  -
yet,  and the chart series will not take a formula to redirect the
reference to a range.

 

Has anyone   done  anything like this before?

 

Ta 

 

Stu 

 

 

 

Information in this email including any attachments may be privileged, 
confidential and is intended exclusively for the addressee. The views expressed 
may not be official policy, but the personal views of the originator. If you 
have received it in error, please notify the sender by return e-mail and delete 
it from your system. You should not reproduce, distribute, store, retransmit, 
use or disclose its contents to anyone. Please note we reserve the right to 
monitor all e-mail communication through our internal and external networks. 
SKY and the SKY marks are trade marks of British Sky Broadcasting Group plc and 
are used under licence. British Sky Broadcasting Limited (Registration No. 
2906991), Sky Interactive Limited (Registration No. 3554332), Sky-In-Home 
Service Limited (Registration No. 2067075) and Sky Subscribers Services Limited 
(Registration No. 2340150) are direct or indirect subsidiaries of British Sky 
Broadcasting Group plc (Registration No. 2247735). All of the companies 
mentioned in this paragraph are incorporated in England and Wales and share the 
same registered office at Grant Way, Isleworth, Middlesex TW7 5QD.


RE: Generating Excel Charts from *nix

2008-10-01 Thread Stewart Anderson
Hi all,

 

I  am  looking to find a way to generate  an  excel sheet with charts
on   a *nix flavour (its MAC OSX  Actually).  

 

I  used  Spreadsheet:::WriteExcel   quite happily to gen a sheet and
fill   it with the data I want.  However the  chart facility has a
slight drawback in that you need to  build the chart and extend the
series to allow for room to cover the   largest number of  data  items
you want to chart.

 

The  items I want to chart range from a series   length of  1000
ranging to 7000.  So  I would need to allow 7000   for the   reporting
period that  has lots of data.

 

This means that the  chart  is either  squashed up  or could miss data
items from the chart altogether.

 

Unfortunately  Spreadsheet::WriteExcel  does not support named ranges  -
yet,  and the chart series will not take a formula to redirect the
reference to a range.

 

Has anyone   done  anything like this before?

 

Ta 

 

Stu 

 

 

[Stewart Anderson] Meant  to  say that I don't want to  do this is
Win32::OLE,  I can just as easy do it from   outlook  when I  send  the
mail with the sheet attached,  really looking for a  neat  perl
solution  for the whole thing  is all.

 

Information in this email including any attachments may be privileged, 
confidential and is intended exclusively for the addressee. The views expressed 
may not be official policy, but the personal views of the originator. If you 
have received it in error, please notify the sender by return e-mail and delete 
it from your system. You should not reproduce, distribute, store, retransmit, 
use or disclose its contents to anyone. Please note we reserve the right to 
monitor all e-mail communication through our internal and external networks. 
SKY and the SKY marks are trade marks of British Sky Broadcasting Group plc and 
are used under licence. British Sky Broadcasting Limited (Registration No. 
2906991), Sky Interactive Limited (Registration No. 3554332), Sky-In-Home 
Service Limited (Registration No. 2067075) and Sky Subscribers Services Limited 
(Registration No. 2340150) are direct or indirect subsidiaries of British Sky 
Broadcasting Group plc (Registration No. 2247735). All of the companies 
mentioned in this paragraph are incorporated in England and Wales and share the 
same registered office at Grant Way, Isleworth, Middlesex TW7 5QD.


RE: send die to a file

2008-09-26 Thread Stewart Anderson
 -Original Message-
 From: Li, Jialin [mailto:[EMAIL PROTECTED]
 Sent: 26 September 2008 06:16
 To: aa aa
 Cc: beginners@perl.org
 Subject: Re: send die  to a file
 
 On Thu, Sep 25, 2008 at 11:55 PM, aa aa [EMAIL PROTECTED] wrote:
 
 
  Hi,
 
  I try to open several files, if one of them failed, my program will
die
 and
  then send the died information to a file.
 
  eg.
  open(AA, a.txt) or die can't open file a.txt\n;
 
  But I want to this string can't open file a.txt\n print to a file.
 
  Is anyone can help me?
 
  org.chen
You could   call an error routine  with  your  string  as an argument,
or 

or Error(Could not pen the file a.txt ; 

Then in your Error  sub you do what ever  you want to do with that
error.  I have used this  and  considered  expanding it to  include
error codes  in  warning/fatal ranges etc but have not yet felt the
need.

This is what mine does (The  $log-msg  liones are from  Log::Simple.):

sub Error {
local ($errormessage) = @_;
if (defined $log) {
$log-msg(1,$errormessage);
}
print \n\nERROR:\t . $errormessage . \n\n  ; 

# rollback  DB  if  it was  connected
if (defined $dbh ) {
$rc  = $dbh-rollback  ;
}
if (defined $log) {
$log-msg(1,Rollback:\t,$rc,\n);
}
print \nCalling cleanup to close connections and rollback
etc...\n ; 
Cleanup();
if ($SendEmailNotification) { 
$subjmodifier=  - ERROR ; 
$EmailBody = $errormessage;
PrepEmailNotification($subjmodifier,$EmailBody,@FileList); 
} else {
if (defined $log) {
$log-msg(1,Email notification
disabled\n);
}
}

Perhaps  a more  experienced Perl Monger might comment on that approach
in general ? 

Ta 

Stu 

 


Information in this email including any attachments may be privileged, 
confidential and is intended exclusively for the addressee. The views expressed 
may not be official policy, but the personal views of the originator. If you 
have received it in error, please notify the sender by return e-mail and delete 
it from your system. You should not reproduce, distribute, store, retransmit, 
use or disclose its contents to anyone. Please note we reserve the right to 
monitor all e-mail communication through our internal and external networks. 
SKY and the SKY marks are trade marks of British Sky Broadcasting Group plc and 
are used under licence. British Sky Broadcasting Limited (Registration No. 
2906991), Sky Interactive Limited (Registration No. 3554332), Sky-In-Home 
Service Limited (Registration No. 2067075) and Sky Subscribers Services Limited 
(Registration No. 2340150) are direct or indirect subsidiaries of British Sky 
Broadcasting Group plc (Registration No. 2247735). All of the companies 
mentioned in this paragraph are incorporated in England and Wales and share the 
same registered office at Grant Way, Isleworth, Middlesex TW7 5QD.

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




RE: Perl Sockets oddity..

2008-09-24 Thread Stewart Anderson
 -Original Message-
 From: Andy Dixon [mailto:[EMAIL PROTECTED]
 Sent: 24 September 2008 12:26
 To: beginners@perl.org
 Subject: Perl Sockets oddity..
 
 Hello,
 
 I may be being a bit dim, but I wrote this:
 
 #!/usr/bin/perl -w
 use IO::Socket::INET;
 print ISONAS Logger (perl) v1\n;
 my $socket = IO::Socket::INET-new(
  PeerAddr = 10.9.1.100,
  PeerPort = 5321
) or die $!;
 
 print Connected.\n;
 
 $socket-print(login|);
 
 while (true) {
  $socket-recv($text,128);
  print $text;
 }
 
 
 The data gets sent to the server, and data comes back, but does not
 get displayed on the screen. However, if I change the while() to
 while($text==$text), I get the following error:
 
 Use of uninitialized value in numeric eq (==) at ilog.pl line 13.
 Use of uninitialized value in numeric eq (==) at ilog.pl line 13.
 Use of uninitialized value in print at ilog.pl line 14.
 Argument  9/24/200812:25:43LOGON| isn't numeric in numeric eq
 (==) at ilog.pl line 16.
 Argument  9/24/200812:25:43LOGON ACCEPTED|| isn't numeric in
 numeric eq (==) at ilog.pl line 16.
 
 So, $text does contain the result, but for some reason it will not
 print to the screen. I'm stuck!!!
 
[Stewart Anderson] 
Is it that   perl is interpolating $text  and your  argument  has
symbols in it ?  Quoting the  var might help?



Information in this email including any attachments may be privileged, 
confidential and is intended exclusively for the addressee. The views expressed 
may not be official policy, but the personal views of the originator. If you 
have received it in error, please notify the sender by return e-mail and delete 
it from your system. You should not reproduce, distribute, store, retransmit, 
use or disclose its contents to anyone. Please note we reserve the right to 
monitor all e-mail communication through our internal and external networks. 
SKY and the SKY marks are trade marks of British Sky Broadcasting Group plc and 
are used under licence. British Sky Broadcasting Limited (Registration No. 
2906991), Sky Interactive Limited (Registration No. 3554332), Sky-In-Home 
Service Limited (Registration No. 2067075) and Sky Subscribers Services Limited 
(Registration No. 2340150) are direct or indirect subsidiaries of British Sky 
Broadcasting Group plc (Registration No. 2247735). All of the companies 
mentioned in this paragraph are incorporated in England and Wales and share the 
same registered office at Grant Way, Isleworth, Middlesex TW7 5QD.

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




RE: Making a program more robust with regard to line endings

2008-09-23 Thread Stewart Anderson
 See `perldoc -f binmode` and search for :crlf
 
 
[Stewart Anderson] 
Or  provide  your  operators  with a  means that  enforces the transfer
in the mode you actually want it?

Then  you don't have to do any changes  to your own code,  as  long as
you can trust the  transfer method.





Information in this email including any attachments may be privileged, 
confidential and is intended exclusively for the addressee. The views expressed 
may not be official policy, but the personal views of the originator. If you 
have received it in error, please notify the sender by return e-mail and delete 
it from your system. You should not reproduce, distribute, store, retransmit, 
use or disclose its contents to anyone. Please note we reserve the right to 
monitor all e-mail communication through our internal and external networks. 
SKY and the SKY marks are trade marks of British Sky Broadcasting Group plc and 
are used under licence. British Sky Broadcasting Limited (Registration No. 
2906991), Sky Interactive Limited (Registration No. 3554332), Sky-In-Home 
Service Limited (Registration No. 2067075) and Sky Subscribers Services Limited 
(Registration No. 2340150) are direct or indirect subsidiaries of British Sky 
Broadcasting Group plc (Registration No. 2247735). All of the companies 
mentioned in this paragraph are incorporated in England and Wales and share the 
same registered office at Grant Way, Isleworth, Middlesex TW7 5QD.

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




RE: Need help with developing Twiki plugins

2008-09-18 Thread Stewart Anderson
 -Original Message-
 From: Manasi Bopardikar [mailto:[EMAIL PROTECTED]
 Sent: 18 September 2008 10:30
 To: beginners@perl.org
 Subject: Need help with developing Twiki plugins
 
 Hi,
 
I need some help developing Twiki plugins.Can anyone give me some
 comprehensive information on Twiki and step by step of how to deveop a
 plugin using standard twiki functions?
 
 
 

[Stewart Anderson] 

Comprehensive docs seem to be here:
http://twiki.org/cgi-bin/view/TWiki/WebHome


Information in this email including any attachments may be privileged, 
confidential and is intended exclusively for the addressee. The views expressed 
may not be official policy, but the personal views of the originator. If you 
have received it in error, please notify the sender by return e-mail and delete 
it from your system. You should not reproduce, distribute, store, retransmit, 
use or disclose its contents to anyone. Please note we reserve the right to 
monitor all e-mail communication through our internal and external networks. 
SKY and the SKY marks are trade marks of British Sky Broadcasting Group plc and 
are used under licence. British Sky Broadcasting Limited (Registration No. 
2906991), Sky Interactive Limited (Registration No. 3554332), Sky-In-Home 
Service Limited (Registration No. 2067075) and Sky Subscribers Services Limited 
(Registration No. 2340150) are direct or indirect subsidiaries of British Sky 
Broadcasting Group plc (Registration No. 2247735). All of the companies 
mentioned in this paragraph are incorporated in England and Wales and share the 
same registered office at Grant Way, Isleworth, Middlesex TW7 5QD.

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




RE: Get the last entry of log file

2008-09-17 Thread Stewart Anderson

 From: Rob Coops [mailto:[EMAIL PROTECTED]
 Sent: 17 September 2008 12:55
 To: Mr. Shawn H. Corey
 Cc: Manasi Bopardikar; beginners@perl.org
 Subject: Re: Get the last entry of log file
 
 my $last_line;
 while(  ){
  $last_line = $_;
 }
 
 Sure... depends on the size of the log, though. Do that for a log that
is
 say 500MB in size and you are in for quite a wait as it will loop over
 each
 line in the file will it not?
 
 On Wed, Sep 17, 2008 at 1:46 PM, Mr. Shawn H. Corey
 [EMAIL PROTECTED]wrote:
 
   On Wed, 2008-09-17 at 15:41 +0530, Manasi Bopardikar wrote:
   I have a log file-
  
   | 15 Sep 2008 - 06:37 | TWikiGuest | view | TWiki.WebHome |
Mozilla |
   10.88.68.26 |
  
   | 15 Sep 2008 - 06:37 | TWikiGuest | view | TWiki.TWikiFAQ |
Mozilla
 |
   10.88.68.26 |
  
   | 15 Sep 2008 - 06:38 | TWikiGuest | view | TWiki.TWikiTutorial |
   Mozilla |
   10.88.68.26 |
  
   | 15 Sep 2008 - 06:42 | TWikiGuest | view | TWiki.TWikiUsersGuide
|
   Mozilla
   | 10.88.68.26 |
  
   | 15 Sep 2008 - 06:42 | TWikiGuest | view | TWiki.TWikiFAQ |
Mozilla
 |
   10.88.68.26 |
  
   | 15 Sep 2008 - 06:44 | TWikiGuest | view | TWiki.ATasteOfTWiki |
   Mozilla |
   10.88.68.26 |
  
   | 15 Sep 2008 - 06:46 | TWikiGuest | view | TWiki.WebHome |
Mozilla |
   10.88.68.26 |
  
   | 16 Sep 2008 - 04:06 | KailasMhase | save | Main.TestNewGroup |
|
   10.88.68.26 |
  
   | 16 Sep 2008 - 04:30 | TWikiGuest | view | Main.WebHome |
Mozilla |
   10.77.224.12 |
  
   | 16 Sep 2008 - 04:30 | TWikiGuest | view | TWiki.WebHome |
Mozilla |
   10.77.224.12 |
  
   | 16 Sep 2008 - 04:30 | TWikiGuest | view | TWiki.InstalledPlugins
|
   Mozilla | 10.77.224.12 |
  
   | 16 Sep 2008 - 04:30 | TWikiGuest | view |
TWiki.SpreadSheetPlugin |
   Mozilla | 10.77.224.12 |
  
   | 16 Sep 2008 - 04:32 | TWikiGuest | view | TWiki.TwistyPlugin |
 Mozilla
  |
   10.77.224.12 |
  
   | 16 Sep 2008 - 04:32 | TWikiGuest | view | TWiki.WebHome |
Mozilla |
   10.77.224.12 |
  
   | 16 Sep 2008 - 04:32 | TWikiGuest | view | TWiki.InstalledPlugins
|
   Mozilla | 10.77.224.12 |
  
   | 16 Sep 2008 - 04:33 | TWikiGuest | view | TWiki.SlideShowPlugin
|
   Mozilla
   | 10.77.224.12 |
  
   | 16 Sep 2008 - 04:34 | TWikiGuest | view | TWiki.InstalledPlugins
|
   Mozilla | 10.77.224.12 |
  
   | 16 Sep 2008 - 04:50 | TWikiGuest | view | TWiki.InstalledPlugins
|
   Mozilla | 10.88.68.26 |
  
   | 17 Sep 2008 - 04:54 | TWikiGuest | view | TWiki.TWikiFuncDotPm |
   Mozilla
   | 10.88.68.26 |
  
  
  
   How can I get the last entry of this file?(highlighted in blue)
 
  my $last_line;
  while(  ){
   $last_line = $_;
  }
 
 
  --
  Just my 0.0002 million dollars worth,
   Shawn
 
  Where there's duct tape, there's hope.
 Cross Time Cafe
 
  Perl is the duct tape of the Internet.
 Hassan Schroeder, Sun's first webmaster
 
 
  --
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
  http://learn.perl.org/
 
 
 
[Stewart Anderson] 
How  about a system(tail -x inputfile   mylastfile)type call to
get the last line and  then open  the mylastfile  to work on the  line
there?





Information in this email including any attachments may be privileged, 
confidential and is intended exclusively for the addressee. The views expressed 
may not be official policy, but the personal views of the originator. If you 
have received it in error, please notify the sender by return e-mail and delete 
it from your system. You should not reproduce, distribute, store, retransmit, 
use or disclose its contents to anyone. Please note we reserve the right to 
monitor all e-mail communication through our internal and external networks. 
SKY and the SKY marks are trade marks of British Sky Broadcasting Group plc and 
are used under licence. British Sky Broadcasting Limited (Registration No. 
2906991), Sky Interactive Limited (Registration No. 3554332), Sky-In-Home 
Service Limited (Registration No. 2067075) and Sky Subscribers Services Limited 
(Registration No. 2340150) are direct or indirect subsidiaries of British Sky 
Broadcasting Group plc (Registration No. 2247735). All of the companies 
mentioned in this paragraph are incorporated in England and Wales and share the 
same registered office at Grant Way, Isleworth, Middlesex TW7 5QD.

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




RE: Round a digit in perl

2008-09-12 Thread Stewart Anderson

 -Original Message-
 From: V.Ramkumar [mailto:[EMAIL PROTECTED]
 Sent: 12 September 2008 11:33
 To: beginners@perl.org
 Subject: Round a digit in perl
 
 Hi List,
 
 My input xml file has,
 citspn246/citspndelimndash;/delimcitepn52/citepn
 
 I have to replace,
 citspn246/citspndelimndash;/delimcitepn252/citepn
 
 Similarly,
 
 100-5 100-105
 198-10198-210.
 
[Stewart Anderson] 
Have a look at XML::Smart  it has an easy   to use interface.   You
could run through   your xml  elements and just prefix  the  elements
with the new code.

That  might take a little longer than  a   regex but I feel  it would be
safer and  probably easier to  predict the outcome.  I   just heard a
sharp intake of breath from  regex kings across the world :)  That's my
view - not being  a regex king!!



Information in this email including any attachments may be privileged, 
confidential and is intended exclusively for the addressee. The views expressed 
may not be official policy, but the personal views of the originator. If you 
have received it in error, please notify the sender by return e-mail and delete 
it from your system. You should not reproduce, distribute, store, retransmit, 
use or disclose its contents to anyone. Please note we reserve the right to 
monitor all e-mail communication through our internal and external networks. 
SKY and the SKY marks are trade marks of British Sky Broadcasting Group plc and 
are used under licence. British Sky Broadcasting Limited (Registration No. 
2906991), Sky Interactive Limited (Registration No. 3554332), Sky-In-Home 
Service Limited (Registration No. 2067075) and Sky Subscribers Services Limited 
(Registration No. 2340150) are direct or indirect subsidiaries of British Sky 
Broadcasting Group plc (Registration No. 2247735). All of the companies 
mentioned in this paragraph are incorporated in England and Wales and share the 
same registered office at Grant Way, Isleworth, Middlesex TW7 5QD.

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




RE: Fetching n number of records at a time in Perl DBI !

2008-09-11 Thread Stewart Anderson
 -Original Message-
 From: Amit Saxena [mailto:[EMAIL PROTECTED]
 Sent: 11 September 2008 12:53
 To: Perl Beginners
 Cc: Amit Saxena
 Subject: Fetching n number of records at a time in Perl DBI !
 
 Hi all,
 
 I am looking for a fetch function to fetch n number of records at
a
 time
 in Perl DBI !
 
 fetchrow_hashref fetches one row at a time whereas
fetchall_hashref
 fetches all the rows at a time.
 
 The requirement is to get 100 records at a time (in array or hash)
before
 printing it into the output file.
 
 I don't want to use following style ;-
 
 my $count=0;
 while ($href1 = $sth-fetchrow_hashref())
 {
   my @arr1 = ();
   $count = $count + 1;
   %arr1 = %$href1;
   if ($count == 100)
   {
# print to the output file
print PTR %arr1;
   }
 }
 
 Thanks  Regards,
 Amit Saxena
[Stewart Anderson] 
Any particular  reason  you don't want to do that,  it seems to  me that
whichever way  you do it you will need to loop  through   the  returned
rows  until they are all done. 

There  are the fetchall functions but I guess there is the risk   of
returning  a gazillion rows  into 1 array there.

Stu 

Information in this email including any attachments may be privileged, 
confidential and is intended exclusively for the addressee. The views expressed 
may not be official policy, but the personal views of the originator. If you 
have received it in error, please notify the sender by return e-mail and delete 
it from your system. You should not reproduce, distribute, store, retransmit, 
use or disclose its contents to anyone. Please note we reserve the right to 
monitor all e-mail communication through our internal and external networks. 
SKY and the SKY marks are trade marks of British Sky Broadcasting Group plc and 
are used under licence. British Sky Broadcasting Limited (Registration No. 
2906991), Sky Interactive Limited (Registration No. 3554332), Sky-In-Home 
Service Limited (Registration No. 2067075) and Sky Subscribers Services Limited 
(Registration No. 2340150) are direct or indirect subsidiaries of British Sky 
Broadcasting Group plc (Registration No. 2247735). All of the companies 
mentioned in this paragraph are incorporated in England and Wales and share the 
same registered office at Grant Way, Isleworth, Middlesex TW7 5QD.

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




RE: Fetching n number of records at a time in Perl DBI !

2008-09-11 Thread Stewart Anderson

 -Original Message-
 From: Dr.Ruud [mailto:[EMAIL PROTECTED]
 Sent: 11 September 2008 14:01
 To: beginners@perl.org
 Subject: Re: Fetching n number of records at a time in Perl DBI !
 
 Amit Saxena schreef:
 
  I am looking for a fetch function to fetch n number of records
at
  a time in Perl DBI !
 
 quote src=DBI item=fetchall_arrayref
 If $max_rows is defined and greater than or equal to zero then it is
 used
 to limit the number of rows fetched before returning.
 fetchall_arrayref() can then be called again to fetch more rows.
 /quote
 
 --
 Affijn, Ruud
 
 Gewoon is een tijger.
 
 
 --
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 http://learn.perl.org/
 

[Stewart Anderson] 

Damn  I missed that bit :)



Information in this email including any attachments may be privileged, 
confidential and is intended exclusively for the addressee. The views expressed 
may not be official policy, but the personal views of the originator. If you 
have received it in error, please notify the sender by return e-mail and delete 
it from your system. You should not reproduce, distribute, store, retransmit, 
use or disclose its contents to anyone. Please note we reserve the right to 
monitor all e-mail communication through our internal and external networks. 
SKY and the SKY marks are trade marks of British Sky Broadcasting Group plc and 
are used under licence. British Sky Broadcasting Limited (Registration No. 
2906991), Sky Interactive Limited (Registration No. 3554332), Sky-In-Home 
Service Limited (Registration No. 2067075) and Sky Subscribers Services Limited 
(Registration No. 2340150) are direct or indirect subsidiaries of British Sky 
Broadcasting Group plc (Registration No. 2247735). All of the companies 
mentioned in this paragraph are incorporated in England and Wales and share the 
same registered office at Grant Way, Isleworth, Middlesex TW7 5QD.

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




RE: perl if/then

2008-09-04 Thread Stewart Anderson
 -Original Message-
 From: Dr.Ruud [mailto:[EMAIL PROTECTED]
 Sent: 04 September 2008 10:11
 To: beginners@perl.org
 Subject: Re: perl if/then
 
 [EMAIL PROTECTED] schreef:
 
  if ($host eq $hostname)
{next;}
{$cmd=/usr/bin/rdist $args $srcdir ${host}:$destdir 21;}
  else
{$cmd=/usr/local/bin/scp $scpargs $srcdir ${host}:/ 21; }
 
 That if has 2 blocks.
 
 --
 Affijn, Ruud
 
 Gewoon is een tijger.
 
 --
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 http://learn.perl.org/
 

[Stewart Anderson] 

if ($host eq $hostname){
$cmd=/usr/bin/rdist $args $srcdir ${host}:$destdir 21;
next;
}else {
$cmd=/usr/local/bin/scp $scpargs $srcdir ${host}:/ 21;
}

Probably works better




Information in this email including any attachments may be privileged, 
confidential and is intended exclusively for the addressee. The views expressed 
may not be official policy, but the personal views of the originator. If you 
have received it in error, please notify the sender by return e-mail and delete 
it from your system. You should not reproduce, distribute, store, retransmit, 
use or disclose its contents to anyone. Please note we reserve the right to 
monitor all e-mail communication through our internal and external networks. 
SKY and the SKY marks are trade marks of British Sky Broadcasting Group plc and 
are used under licence. British Sky Broadcasting Limited (Registration No. 
2906991), Sky Interactive Limited (Registration No. 3554332), Sky-In-Home 
Service Limited (Registration No. 2067075) and Sky Subscribers Services Limited 
(Registration No. 2340150) are direct or indirect subsidiaries of British Sky 
Broadcasting Group plc (Registration No. 2247735). All of the companies 
mentioned in this paragraph are incorporated in England and Wales and share the 
same registered office at Grant Way, Isleworth, Middlesex TW7 5QD.

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




RE: Perl and vi (not vim) , ctags like feature in Perl !

2008-08-26 Thread Stewart Anderson
 -Original Message-
 From: Amit Saxena [mailto:[EMAIL PROTECTED]
 Sent: 26 August 2008 15:51
 To: anders
 Cc: beginners@perl.org
 Subject: Re: Perl and vi (not vim) , ctags like feature in Perl !
 
 On Mon, Aug 25, 2008 at 9:03 PM, anders [EMAIL PROTECTED]
 wrote:
 
  On 25 Aug, 16:32, [EMAIL PROTECTED] (Amit Saxena) wrote:
   Hi all,
  
  - I am using Perl 5.8.4 and vi (not vim) on Solaris 9.
  
   While developing my Perl programs, I have to open two sessions one
for
 my
   vi session and another where I run my perl programs. Moreover,
in
 some
   scenarios, I have to open a sqlplus session to access Oracle 10g.
  Shifting
   between the sessions is tough sometimes.
  
   Is there a possibility where I can customize vi for some
shortcuts
 for
  at
   least running Perl programs or accessing sqlplus session ?
  
  - Is there a ctags like facility for Perl as well ?
  
   Thanks  Regards,
   Amit Saxena
 
  There is a serverprogram called Screens it can handle multiple
  screens and let you switch between,
 
  On VI you could enter :! to get a shell, test your program and
CTRL-D
  back
  to the VI, this is my way, maby there is easy steps...
 
  // Anders
 
 
  --
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
  http://learn.perl.org/
 
 
 
 Hi
 
 Though I don't know much about creating shortcuts in vi but is it
 possible
 to create a shortcut in vi (something like epp for execute perl
 program
 ) which will take current file as an input, exit temporarily to the
shell
 and once ENTER is pressed, returns to the original program ?
 
 Regards,
 Amit Saxena
[Stewart Anderson] I  edit using ultraedit,  it has  ssh save options.
You can combine  any editor  with winscp  to scurely  copy changes to
another machine via ssh and  run  the  script remotely once its copied

lots of people use  emacs which can be heavily  customised to  do lots
of clever  dev stuff.

You can get  DBI  to  switch on oracle  tracing and pipe that  to
wherever you want.

:!'cmd'   executes  the  cmd  in a shell outside vi.  

I have never made myself  totally vi  able,  I'm quite happy using it,
but prefer  the comfort and laziness of a gui'ified spot.

HTH




Information in this email including any attachments may be privileged, 
confidential and is intended exclusively for the addressee. The views expressed 
may not be official policy, but the personal views of the originator. If you 
have received it in error, please notify the sender by return e-mail and delete 
it from your system. You should not reproduce, distribute, store, retransmit, 
use or disclose its contents to anyone. Please note we reserve the right to 
monitor all e-mail communication through our internal and external networks. 
SKY and the SKY marks are trade marks of British Sky Broadcasting Group plc and 
are used under licence. British Sky Broadcasting Limited (Registration No. 
2906991), Sky Interactive Limited (Registration No. 3554332), Sky-In-Home 
Service Limited (Registration No. 2067075) and Sky Subscribers Services Limited 
(Registration No. 2340150) are direct or indirect subsidiaries of British Sky 
Broadcasting Group plc (Registration No. 2247735). All of the companies 
mentioned in this paragraph are incorporated in England and Wales and share the 
same registered office at Grant Way, Isleworth, Middlesex TW7 5QD.

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




RE: About the error message in Perl : Missing right curly braces

2008-08-22 Thread Stewart Anderson

 -Original Message-
 From: Peter Scott [mailto:[EMAIL PROTECTED]
 Sent: 21 August 2008 20:14
 To: beginners@perl.org; Amit Saxena
 Subject: Re: About the error message in Perl : Missing right curly
 braces
 
 On Thu, 21 Aug 2008 17:48:00 +0530, Amit Saxena wrote:
  Load the code into Emacs.  Ensure cperl-mode is enabled.  Mark the
 whole
  buffer (control-space at the beginning, then move point to the
end).
  Execute M-x indent-region,  Look to see where the indentation goes
 off.
 
  How can we enable indentation with in  vi (and not vim) on
Solaris
 for
  Perl code?
 
 Oh, I am the wrong person to ask about deviant editors with arcane
modal
 interfaces :-) :-)
 
 Maybe you have just found a use case to come over to the path of
 righteousness :-) :-) :-)
 
 Seriously, perltidy is a good suggestion given your parameters.
 
 --
 Peter Scott
 http://www.perlmedic.com/
 http://www.perldebugged.com/
 
 
 --
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 http://learn.perl.org/
 

[Stewart Anderson] ohoh  EMACS preacher proximity alert just went off :)


Information in this email including any attachments may be privileged, 
confidential and is intended exclusively for the addressee. The views expressed 
may not be official policy, but the personal views of the originator. If you 
have received it in error, please notify the sender by return e-mail and delete 
it from your system. You should not reproduce, distribute, store, retransmit, 
use or disclose its contents to anyone. Please note we reserve the right to 
monitor all e-mail communication through our internal and external networks. 
SKY and the SKY marks are trade marks of British Sky Broadcasting Group plc and 
are used under licence. British Sky Broadcasting Limited (Registration No. 
2906991), Sky Interactive Limited (Registration No. 3554332), Sky-In-Home 
Service Limited (Registration No. 2067075) and Sky Subscribers Services Limited 
(Registration No. 2340150) are direct or indirect subsidiaries of British Sky 
Broadcasting Group plc (Registration No. 2247735). All of the companies 
mentioned in this paragraph are incorporated in England and Wales and share the 
same registered office at Grant Way, Isleworth, Middlesex TW7 5QD.

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




RE: About the error message in Perl : Missing right curly braces

2008-08-21 Thread Stewart Anderson

 -Original Message-
 From: Amit Saxena [mailto:[EMAIL PROTECTED]
 Sent: 21 August 2008 08:56
 To: Perl
 Cc: Amit Saxena
 Subject: About the error message in Perl : Missing right curly
braces
 
 Hi all,
 
 I want to know the best approach that should be used to find the extra
 curly
 brace when any Perl program aborts with the error message as Missing
 right
 curly braces.
 
 Though the error message is simple enough to suggest that there is an
 extra
 curly brace in the Perl program, but it specifies the line number as
the
 last line of the program. If the program is very big, matching all the
 properly nested curly braces and finding out the mismatched one takes
lots
 of effort and time. It happened with me yesterday when I was working
with
 a
 perl code of around 3000 lines long and it took me nearly 1.5 hours to
 find
 out the exact line where the problem is.
[Stewart Anderson] 
I usually go back to where  I was last editing.

I do regular syntax checks to see if I missed anything as I'm going too.



Information in this email including any attachments may be privileged, 
confidential and is intended exclusively for the addressee. The views expressed 
may not be official policy, but the personal views of the originator. If you 
have received it in error, please notify the sender by return e-mail and delete 
it from your system. You should not reproduce, distribute, store, retransmit, 
use or disclose its contents to anyone. Please note we reserve the right to 
monitor all e-mail communication through our internal and external networks. 
SKY and the SKY marks are trade marks of British Sky Broadcasting Group plc and 
are used under licence. British Sky Broadcasting Limited (Registration No. 
2906991), Sky Interactive Limited (Registration No. 3554332), Sky-In-Home 
Service Limited (Registration No. 2067075) and Sky Subscribers Services Limited 
(Registration No. 2340150) are direct or indirect subsidiaries of British Sky 
Broadcasting Group plc (Registration No. 2247735). All of the companies 
mentioned in this paragraph are incorporated in England and Wales and share the 
same registered office at Grant Way, Isleworth, Middlesex TW7 5QD.

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




RE: About the error message in Perl : Missing right curly braces

2008-08-21 Thread Stewart Anderson
  _  

From: Amit Saxena [mailto:[EMAIL PROTECTED] 
Sent: 21 August 2008 10:01
To: Stewart Anderson
Cc: Perl
Subject: Re: About the error message in Perl : Missing right curly
braces

 

 

On Thu, Aug 21, 2008 at 2:23 PM, Stewart Anderson
[EMAIL PROTECTED] wrote:


 -Original Message-
 From: Amit Saxena [mailto:[EMAIL PROTECTED]
 Sent: 21 August 2008 08:56
 To: Perl
 Cc: Amit Saxena
 Subject: About the error message in Perl : Missing right curly
braces

 Hi all,

 I want to know the best approach that should be used to find the extra
 curly
 brace when any Perl program aborts with the error message as Missing
 right
 curly braces.

 Though the error message is simple enough to suggest that there is an
 extra
 curly brace in the Perl program, but it specifies the line number as
the
 last line of the program. If the program is very big, matching all the
 properly nested curly braces and finding out the mismatched one takes
lots
 of effort and time. It happened with me yesterday when I was working
with
 a
 perl code of around 3000 lines long and it took me nearly 1.5 hours to
 find
 out the exact line where the problem is.

[Stewart Anderson]
I usually go back to where  I was last editing.

I do regular syntax checks to see if I missed anything as I'm going too.



Information in this email including any attachments may be privileged,
confidential and is intended exclusively for the addressee. The views
expressed may not be official policy, but the personal views of the
originator. If you have received it in error, please notify the sender
by return e-mail and delete it from your system. You should not
reproduce, distribute, store, retransmit, use or disclose its contents
to anyone. Please note we reserve the right to monitor all e-mail
communication through our internal and external networks. SKY and the
SKY marks are trade marks of British Sky Broadcasting Group plc and are
used under licence. British Sky Broadcasting Limited (Registration No.
2906991), Sky Interactive Limited (Registration No. 3554332),
Sky-In-Home Service Limited (Registration No. 2067075) and Sky
Subscribers Services Limited (Registration No. 2340150) are direct or
indirect subsidiaries of British Sky Broadcasting Group plc
(Registration No. 2247735). All of the companies mentioned in this
paragraph are incorporated in England and Wales and share the same
registered office at Grant Way, Isleworth, Middlesex TW7 5QD.

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




Hi 

Assuming you are getting the buggy code for the first time and you need
to track which line contains that curly brace which is causing that
problem, what your modified approach be ?

This is exactly the same scenario which I have faced just now.

Thanks  Regards,
Amit Saxena

Hi,

 

Most decent editors have  a match brace  function  - google  for the
function  for the editor you use?

 

HTH

 

 

 



RE: doubt in code

2008-08-21 Thread Stewart Anderson

 -Original Message-
 From: Irfan J Sayed (isayed) [mailto:[EMAIL PROTECTED]
 Sent: 21 August 2008 15:49
 To: beginners@perl.org
 Subject: doubt in code
 
 Hi All,
 
 I have sample code like this:
 
 #!/usr/bin/perl
 
 # file: lgetr.pl
 
 # Figure 1.2: Read the first line from a remote server
 
 use IO::Socket;
 
 my $server = shift;
 
 my $fh = IO::Socket::INET-new($server);
 
 my $line = $fh;
 
 print $line;
 
 As per comment it says that, it prints the first line of a file from
 remote server. So my understanding is that, it will go to remote
 server,read the file and then prints the first line of a file on the
 existing console. is it right ?? if yes then in the code where are we
 giving the filename??
 
 Please suggest.
 
 Regards
 
 Irfan.
 
 

[Stewart Anderson] 

 my $fh = IO::Socket::INET-new($server);

is   where the  file handle $fh gets assigned



Information in this email including any attachments may be privileged, 
confidential and is intended exclusively for the addressee. The views expressed 
may not be official policy, but the personal views of the originator. If you 
have received it in error, please notify the sender by return e-mail and delete 
it from your system. You should not reproduce, distribute, store, retransmit, 
use or disclose its contents to anyone. Please note we reserve the right to 
monitor all e-mail communication through our internal and external networks. 
SKY and the SKY marks are trade marks of British Sky Broadcasting Group plc and 
are used under licence. British Sky Broadcasting Limited (Registration No. 
2906991), Sky Interactive Limited (Registration No. 3554332), Sky-In-Home 
Service Limited (Registration No. 2067075) and Sky Subscribers Services Limited 
(Registration No. 2340150) are direct or indirect subsidiaries of British Sky 
Broadcasting Group plc (Registration No. 2247735). All of the companies 
mentioned in this paragraph are incorporated in England and Wales and share the 
same registered office at Grant Way, Isleworth, Middlesex TW7 5QD.

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




RE: Not able to open a file.

2008-08-14 Thread Stewart Anderson

 -Original Message-
 From: Xavier Mas [mailto:[EMAIL PROTECTED]
 Sent: 14 August 2008 12:00
 To: beginners@perl.org
 Subject: Re: Not able to open a file.
 
 El Thursday 14 August 2008 12:42:15 jis va escriure:
  On Aug 13, 7:46 pm, [EMAIL PROTECTED] (John W. Krahn) wrote:
   jis wrote:
Hi
  
   Hello,
  
I simply could not open a file which is in the same path as my
 script
is.
i could open the file if i explicitly mention the path. but i dont
want that..
   
my script is..
   
 use strict;
use warnings;
 my  $fil=pdef.txt;
open(DEFILE,$fil)|| die Couldnt open pdef file - $!\n;
   
Any idea what is wrong..( the file exists in the same path as the
script is.)
  
[Stewart Anderson] 
This  works.


#!/usr/bin/perl

use strict;
use warnings ;

my $filetoopen=test.out; 

open FILEH, '', $filetoopen or die Can't open file:\t $filetoopen  .  $! . 
\n; 

while (FILEH) { print $_  } ;



#test.out 
One
Two
Three





Information in this email including any attachments may be privileged, 
confidential and is intended exclusively for the addressee. The views expressed 
may not be official policy, but the personal views of the originator. If you 
have received it in error, please notify the sender by return e-mail and delete 
it from your system. You should not reproduce, distribute, store, retransmit, 
use or disclose its contents to anyone. Please note we reserve the right to 
monitor all e-mail communication through our internal and external networks. 
SKY and the SKY marks are trade marks of British Sky Broadcasting Group plc and 
are used under licence. British Sky Broadcasting Limited (Registration No. 
2906991), Sky Interactive Limited (Registration No. 3554332), Sky-In-Home 
Service Limited (Registration No. 2067075) and Sky Subscribers Services Limited 
(Registration No. 2340150) are direct or indirect subsidiaries of British Sky 
Broadcasting Group plc (Registration No. 2247735). All of the companies 
mentioned in this paragraph are incorporated in England and Wales and share the 
same registered office at Grant Way, Isleworth, Middlesex TW7 5QD.

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




RE: how to round off a decimal to the next whole number

2008-08-06 Thread Stewart Anderson

 -Original Message-
 From: Anirban Adhikary [mailto:[EMAIL PROTECTED]
 Sent: 06 August 2008 06:51
 To: beginners@perl.org
 Subject: Re: how to round off a decimal to the next whole number
 
 On Wed, Aug 6, 2008 at 11:01 AM, [EMAIL PROTECTED] wrote:
 
  Hi,
  How do I round off a decimal to the next nearest whole digit ,
  example
  0.123 = 1,
  1.23 = 2,
  4.7312 = 5, etc etc.
 
  Right now I can only do the above by extracting the first digit
using
  splice , then add one.
 
  Thanks
 

This is straight from the Perl FAQ.

sub round {
my($number) = shift;
return int($number + .5);
}

Stu



Information in this email including any attachments may be privileged, 
confidential and is intended exclusively for the addressee. The views expressed 
may not be official policy, but the personal views of the originator. If you 
have received it in error, please notify the sender by return e-mail and delete 
it from your system. You should not reproduce, distribute, store, retransmit, 
use or disclose its contents to anyone. Please note we reserve the right to 
monitor all e-mail communication through our internal and external networks. 
SKY and the SKY marks are trade marks of British Sky Broadcasting Group plc and 
are used under licence. British Sky Broadcasting Limited (Registration No. 
2906991), Sky Interactive Limited (Registration No. 3554332), Sky-In-Home 
Service Limited (Registration No. 2067075) and Sky Subscribers Services Limited 
(Registration No. 2340150) are direct or indirect subsidiaries of British Sky 
Broadcasting Group plc (Registration No. 2247735). All of the companies 
mentioned in this paragraph are incorporated in England and Wales and share the 
same registered office at Grant Way, Isleworth, Middlesex TW7 5QD.

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




RE: use of Configuration files

2008-07-30 Thread Stewart Anderson

 -Original Message-
 From: mani kandan [mailto:[EMAIL PROTECTED]
 Sent: 30 July 2008 17:50
 To: beginners@perl.org
 Subject: use of Configuration files
 
 
 Dear gurus,
 
 I want to know how to use configuration files concept in Perl, using
 configuration files working with Perl scripts that is using reading an
 input from *.ini files and if possible sample files for my reference
 
 Regards
 Manikandan
 
 
Check  out  Config::Simple  
Very  straightforward to use.

Stu



Information in this email including any attachments may be privileged, 
confidential and is intended exclusively for the addressee. The views expressed 
may not be official policy, but the personal views of the originator. If you 
have received it in error, please notify the sender by return e-mail and delete 
it from your system. You should not reproduce, distribute, store, retransmit, 
use or disclose its contents to anyone. Please note we reserve the right to 
monitor all e-mail communication through our internal and external networks. 
SKY and the SKY marks are trade marks of British Sky Broadcasting Group plc and 
are used under licence. British Sky Broadcasting Limited (Registration No. 
2906991), Sky Interactive Limited (Registration No. 3554332), Sky-In-Home 
Service Limited (Registration No. 2067075) and Sky Subscribers Services Limited 
(Registration No. 2340150) are direct or indirect subsidiaries of British Sky 
Broadcasting Group plc (Registration No. 2247735). All of the companies 
mentioned in this paragraph are incorporated in England and Wales and share the 
same registered office at Grant Way, Isleworth, Middlesex TW7 5QD.

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




RE: perl2exe

2008-07-24 Thread Stewart Anderson

 -Original Message-
 From: Rob Dixon [mailto:[EMAIL PROTECTED]
 Sent: 23 July 2008 21:10
 To: beginners@perl.org
 Cc: epanda
 Subject: Re: perl2exe
 
 
 epanda wrote:
 
  I am using perl2exe (Oct 27, 2001) and it works fine for little
script
  without several .pm and it does good binary conversion.
  I am working without any install of perl8.8 or 10.
 
  Now I want to include Win32::process which includes others
  dependencies and I would like to know if I can continue using
perl2exe
  and install perl 10.
 
  How can I include all .pm easily with the install of perl 10 and
  perl2exe is it compatible ?
 
 You need to install a different version of perl2exe to build images
that
 use
 Perl 5.10. You should install Perl 5.10 on your PC as well as the
relevant
 modules for your program. Once you have tested it thoroughly under the
 perl
 interpreter you can use perl2exe to build an executable image.
 
 HTH,
 
 Rob
[Stewart Anderson] 
Hi,  I thought I read  somewhere that generating executable Perl
binaries was  at best in the  prototype  stages of evolution.  I'm not
putting down the  efforts of  IndigoSTAR  or any others who are involved
in  producing tools like this,  just seeking  a clarification on how
robust and reliable the programs created are as compared to their
original Perl counterparts?

Thanks 

Stu.



Information in this email including any attachments may be privileged, 
confidential and is intended exclusively for the addressee. The views expressed 
may not be official policy, but the personal views of the originator. If you 
have received it in error, please notify the sender by return e-mail and delete 
it from your system. You should not reproduce, distribute, store, retransmit, 
use or disclose its contents to anyone. Please note we reserve the right to 
monitor all e-mail communication through our internal and external networks. 
SKY and the SKY marks are trade marks of British Sky Broadcasting Group plc and 
are used under licence. British Sky Broadcasting Limited (Registration No. 
2906991), Sky Interactive Limited (Registration No. 3554332), Sky-In-Home 
Service Limited (Registration No. 2067075) and Sky Subscribers Services Limited 
(Registration No. 2340150) are direct or indirect subsidiaries of British Sky 
Broadcasting Group plc (Registration No. 2247735). All of the companies 
mentioned in this paragraph are incorporated in England and Wales and share the 
same registered office at Grant Way, Isleworth, Middlesex TW7 5QD.

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




RE: Request for advice/suggestions....

2008-07-24 Thread Stewart Anderson
 your category subroutines, again a lot depends on
the
 scope
 of the data and subroutines involved ( chkclose(), for instance, and
 anything
 else you've edited out. But you could write something like this.
 
 
 
 
 sub _process_category {
 
   my ($hash, $text) = @_;
 
   chkclose();
 
   print HTML;
   p align=center
 b
   font color=$config{colortablebody} face=Arial size=2
 $text
   /font
 /b
   /td
 /tr
 HTML
 
   foreach my $key (sort keys %$hash) {
   }
 }
 
 sub paper {
   _process_category(\%paper, 'Paper Categories');
 }
 
 sub records {
   _process_category(\%records, 'Records Categories');
 }
 
 
 
 
 But once again it would be best if these subroutines were exported
from
 the
 Categories module and the data itself was kept private. Only you know
what
 is
 possible here.
 
 HTH,
 
[Stewart Anderson] 
May be a bit late for  this but,  you could  also  use  Config::Simple
to achieve this.  I know its   intended for config files  but it would
lend itself  quite well to  doing what you want.  The  real  benefit is
that  you would not need to edit Perl at all to add  new entries  to
categories or  entire categories,  you could just edit your config file.

Couple of simple examples below.  The  Config::Simple  docs  describe
lots more  functionality that you could use.  Stick  the  commented
section into categories.cfg (uncommented of course)


#! /usr/bin/perl

use warnings;
use strict ; 
use Data::Dumper;
use Config::Simple;

my $catcfg = new Config::Simple('categories.cfg');
print P01:\t  . $catcfg-param('paper.p01') . \n; 

Config::Simple-new('categories.cfg')-import_names();
print r01:\t  . our $RECORDS_R01 . \n;

#[paper]
#p01 =  PAPER ITEMS GENERAL
#p02 =  Diaries and Journals
#p03 =  Indentures
#p04 =  Letters
#p05 =  Certificates
#p10 =  Other Paper Items
#
#
#[records] 
#r01 =  RECORDS GENERAL
#r02 =  Birth and Death
#r03 =  Marriage 
#r04 =  Wills 
#r05 =  Census
#r06 =  Court and Probate
#r07 =  Immigration and Ship Lists
#r08 =  Military
#r09 =  Maps
#r10 =  Other Records





Information in this email including any attachments may be privileged, 
confidential and is intended exclusively for the addressee. The views expressed 
may not be official policy, but the personal views of the originator. If you 
have received it in error, please notify the sender by return e-mail and delete 
it from your system. You should not reproduce, distribute, store, retransmit, 
use or disclose its contents to anyone. Please note we reserve the right to 
monitor all e-mail communication through our internal and external networks. 
SKY and the SKY marks are trade marks of British Sky Broadcasting Group plc and 
are used under licence. British Sky Broadcasting Limited (Registration No. 
2906991), Sky Interactive Limited (Registration No. 3554332), Sky-In-Home 
Service Limited (Registration No. 2067075) and Sky Subscribers Services Limited 
(Registration No. 2340150) are direct or indirect subsidiaries of British Sky 
Broadcasting Group plc (Registration No. 2247735). All of the companies 
mentioned in this paragraph are incorporated in England and Wales and share the 
same registered office at Grant Way, Isleworth, Middlesex TW7 5QD.

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




RE: parsing a large excel file

2008-07-22 Thread Stewart Anderson

 -Original Message-
 From: ANJAN PURKAYASTHA [mailto:[EMAIL PROTECTED]
 Sent: 22 July 2008 02:41
 To: beginners@perl.org
 Subject: parsing a large excel file
 
 to all,
 i have installed Spreadshee::ParseExcel to parse some large excel data
 files.
 Here is the problem I'm facing. I need to parse data from columns M to
P
 and
 rows 10 to 43000. Now I know that there is a PrintArea method that can
 print
 an area of a worksheet specified in (start row, start col, end row,
end
 col). However I'm having difficulty in specifying these parameters
 correctly
 for the PrintArea method. I'm also not sure what the output is going
to
 look
 like.
 does anyone in this forum have any pointers?
 all advice will be appreciated.
 tia,
 anjan
 
I have only  used  the Simple version previously to parse and entire row
but the method  Cell ( ROW, COL )  In the  docs  for the module  you
showed  suggests you can get  at the data directly.

Stu




Information in this email including any attachments may be privileged, 
confidential and is intended exclusively for the addressee. The views expressed 
may not be official policy, but the personal views of the originator. If you 
have received it in error, please notify the sender by return e-mail and delete 
it from your system. You should not reproduce, distribute, store, retransmit, 
use or disclose its contents to anyone. Please note we reserve the right to 
monitor all e-mail communication through our internal and external networks. 
SKY and the SKY marks are trade marks of British Sky Broadcasting Group plc and 
are used under licence. British Sky Broadcasting Limited (Registration No. 
2906991), Sky Interactive Limited (Registration No. 3554332), Sky-In-Home 
Service Limited (Registration No. 2067075) and Sky Subscribers Services Limited 
(Registration No. 2340150) are direct or indirect subsidiaries of British Sky 
Broadcasting Group plc (Registration No. 2247735). All of the companies 
mentioned in this paragraph are incorporated in England and Wales and share the 
same registered office at Grant Way, Isleworth, Middlesex TW7 5QD.

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




RE: parsing a large excel file

2008-07-22 Thread Stewart Anderson

 -Original Message-
 From: Stewart Anderson
 Sent: 22 July 2008 09:34
 To: ANJAN PURKAYASTHA; beginners@perl.org
 Cc: Stewart Anderson
 Subject: RE: parsing a large excel file
 
 
  -Original Message-
  From: ANJAN PURKAYASTHA [mailto:[EMAIL PROTECTED]
  Sent: 22 July 2008 02:41
  To: beginners@perl.org
  Subject: parsing a large excel file
 
  to all,
  i have installed Spreadshee::ParseExcel to parse some large excel
data
  files.
  Here is the problem I'm facing. I need to parse data from columns M
to P
  and
  rows 10 to 43000. Now I know that there is a PrintArea method that
can
  print
  an area of a worksheet specified in (start row, start col, end row,
end
  col). However I'm having difficulty in specifying these parameters
  correctly
  for the PrintArea method. I'm also not sure what the output is going
to
  look
  like.
  does anyone in this forum have any pointers?
  all advice will be appreciated.
  tia,
  anjan
 
 I have only  used  the Simple version previously to parse and entire
row
 but the method  Cell ( ROW, COL )  In the  docs  for the module  you
 showed  suggests you can get  at the data directly.
 
 Stu
 
 
Maybe I spoke to soon,  that method seem to return the iobject,  not
100% sure  what that gives you without trying it.

But the  sample script  in the  doc   looks like a  good place to start,
just set  your  row min/max and col min/max  and you should be close to
getting something.  


However,   the sample program  in the docs  work as is.  It should be
easy to adapt it for your needs.  Try this as a start.  The first bit is
pretty much out of the box and the last bit just shows  you can extract
what row/column you want.

The  data is  at the end, load  it into excel.



#! /usr/bin/perl

use warnings;
use strict ; 
use Data::Dumper;
use Spreadsheet::ParseExcel;

my $excel =
Spreadsheet::ParseExcel::Workbook-Parse('c:\temp\filetest.xls');
foreach my $sheet (@{$excel-{Worksheet}}) {
printf(Sheet: %s\n, $sheet-{Name});
$sheet-{MaxRow} ||= $sheet-{MinRow};
foreach my $row ($sheet-{MinRow} .. $sheet-{MaxRow}) {
$sheet-{MaxCol} ||= $sheet-{MinCol};
foreach my $col ($sheet-{MinCol} ..  $sheet-{MaxCol}) {
my $cell = $sheet-{Cells}[$row][$col];
if ($cell) {
printf(( %s , %s ) = %s\n, $row, $col,
$cell-{Val});
}
}
}
}

print Extract specific row/cell row 2, col b \n ; 
  foreach my $sheet (@{$excel-{Worksheet}}) {
my $row = 2;
my $col = 2;
  my $cell = $sheet-{Cells}[$row][$col];
  printf(( %s , %s ) = %s\n, $row, $col, $cell-{Val});
 
  }



Data  to load in excel
1a,1b,1c,1d,1e,1f
2a,2b,3c,4d,2e,2f
3a,3b,3c,3d,3e,3f
4a,4b,4c,4d,4e,4f


Information in this email including any attachments may be privileged, 
confidential and is intended exclusively for the addressee. The views expressed 
may not be official policy, but the personal views of the originator. If you 
have received it in error, please notify the sender by return e-mail and delete 
it from your system. You should not reproduce, distribute, store, retransmit, 
use or disclose its contents to anyone. Please note we reserve the right to 
monitor all e-mail communication through our internal and external networks. 
SKY and the SKY marks are trade marks of British Sky Broadcasting Group plc and 
are used under licence. British Sky Broadcasting Limited (Registration No. 
2906991), Sky Interactive Limited (Registration No. 3554332), Sky-In-Home 
Service Limited (Registration No. 2067075) and Sky Subscribers Services Limited 
(Registration No. 2340150) are direct or indirect subsidiaries of British Sky 
Broadcasting Group plc (Registration No. 2247735). All of the companies 
mentioned in this paragraph are incorporated in England and Wales and share the 
same registered office at Grant Way, Isleworth, Middlesex TW7 5QD.

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




RE: Perl DBI-Connect: how to detect a a lost connection

2008-07-21 Thread Stewart Anderson


Ravi Malghan wrote:
 Hi: I have a script which connects to a database when it starts up 

   $dbh = DBI-connect(dbi:Pg:dbname=$dbname;host=$host;port=$port;,
   $username, $password, {AutoCommit = 1});

 followed by a while loop which runs a query for this connection at 60
second
 intervals. If the database goes down for some reason, I want the
script to
 try reconnecting to the database. How do I figure out within the while
look
 if the database connection is still valid. If tried using the $dbh
variable
 (if ($dbh)then connection is fin. else connection is bad). That
doesn't seem
 to work. How do I figure out if the $dbh connection has been lost
within the
 while loop?

I suggest you connect to the database every time around the loop instead
of just
once before it. If you use the connect_cached method instead of connect
then the
connection will be verified and used again if it is still valid.

HTH,

Rob


I have seen  in other implementations.using a  simple   select
sysdate from dual  (which is very  fast since it does not query any
table) type of check and trapping  the response  to see if it is
connected.  But, that will take  more instructions than  simply
re-connecting,  don't know  how  much of a performance  thing  it will
be versus  the select/check,  Though  if  Rob suggests a re-connect,
he might already have been down that alley.


Stu




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



Information in this email including any attachments may be privileged, 
confidential and is intended exclusively for the addressee. The views expressed 
may not be official policy, but the personal views of the originator. If you 
have received it in error, please notify the sender by return e-mail and delete 
it from your system. You should not reproduce, distribute, store, retransmit, 
use or disclose its contents to anyone. Please note we reserve the right to 
monitor all e-mail communication through our internal and external networks. 
SKY and the SKY marks are trade marks of British Sky Broadcasting Group plc and 
are used under licence. British Sky Broadcasting Limited (Registration No. 
2906991), Sky Interactive Limited (Registration No. 3554332), Sky-In-Home 
Service Limited (Registration No. 2067075) and Sky Subscribers Services Limited 
(Registration No. 2340150) are direct or indirect subsidiaries of British Sky 
Broadcasting Group plc (Registration No. 2247735). All of the companies 
mentioned in this paragraph are incorporated in England and Wales and share the 
same registered office at Grant Way, Isleworth, Middlesex TW7 5QD.

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




RE: how do you do this in one step instead of two

2008-07-18 Thread Stewart Anderson
On Fri, Jul 18, 2008 at 12:26 AM, Stewart Anderson
[EMAIL PROTECTED] wrote:



 push @hh, [$direction, $source];


 Is  that creating an  anonymous reference  ?



I think it's an anonymous array, not an anonymous reference.



-- 
Regards,
Jeff. - [EMAIL PROTECTED]


OK Thanks  :)

Stu



Information in this email including any attachments may be privileged, 
confidential and is intended exclusively for the addressee. The views expressed 
may not be official policy, but the personal views of the originator. If you 
have received it in error, please notify the sender by return e-mail and delete 
it from your system. You should not reproduce, distribute, store, retransmit, 
use or disclose its contents to anyone. Please note we reserve the right to 
monitor all e-mail communication through our internal and external networks. 
SKY and the SKY marks are trade marks of British Sky Broadcasting Group plc and 
are used under licence. British Sky Broadcasting Limited (Registration No. 
2906991), Sky Interactive Limited (Registration No. 3554332), Sky-In-Home 
Service Limited (Registration No. 2067075) and Sky Subscribers Services Limited 
(Registration No. 2340150) are direct or indirect subsidiaries of British Sky 
Broadcasting Group plc (Registration No. 2247735). All of the companies 
mentioned in this paragraph are incorporated in England and Wales and share the 
same registered office at Grant Way, Isleworth, Middlesex TW7 5QD.

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




RE: how do you do this in one step instead of two

2008-07-17 Thread Stewart Anderson

On Fri, Jul 18, 2008 at 12:00 AM, Richard Lee [EMAIL PROTECTED]
wrote:
 is there way to do this in one step?

  push @array, ($direction, $source);

push @hh, [EMAIL PROTECTED]


 push @hh \($direction,$source) doesn't seem to work.. or not the
samething


push @hh, [$direction, $source];


-- 
Regards,
Jeff. - [EMAIL PROTECTED]

Is  that creating an  anonymous reference  ? 

Ta 

Stewart  

  

Information in this email including any attachments may be privileged, 
confidential and is intended exclusively for the addressee. The views expressed 
may not be official policy, but the personal views of the originator. If you 
have received it in error, please notify the sender by return e-mail and delete 
it from your system. You should not reproduce, distribute, store, retransmit, 
use or disclose its contents to anyone. Please note we reserve the right to 
monitor all e-mail communication through our internal and external networks. 
SKY and the SKY marks are trade marks of British Sky Broadcasting Group plc and 
are used under licence. British Sky Broadcasting Limited (Registration No. 
2906991), Sky Interactive Limited (Registration No. 3554332), Sky-In-Home 
Service Limited (Registration No. 2067075) and Sky Subscribers Services Limited 
(Registration No. 2340150) are direct or indirect subsidiaries of British Sky 
Broadcasting Group plc (Registration No. 2247735). All of the companies 
mentioned in this paragraph are incorporated in England and Wales and share the 
same registered office at Grant Way, Isleworth, Middlesex TW7 5QD.

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




RE: A newbie question - line number inside the script

2008-07-16 Thread Stewart Anderson


You could   use the  __LINE__   directive  in your error handler.



-Original Message-
From: Amit Saxena [mailto:[EMAIL PROTECTED] 
Sent: 16 July 2008 11:25
To: Amit Koren
Cc: beginners@perl.org
Subject: Re: A newbie question - line number inside the script

On Wed, Jul 16, 2008 at 3:52 PM, Amit Koren [EMAIL PROTECTED]
wrote:

 Hi list.

 I'm a newbie to Perl, (and to this mailing list)  :)
 There's a task i was given, in which it is necessary to get the
 number of the current executing line/command - inside the script
itself.

 Can someone assist please ?

 Thanks in advance,

 Amit.


If you are referring to process ID by number, you can use $$ for that.

Regards,
Amit Saxena

Information in this email including any attachments may be privileged, 
confidential and is intended exclusively for the addressee. The views expressed 
may not be official policy, but the personal views of the originator. If you 
have received it in error, please notify the sender by return e-mail and delete 
it from your system. You should not reproduce, distribute, store, retransmit, 
use or disclose its contents to anyone. Please note we reserve the right to 
monitor all e-mail communication through our internal and external networks. 
SKY and the SKY marks are trade marks of British Sky Broadcasting Group plc and 
are used under licence. British Sky Broadcasting Limited (Registration No. 
2906991), Sky Interactive Limited (Registration No. 3554332), Sky-In-Home 
Service Limited (Registration No. 2067075) and Sky Subscribers Services Limited 
(Registration No. 2340150) are direct or indirect subsidiaries of British Sky 
Broadcasting Group plc (Registration No. 2247735). All of the companies 
mentioned in this paragraph are incorporated in England and Wales and share the 
same registered office at Grant Way, Isleworth, Middlesex TW7 5QD.

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




RE: A newbie question - line number inside the script

2008-07-16 Thread Stewart Anderson

This demonstrates it  simply enough.

#!/usr/local/ActivePerl-5.8/bin/perl

sub errorhandler {
local ($trapped_line_no) = @_ ; 
print \nThe  error handler was  invoked from line no is:\t   .
$trapped_line_no  . \n ; 

}

errorhandler( __LINE__ ) ;


-Original Message-
From: Amit Koren [mailto:[EMAIL PROTECTED] 
Sent: 16 July 2008 11:22
To: beginners@perl.org
Subject: A newbie question - line number inside the script

Hi list.

I'm a newbie to Perl, (and to this mailing list)  :)
There's a task i was given, in which it is necessary to get the
number of the current executing line/command - inside the script itself.

Can someone assist please ?

Thanks in advance,

Amit.

Information in this email including any attachments may be privileged, 
confidential and is intended exclusively for the addressee. The views expressed 
may not be official policy, but the personal views of the originator. If you 
have received it in error, please notify the sender by return e-mail and delete 
it from your system. You should not reproduce, distribute, store, retransmit, 
use or disclose its contents to anyone. Please note we reserve the right to 
monitor all e-mail communication through our internal and external networks. 
SKY and the SKY marks are trade marks of British Sky Broadcasting Group plc and 
are used under licence. British Sky Broadcasting Limited (Registration No. 
2906991), Sky Interactive Limited (Registration No. 3554332), Sky-In-Home 
Service Limited (Registration No. 2067075) and Sky Subscribers Services Limited 
(Registration No. 2340150) are direct or indirect subsidiaries of British Sky 
Broadcasting Group plc (Registration No. 2247735). All of the companies 
mentioned in this paragraph are incorporated in England and Wales and share the 
same registered office at Grant Way, Isleworth, Middlesex TW7 5QD.

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




RE: possible to compare two excel file by using Perl?

2008-07-15 Thread Stewart Anderson

I hope you have sent a complete working  program.  That is what the list
is for after all,  isn't it ?


-Original Message-
From: Gunnar Hjalmarsson [mailto:[EMAIL PROTECTED] 
Sent: 15 July 2008 12:20
To: beginners@perl.org; ramkumar
Subject: Re: possible to compare two excel file by using Perl?

ramkumar wrote (to me privately):
 Pls send perl code to my id for xl fils comparision using perl.

How much would you pay me? Because you didn't mean for free, did you?

-- 
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl

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



Information in this email including any attachments may be privileged, 
confidential and is intended exclusively for the addressee. The views expressed 
may not be official policy, but the personal views of the originator. If you 
have received it in error, please notify the sender by return e-mail and delete 
it from your system. You should not reproduce, distribute, store, retransmit, 
use or disclose its contents to anyone. Please note we reserve the right to 
monitor all e-mail communication through our internal and external networks. 
SKY and the SKY marks are trade marks of British Sky Broadcasting Group plc and 
are used under licence. British Sky Broadcasting Limited (Registration No. 
2906991), Sky Interactive Limited (Registration No. 3554332), Sky-In-Home 
Service Limited (Registration No. 2067075) and Sky Subscribers Services Limited 
(Registration No. 2340150) are direct or indirect subsidiaries of British Sky 
Broadcasting Group plc (Registration No. 2247735). All of the companies 
mentioned in this paragraph are incorporated in England and Wales and share the 
same registered office at Grant Way, Isleworth, Middlesex TW7 5QD.

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




RE: closing dbh with active statement handles

2008-07-09 Thread Stewart Anderson


Is that due to the   use strict ;   pragma?

Ta 

Stu

-Original Message-
From: Octavian Rasnita [mailto:[EMAIL PROTECTED] 
Sent: 09 July 2008 06:07
To: luke devon; Perl
Subject: Re: closing dbh with active statement handles

From: luke devon [EMAIL PROTECTED]
Hi Friends, 

Here, I am trying to connect sqlite DB and access some data for matching
values with STDIN.But when i try to debug the code it gives following
message. I went through google , and couldn't find any solution yet. Can
some body help me pelase.

 
After you finish using some vars like $sth, do:

undef $sth;

And you won't receive those warnings.

Octavian


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



Information in this email including any attachments may be privileged, 
confidential and is intended exclusively for the addressee. The views expressed 
may not be official policy, but the personal views of the originator. If you 
have received it in error, please notify the sender by return e-mail and delete 
it from your system. You should not reproduce, distribute, store, retransmit, 
use or disclose its contents to anyone. Please note we reserve the right to 
monitor all e-mail communication through our internal and external networks. 
SKY and the SKY marks are trade marks of British Sky Broadcasting Group plc and 
are used under licence. British Sky Broadcasting Limited (Registration No. 
2906991), Sky Interactive Limited (Registration No. 3554332), Sky-In-Home 
Service Limited (Registration No. 2067075) and Sky Subscribers Services Limited 
(Registration No. 2340150) are direct or indirect subsidiaries of British Sky 
Broadcasting Group plc (Registration No. 2247735). All of the companies 
mentioned in this paragraph are incorporated in England and Wales and share the 
same registered office at Grant Way, Isleworth, Middlesex TW7 5QD.

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




RE: function call help

2008-07-09 Thread Stewart Anderson
 

Lock is a perl function

 

http://perldoc.perl.org/functions/lock.html

 

 

 

#! /usr/bin/perl

 

# Perl script to take the backup of critical clearcase data

 

@vob_lst=(qw(test test1 test2));

 

 

foreach $a (@vob_lst) {

 lockvob($a);

}

 

 

 sub lockvob {

local ( $lockitem ) = @_ ; 

 print Locking VOB:\t$lockitem \n;

 #`/usr/atria/bin/cleartool lock:$a`;

 #if($?){print Locking of VOB $lock failed\n;}

 #else{print Locking of VOB $lock done\n;

 #}

}

 

 

 

Stewart Anderson

Application Support Analyst 
Sky Network Services (SNS)

Extension: 7212
Direct Line: +44 (0) 20 7032 7212
Email: [EMAIL PROTECTED]

Support Team Email:  [EMAIL PROTECTED]
blocked::mailto:[EMAIL PROTECTED]  

  _  

From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Sent: 09 July 2008 14:33
To: beginners@perl.org
Subject: function call help

 

Hi All,

 

I facing one issue in Perl script.  I am executing one command in Perl
script and taking the output of that command in one array.  Now I want
to execute some more commands on each value of the array.

 

But the problem is that I am passing each value of the array as a
argument to that function but somehow it is not taking that value.

 

The output of the perl script is:

 

bash-3.00# perl backup.pl

/vob/test

Locking VOB 0

cleartool: Error: Unrecognized command: lock:0

Locking of VOB 0 failed

 

Now what I want is I need value /vob/test instead of 0.

 

Please find the attached perl script.

 

Please help/guide me.

 

Regards

Sayed.

 

Information in this email including any attachments may be privileged, 
confidential and is intended exclusively for the addressee. The views expressed 
may not be official policy, but the personal views of the originator. If you 
have received it in error, please notify the sender by return e-mail and delete 
it from your system. You should not reproduce, distribute, store, retransmit, 
use or disclose its contents to anyone. Please note we reserve the right to 
monitor all e-mail communication through our internal and external networks. 
SKY and the SKY marks are trade marks of British Sky Broadcasting Group plc and 
are used under licence. British Sky Broadcasting Limited (Registration No. 
2906991), Sky Interactive Limited (Registration No. 3554332), Sky-In-Home 
Service Limited (Registration No. 2067075) and Sky Subscribers Services Limited 
(Registration No. 2340150) are direct or indirect subsidiaries of British Sky 
Broadcasting Group plc (Registration No. 2247735). All of the companies 
mentioned in this paragraph are incorporated in England and Wales and share the 
same registered office at Grant Way, Isleworth, Middlesex TW7 5QD.


RE: arrayref

2008-07-08 Thread Stewart Anderson

Use this  in the  loop it might make it easier to see.

foreach my $region ( keys %Regions ) {
 print Region:\t$region\n ; 
 print \t\t @{ $Regions{$region} }\n;
 }
 

-Original Message-
From: elavazhagan perl [mailto:[EMAIL PROTECTED] 
Sent: 08 July 2008 12:00
To: Dr.Ruud; [EMAIL PROTECTED]
Cc: beginners@perl.org
Subject: Re: arrayref

Hi..

Thanks Rob,with ur code ,Now I can display all the countries with
regions.Now i would like to display only countries specific to the
region.
We can split the data and assign into two different arrays.Let me know
is
there any specific way to retrive the data ??
Thanks a lot




#! /usr/perl/bin
use strict;
my %Regions = (
 Europe = [
   'Belgium',
   'Denmark',
   'France',
   'Germany',
   'Great Britain',
   'Hungary',
   'Portugal',
   'Russia',
   'Spain',
   'Sweden',
   'Turkey',
 ],
 Asia = [
   'Australia',
   'China',
   'India',
   'Malaysia',
   'NewZealand',
   'Philippines',
   'South Africa',
   'Taiwan',
   'Vietnam',
 ],
 North = [
   'U.S.',
   'Canada',
   'Mexico',
 ],

 South = [
   'Argentina',
   'Brazil',
   'Venezuela',
 ],
);


 foreach my $countries ( keys %Regions ) {
 print $countries: @{ $Regions{$countries} }\n
 }


On 7/8/08, Dr.Ruud [EMAIL PROTECTED] [EMAIL PROTECTED]
wrote:

 elavazhagan perl schreef:

  #Start
  #! /usr/local/perl/bin
  use strict;

 The shebang-line should be the first one.
 use warnings; is missing.

 --
 Affijn, Ruud

 Gewoon is een tijger.

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




Information in this email including any attachments may be privileged, 
confidential and is intended exclusively for the addressee. The views expressed 
may not be official policy, but the personal views of the originator. If you 
have received it in error, please notify the sender by return e-mail and delete 
it from your system. You should not reproduce, distribute, store, retransmit, 
use or disclose its contents to anyone. Please note we reserve the right to 
monitor all e-mail communication through our internal and external networks. 
SKY and the SKY marks are trade marks of British Sky Broadcasting Group plc and 
are used under licence. British Sky Broadcasting Limited (Registration No. 
2906991), Sky Interactive Limited (Registration No. 3554332), Sky-In-Home 
Service Limited (Registration No. 2067075) and Sky Subscribers Services Limited 
(Registration No. 2340150) are direct or indirect subsidiaries of British Sky 
Broadcasting Group plc (Registration No. 2247735). All of the companies 
mentioned in this paragraph are incorporated in England and Wales and share the 
same registered office at Grant Way, Isleworth, Middlesex TW7 5QD.

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




RE: Perl how to die without printing out a message?

2008-07-02 Thread Stewart Anderson


Send it to  an  error sub ?

connect(dbi:Pg:dbname=$dbname;host=$host;port=$port;,$username, 
$password, {AutoCommit = 1})
  or  Error(error message);


sub Error {
my ($errormessage) = @_

sendmail 

etc 


}

HTH 

Stu 



-Original Message-
From: Ravi Malghan [mailto:[EMAIL PROTECTED] 
Sent: 02 July 2008 13:44
To: beginners@perl.org
Subject: Perl how to die without printing out a message?

Hi: I connect to a database within my script. If the script cannot connect, I 
want it to send an email and terminate without printing any message on stdout. 
I have the following code
  $dbh = 
DBI-connect(dbi:Pg:dbname=$dbname;host=$host;port=$port;,$username, 
$password, {AutoCommit = 1})
  or die notifyError($message, $subject);

When I run the script, it does call the notifyError function fine and I receive 
the email. But it spits out the following message. Any way I can terminate 
without putting any message on the screen?
-bash-3.00$ processRemedySubmit.pl  
DBI connect('dbname=data;host=hostA;port=5435;','postgres',...) failed: could 
not translate host name hostA to address: node name or service name not known 
at ./scripts/processRemedySubmit.pl line 32
Died at ./scripts/processRemedySubmit.pl line 32.

Thanks
Ravi


  

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



Information in this email including any attachments may be privileged, 
confidential and is intended exclusively for the addressee. The views expressed 
may not be official policy, but the personal views of the originator. If you 
have received it in error, please notify the sender by return e-mail and delete 
it from your system. You should not reproduce, distribute, store, retransmit, 
use or disclose its contents to anyone. Please note we reserve the right to 
monitor all e-mail communication through our internal and external networks. 
SKY and the SKY marks are trade marks of British Sky Broadcasting Group plc and 
are used under licence. British Sky Broadcasting Limited (Registration No. 
2906991), Sky Interactive Limited (Registration No. 3554332), Sky-In-Home 
Service Limited (Registration No. 2067075) and Sky Subscribers Services Limited 
(Registration No. 2340150) are direct or indirect subsidiaries of British Sky 
Broadcasting Group plc (Registration No. 2247735). All of the companies 
mentioned in this paragraph are incorporated in England and Wales and share the 
same registered office at Grant Way, Isleworth, Middlesex TW7 5QD.

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




RE: 2 part question for DBI-1.604

2008-06-23 Thread Stewart Anderson


Hi Tim,

I totally understand the  rebuild perl  approach, you mentioned in
that I know what you mean and  how to  go about it;but I'm  fairly
new to Perl too and  that seems like a   big undertaking for  1 module,
1,  because  I'm new  to perl  and   building environments in general
and 2.  does it not run the risk  of ending  up with everything having
to be built  custom?  Which I  would think is  something to avoid
because then you have to rebuild  everything custom on every environment
in the same way etc etc.

Hope that  question makes sense.


Ta 

Stu

-Original Message-
From: Tim Bunce [mailto:[EMAIL PROTECTED] On Behalf Of Tim Bunce
Sent: 21 June 2008 11:04
To: Rich
Cc: [EMAIL PROTECTED]
Subject: Re: 2 part question for DBI-1.604

On Fri, Jun 20, 2008 at 08:51:33AM -0700, Rich wrote:
 I am trying to load DBI on a server and getting errors with the make
command.
 background---
 DBI 1.604 (building this package)
 os = AIX 5300-07
 Perl -v v5.8.2 built for aix-thread-multi-64all
 # gcc -v
 Using built-in specs.
 Target: powerpc-ibm-aix5.3.0.0
 Configured with: ../configure --with-as=/usr/bin/as
--with-ld=/usr/bin/ld --enable-languages=c,c++,java
--prefix=/opt/freeware --enable-threads
--enable-version-specific-runtime-libs --host=powerpc-ibm-aix5.3.0.0
--target=powerpc-ibm-aix5.3.0.0 --build=powerpc-ibm-aix5.3.0.0
--disable-libjava-multilib
 Thread model: aix
 gcc version 4.2.0
 ---
 /usr/opt/perl5/lib64/5.8.2/aix-thread-multi-64all/CORE/reentr.h:619:
error: field '_drand48_struct' has incomplete type
 /usr/opt/perl5/lib64/5.8.2/aix-thread-multi-64all/CORE/reentr.h:727:
error: field '_random_struct' has incomplete type
 /usr/opt/perl5/lib64/5.8.2/aix-thread-multi-64all/CORE/reentr.h:775:
error: field '_srandom_struct' has incomplete type
 make: 1254-004 The error code from the last command is 1.
 --
 Question 1:  What is wrong with the reentr.h using gcc in first test
case?

You should build perl extensions with the same compiler and platform
that was used to build the perl executable itself.

Build and install a new perl, then use that perl to build DBI etc.

Tim.

Information in this email including any attachments may be privileged, 
confidential and is intended exclusively for the addressee. The views expressed 
may not be official policy, but the personal views of the originator. If you 
have received it in error, please notify the sender by return e-mail and delete 
it from your system. You should not reproduce, distribute, store, retransmit, 
use or disclose its contents to anyone. Please note we reserve the right to 
monitor all e-mail communication through our internal and external networks. 
SKY and the SKY marks are trade marks of British Sky Broadcasting Group plc and 
are used under licence. British Sky Broadcasting Limited (Registration No. 
2906991), Sky Interactive Limited (Registration No. 3554332), Sky-In-Home 
Service Limited (Registration No. 2067075) and Sky Subscribers Services Limited 
(Registration No. 2340150) are direct or indirect subsidiaries of British Sky 
Broadcasting Group plc (Registration No. 2247735). All of the companies 
mentioned in this paragraph are incorporated in England and Wales and share the 
same registered office at Grant Way, Isleworth, Middlesex TW7 5QD.

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




Perl to ftp files remote to local

2008-06-23 Thread Stewart Anderson

Hi,

I'm sure there  are a zillion ways  of doing this,  but  rather than
re-invent the wheel  I thought I'd use my best skill -  The  ability to
ask someone else and plaguerise :)


So,  I  would like to poll a remote server (production app server)  find
files (log files) in a  specific directory  tree (recursive)  and  copy
any over,  say day old,  to  the local machine.  

I would  like to do it  in a secure way using ssh or some such
mechanism.  I can't put anything on the production machine,  at best  I
could  have  it run a job to prepare a list of files for the remote to
poll and  trawl through.

All pointers and  suggestions appreciated :)

Stu.



Ps   Why  you ask?  Well,  there is no log file  retention policy,
logging is done locally and  there is not enough disk to keep the log
files for  the period they are usually required  -   Yes I know  -
Please don't ask !!



Information in this email including any attachments may be privileged, 
confidential and is intended exclusively for the addressee. The views expressed 
may not be official policy, but the personal views of the originator. If you 
have received it in error, please notify the sender by return e-mail and delete 
it from your system. You should not reproduce, distribute, store, retransmit, 
use or disclose its contents to anyone. Please note we reserve the right to 
monitor all e-mail communication through our internal and external networks. 
SKY and the SKY marks are trade marks of British Sky Broadcasting Group plc and 
are used under licence. British Sky Broadcasting Limited (Registration No. 
2906991), Sky Interactive Limited (Registration No. 3554332), Sky-In-Home 
Service Limited (Registration No. 2067075) and Sky Subscribers Services Limited 
(Registration No. 2340150) are direct or indirect subsidiaries of British Sky 
Broadcasting Group plc (Registration No. 2247735). All of the companies 
mentioned in this paragraph are incorporated in England and Wales and share the 
same registered office at Grant Way, Isleworth, Middlesex TW7 5QD.

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