[21879] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4083 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Nov 8 00:06:19 2002

Date: Thu, 7 Nov 2002 21:05:08 -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           Thu, 7 Nov 2002     Volume: 10 Number: 4083

Today's topics:
    Re: A vision for Parrot <max@alcyone.com>
    Re: converting cgi scripts to java <spam@thecouch.homeip.net>
    Re: converting cgi scripts to java (Jay Tilton)
        CPAN for rootless (l)users. <ocscwar@h-after-ocsc.mit.edu>
        GD and libgd (David Alyea)
    Re: GD and libgd <mgjv@tradingpost.com.au>
    Re: How to guarantee process ID stays with web connecti (Walter Roberson)
        internal variable-format and unexpected variable-value  <pilsl_use@goldfisch.at>
        Object in @INC returning Tie::Handles from INC method (Bryan Castillo)
        Oracle Transactions in Perl Script <fozzie_beer@hhhotmail.com>
    Re: Perfecting my Perl (Jay Tilton)
    Re: Perfecting my Perl <nobody@noplace.com>
    Re: script to modify database table as different user <pilsl_use@goldfisch.at>
        silent stack overflow in regex engine <edi@agharta.de>
    Re: silent stack overflow in regex engine <goldbb2@earthlink.net>
    Re: Simple question - What is unicode? (Malcolm Dew-Jones)
    Re: Simple question - What is unicode? (Alan Anderson)
    Re: special characters in command-line (Walter Roberson)
        typemap between vector<int> and perl array (Yan Lin)
    Re: typemap between vector<int> and perl array <goldbb2@earthlink.net>
    Re: Why not PERL? <vm.mayer@comcast.net>
    Re: Why not PERL? <wksmith@optonline.net>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Thu, 07 Nov 2002 19:25:35 -0800
From: Erik Max Francis <max@alcyone.com>
Subject: Re: A vision for Parrot
Message-Id: <3DCB2EAF.DEE7D6B6@alcyone.com>

Alan Green wrote:

> Is it just me, or does anyone else think it peculiar that someone
> '@esperanto.org' is championing a unified approach to language?

Now, now :-).  Esperanto is an auxiliary language, so its intend is to
be a second language that everyone learns in addition to their primary
tongue, rather than a replacement for it.

-- 
 Erik Max Francis / max@alcyone.com / http://www.alcyone.com/max/
 __ San Jose, CA, USA / 37 20 N 121 53 W / &tSftDotIotE
/  \ The conviction of wisdom is the plague of man.
\__/ Montaigne
    Church / http://www.alcyone.com/pyos/church/
 A lambda calculus explorer in Python.


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

Date: Thu, 07 Nov 2002 20:36:46 -0500
From: Mina Naguib <spam@thecouch.homeip.net>
Subject: Re: converting cgi scripts to java
Message-Id: <3DCB152E.4070206@thecouch.homeip.net>

-----BEGIN xxx SIGNED MESSAGE-----
Hash: SHA1



anekwe wrote:
| looking for instructions on how to completely convert a perl cgi to java

Step 1: Learn Perl
Step 2: Learn Java
Step 3: Translate the program


-----BEGIN xxx SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQE9yxUueS99pGMif6wRAo+JAJwNlp+69WCLPH0MB/YfJg3VtZkbkACgvwjS
2sJpsq0BQLE55HTNv6sE4qc=
=+Miz
-----END PGP SIGNATURE-----



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

Date: Fri, 08 Nov 2002 03:10:20 GMT
From: tiltonj@erols.com (Jay Tilton)
Subject: Re: converting cgi scripts to java
Message-Id: <3dcb2ae7.377049671@news.erols.com>

anekwe <member@dbforums.com> wrote:

: looking for instructions on how to completely convert a perl cgi to java

Phase 1:  Hire programmer
Phase 2:  ???
Phase 3:  Profit!



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

Date: 07 Nov 2002 19:13:07 -0500
From: Omri Schwarz <ocscwar@h-after-ocsc.mit.edu>
Subject: CPAN for rootless (l)users.
Message-Id: <octisz8hqb0.fsf@no-knife.mit.edu>

Hullo, all.

How do I tell CPAN that the installation 
prefix I need for my Perl module makefiles 
is not anywhere in /usr land but is in fact
~/perllib?

Or, do I have to do this:

perl -MCPAN -e shell
test (package) 
PREFIX=/home/omri/perllib install (package) 



-- 
Omri Schwarz --- ocscwar@mit.edu ('h' before war) 
Timeless wisdom of biomedical engineering: "Noise is principally
due to the presence of the patient." -- R.F. Farr



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

Date: 7 Nov 2002 15:23:44 -0800
From: ironmanda@yahoo.com (David Alyea)
Subject: GD and libgd
Message-Id: <4e277f62.0211071523.3c83f4dc@posting.google.com>

I just can't get these straight- the names
and most current versions are so similar,
I feel lost.  I've got GD2.01 untarred
and ready to go, and the README says I need
libgd 2.0.1 or higher.  On the Boutrell site,
this libgd appears to be GD2.04, not libgd.
Where do I find libgd 2.0.1?  I'm all
googled out.  The reason I need it, by the
way:

[root@dir/GD-2.01]# perl Makefile.PL
NOTICE: This module requires libgd 2.0.1 or higher.
        For earlier versions of libgd, use GD version 1.43.

Please choose the features that match how libgd was built:
Build JPEG support? [y] y
Build FreeType support? [y] y
Build XPM support? [y] y

If you experience compile problems, please check the @INC, @LIBPATH and @LIBS
arrays defined in Makefile.PL and manually adjust, if necessary.

WARNING: CAPI is not a known parameter.
Checking if your kit is complete...
Looks good
Warning: prerequisite Math::Trig 0 not found.
Writing Makefile for GD

Math::Trig is definitely installed.  Any help would
be appreciated!

David


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

Date: Fri, 08 Nov 2002 02:15:18 GMT
From: Martien Verbruggen <mgjv@tradingpost.com.au>
Subject: Re: GD and libgd
Message-Id: <slrnasm7m4.2kt.mgjv@verbruggen.comdyn.com.au>

On 7 Nov 2002 15:23:44 -0800,
	David Alyea <ironmanda@yahoo.com> wrote:
> I just can't get these straight- the names
> and most current versions are so similar,
> I feel lost.  I've got GD2.01 untarred
> and ready to go, and the README says I need
> libgd 2.0.1 or higher.  On the Boutrell site,
> this libgd appears to be GD2.04, not libgd.
> Where do I find libgd 2.0.1?  I'm all
> googled out.  The reason I need it, by the
> way:

GD is Stein's Perl interface to libgd, which is the library that's
part of Boutell's gd package.

So, either download gd-2.0.4 (boutell) and GD 2.041 (CPAN)
or         download gd-1.8.4           and GD 1.41

Both of these combinations should work.

for the gd versions:
    http://www.boutell.com/gd/
for the GD versions:
    http://www.cpan.org/authors/id/L/LD/LDS/

You should probably only get the older versions if you can't use the
newer ones (compatibility reasons, conflicts with "system" installed
libraries, etc.)

> WARNING: CAPI is not a known parameter.
> Checking if your kit is complete...
> Looks good
> Warning: prerequisite Math::Trig 0 not found.
> Writing Makefile for GD
> 
> Math::Trig is definitely installed.  Any help would
> be appreciated!

Are you sure it is installed correctly, and with the Perl that you're
using to build this package?

Martien
-- 
                        | 
Martien Verbruggen      | 
Trading Post Australia  | Can't say that it is, 'cause it ain't.
                        | 


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

Date: 8 Nov 2002 04:31:17 GMT
From: roberson@ibd.nrc.ca (Walter Roberson)
Subject: Re: How to guarantee process ID stays with web connection
Message-Id: <aqfeml$814$1@canopus.cc.umanitoba.ca>

In article <aqei9s$hpf$1@ins22.netins.net>, Joe Moschak <joe@amrita.net> wrote:
:I'm now looking into Apache::Session.  I thought it was part of mod_perl
:(http://perl.apache.org/dist/mod_perl-1.0-current/apache-modlist.html#module
:s) but even though I have mod_perl 1.26 installed my program keeps balking

:Can't locate Apache/Session/File.pm in @INC (@INC contains:

Install it from CPAN.
--
I predict that you will not trust this prediction.


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

Date: Fri, 8 Nov 2002 02:39:31 +0100
From: peter pilsl <pilsl_use@goldfisch.at>
Subject: internal variable-format and unexpected variable-value 
Message-Id: <3dcb1606$1@e-post.inode.at>


Just ran into a strange phenomena here where a variable suddenly gets an 
unexpected value.

I assign a variable and then I read values in this variable from a shared 
memory-segment.  

----------
my $num=2345.45;
 ...
shmread(..,$num,0,10);   #  $num gets assigned with 10\0\0\0\0\0\0\0\0\0

foreach (0..length($num)) {print ord(substr($num,$_,1)),","}

print "val\t-"   ,$num,"-\n";
print "val+0\t-",$num+0,"-\n";
print "val+1\t-",$num+1,"-\n";
print "val\t-"   ,$num.'',"-\n";
--------

The unexepted output is:
49,48,0,0,0,0,0,0,0,0,0,
val     -10-
val+0   -2345.45-
val+1   -2346.45-
val     -10-

I know what the problem is: I need to remove all the trailing \0 from the 
variable but I dont know what causes this strange effect that $num suddenly 
has the previous value. Obviously this has something to do with internal 
storage of variables, but like the foreach-loop shows $num doesnt have any 
information about this 2345.45-number left in its "visible area".

Maybe someone can try to lighten this darkness to me.

Below is simple programm the recreates the behaviour. It uses IPC::SysV, so 
maybe it doesnt work on each platform. I use perl5.8.0 on linux.

thnx,
peter

ps :I tried to recreate the behaviour by assigning the 10\0\0\0... string 
but it didnt had the same effect.

pps: I also tried to write longer strings ($num1='111111111111111111111') 
and got the same problem and even the s/\0//g doesnt solve it ...

===============================
#!/usr/bin/perl -w

use IPC::SysV qw(ftok IPC_CREAT S_IRWXU IPC_RMID);
use strict;
use constant FID => '/tmp/share_x';   # note that this file must exist !!
use constant RVID => 121;
use constant SIZE => 1000;
$|=1;

my $num=2345.45;
my $num1=10;   # same effect if using 8703.62 here
my $file=FID;
my $id;

die "FID $file does not exist" if not -e $file;

$id=shmget(ftok($file,RVID),SIZE,S_IRWXU | IPC_CREAT) or 
   die "cant create memorysegment: $!\n";
shmwrite($id,$num1,0,10) or die "cant write into memorysegmet: $!\n";
shmread($id,$num,0,10) or die "cant read from memorysegmet: $!\n";
shmctl($id, IPC_RMID, 0) || die "cant delete segment : $!";
foreach (0..length($num)) {print ord(substr($num,$_,1)),","}
  print "\n";
#  $num="10\0\0\0\0\0\0\0\0";
#  $num=~s/\0//g;

print "val\t-"   ,$num,"-\n";
print "val+0\t-" ,$num+0,"-\n";
print "val+1\t-" ,$num+1,"-\n";
print "val\t-"   ,$num.'',"-\n";
===================================


$ perl -V
Summary of my perl5 (revision 5.0 version 8 subversion 0) configuration:
  Platform:
    osname=linux, osvers=2.4.19, archname=i686-linux
    uname='linux limpio.local 2.4.19 #2 fri aug 23 23:07:03 cest 2002 i686 
unknown '
    config_args='-ds -e'
    hint=recommended, useposix=true, d_sigaction=define
    usethreads=undef use5005threads=undef useithreads=undef 
usemultiplicity=undef
    useperlio=define d_sfio=undef uselargefiles=define usesocks=undef
    use64bitint=undef use64bitall=undef uselongdouble=undef
    usemymalloc=n, bincompat5005=undef
  Compiler:
    cc='cc', ccflags ='-fno-strict-aliasing -I/usr/local/include 
-I/opt/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 
-I/usr/include/gdbm',
    optimize='-O2',
    cppflags='-fno-strict-aliasing -I/usr/local/include 
-I/opt/local/include -I/usr/include/gdbm'
    ccversion='', gccversion='2.96 20000731 (Linux-Mandrake 8.0 
2.96-0.48mdk)', gccosandvers=''
    intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12
    ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', 
lseeksize=8
    alignbytes=4, prototype=define
  Linker and Libraries:
    ld='cc', ldflags =' -L/usr/local/lib -L/opt/local/lib'
    libpth=/usr/local/lib /opt/local/lib /lib /usr/lib
    libs=-lnsl -lndbm -lgdbm -ldl -lm -lc -lcrypt -lutil
    perllibs=-lnsl -ldl -lm -lc -lcrypt -lutil
    libc=/lib/libc-2.2.2.so, so=so, useshrplib=false, libperl=libperl.a
    gnulibc_version='2.2.2'
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-rdynamic'
    cccdlflags='-fpic', lddlflags='-shared -L/usr/local/lib 
-L/opt/local/lib'
 
 
Characteristics of this binary (from libperl):
  Compile-time options: USE_LARGE_FILES
  Built under linux
  Compiled at Nov  1 2002 15:37:33
  @INC:
    /usr/local/lib/perl5/5.8.0/i686-linux
    /usr/local/lib/perl5/5.8.0
    /usr/local/lib/perl5/site_perl/5.8.0/i686-linux
    /usr/local/lib/perl5/site_perl/5.8.0
    /usr/local/lib/perl5/site_perl
    .


-- 
peter pilsl
pilsl_@goldfisch.at
http://www.goldfisch.at



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

Date: 7 Nov 2002 17:07:02 -0800
From: rook_5150@yahoo.com (Bryan Castillo)
Subject: Object in @INC returning Tie::Handles from INC method
Message-Id: <1bff1830.0211071707.72c79ec0@posting.google.com>

I've been trying to come up with a way to load perl modules out of zip
files, by appending an object that implements an INC method, onto the
end of @INC.

I can get this to work if the value returned from INC is a symbol
that was opened for a pipe.

my $sym = gensym;
open(*$sym, "unzip -p test.zip TestZip1.pm |");
return $sym;

However, I can't get a tied filehandle to work as a return value
from the INC method.  I was hoping to wrap Archive::Zip's lower level 
reading methods with a Tie::Handle interface.

When I manually create and call INC on the ZipLoader (code below),
then
try to read it, I get debugging messages.  However when the method is
called
from perl as a result of require or use; It seems perl doesn't ever
try
to read the filehandle.

I've been searching through google and cpan for similar
modules/problems,
but haven't found any.  Is it just that tied handles aren't supported 
as return values from callbacks in @INC?



This works:
-------------------------------------------
package ZipLoader2;
use strict;
use warnings;
use File::Basename;
use Symbol;

sub new {
  my $this = shift;
  my $class = ref($this) || $this;
  my $self = {};
  bless $self, $class;
  $self->init(@_);
  return $self;
}

sub init {
  my $self = shift;
  $self->{ZipLoader_files} = [];
}

sub add_zip {
  my $self = shift;
  my $file_path = shift;
  push (@{$self->{ZipLoader_files}}, $file_path);
}

sub ZipLoader2::INC {
  my $self = shift;
  my $file = shift;
  print "Looking for: $file\n";
  foreach my $zip (@{$self->{ZipLoader_files}}) {
    my $command = "unzip -p $zip $file |";
    print $command, "\n";
    my $fh = gensym;
    open(*$fh, $command) || next;
    return $fh;
  }
}

package ZipLoader2::Bootstrap;
use strict;
use warnings;

sub BEGIN {
  my $loader = ZipLoader2->new();
  $loader->add_zip('test.zip');
  push(@INC, $loader);
}

1;
-----------------------------------------------------
#!/usr/bin/perl
use strict;
use warnings;
use ZipLoader2;
use TestZip1;
use TestZip2;
my $loader = $INC[-1];
print $loader, "\n";




This doesn't work - (It shouldn't work currently,
but I should get a printout before reading fails.
There is never any output, only the message taht
the 
Shouldn't the read be attempted on the file handle?)
-----------------------------------------------------
package ZipLoader;
use strict;
use warnings;
use File::Basename;
use Archive::Zip;

sub new {
  my $this = shift;
  my $class = ref($this) || $this;
  my $self = {};
  bless $self, $class;
  $self->init(@_);
  return $self;
}

sub init {
  my $self = shift;
  $self->{ZipLoader_files} = {};
  $self->{ZipLoader_zips}  = [];
}

sub add_zip {
  my $self = shift;
  my $file_path = shift;
  my $file_name = File::Basename::basename($file_path);
  if (exists $self->{ZipLoader_files}{$file_name}) {
    return 1;
  }
  my $zip = Archive::Zip->new(); 
  if ($zip->read($file_path) != &Archive::Zip::AZ_OK) {
    die "error reading $file_name";
  } 
  $self->{ZipLoader_files}{$file_name} = 1;
  push(@{$self->{ZipLoader_zips}}, {
    path => $file_path,
    zip  => $zip 
  });
}

sub ZipLoader::INC {
  my $self = shift;
  my $file = shift;
  print "Looking for: $file\n";
  foreach my $zip (@{$self->{ZipLoader_zips}}) {
    foreach my $member ($zip->{zip}->members()) {
      print "Is it: ", $member->fileName, "\n";
      if ($member->fileName eq $file) {
        my $fh = ZipLoader::MemberHandle->new($member);
	return $fh;
      }
    }
  }
}

package ZipLoader::MemberHandle;
use strict;
use warnings;
use Archive::Zip;
use Tie::Handle;
use Symbol;

@ZipLoader::MemberHandle::ISA = qw/Tie::Handle/;

sub new {
  print "Making a new one\n";
  my $class = shift;
  my $self = gensym();
  return tie *{$self}, $class, $self, @_;
}

sub TIEHANDLE {
  print "lets tie it\n";
  my ($class, $self, $member) = @_;
  bless $self, $class;
  ${*$self}{member} = $member;
  ${*$self}{buffer} = '';
  return $self;
}

sub _debug {
  my @c = caller(1); 
  printf "%s|%d|%s\n", $c[1], $c[2], $c[3];
}

sub ZipLoader::MemberHandle::READ {
  _debug();
  my ($self, $data, $length, $offset) = @_;
}

sub ZipLoader::MemberHandle::READLINE {
  _debug();
  my $self = shift;
}

sub ZipLoader::MemberHandle::GETC {
  _debug();
  my $self = shift;
}

sub CLOSE {
  _debug();
  my $self = shift;
}

sub BINMODE {
  _debug();
  my $self = shift;
}

sub EOF {
  _debug();
  my $self = shift;
  return 0; 
}

sub TELL {
  _debug();
  my $self = shift;
}

sub SEEK {
  _debug();
  my ($self, $offset, $whence) = @_;
}

sub ZipLoader::MemberHandle::OPEN {
  _debug();
}

package ZipLoader::Bootstrap;
use strict;
use warnings;

sub BEGIN {
  my $loader = ZipLoader->new(); 
  $loader->add_zip('test.zip');
  push(@INC, $loader);
}

1;
-----------------------------------------------------
#!/usr/bin/perl
use strict;
use warnings;
use ZipLoader;
use TestZip1;
use TestZip2;
my $loader = $INC[-1];
print $loader, "\n";


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

Date: Fri, 08 Nov 2002 03:10:42 GMT
From: "Frank Foss" <fozzie_beer@hhhotmail.com>
Subject: Oracle Transactions in Perl Script
Message-Id: <SWFy9.929$hK4.73199@bgtnsc05-news.ops.worldnet.att.net>

First: Please bear with me, I'm kinda new to Perl.

Second: I have a small Perl Script to generate test data in an Oracle 9i

Database.

The script roughly does this:

1) Select a list of resources from an existing table

2) Loop thru these, and

    3) Loop thru 1..24 (hours per day), and

        4) Loop thru 1..60 (minutes per hour), and

            5) insert a value in a table

So far, so good.

I am currently strugglin to BEGIN TRANSACTION at point 2, and commit at the
end of that 'resource' loop.

This will insert 24*60 rown in one transaction.

THe actual code is at the end of the post.

How to program the begin transaction?

by using the database handle $dbh or the statement handle $sth.?

Actual syntax? Preparing and executing a "begin transaction" and a "commit"

Insights appreciated

Foz




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

Date: Thu, 07 Nov 2002 23:35:39 GMT
From: tiltonj@erols.com (Jay Tilton)
Subject: Re: Perfecting my Perl
Message-Id: <3dcaf5f0.363488716@news.erols.com>

"Gregory Toomey" <nobody@noplace.com> wrote:

: I'm helping a relative with some word puzzles but the solution I've come up
: with is rather ugly.
: 
: Problem:
: Make as many words as possible with the letters a,a,c,c,e,i,n,t,v; each
: word must contain the letter c.
: 
: My solution:
: Using the English language word list at www.wordlist.sourceforge.net/ ,
: I've come up with the following:
: 
: while(<>) {
:         if (/^[aceintv]*$/ && /c/) {
:                 my %hash;
:                 foreach (split //) {$hash{$_}++};
:                 print "$_" if $hash{v}<=1 &&  $hash{c}<=2 &&
:  $hash{c}>=1 && $hash{i}<=1 && $hash{n}<=1  && $hash{t}<=1 && $hash{e}<=1;
:          }
: }
: 
: Does somebody have a more elegant solution?

Depends entirely on how you want to measure elegance.

Here's one I've had for a while.  It started life as a golfish
one-liner, so clarity takes a shot on the chin.  The basic idea is the
same as yours except the letters aren't hardcoded, and there isn't a
nicely abstract way to glue in the "must contain 'c'" requirement.

    #!perl -p
    sub f{my%w;$w{$_}++for/./g;%w}
    %j=f;for$k(keys%j){$_ x=$j{$k}<=$i{$k}}
    BEGIN{
        die("Usage: $0 [letters] [dictionary file]")unless@ARGV==2;
        $_=shift;%i=f
    }

If you anticipate scrabbling many lettersets in one run, there is
obvious benefit in keeping the word list around in some kind of data
structure; a hash-of-arrays of words that are anagrams of each other
seems a decent choice.  From there it's just hash lookups on letterset
permutations.  Add a simple filtering callback mechanism, whatever
other bells and whistles you want, et voila.

    #!perl
    use warnings;
    use strict;
    print "$_\n"
        for scrabble(
            letters => 'aacceintv',
            filter => sub{$_[0] =~ /c/}
        );

    sub scrabble {
        my %args = @_;
        $args{filter} ||= sub{1};
        my $anagrams = wordlist();
        my @ret;
        for( permute_letters( $args{letters} ) ) {
            next unless $args{filter}->($_);
            push @ret, @{$anagrams->{$_}}
                if defined $anagrams->{$_};
        }
        return @ret;
    }

    sub uniq {
        my %seen;
        @seen{@_} = ();
        return keys %seen;
    }

    sub permute_letters {
        my @elems = sort $_[0] =~ /./g;
        my @perms;
        for my $mask ( 1 .. (1<<@elems) - 1 ) {
            push @perms, join '',
                map $mask & 1<<$_
                    ? $elems[$_]
                    : '',
                0..$#elems;
        }
        return uniq(@perms);
    }

    {
        my $words; # crude memoization of the sub's only return
        sub wordlist {
            unless( defined $words ) {
                print "Reading word list...";
                open WORDS, '<', 'wordlist.txt' or die $!;
                while(<WORDS>) {
                    chomp;
                    my $key = join '', sort /./g;
                    push @{$words->{$key}}, $_;
                }
                close WORDS;
                print "Done.\n";
            }
            return $words;
        }
    }



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

Date: Thu, 07 Nov 2002 23:49:22 GMT
From: "Gregory Toomey" <nobody@noplace.com>
Subject: Re: Perfecting my Perl
Message-Id: <01c286b9$b6339220$d1498a90@gmtoomey>

Thanks - that's lots of useful info. Constructing an anagram dictionary
would be very helpful too.

gtoomey


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

Date: Fri, 8 Nov 2002 02:50:50 +0100
From: peter pilsl <pilsl_use@goldfisch.at>
Subject: Re: script to modify database table as different user
Message-Id: <3dcb18ad$1@e-post.inode.at>

Andrew wrote:

> Hello perl.misc!
> 
> I am using perl 5.6 on a linux machine (2.4.9 kernel).  Could someone
> provide me with the common strategy for doing the following since suid bit
> is not usable in linux unless wrapped in a c program:
> I need to allow certain users to modify a database table in a postgresql
> database through a simple program written in perl.  However the user's
> ability to modify the program must ONLY be through this perl program so
> the
> user can not modify the db table from other areas.  How is this
> restriction generally achieved if the script can not be run by user X as
> user Y where Y
> has the proper database permissions and X does not?  I suppose the script
> itself could change users but how is that safer?
> 
> Thank you for the time and for sharing your knowledge.
> 

Why not use a server-client-solution (via a socket)
The server runs "unreachable" for the user and has all the 
logon-information. The user-script sends its data to this server and the 
server sends it to the sql-database.

This is merely what each webbased CMS does where we dont want to have all 
users to edit all the database but only certain tables or rows/cols.

peter

-- 
peter pilsl
pilsl_@goldfisch.at
http://www.goldfisch.at



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

Date: 08 Nov 2002 00:10:23 +0100
From: Edi Weitz <edi@agharta.de>
Subject: silent stack overflow in regex engine
Message-Id: <87znslx9gg.fsf@bird.agharta.de>

edi@bird:~ > perl -le '$_="x" . ("a" x (2 ** 15 - 1)) . "y"; print (/x(bc|a)*y/ ? "yes" : "no");'
yes
edi@bird:~ > perl -le '$_="x" . ("a" x (2 ** 15)) . "y"; print (/x(bc|a)*y/ ? "yes" : "no");'
no

I've seen this with Perl 5.005, 5.6.0, 5.6.1, and 5.8.0 on various
Linux 2.4.x machines and on FreeBSD 4.5. With Linux 2.2.x and Solaris
5.8 (both Perl 5.6.1) I got core dumps instead. (I think I like the
core dumps a little bit more. At least I'm not getting a wrong
result... :)

Is this a known bug or should I report it somewhere?

Thanks,
Edi.


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

Date: Thu, 07 Nov 2002 19:05:53 -0500
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: silent stack overflow in regex engine
Message-Id: <3DCAFFE1.8C645A7D@earthlink.net>

Edi Weitz wrote:
> 
> edi@bird:~ > perl -le '$_="x" . ("a" x (2 ** 15 - 1)) . "y";
>                        print (/x(bc|a)*y/ ? "yes" : "no");'
> yes
> edi@bird:~ > perl -le '$_="x" . ("a" x (2 ** 15)) . "y";
>                        print (/x(bc|a)*y/ ? "yes" : "no");'
> no
> 
> I've seen this with Perl 5.005, 5.6.0, 5.6.1, and 5.8.0 on various
> Linux 2.4.x machines and on FreeBSD 4.5. With Linux 2.2.x and Solaris
> 5.8 (both Perl 5.6.1) I got core dumps instead. (I think I like the
> core dumps a little bit more. At least I'm not getting a wrong
> result... :)
> 
> Is this a known bug or should I report it somewhere?

I would suggest you report it.  Use the 'perlbug' program.

-- 
my $n = 2; print +(split //, 'e,4c3H r ktulrnsJ2tPaeh'
 ."\n1oa! er")[map $n = ($n * 24 + 30) % 31, (42) x 26]


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

Date: 7 Nov 2002 16:40:55 -0800
From: yf110@vtn1.victoria.tc.ca (Malcolm Dew-Jones)
Subject: Re: Simple question - What is unicode?
Message-Id: <3dcb0817@news.victoria.tc.ca>

pkent (pkent77tea@yahoo.com.tea) wrote:
: In article <aqdld3$ms2$1@nets3.rz.RWTH-Aachen.DE>,
:  "Tassilo v. Parseval" <tassilo.parseval@post.rwth-aachen.de> wrote:

: > Hadn't the Britons decided to use such an odd character for their
: > currency (£), they'd probably get on quite well with plain ascii. ;-)

: That's _nothing_ compared to people using MS Word's smart quotes in XML 
: files, and wondering why XML::Parser dies.

<rant again>

xml doesn't allow the smart quotes because they're in the value range
where, if the eigth bit where removed, then the value would be a control
code.  Allowing these values to be used might, therefore, in some
situations involving old equipment (and probably requiring some
misconfiguration to boot) interfere with somebodies legacy terminal
equipment. 

To ensure that nobody using this equipment could ever be inconvenienced in
this manner, the standards people decided to be slightly incompatible with
the character set used by the vast majority of computer users, who use
(like it or not) microsoft software that uses the microsoft supported
character set that includes (and has included for 15 years or so) these
characters but is otherwise identical to the official standard.

</rant again>

Personally I don't see how this trade off is supposed to make sense.  



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

Date: 7 Nov 2002 20:02:26 -0800
From: aranders@netusa1.net (Alan Anderson)
Subject: Re: Simple question - What is unicode?
Message-Id: <24f07aba.0211072002.264b424a@posting.google.com>

yf110@vtn1.victoria.tc.ca (Malcolm Dew-Jones) wrote

> As for running out of values for all languages, what do you expect when
> the standard wastes the "unicode bandwidth" for languages such as klingon. 
> This is simply an example of the lack of mental disipline as mentioned
> earlier.
> 
> </rant>

Your rant is misplaced.  Klingon was rejected for inclusion in
Unicode.  Mental discipline *was* applied, and the prevailing thought
was that Klingon script was inappropriate.  Not because it's a script
for a constructed language, but because its potential users generally
don't use the script.  (I think that's a chicken-and-egg situation,
myself, but nobody on the Unicode committees asked my opinion.)

Of course, there's still the Private Use Area, and Klingon does have a
consistent place there according to the ConScript Unicode Registry. 
But the PUA was *intended* for such special purposes outside the
Unicode standard.

--
  Alan Anderson, professional programmer and amateur Klingonist
    proud member of the Klingon Language Institute since 1995
qo'mey poSmoH Hol -- language opens worlds -- http://www.kli.org/


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

Date: 8 Nov 2002 04:42:17 GMT
From: roberson@ibd.nrc.ca (Walter Roberson)
Subject: Re: special characters in command-line
Message-Id: <aqffb9$8a1$1@canopus.cc.umanitoba.ca>

In article <62dbf7f1.0211061116.69ff875f@posting.google.com>,
Stuart Kendrick <skendric@fhcrc.org> wrote:
:In fact, I was incorrect. Swatch uses exec.

:    my $sanitized_ = $_;
:    @_ = split;

Hmmm, @_ is the subroutine arguments... kind of a strange thing to
overwrite.

:    # quote all special shell chars
:    $sanitized_ =~ s/([;&\(\)\|\^><\$`'\\])/\\$1/g;

That does miss the file globbing characters ? and * (and ~ as well
if exec_command isn't using Bourne Shell).

:    my @sanitized_ = split(/\s+/, $sanitized_);

:    exec_command('COMMAND' => "/home/skendric/myprog cns $sanitized_",

Notice that it's using $sanitized_ there, after having split
into @sanitized_ . The split seems unnecessary, unless there's a further
transformation that you've omitted for brevity?


:However, I'm not smart enough to figure out why the quoting of special
:characters doesn't accomplish what I'm wanting.
--
   I don't know if there's destiny,
   but there's a decision!                  -- Wim Wenders (WoD)


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

Date: 7 Nov 2002 16:12:03 -0800
From: yanlin_100@yahoo.com (Yan Lin)
Subject: typemap between vector<int> and perl array
Message-Id: <a13fc870.0211071612.563781c1@posting.google.com>

Hi all,
  I am getting very frustrated on lastest version of SWIG. I have no
clue what the typemap should look like for a simple task like mapping
between stl vector<int> and perl array. Someone must have done that,
please me show how define the .i file.

Thanks.


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

Date: Thu, 07 Nov 2002 19:56:32 -0500
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: typemap between vector<int> and perl array
Message-Id: <3DCB0BC0.E317BCBB@earthlink.net>

Yan Lin wrote:
> 
> Hi all,
>   I am getting very frustrated on lastest version of SWIG. I have no
> clue what the typemap should look like for a simple task like mapping
> between stl vector<int> and perl array. Someone must have done that,
> please me show how define the .i file.

It's *possible* that this particular task has been done, but I don't
think so -- odds are, you'll need to read the documentation for
typemaps, and write your own.  How hard can it be?

-- 
my $n = 2; print +(split //, 'e,4c3H r ktulrnsJ2tPaeh'
 ."\n1oa! er")[map $n = ($n * 24 + 30) % 31, (42) x 26]


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

Date: Thu, 07 Nov 2002 22:36:47 -0500
From: Mike Mayer <vm.mayer@comcast.net>
Subject: Re: Why not PERL?
Message-Id: <vm.mayer-9A7AFD.22364707112002@news-east.giganews.com>

In article <9Dxy9.221$Xk3.1849@news.uk.colt.net>,
 "W K" <bill.kemp@wire2.com> wrote:

> Tad McClellan <tadmc@augustmail.com> wrote in message
> news:slrnasl8vp.3a4.tadmc@magna.augustmail.com...
> 
> > The pragmatic reason, regardless of whether it is "right" or "wrong",
> > is that you might be ignored if you use PERL, so use Perl to get
> > the widest possible readership for your articles.
> 
> although some of us are case insensitive.
> 
> 

As opposed to those who are insensitive in this case???

=8-}


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

Date: Fri, 08 Nov 2002 03:45:19 GMT
From: "Bill Smith" <wksmith@optonline.net>
Subject: Re: Why not PERL?
Message-Id: <jrGy9.24665$h4.13213@news4.srv.hcvlny.cv.net>


"David K. Wall" <usenet@dwall.fastmail.fm> wrote in message
news:Xns92BF908246542dkwwashere@216.168.3.30...
> cp <cpryce@pryce.net> wrote on 07 Nov 2002:
>
> > Another reason for the flames is that the answer to your question is
> > found in the FAQs. And people that make the mistake of writing PERL
> > demonstrate that they haven't read those either.
>
> Including some book publishers.
>
> I recently ran across a program that claimed full support for "Pearl's
> regular expressions".  Um... ok....
>
>

and O'REILLY with 'PERL IN A NUTSHELL'

Bill




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

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.  

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 V10 Issue 4083
***************************************


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