[22608] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4829 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Apr 11 03:05:50 2003

Date: Fri, 11 Apr 2003 00:05:08 -0700 (PDT)
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, 11 Apr 2003     Volume: 10 Number: 4829

Today's topics:
        Allowing User to delete image files via HTML page in fl <georgeconklin@NO.SpaM.re.move.this.ALL.comcast.net>
    Re: Allowing User to delete image files via HTML page i (Jay Tilton)
    Re: Allowing User to delete image files via HTML page i <georgeconklin@NO.SpaM.re.move.this.ALL.comcast.net>
        From Perl 5.6 migration to 5.8 problem <kasp@epatra.com>
    Re: hashes as lists <ericw@nospam.ku.edu>
    Re: Help with Win32::Process <kalinabears@hdc.com.au>
        How to standardize variable output length (Mike Grimes)
    Re: How to standardize variable output length <root@hines.welch.com>
    Re: How to standardize variable output length <jurgenex@hotmail.com>
    Re: How to standardize variable output length <josef.moellers@fujitsu-siemens.com>
    Re: list of parameter files based on date input <bwalton@rochester.rr.com>
        memleak in perl 5.8.0 ? <pilsl_usenet@goldfisch.at>
        mod_perl and apache-perl form debian? <mt-news@gmx.net>
        no backtick output on client-side perlscript under w2k <fixerdave@hot-nospam-mail.com>
    Re: pack, unpack and 'w' <goldbb2@earthlink.net>
    Re: pack, unpack and 'w' <mbear@uq.net.au>
    Re: Perl DBD::DB2 and security? (Jacinle Young)
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Fri, 11 Apr 2003 01:44:10 -0400
From: "George" <georgeconklin@NO.SpaM.re.move.this.ALL.comcast.net>
Subject: Allowing User to delete image files via HTML page in flat text database
Message-Id: <uAadnVFG7efHyAujXTWcpg@comcast.com>

I have inherited a custom-written Perl flat text database script allowing a
web site owner to enter new properties for sale complete with description
and a picture. Now the web site owner wants to be able to delete pictures
for properties that are sold. I am not a Perl Master - but have a
programming background from years ago.

1) Is there a way within Perl or CGI methods to select and delete a file?
2) If not is there an easy way to implement the same thing in ASP?

Thanks,
George Conklin
geocon007 AT yahoo DOT com




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

Date: Fri, 11 Apr 2003 06:14:23 GMT
From: tiltonj@erols.com (Jay Tilton)
Subject: Re: Allowing User to delete image files via HTML page in flat text database
Message-Id: <3e965c45.131782123@news.erols.com>

"George" <georgeconklin@NO.SpaM.re.move.this.ALL.comcast.net> wrote:

: 1) Is there a way within Perl or CGI methods to select and delete a file?

Files may be deleted with Perl's unlink() command.



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

Date: Fri, 11 Apr 2003 02:33:18 -0400
From: "George" <georgeconklin@NO.SpaM.re.move.this.ALL.comcast.net>
Subject: Re: Allowing User to delete image files via HTML page in flat text database
Message-Id: <H_Ocnb1t_L9A_QujXTWcpw@comcast.com>

Jay,

Thanks very much, I will try it out. I just realized the server is a Windows
NT or Windows2000 server and came back to post that -fast response, Jay!

Will unlink() work on the Windows web servers?


Something like this?

the_file = (filename passed from form)
unlink(the_file)


-george

=========================

"Jay Tilton" <tiltonj@erols.com> wrote in message
news:3e965c45.131782123@news.erols.com...
> "George" <georgeconklin@NO.SpaM.re.move.this.ALL.comcast.net> wrote:
>
> : 1) Is there a way within Perl or CGI methods to select and delete a
file?
>
> Files may be deleted with Perl's unlink() command.
>




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

Date: Fri, 11 Apr 2003 11:35:36 +0530
From: "Kasp" <kasp@epatra.com>
Subject: From Perl 5.6 migration to 5.8 problem
Message-Id: <b75ofe$vtp$1@newsreader.mailgate.org>

Hi,

I am facing a peculiar problem. Wonder if anyone out here has faced
something similar and has a solution.

I can compile and run a piece of code (on Windows 2000) written in C++ that
uses Perl libraries (Perl56.lib + PerlEz.lib). Now that I want it to run
with Perl 5.8, I simply tried to replace these files with those from version
Perl5.8. But now it does not link. The error I get is:

"PerlInterp.obj : error LNK2001: unresolved external symbol _Perl_sv_2pv
 ../bin/debug/Scrubber.exe : fatal error LNK1120: 1 unresolved externals"

I have both 5.8 and 5.6 installed on my machine...and in the PATH it shows
5.8 before 5.6. So, it's not picking the DLLs from Perl 5.6 directory (I
even renamed Perl 5.6 Home directory just to be sure).

TIA,
Kasp.
--
Perl is designed to give you several ways to do anything, so
consider picking the most readable one.
             -- Larry Wall




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

Date: Fri, 11 Apr 2003 01:18:22 GMT
From: Eric Wilhelm <ericw@nospam.ku.edu>
Subject: Re: hashes as lists
Message-Id: <pan.2003.04.10.20.15.56.343013.23897@nospam.ku.edu>

On Thu, 10 Apr 2003 13:20:19 -0500, Sara wrote:

> Eric Wilhelm <ericw@nospam.ku.edu> wrote in message
> news:<pan.2003.04.10.07.52.06.315922.23897@nospam.ku.edu>...
>> Perl never ceases to amaze me.
>> 
>> %a = (%b, %c);
> Along the same lines, something I picked up in like my 5th re-read of
> Camel:
> 
>   %h = reverse %h
> 
> makes the keys of %h the values and visa versa..
Ah, yes.  Page 776.  I have not finished the first read (after using it
for about 10 months, but I hang out in the Index a LOT (just noticed the
hashes...inverting entry while trying to find this trick).  

Note to Larry: Kudos for the index.

--Eric


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

Date: Fri, 11 Apr 2003 11:54:12 +1000
From: "Sisyphus" <kalinabears@hdc.com.au>
Subject: Re: Help with Win32::Process
Message-Id: <3e962133$0$30088@echo-01.iinet.net.au>


"George Bouras" <novastar@dtdns.net.nospam> wrote in message
news:1049962175.923241@athprx02...
> # The following should start Windows notepad.exe program at
> # background ( hidden - no window ) but it keeps poping up!
> # What I am doing wrong with that , please help (Win2K).
>
> use Win32::Process;
> my $prc=Win32::Process;
> $prc->Create(
> "$ENV{SystemRoot}\\Notepad.exe",
> 'Notepad win.ini',
> 0,
> CREATE_NO_WINDOW,
> $ENV{SystemRoot},
> ) || die "$^E\n";
>
>

Try 'CREATE_SUSPENDED' instead of 'CREATE_NO_WINDOW'.

It then shows up in Task Manager under Processes, but that's the only
indication it's running.

Cheers,
Rob




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

Date: 10 Apr 2003 17:21:28 -0700
From: michael.e.grimes@fritolay.com (Mike Grimes)
Subject: How to standardize variable output length
Message-Id: <96b99672.0304101621.45f41121@posting.google.com>

Hello all,

I am working on a project where I need to dynamically create variables
with a set length of 80 bytes where the unused white space is filled
in by a ".".

For example:
A loop that splits fields from an input line. The first field contains
text of varying lengths but I want to standardize the variable output
length to 80 bytes. Like:

Print $field1;
output from field1....................................

Appreciate any comments,
Mike


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

Date: Thu, 10 Apr 2003 19:30:38 -0500
From: welchad <root@hines.welch.com>
Subject: Re: How to standardize variable output length
Message-Id: <uDydnV52nb8zkQujXTWcpQ@comcast.com>

Mike Grimes <michael.e.grimes@fritolay.com> wrote:
> Hello all,

> I am working on a project where I need to dynamically create variables
> with a set length of 80 bytes where the unused white space is filled
> in by a ".".

> For example:
> A loop that splits fields from an input line. The first field contains
> text of varying lengths but I want to standardize the variable output
> length to 80 bytes. Like:

> Print $field1;
> output from field1....................................

> Appreciate any comments,
> Mike

You could just use printf, I suppose.  That be fairly painless.


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

Date: Fri, 11 Apr 2003 00:35:40 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: How to standardize variable output length
Message-Id: <w5ola.52935$aQ3.20845@nwrddc02.gnilink.net>

Mike Grimes wrote:
> I am working on a project where I need to dynamically create variables
> with a set length of 80 bytes where the unused white space is filled
> in by a ".".
>
> For example:
> A loop that splits fields from an input line. The first field contains
> text of varying lengths but I want to standardize the variable output
> length to 80 bytes. Like:
>
> Print $field1;
> output from field1....................................

I'm sure there is a better method but some ideas

while (length $field1 < 80) {
    $field1 .= '.'; }

$field1 .= '.' x (80 - length $field1);

Maybe there is some trickery for printf which allows padding with dots
instead of with blanks.

And of course you can always consult TFM: "perldoc -q pad"

jue




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

Date: Fri, 11 Apr 2003 08:36:16 +0200
From: Josef =?iso-8859-1?Q?M=F6llers?= <josef.moellers@fujitsu-siemens.com>
Subject: Re: How to standardize variable output length
Message-Id: <3E966260.22DF6064@fujitsu-siemens.com>

"J=FCrgen Exner" wrote:
> =

> Mike Grimes wrote:
> > I am working on a project where I need to dynamically create variable=
s
> > with a set length of 80 bytes where the unused white space is filled
> > in by a ".".
> >
> > For example:
> > A loop that splits fields from an input line. The first field contain=
s
> > text of varying lengths but I want to standardize the variable output=

> > length to 80 bytes. Like:
> >
> > Print $field1;
> > output from field1....................................
> =

> I'm sure there is a better method but some ideas
> =

> while (length $field1 < 80) {
>     $field1 .=3D '.'; }
> =

> $field1 .=3D '.' x (80 - length $field1);
> =

> Maybe there is some trickery for printf which allows padding with dots
> instead of with blanks.
> =

> And of course you can always consult TFM: "perldoc -q pad"

TMTOWTDI, I use

	$field1 .=3D '.' x 80;
	$field1 =3D substr($field1, 0, 80);

But your solution looks neater.

-- =

Josef M=F6llers (Pinguinpfleger bei FSC)
	If failure had no penalty success would not be a prize
						-- T.  Pratchett


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

Date: Fri, 11 Apr 2003 01:27:59 GMT
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: list of parameter files based on date input
Message-Id: <3E9619FC.9020904@rochester.rr.com>

robw@linkline.com wrote:

>  I am trying to build a list of parameter files based on date input.  How
> hard is it to do?  I am learning it right now.  Can you give me some tips on
> what I should do?
> 
> Here are my output parameter files:
> list of file names contents of the files
> account.parameter.txt [s_Account]
> 
> $$BEGIN_TXN_DATE=04/08/2003
> 
> $$END_TXN_DATE=04/09/2003
> service.parameter.txt [s_Service]
> 
> $$BEGIN_TXN_DATE=04/08/2003
> 
> $$END_TXN_DATE=04/09/2003
> partner.parameter.txt [s_Partner]
> 
> $$BEGIN_TXN_DATE=04/08/2003
> 
> $$END_TXN_DATE=04/09/2003
> 
> The date input should be incremented by one day on the files when the script
> is run.  Let say if I run the script again for account.parameter.txt file,
> the $$BEGIN_TXN_DATE should be 04/09/2003 and $$END_TXN_DATE should be
> 04/10/2003.
> 
> Can someone tell me what would be the easiest way to build this Perl script?
> Here are my thoughts.  One way is to have parameter files for Session name
> ([s_Account]), begin date  and end date. Then, build the files based on the
> parameter files.  The other way is to read the list of the file names then
> search everything after the '=' then increment the date with a Perl date
> function.  Does this sound crazy?
 ...

> R-
 ...


You want to increment all the dates in the file by one day, right?  Try:


use Date::Manip;
$ENV{TZ}='EDT'; #if needed on your OS; use any time zone code
while(<>){
  s#=(\d{2}/\d{2}/\d{4})#UnixDate(DateCalc($1,'+1 day'),'=%m/%d/%Y')#e;
  print;
} 
	

-- 
Bob Walton



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

Date: Fri, 11 Apr 2003 00:11:55 +0200
From: peter pilsl <pilsl_usenet@goldfisch.at>
Subject: memleak in perl 5.8.0 ?
Message-Id: <3e95ec39@e-post.inode.at>


After a long day I hunted down a problem in one of my scripts and I'd like 
to ask you if this is possibly a memleak in perl 5.8.0.

An object  holds an anomyous sub which uses another anonymous sub inside 
the same structure. 
After undefing the object its structure seems not to be garbage-collected 
and the mem is not released.
 If ->{s} is just a normal sub, the problem vanishes.  Also explicitely 
undefing ->{s} before undefing the whole object helps.

There was a similar problem in perl 5.6.0 that was fixed in 5.6.1. There 
problem then was if anonymous subs where defined inside eval-statements. 
(search at google-groups for "mem perl eval pilsl")


#!/usr/bin/perl -w

--------------mem.pl--------------
use strict;

package test;

sub new{
  my $class=shift;
  my $s={};
  bless($s,$class);

  $s->{bigarray}=[];
  $#{$s->{bigarray}}=5000000;

  $s->{s}=sub{return &{$s->{private}->{subsub}}();};
#  $s->{s}=sub{return 4};

  return $s;
}

package main;

my $s=test->new();
print `ps waux | grep mem.pl | grep -v grep | grep -v emacs`;
undef $s;
print `ps waux | grep mem.pl | grep -v grep | grep -v emacs`;
-------------------------------------------


my perl:

$ 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_usenet@goldfisch.at
http://www.goldfisch.at



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

Date: Fri, 11 Apr 2003 01:37:48 +0200
From: "matthias tarasiewicz" <mt-news@gmx.net>
Subject: mod_perl and apache-perl form debian?
Message-Id: <pan.2003.04.10.23.37.48.15843@gmx.net>

how is the apache-perl package from debian/woody compared to a mod_perl
compiled by hand or even on an apache 2?
i am running some sites on apache 1.3.27 and apache-perl from debian,
i am asking myself if there would be more performance, as i am coming into
performance problems (too much users)

thanks,
matthias


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

Date: Thu, 10 Apr 2003 22:16:41 -0700
From: "fixerdave" <fixerdave@hot-nospam-mail.com>
Subject: no backtick output on client-side perlscript under w2k
Message-Id: <3e964fcf$1@obsidian.gov.bc.ca>

I know, this is not a Perl question - but I'm asking here on the hopes that
someone will either A) have the answer, or B) know a better place to ask,
because I can't think of one.

I'm trying to get output from backticks while running a client-side
perlscript in IE under W2k.  I know it's not perl because it works fine as
an app run from the command prompt.  It also works fine as a perlscript in
IE under NT.

(testing on v5.6.1 build 635 provided by ActiveState Corp)

As a simple example:
    @x=`getmac`;         # getmac = a simple exe, same results for `dir`
etc..
works fine in test.pl on NT or W2k

if I wrap it in a client-side HTML perlscript as: (much trimed for brevity)
    <SCRIPT language="PerlScript">
        @x=`getmac`;
    </script>
Within IE on NT, it's fine, but on W2k, @x is empty.

Note that redirecting the command output (ie. `getmac >c:\\output.txt`)
works fine.  So, the command is running, I'm just not getting the results
back into perl.  I've also tried @x=qx{getmac}; with the same results.

Where do I go from here?  Anyone have any suggestions about what could be
going on?  Is there some specific bit of documentation I need to read?  Any
pointers on where I should look next?  I'm stuck! help...

David...




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

Date: Thu, 10 Apr 2003 22:29:46 -0400
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: pack, unpack and 'w'
Message-Id: <3E96289A.9E39B7E3@earthlink.net>



Matthew Braid wrote:
> 
> <snip>
> 
> > What program is giving you, in @ARGV, an ip6 address as an *integer*,
> > instead of as a colon seperated string of pairs of hex digits?
> 
> Er, none. That was a test. Hence the term 'test script'. I'm _storing_
> the ipv6 address as a packed integer string since the storage system is
> for both ipv6 and ipv4 (and range checkes, ie 'is this ip somewhere in
> between two other ips?' are a lot easier with integers).

The most sensible non-packed format for ipv4 addresses is d.d.d.d, where
each 'd' is one to three decimal digits, with leading zeros removed,
since this is fairly standard.  One would pack it as a 4-byte string,
using:
   $packed = inet_aton($dotted_decimal); # from Socket.pm
, and do comparisons using lt, le, eq, ge, gt, ne.  The most sensible
non-packed format for ipv6 addresses is h:h:h:h:h:h:h:h, where each h is
one to 4 hex digits, with leading zeros removed, since this is fairly
standard.  One would pack it to a 16 byte string, using something like:
Or:
   $packed = inet_aton6($coloned_hex); # from Socket6.pm
, and do comparisons using lt, le, eq, ge, gt, ne.

I can't imagine why one would try and deal with either of these things
as numbers.

PS: I use inet_aton and inet_aton6, instead of pack(), since there are
so many valid but irregular addresses.

> Obviously another part of the full program would convert the ip4/ip6
> address to an integer string (hooray for Math::BigInt).
> 
> I'm not just storing addresses either - they're address ranges. That's
> why I need to do <, > and = checking (or in the case of a packed
> integer string, strcmp).

You can't use <, >, and == in C to do comparisons on ipv6 addresses,
unless you have 128 bit integers.

Also, numbers packed with "w" don't always coalate properly.  For
example, pack('w', 17000) cmp pack('w', 1000) produces -1.

And if you've packed to fixed length (4 or 16 byte) strings, then the
data may contain '\0's -- you need to use memcmp, not strcmp.

> An IPv4 address packs to a maximum of 4 bytes so I'm not sacrificing
> space for them (in fact, I'm gaining some amortised space), and an IPv6
> address packs to a maximum of 16 bytes, so with packed integer string I
> can store either in a single VARCHAR(16) database column.

Only if you pack to a fixed length string -- which "w" doesn't do.

> What I _really_ need to know is whether using packed strings causes any
> serious problems for other languages to decode.

If you store packed strings of fixed length (either 4 or 16 bytes), then
there are no problems with having other languages deal with them.  If
you try and use pack("w",...), then yes, you are going to have problems.

> Anyone?
> 
> MB
> 
> BTW - It's a colon seperated string of _quads_ of hex digits, eg
> FEDC:BA98:7654:3210:FEDC:BA98:7654:3210 (not including 0-compressed
> strings, embedded IPv4 addresses etc)

Yes, thanks.  Fortunatly, inet_aton6 *should* pack any of those fine.
I haven't tested that feature, but if it doesn't, bug the author.

-- 
$a=24;split//,240513;s/\B/ => /for@@=qw(ac ab bc ba cb ca
);{push(@b,$a),($a-=6)^=1 for 2..$a/6x--$|;print "$@[$a%6
]\n";((6<=($a-=6))?$a+=$_[$a%6]-$a%6:($a=pop @b))&&redo;}


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

Date: Fri, 11 Apr 2003 13:50:09 +1000
From: Matthew Braid <mbear@uq.net.au>
Subject: Re: pack, unpack and 'w'
Message-Id: <b75e1i$uao$1@bunyip.cc.uq.edu.au>

> The most sensible non-packed format for ipv4 addresses is d.d.d.d, where
> each 'd' is one to three decimal digits, with leading zeros removed,
> since this is fairly standard.  One would pack it as a 4-byte string,
> using:
>    $packed = inet_aton($dotted_decimal); # from Socket.pm
> , and do comparisons using lt, le, eq, ge, gt, ne.  The most sensible
> non-packed format for ipv6 addresses is h:h:h:h:h:h:h:h, where each h is
> one to 4 hex digits, with leading zeros removed, since this is fairly
> standard.  One would pack it to a 16 byte string, using something like:
> Or:
>    $packed = inet_aton6($coloned_hex); # from Socket6.pm
> , and do comparisons using lt, le, eq, ge, gt, ne.
> 
> I can't imagine why one would try and deal with either of these things
> as numbers.

I'll be storing possibly millions of addresses - and they won't be 
unique as they are attributes of a larger object. I need to minimise 
storage as much as possible. pack('w'..) not only shrinks the addresses 
to binary instead of strings, it also only takes up the minimum number 
of bytes required to store it.

> PS: I use inet_aton and inet_aton6, instead of pack(), since there are
> so many valid but irregular addresses.

I'll be using those functions to normalise the input and then pack for 
storage.

> You can't use <, >, and == in C to do comparisons on ipv6 addresses,
> unless you have 128 bit integers.

Yeah, I know - that's where my problem arose - 128bit integers are a 
little too big :) That's solved with numbers as strings (as long as 
they're not zero-padded/have signs of course)

> Also, numbers packed with "w" don't always coalate properly.  For
> example, pack('w', 17000) cmp pack('w', 1000) produces -1.

Damn. There's a big problem. Sort of rules out w now...

> And if you've packed to fixed length (4 or 16 byte) strings, then the
> data may contain '\0's -- you need to use memcmp, not strcmp.

As long as there's a way to do it I don't mind. I use C about as often 
as I fly to the moon anyway.

>>An IPv4 address packs to a maximum of 4 bytes so I'm not sacrificing
>>space for them (in fact, I'm gaining some amortised space), and an IPv6
>>address packs to a maximum of 16 bytes, so with packed integer string I
>>can store either in a single VARCHAR(16) database column.
> 
> 
> Only if you pack to a fixed length string -- which "w" doesn't do.

? VARCHAR(16) means I can store strings _up to_ 16 characters long. If I 
chuck a 4 character string in there I use 5 bytes - 4 for the data, 1 
for the length. But that's all moot now anyway - I was kind of depending 
on string comparisons to work. I'll need fixed length for that... hmmm.

# Assuming the address ($ip) is currently a string that contains a
# hex integer, 0 padded and 32 bytes in length
my $pip;
for my $i (0..3) {
	$pip .= pack('L', substr($ip, 0, 8, ''));
}
# ...?

I lose the compression, but at least (for ip6 at least) its as small as 
it can go while still being testable.... If I treat IPv4 differently (ie 
just a single 'L' pack) and structure my queries intelligently then 
maybe things will still work.

> If you store packed strings of fixed length (either 4 or 16 bytes), then
> there are no problems with having other languages deal with them.  If
> you try and use pack("w",...), then yes, you are going to have problems.

Sigh. Oh well. 16/4 bytes it is.

MB



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

Date: 10 Apr 2003 18:33:03 -0700
From: jacinle_young@hongkong.com (Jacinle Young)
Subject: Re: Perl DBD::DB2 and security?
Message-Id: <12ac9d4d.0304101733.7320bb5c@posting.google.com>

Hemant,

Did you find a way to solve it? I met the same problem with you too.

Jacinle

Hemant Shah <shah@typhoon.xnet.com> wrote in message news:<b5soai$of0$1@flood.xnet.com>...
> Folks,
> 
>   While accessing DB2 database from perl, I have to connect to the
>   database using DBI->connect( "dbi:DB2:dbname", "user", "password");
> 
>   The password is in plain ASCII text. Any one who can read the perl
>   script will be able to know the password of the user. I am concerned,
>   because the perl script will be running on the web server and access
>   the database on remote Linux system. If someone breaks into the web server
>   he/she can get the username and password from the perl script and try to
>   access/update the database.
> 
>   Is there another way to connect to the database without using password 
>   in plain text? 
> 
>   Thanks.
> 
> -- 
> Hemant Shah                           /"\  ASCII ribbon campaign
> E-mail: NoJunkMailshah@xnet.com       \ /  --------------------- 
>                                        X     against HTML mail
> TO REPLY, REMOVE NoJunkMail           / \      and postings      
> FROM MY E-MAIL ADDRESS.           
> -----------------[DO NOT SEND UNSOLICITED BULK E-MAIL]------------------
> I haven't lost my mind,                Above opinions are mine only.
> it's backed up on tape somewhere.      Others can have their own.


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

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 4829
***************************************


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