[30077] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 1320 Volume: 11

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Feb 29 14:09:47 2008

Date: Fri, 29 Feb 2008 11:09:09 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Fri, 29 Feb 2008     Volume: 11 Number: 1320

Today's topics:
        every(seconds => 4) <tzz@lifelogs.com>
    Re: Generate an associative array from a file <gniagnia@gmail.com>
    Re: Generate an associative array from a file <peter@makholm.net>
    Re: Generate an associative array from a file <cartercc@gmail.com>
    Re: Generate an associative array from a file <cartercc@gmail.com>
    Re: Generate an associative array from a file <gniagnia@gmail.com>
    Re: Generate an associative array from a file <cartercc@gmail.com>
        Hell of a time extracting bits from a vector <idgarad@gmail.com>
    Re: Hell of a time extracting bits from a vector <someone@example.com>
        How to set a HARD memory limit for apache <ignoramus12509@NOSPAM.12509.invalid>
    Re: How to set a HARD memory limit for apache <joost@zeekat.nl>
    Re: How to set a HARD memory limit for apache xhoster@gmail.com
    Re: How to set a HARD memory limit for apache <jurgenex@hotmail.com>
    Re: Magic $a $b <achimpeters@gmx.de>
        Newbie needs help with IO::Socket (maybe IO::Select) <john@doe.com>
    Re: Newbie needs help with IO::Socket (maybe IO::Select xhoster@gmail.com
    Re: regex for chars 192 to 255 <someone@example.com>
    Re: regex for chars 192 to 255 <jurgenex@hotmail.com>
    Re: regex for chars 192 to 255 <john1949@yahoo.com>
    Re: Regular Expression to Replace UPPER Case Text with  <hjp-usenet2@hjp.at>
        Secure FTP john_paul_byrne@yahoo.co.uk
    Re: Secure FTP <m@rtij.nl.invlalid>
    Re: Secure FTP <cartercc@gmail.com>
    Re: Secure FTP john_paul_byrne@yahoo.co.uk
    Re: Spreadsheet::ParseExcel - How to get certain Cells <not@home.net>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: Fri, 29 Feb 2008 12:30:41 -0600
From: Ted Zlatanov <tzz@lifelogs.com>
Subject: every(seconds => 4)
Message-Id: <86lk53fwdq.fsf@lifelogs.com>

I've extended the every() function I discussed before to handle the
'seconds' syntax, so you can say

while (<>)
{
 ...
 if (every(seconds=>60))
 {
  # do this every minute when input arrives
 }
 elsif (every(5000) || every(943, "second one")) # distinguish the second call's hash entry
 {
 }
}

Here's my implementation, which preserves the semantics of the original
every(N) function as well.  I'm curious if anyone has ideas for more
things I can add.  I am debating if it's worth putting on CPAN (I don't
know of anything like it already on CPAN).  It seems like a really
simple piece of code that doesn't necessarily merit its own module, but
it's really useful to me...

Ted

{
 my %counters;
 my %time_counters;
 sub every
 {
  my ($div, @id) = @_;

  if ($div eq 'seconds')
  {
   $div = shift @id; # the number follows the 'seconds' string

   $time_counters{caller(), $div, @id} ||= time;

   my $then = $time_counters{caller(), $div, @id};
   my $diff = time - ($then + $div);
   return ($diff >= 0) ? ($time_counters{caller(), $div, @id} = time) : 0;
  }
  # else...
  return !(++$counters{ caller(), $div, @id } % $div);
 }
}


------------------------------

Date: Fri, 29 Feb 2008 05:56:01 -0800 (PST)
From: Mr_Noob <gniagnia@gmail.com>
Subject: Re: Generate an associative array from a file
Message-Id: <661fec5e-5361-4129-adbe-5ed4477838cb@s8g2000prg.googlegroups.com>

Oook,

Here is what i succeed to write so far :

	my %hash;
	open(INFILE, $cftp_conf_file)  or die "$cftp_conf_file : $!";

	while (<INFILE>)
	{
	next if $_ =~ /^\#/;
	if ($_ =~ /^\[/)
		{
			$hash{cftp_client_name} = $_;
		}
	}
	close (INFILE);
	print %hash;


this only creates a list of clients ... but I cannot find how to
retrieve other client's info (lines beginning with "remote" and
"passive") and feed the array with it...




------------------------------

Date: Fri, 29 Feb 2008 13:58:21 +0000
From: Peter Makholm <peter@makholm.net>
Subject: Re: Generate an associative array from a file
Message-Id: <87y7933lvm.fsf@hacking.dk>

ccc31807 <cartercc@gmail.com> writes:

> This is what Perl does, for goodness sake!

Forcing you to reinvent existing wheel? But why oh why?

To me, Perl is the exact opposite...

//Makholm


------------------------------

Date: Fri, 29 Feb 2008 07:00:24 -0800 (PST)
From: ccc31807 <cartercc@gmail.com>
Subject: Re: Generate an associative array from a file
Message-Id: <66cfe521-b80e-44ac-bdb3-2bc066d4fd41@o77g2000hsf.googlegroups.com>

On Feb 29, 8:56 am, Mr_Noob <gniag...@gmail.com> wrote:
> Oook,
>
> Here is what i succeed to write so far :
>
>         my %hash;
>         open(INFILE, $cftp_conf_file)  or die "$cftp_conf_file : $!";
>
>         while (<INFILE>)
>         {
>         next if $_ =~ /^\#/;
>         if ($_ =~ /^\[/)
>                 {
>                         $hash{cftp_client_name} = $_;
>                 }
>         }
>         close (INFILE);
>         print %hash;
>
> this only creates a list of clients ... but I cannot find how to
> retrieve other client's info (lines beginning with "remote" and
> "passive") and feed the array with it...

My approach would be to create a hash of hashrefs. This is an approach
I have found useful in my job, and I do a LOT of the kind of stuff you
want to do with your input file. Randal Schwartz wrote a little book
about learning Perl objects, modules, and references, and there is
code in there that you can adapt almost verbatim. I shamelessly copied
his code the same way I am recommending to you.

Okay, it's tough at first, I'll grant, but it does get a lot easier
over time, and if you do this kind of stuff often, you'll soon find
that you can bash out a script from memory -- which is quick and
(repeating myself) very useful.

CC


------------------------------

Date: Fri, 29 Feb 2008 07:28:54 -0800 (PST)
From: ccc31807 <cartercc@gmail.com>
Subject: Re: Generate an associative array from a file
Message-Id: <81dc899b-e8b3-4f92-8c91-38efda9f2ea7@q78g2000hsh.googlegroups.com>

On Feb 29, 8:58 am, Peter Makholm <pe...@makholm.net> wrote:
> ccc31807 <carte...@gmail.com> writes:
> > This is what Perl does, for goodness sake!
>
> Forcing you to reinvent existing wheel? But why oh why?

No, not reinventing the wheel. Just using the wheel for its intended
purpose.

Actually, writing a module to do what Perl will natively do anyway
seems reinventing the wheel to me. If you can do something directly
with a function, or indirectly with a module that might call the
function or duplicate its functionality, why not do it directly?

CC


------------------------------

Date: Fri, 29 Feb 2008 08:50:29 -0800 (PST)
From: Mr_Noob <gniagnia@gmail.com>
Subject: Re: Generate an associative array from a file
Message-Id: <f9a67e36-d7cf-4761-8ced-16650828d54b@b1g2000hsg.googlegroups.com>

thanks for your advise.
I am still struggling with hashref creation within a hash...could you
please give a small example ?


------------------------------

Date: Fri, 29 Feb 2008 10:13:56 -0800 (PST)
From: ccc31807 <cartercc@gmail.com>
Subject: Re: Generate an associative array from a file
Message-Id: <8af8d9c7-5e2b-4d5c-8637-16a2f1e5802a@h25g2000hsf.googlegroups.com>

On Feb 29, 11:50 am, Mr_Noob <gniag...@gmail.com> wrote:
> thanks for your advise.
> I am still struggling with hashref creation within a hash...could you
> please give a small example ?

Look at your Perl documentation. Look at these man pages:
perldsc - data structures cookbook
perlreftut = Perl reference tutor
perllol - Perl lists of lists

A reference is a scalar value that contains a memory address, a scalar
value, that points to another place in memory that may contain
anything else, including a hash. Look at the examples in the man pages
given above.

Bottom line: You need to learn how to do this for yourself. I can't
give you an example script to follow that would work for you. I could
give you an example script that works for me, but that won't do you
any good. You need to learn how to do this for yourself.

CC


------------------------------

Date: Fri, 29 Feb 2008 09:09:39 -0800 (PST)
From: Idgarad <idgarad@gmail.com>
Subject: Hell of a time extracting bits from a vector
Message-Id: <552b057e-86f8-4428-825d-fd0eccd7e9f8@s19g2000prg.googlegroups.com>

I am generating a SHA1 digest that I want to use for some values.

I want to take the digest that is generated at extact a given number
of bits, in sequence.

SHA1 generates 160 bits.

I would like to partition that 160 bits into an array storing the
value of those bits

for instance (in short form using only 10 bits grabbing 2 at a time)
lets say I have:

1010010101

and I am grabbing pairs I need (from least to most):

@somearray

$somearray[0] = 1 (01)
$somearray[1] = 1 (01)
$somearray[2] = 1 (01)
$somearray[3] = 2 (10)
$somearray[4] = 2 (10)


I I tried using vec (going back to the full 160 bits) but it fails
miserably. Here a sample

Using vec($digest,$loop*8,8) (Grabbing 8 bits)

I would get
0101010101
1101011010
100101001010101101
010110110101011101
 ...

The lengths would be wrong (doing an unpack "b*" on the array that was
holding the result. Sometimes I would get 8, other 16 and the number
even changes running the same data!)

I even tried using the Binary::Vector with a Chunk_Read and got
similar results.

This should be this hard to just extract X bits from a Y*X offset
where Y is the loop iteration.

What am I missing?


------------------------------

Date: Fri, 29 Feb 2008 18:53:22 GMT
From: "John W. Krahn" <someone@example.com>
Subject: Re: Hell of a time extracting bits from a vector
Message-Id: <CwYxj.50012$w57.40153@edtnps90>

Idgarad wrote:
> I am generating a SHA1 digest that I want to use for some values.
> 
> I want to take the digest that is generated at extact a given number
> of bits, in sequence.
> 
> SHA1 generates 160 bits.
> 
> I would like to partition that 160 bits into an array storing the
> value of those bits

use Digest::SHA1  qw(sha1);

unpack '(a)*', unpack 'B*', sha1( $data );


> for instance (in short form using only 10 bits grabbing 2 at a time)
> lets say I have:
> 
> 1010010101
> 
> and I am grabbing pairs I need (from least to most):
> 
> @somearray
> 
> $somearray[0] = 1 (01)
> $somearray[1] = 1 (01)
> $somearray[2] = 1 (01)
> $somearray[3] = 2 (10)
> $somearray[4] = 2 (10)

my @somearray = unpack '(a2)*', unpack 'B*', sha1( $data );



John
-- 
Perl isn't a toolbox, but a small machine shop where you
can special-order certain sorts of tools at low cost and
in short order.                            -- Larry Wall


------------------------------

Date: Fri, 29 Feb 2008 08:30:10 -0600
From: Ignoramus12509 <ignoramus12509@NOSPAM.12509.invalid>
Subject: How to set a HARD memory limit for apache
Message-Id: <qY6dndEgD-Jvi1XanZ2dnUVZ_q2hnZ2d@giganews.com>

I have a Linux server that I am configuring for Apache to me used with
mod_perl.

I want to make sure that no apache child can, ever, under any
circumstances, exceed some memory size limit such as 300 MB. 

I looked at perl modules such as Apache2::Resource and
Apache2::SizeLimit and they would not work for me. The former just
does not do its job, and the second a) just checks memory size and b)
does not work with threaded MPM. 

What I want is a very simple thing: I want an apache daemon to
INSTANTLY DIE if it ever reaches size of X such as X = 300 MB. I do
not want to "give them a chance". I also do not want to "check the
size at some times (like in CleanupHandler)". I want behaviour such as
that specified by bash ulimit function. Instant death immediately upon
reaching the limit.

The reason for this is that I do not want a memory consuming bug in my
mod_perl code to damage my server.

At the same time, I would like to set a lower limit that would exit
apache gracefully and that would be checked from, say, a
CleanupHandler. 

So, does anyone have any suggestions for what I should use.

Thanks.

i


------------------------------

Date: Fri, 29 Feb 2008 16:15:21 +0100
From: Joost Diepenmaat <joost@zeekat.nl>
Subject: Re: How to set a HARD memory limit for apache
Message-Id: <87r6evrdyu.fsf@zeekat.nl>

Ignoramus12509 <ignoramus12509@NOSPAM.12509.invalid> writes:

> What I want is a very simple thing: I want an apache daemon to
> INSTANTLY DIE if it ever reaches size of X such as X = 300 MB. I do
> not want to "give them a chance". I also do not want to "check the
> size at some times (like in CleanupHandler)". I want behaviour such as
> that specified by bash ulimit function. Instant death immediately upon
> reaching the limit.

How about just putting a hard ulimit in the apache init.d script?

> At the same time, I would like to set a lower limit that would exit
> apache gracefully and that would be checked from, say, a
> CleanupHandler. 

Dunno about that.

-- 
Joost Diepenmaat | blog: http://joost.zeekat.nl/ | work: http://zeekat.nl/


------------------------------

Date: 29 Feb 2008 16:44:53 GMT
From: xhoster@gmail.com
Subject: Re: How to set a HARD memory limit for apache
Message-Id: <20080229114454.911$LA@newsreader.com>

Ignoramus12509 <ignoramus12509@NOSPAM.12509.invalid> wrote:
> I have a Linux server that I am configuring for Apache to me used with
> mod_perl.
>
> I want to make sure that no apache child can, ever, under any
> circumstances, exceed some memory size limit such as 300 MB.
>
 ...
> I want behaviour such as
> that specified by bash ulimit function. Instant death immediately upon
> reaching the limit.

I don't understand the problem.  If ulimit does exactly what you want,
why not just use ulimit?

Xho

-- 
-------------------- http://NewsReader.Com/ --------------------
The costs of publication of this article were defrayed in part by the
payment of page charges. This article must therefore be hereby marked
advertisement in accordance with 18 U.S.C. Section 1734 solely to indicate
this fact.


------------------------------

Date: Fri, 29 Feb 2008 16:48:49 GMT
From: Jürgen Exner <jurgenex@hotmail.com>
Subject: Re: How to set a HARD memory limit for apache
Message-Id: <tjdgs3tmftecvhe3msjhcg4gltgt139jbh@4ax.com>

Ignoramus12509 <ignoramus12509@NOSPAM.12509.invalid> wrote:
>I have a Linux server that I am configuring for Apache to me used with
>mod_perl.
>
>I want to make sure that no apache child can, ever, under any
>circumstances, exceed some memory size limit such as 300 MB. 

I fail to see the relationship between your question and the programming
language uses.

[...]
>So, does anyone have any suggestions for what I should use.

I would suggest to use a newsgroup that deals with Apache and/or your OS of
choice.

jue


------------------------------

Date: Fri, 29 Feb 2008 13:29:24 +0100
From: Achim Peters <achimpeters@gmx.de>
Subject: Re: Magic $a $b
Message-Id: <47C7FAA4.6010304@gmx.de>

Joost Diepenmaat schrieb:
> Achim Peters <achimpeters@gmx.de> writes:
> 
>> which in fact does print the 4711 (a German "magic" number) with Perl
>> 5.8.2, thus no side effects of the sorting (except of course that the
>> missing "my" in front of $a does not cause an compile error.
>>
>> Is there any example to prove his impertinence of questioning the gurus'
>>   wisdom?
> 
> I would think:

> my $a = 4711;
[...]

> would be enough reason not to use $a and $b.

Tnx! He converted and now is a true fellow believer. ;-)

Bye
 Achim


------------------------------

Date: Fri, 29 Feb 2008 15:41:22 +0100
From: "Boerni" <john@doe.com>
Subject: Newbie needs help with IO::Socket (maybe IO::Select)
Message-Id: <fq95ik$69s$1@atlas.ip-plus.net>

Hi all

I'm playing around with IO::Socket and try to build a small Client/Server 
App.

The Serverpart is working as it's supposed to, but I have some problems with 
the Clientpart.

So I have a couple of Questions:
1. How can a Client react to a Servermessage (Server prints to Socket), when 
it's not expecting a Servermessage (For example another client connects to 
the server and kicks the first one or the server is beeing shutdown). If I 
use the IO::Select approach like in the Serverpart, the Client is blocked 
and the User can't interact with it anymore.

2. Why does $socket->connected still return the peer-address, eventhough the 
server is shutdown?

I'm sure there is a solution for this (probably by using IO::Select), but I 
can't find any examples of Clientcode using this.

Here's what I have (simplified... the "real" Client is using Tk):

------ Star Serverpart -------
#!perl -w
use strict;
use IO::Socket;
use IO::Select;
use Data::Dumper;

our $socket;
my %users;
my $port = 9901;

#Socket erstellen
my $main_socket = IO::Socket::INET->new(LocalPort => $port,
                                     Type      => SOCK_STREAM,
                                     Reuse     => 1,
                                     Listen    => 1) or die "Kann kein 
TCP-Server an Port $port sein: @!\n";

my $lesbar = new IO::Select();
$lesbar->add($main_socket);

#Pruefen ob ein Client connectet
while(1) {
 my ($neu_lesbare) = IO::Select->select($lesbar, undef, undef, undef);

 foreach $socket(@{$neu_lesbare}) {
  if ($socket == $main_socket) {
   #Neue Verbindung kommt rein...
   my $neues_socket = $socket->accept();
   $lesbar->add($neues_socket);
  }
  else {
   # Hier drin passiert Zeug mit dem Client
   my $buf = <$socket>;
   if ($buf) {
    chomp($buf);
    my @args = split(',', $buf);
    if ($args[0] eq "AUTH") {
     auth($args[1], $args[2]);
    }
    else {
     print "Nicht unterstuetzter Command\n";
    }
   }
   else {
#    print "Client hat Socket geschlossen\n";
    $lesbar->remove($socket);
    close ($socket);

    foreach (keys %users) {
     if ($socket eq $users{$_}{socket}) {
      print localtime().": User [$_] disconnected\n";
      delete $users{$_};
     }
    }
   }
  }
 }
}

#---- Subroutinen ---#
sub write2socket {
 my $socket = shift;
 my $text = shift;
 my $length = sprintf("%04d", length($text));
 my $newstring = $length.$text;
 print $socket "$newstring";
}

sub auth {
 my $usr  = shift;
 my $pass = shift;

 #Na wer ists denn...
 my $iaddr = inet_ntoa($socket->peeraddr());
 my $rem_host = gethostbyaddr($socket->peeraddr(), AF_INET);
 my $rem_port = $socket->peerport();
 print localtime().": Neue Verbindung von Host: $rem_host 
[$iaddr:$rem_port]\n";

 if (($usr eq "boerni") or ($usr eq "admin")) {
  if ($users{$usr}) {
   write2socket ($socket,"User $usr ist bereits verbunden 
($users{$usr}{host}:$users{$usr}{port})");
  }
  else {
   write2socket ($socket,"Verbindung mit User $usr akzeptiert");
   $users{$usr}{socket} = $socket;
   $users{$usr}{host} = $rem_host;
   $users{$usr}{port} = $rem_port;
  }
 }
 else {
  write2socket ($socket, "Verbindung abgelehnt");
  $lesbar->remove($socket);
  $socket->shutdown(2);
  close ($socket);
 }

 #print Dumper \%users;
 #print Dumper \%sockets;

 foreach (keys %users) {
  my $handle = $users{$_}{socket};
  write2socket($handle, "User $usr hat sich verbunden");
 }
}
------ End Serverpart -------

------ Star Clientpart -------
#!perl -w
use strict;
use IO::Socket;
use IO::Select;

my $socket;
my $usr = "admin";
my $pw  = "pass";
my $remote_host = 'localhost';
my $remote_port = 9901;

my $svrmsg;

my $lesbar = new IO::Select();
$lesbar->add($socket);

while (<>) {
 chomp;
 if ($_ eq "connect") {
  connect2server();
 }
 elsif ($_ eq "man_move") {
  man_move("up");
 }
 elsif ($_ eq "check") {
  check_status();
 }
 else {
  print "Nicht unterstuetzt\n";
 }
}

#---- Subroutinen ----#
sub connect2server {
 #---- Socket aufbauen ----#
 $socket = IO::Socket::INET->new(PeerAddr => $remote_host,
                                    PeerPort => $remote_port,
                                    Proto    => "tcp",
                                    Type     => SOCK_STREAM)
 or die "Konnte Verbindung zu $remote_host:$remote_port nicht herstellen: 
@!\n";

 print $socket "AUTH,$usr,$pw\n";

 $svrmsg = read_from_sock($socket);
 print "FROM SERVER: [$svrmsg]\n";

}

sub man_move {
 return if ! $socket;
 my $direction = shift;
 print $socket "man_move,$direction\n";

 $svrmsg = read_from_sock($socket);
 print "FROM SERVER: $svrmsg\n";
}

sub read_from_sock {
 my $socket = shift;
 my $length = 0;
 my $data;

 $socket->read($length, 4);
 $socket->read($data,$length);

 return $data;
}

sub check_status {
 if (! $socket) {
  print "CHECK: No socket\n";
 }
 elsif ($socket->connected()) {
  print "CHECK: Connected with ".inet_ntoa($socket->peeraddr())."\n";
 }
 else {
  print "CHECK: Not connected";
 }
}
------ End Clientpart -------

Thanks a lot 




------------------------------

Date: 29 Feb 2008 17:14:45 GMT
From: xhoster@gmail.com
Subject: Re: Newbie needs help with IO::Socket (maybe IO::Select)
Message-Id: <20080229121446.634$qm@newsreader.com>

"Boerni" <john@doe.com> wrote:
> Hi all
>
> I'm playing around with IO::Socket and try to build a small Client/Server
> App.
>
> The Serverpart is working as it's supposed to, but I have some problems
> with the Clientpart.
>
> So I have a couple of Questions:
> 1. How can a Client react to a Servermessage (Server prints to Socket),
> when it's not expecting a Servermessage (For example another client
> connects to the server and kicks the first one or the server is beeing
> shutdown).

Why would another client connecting to the server kick off the first one?
Wouldn't it be easier to fix this problem than to deal with the
consequences?

If the server has gone away, the client will realize this next time it
tries to communicate with it.  While I guess it might be nice to know
immediately that the server has gone away, plenty of very good
client-server apps don't detect server failure until the next time it tries
to communicate. I'd need a very compelling reason not to follow this
paradigm for my own clients.

> If I use the IO::Select approach like in the Serverpart, the
> Client is blocked and the User can't interact with it anymore.

You need to add STDIN (or whatever you use to communicate with the User)
into the IO::Select, too.  This means you probably have to use sysread,
rather than <>, to read from STDIN.

 ....

> #Pruefen ob ein Client connectet
> while(1) {
>  my ($neu_lesbare) = IO::Select->select($lesbar, undef, undef, undef);
>
>  foreach $socket(@{$neu_lesbare}) {
>   if ($socket == $main_socket) {
>    #Neue Verbindung kommt rein...
>    my $neues_socket = $socket->accept();
>    $lesbar->add($neues_socket);
>   }
>   else {
>    # Hier drin passiert Zeug mit dem Client
>    my $buf = <$socket>;

You are mixing buffered IO with select.  This is rather dangerous.  If
the client can ever print two (or more) lines into $socket in quick
succession, then this code might cause both of them to be read into the
perl internal buffer, but only one of them to be returned from there
into $buf.  The next line just sits in the internal buffer, where it will
not trigger IO::Select and hence not get read.  The client won't send any
more lines (which would trigger IO::Select) because it is waiting for a
response to the last line it sent, and the server will never respond to
that line because it doesn't know that it is there.  Deadlock.

I think IO::Select (or some subclass thereof) should return readable for
any file handle that has data sitting in the perl internal buffer, in
addition to the handles that have data (or eof) in the system's buffers.  I
haven't quite figured out how to implement that.  All of those globs and
glob refs and PerlIO layers and tied handles and scalar masquerading as
handles are just too much for me.

Xho

-- 
-------------------- http://NewsReader.Com/ --------------------
The costs of publication of this article were defrayed in part by the
payment of page charges. This article must therefore be hereby marked
advertisement in accordance with 18 U.S.C. Section 1734 solely to indicate
this fact.


------------------------------

Date: Fri, 29 Feb 2008 11:54:39 GMT
From: "John W. Krahn" <someone@example.com>
Subject: Re: regex for chars 192 to 255
Message-Id: <3oSxj.49145$w57.44754@edtnps90>

John wrote:
> 
> Is there a character class like [a-zA-Z] for accented characters that lie 
> between ASCII 192 and 255 (excluding 215 and 247)?

Using hexadecimal: [\xC0-\xD6\xD8-\xF6\xF8-\xFF] or using octal: 
[\300-\326\330-\366\370-\377]


(ASCII only includes the characters between 0 and 127 [inclusive])

John
-- 
Perl isn't a toolbox, but a small machine shop where you
can special-order certain sorts of tools at low cost and
in short order.                            -- Larry Wall


------------------------------

Date: Fri, 29 Feb 2008 12:00:00 GMT
From: Jürgen Exner <jurgenex@hotmail.com>
Subject: Re: regex for chars 192 to 255
Message-Id: <65sfs3tvuhbcgggibo97325hh3hg9elv3f@4ax.com>

"John" <john1949@yahoo.com> wrote:
>Is there a character class like [a-zA-Z] for accented characters that lie 
>between ASCII 192 and 255 (excluding 215 and 247)?

No, because there are no such characters. ASCII is a 7-bit encoding and the
largest possible code point is 127 (0x7f).

>If not, what is the easiest way to match those, other that specifying them 
>indvidually?

In whatever encoding you are using (obviously not ASCII) have you tried
specifying ranges like e.g. [\0xC0-\0xFF]? 
This will get you the code points although what characters are encoded in
those code points will be very different depending upon the actual encoding
used.

jue


------------------------------

Date: Fri, 29 Feb 2008 18:22:50 -0000
From: "John" <john1949@yahoo.com>
Subject: Re: regex for chars 192 to 255
Message-Id: <E_CdnW4KAY_l0FXanZ2dneKdnZydnZ2d@eclipse.net.uk>


"Jürgen Exner" <jurgenex@hotmail.com> wrote in message 
news:65sfs3tvuhbcgggibo97325hh3hg9elv3f@4ax.com...
> "John" <john1949@yahoo.com> wrote:
>>Is there a character class like [a-zA-Z] for accented characters that lie
>>between ASCII 192 and 255 (excluding 215 and 247)?
>
> No, because there are no such characters. ASCII is a 7-bit encoding and 
> the
> largest possible code point is 127 (0x7f).
>
>>If not, what is the easiest way to match those, other that specifying them
>>indvidually?
>
> In whatever encoding you are using (obviously not ASCII) have you tried
> specifying ranges like e.g. [\0xC0-\0xFF]?
> This will get you the code points although what characters are encoded in
> those code points will be very different depending upon the actual 
> encoding
> used.
>
> jue

Many thanks, gentlemen.  That's the solution I was after.
Regards
John




------------------------------

Date: Fri, 29 Feb 2008 17:29:45 +0100
From: "Peter J. Holzer" <hjp-usenet2@hjp.at>
Subject: Re: Regular Expression to Replace UPPER Case Text with lower case text
Message-Id: <slrnfsgcnr.huu.hjp-usenet2@hrunkner.hjp.at>

On 2008-02-19 04:59, Charlton Wilbur <cwilbur@chromatico.net> wrote:
>>>>>> "p" == penny  <kevin.penny@gmail.com> writes:

[Solution: Use \L]

>    p> The reason I didn't go the CFusion newsgroup first is that CF
>    p> runs with a limited perl engine and I figured you guys would
>    p> know more about regex than the cf group (eek)
>
> Er, no, while CF may have a PCRE library glommed into it somewhere, it
> has no Perl content at all; and "Perl compatible" regular expressions
> aren't.

Maybe not, but \L works in perl also (reading this thread (yes, I'm a
bit behind ...) I was astounded that nobody came up with this).

	hp


------------------------------

Date: Fri, 29 Feb 2008 03:14:18 -0800 (PST)
From: john_paul_byrne@yahoo.co.uk
Subject: Secure FTP
Message-Id: <6ee55424-0f57-4472-b63f-811f87752924@f47g2000hsd.googlegroups.com>

Hi,

I am setting up a cron job which calls a perl script, at the end of
which, I want to upload a file to a secure ftp server.

Can somebody point me in the best way to approach this? A sample would
be fantastic ;o)

John


------------------------------

Date: Fri, 29 Feb 2008 14:35:26 +0100
From: Martijn Lievaart <m@rtij.nl.invlalid>
Subject: Re: Secure FTP
Message-Id: <pan.2008.02.29.13.35.26@rtij.nl.invlalid>

On Fri, 29 Feb 2008 03:14:18 -0800, john_paul_byrne wrote:

> Hi,
> 
> I am setting up a cron job which calls a perl script, at the end of
> which, I want to upload a file to a secure ftp server.
> 
> Can somebody point me in the best way to approach this? A sample would
> be fantastic ;o)

Putting the words "Perl sftp" in Google pointed directly to CPANs 
Net::SFTP. I think it'll do the job.

HTH,
M4


------------------------------

Date: Fri, 29 Feb 2008 07:03:49 -0800 (PST)
From: ccc31807 <cartercc@gmail.com>
Subject: Re: Secure FTP
Message-Id: <b4b806f7-bc0c-4096-8c82-29ab0a47c1e5@x41g2000hsb.googlegroups.com>

On Feb 29, 6:14 am, john_paul_by...@yahoo.co.uk wrote:
> Hi,
>
> I am setting up a cron job which calls a perl script, at the end of
> which, I want to upload a file to a secure ftp server.
>
> Can somebody point me in the best way to approach this? A sample would
> be fantastic ;o)
>
> John


You can also use pscp. This is a command line program you can get from
http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html

We use this quite often and I can tell you from personal experience
that it's easy to use and reliable. Call it with system and check the
return value.

CC


------------------------------

Date: Fri, 29 Feb 2008 09:45:38 -0800 (PST)
From: john_paul_byrne@yahoo.co.uk
Subject: Re: Secure FTP
Message-Id: <f4937bef-c20c-4828-bd26-924f92efc5e5@o77g2000hsf.googlegroups.com>

On Feb 29, 3:03 pm, ccc31807 <carte...@gmail.com> wrote:
> On Feb 29, 6:14 am, john_paul_by...@yahoo.co.uk wrote:
>
> > Hi,
>
> > I am setting up a cron job which calls a perl script, at the end of
> > which, I want to upload a file to a secure ftp server.
>
> > Can somebody point me in the best way to approach this? A sample would
> > be fantastic ;o)
>
> > John
>
> You can also use pscp. This is a command line program you can get fromhttp://www.chiark.greenend.org.uk/~sgtatham/putty/download.html
>
> We use this quite often and I can tell you from personal experience
> that it's easy to use and reliable. Call it with system and check the
> return value.
>
> CC

Cheers CC


------------------------------

Date: Fri, 29 Feb 2008 19:01:09 +0100
From: Tom Brown <not@home.net>
Subject: Re: Spreadsheet::ParseExcel - How to get certain Cells
Message-Id: <2008022919010975249-not@homenet>

On 2008-02-25 18:15:42 +0100, "J. Gleixner" 
<glex_no-spam@qwest-spam-no.invalid> said:

> Ahhh... what?  Where does column A come in to all of this?
> The module processes rows and columns. If the worksheet
> looks like that, and you want column 3, rows 3-6, then your code
> looks OK.  If you want something else, then I don't understand.

After sleeping over it, I conclude Perl, respectively the module 
Spreadsheet::ParseExcel, can't provide what I was looking for. For a 
simple reason: The initial point where I started was just a partial 
view (let's say excerpt) on a sheet, i. e., the actual sheet has in 
fact a quite different data structure as shown in the filtered excel 
view. Therefore, the output from my script/Spreadsheet::ParseExcel is 
based on the real content of the sheet and not on my partial view.

However, your comments, J., nudged me into the proper direction and I 
got now what I was initally looking for.

Many thanks,

Tom



------------------------------

Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>


Administrivia:

#The Perl-Users Digest is a retransmission of the USENET newsgroup
#comp.lang.perl.misc.  For subscription or unsubscription requests, send
#the single line:
#
#	subscribe perl-users
#or:
#	unsubscribe perl-users
#
#to almanac@ruby.oce.orst.edu.  

NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice. 

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

#To request back copies (available for a week or so), send your request
#to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
#where x is the volume number and y is the issue number.

#For other requests pertaining to the digest, send mail to
#perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
#sending perl questions to the -request address, I don't have time to
#answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V11 Issue 1320
***************************************


home help back first fref pref prev next nref lref last post