[24517] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 6697 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Jun 16 11:05:44 2004

Date: Wed, 16 Jun 2004 08:05:06 -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           Wed, 16 Jun 2004     Volume: 10 Number: 6697

Today's topics:
        Crypt::OpenPGP problem (Gilian)
    Re: Crypt::OpenPGP problem <kalinaubears@iinet.net.au>
    Re: dates... <Joe.Smith@inwap.com>
    Re: enlarge Variablenames <gnari@simnet.is>
    Re: enlarge Variablenames <Joe.Smith@inwap.com>
    Re: filehandles <bmb@ginger.libs.uga.edu>
    Re: How to compress on unix? <me@privacy.net>
    Re: How to compress on unix? <fatted@spymac.com>
    Re: How to compress on unix? <me@privacy.net>
        How to convert MS Word document to text file? (Goh, Yong Kwang)
    Re: How to convert MS Word document to text file? <postmaster@castleamber.com>
    Re: How to convert MS Word document to text file? <Petri_member@newsguy.com>
    Re: How to convert MS Word document to text file? <flavell@ph.gla.ac.uk>
    Re: How to convert MS Word document to text file? <ceo@nospan.on.net>
        LWP::Parallel is not giving me the accesstime for each  (Leif Wessman)
    Re: parsing a text file <josef.moellers@fujitsu-siemens.com>
    Re: parsing a text file <ittyspam@yahoo.com>
    Re: Perl cgi on Windows 2003 Server fails (Hallvard ?strem)
        Port forwarding utility in perl (Debashish Mishra)
    Re: Port forwarding utility in perl <uri@stemsystems.com>
    Re: SQL Injection and DBI placeholders <vetro@online.no>
    Re: SQL Injection and DBI placeholders <gnari@simnet.is>
    Re: SQL Injection and DBI placeholders <vetro@online.no>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: 16 Jun 2004 01:21:33 -0700
From: linux@colsen.org (Gilian)
Subject: Crypt::OpenPGP problem
Message-Id: <f325939e.0406160021.1226ac26@posting.google.com>

Hello,

I hope somebody can help me with this problem.

I have a perl-script that creates file, that need to be encrypted.
I use the Crypt::OpenPGP module to make the encryption done. The only
thing I want to do is 'conventional encryption', which means I don't
want to use keys, but I want to encrypt it with a password.

The script looks like this:
#!/usr/bin/perl

use Crypt::OpenPGP;

my $pgp = Crypt::OpenPGP->new();

$file = 'file.txt';
$phrase = 'test123456';

$encrypted = $pgp->encrypt(
        Compat     => 'PGP5',             # <== in PGP2 it works fine!
        Filename   => $file,
        Passphrase => $phrase,
) or die "can not encrypt ",$pgp->errstr;

print "$encrypted\n"; 

open (OUTFILE, "> $file.pgp");
print OUTFILE "$encrypted";
close (OUTFILE);


When I do this with the encryption in PGP2 there is no proble, when I
try to encrypt in PGP5 I get the following response:
Can't call method "keysize" on an undefined value at
/usr/lib/perl5/site_perl/5.8.3/Crypt/OpenPGP.pm line 525.

Can somebody tell me what the problem is, or rather give me a solution
to the problem.

Thanks in advance.

Regards,
Gilian.


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

Date: Wed, 16 Jun 2004 21:02:09 +1000
From: Sisyphus <kalinaubears@iinet.net.au>
Subject: Re: Crypt::OpenPGP problem
Message-Id: <40d029e3$0$28947$5a62ac22@per-qv1-newsreader-01.iinet.net.au>

Gilian wrote:
> Hello,
> 
> I hope somebody can help me with this problem.
> 
> I have a perl-script that creates file, that need to be encrypted.
> I use the Crypt::OpenPGP module to make the encryption done. The only
> thing I want to do is 'conventional encryption', which means I don't
> want to use keys, but I want to encrypt it with a password.
> 
> The script looks like this:
> #!/usr/bin/perl
> 
> use Crypt::OpenPGP;
> 
> my $pgp = Crypt::OpenPGP->new();
> 
> $file = 'file.txt';
> $phrase = 'test123456';
> 
> $encrypted = $pgp->encrypt(
>         Compat     => 'PGP5',             # <== in PGP2 it works fine!
>         Filename   => $file,
>         Passphrase => $phrase,
> ) or die "can not encrypt ",$pgp->errstr;
> 
> print "$encrypted\n"; 
> 
> open (OUTFILE, "> $file.pgp");
> print OUTFILE "$encrypted";
> close (OUTFILE);
> 
> 
> When I do this with the encryption in PGP2 there is no proble, when I
> try to encrypt in PGP5 I get the following response:
> Can't call method "keysize" on an undefined value at
> /usr/lib/perl5/site_perl/5.8.3/Crypt/OpenPGP.pm line 525.
> 
> Can somebody tell me what the problem is, or rather give me a solution
> to the problem.
> 

The script you supplied works fine for me on Linux (Mandrake-9.1), perl 
5.8.3. I'm using version 1.03 of Crypt-OpenPGP, which is the latest 
available on CPAN. If you're using an older version then you probably 
need only to update.

Otherwise, 'use warnings;' at the start of your script. That may provide 
some useful output.

Also you should check that the 'open' and 'close' calls succeeded 
(though that has nothing to do with the problem you are experiencing).

Cheers,
Rob

-- 
To reply by email u have to take out the u in kalinaubears.



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

Date: Wed, 16 Jun 2004 10:09:19 GMT
From: Joe Smith <Joe.Smith@inwap.com>
Subject: Re: dates...
Message-Id: <j%Uzc.58161$HG.27961@attbi_s53>

Sergei Shelukhin wrote:

> my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) =
> localtime($startdate);
> 24 > 33 > 21 > 31 > 11 > 69 > 3 > 364 > 0

The argument to localtime() is expected to be a positive integer.

print scalar localtime(0);         # "Wed Dec 31 16:00:00 1969" for US/Pacific
print scalar localtime(1087379540);# "Wed Jun 16 02:52:20 2004" PDT
print scalar localtime(2004);      # "Wed Dec 31 16:33:24 1969" for PST
print scalar localtime("2004-06-16 02:52:20"); # same as localtime(2004)

It appears that your timezone is 5 hours east of US/Pacific and that you gave
localtime() a string that had "2004" before the first non-digit character.
	-Joe


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

Date: Wed, 16 Jun 2004 08:07:31 -0000
From: "gnari" <gnari@simnet.is>
Subject: Re: enlarge Variablenames
Message-Id: <caov0f$54b$1@news.simnet.is>

"Andrew DeFaria" <Andrew@DeFaria.com> wrote in message
news:746e9$40cf68b4$c09cfc9$28691@msgid.meganewsservers.com...
>
> "Jürgen Exner" <jurgenex@hotmail.com> wrote in message
> news:4gDzc.46771$TR1.20338@nwrddc01.gnilink.net...
> > [Please do not top-post]
> > [Please trim the quoted text to a reasonble amout that is needed for
> > context]
>
> Also, aren't these top posts? ;-)

not really. these were general comments that did not depend on any
quoted text. Jürgen could have stopped there but decided to
also reply to the top-poster, and did that properly quoted, of
course

gnari






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

Date: Wed, 16 Jun 2004 10:15:22 GMT
From: Joe Smith <Joe.Smith@inwap.com>
Subject: Re: enlarge Variablenames
Message-Id: <_4Vzc.58174$HG.20277@attbi_s53>

Ugur Boss wrote:

> my Problem ist following:
> 
>     $nr1 = 1;
>     $nr2 = 2;
> 
>     $name.$nr = "Hello";

   my %name;	# Use a hash
   $name{666} = "Number of the beast";
   $name{foo} = "bar";
   $name{$nr1} = "one";
   $name{$nr2} = "two";


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

Date: Wed, 16 Jun 2004 09:46:37 -0400
From: Brad Baxter <bmb@ginger.libs.uga.edu>
Subject: Re: filehandles
Message-Id: <Pine.A41.4.58.0406160944260.38228@ginger.libs.uga.edu>

On Tue, 16 Jun 2004, Sam Holden wrote:

> On Tue, 15 Jun 2004 22:10:22 -0400, Brad Baxter <bmb@ginger.libs.uga.edu> wrote:
> >
> > Sorry, but param() doesn't return open filehandles.  I guess you just need
> > to open them yourself.
>
> Yes it does. I guess you need to read the documentation.
>
> Of course using upload() instead of param() is a far wiser choice.

Sunny beaches.  I stand corrected--just never used that feature, and
didn't recall reading about it.  Thanks.

Brad


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

Date: Wed, 16 Jun 2004 19:55:08 +1200
From: "Tintin" <me@privacy.net>
Subject: Re: How to compress on unix?
Message-Id: <2jacm1Funl8qU1@uni-berlin.de>


"zeke" <mfzarno@nsa.gov> wrote in message
news:e1810acf.0406150554.cecb944@posting.google.com...
> Running ActivePerl on Windows2000PRO.  Need perl script to 'tell'
> connected unix workstation to compress specified files on the unix
> drive.  Not compressing/zipping on Windows platform.  Must use unix
> command "compress".  Any assist/direction/samples appreciated!

Why use compress?  Better to use gzip or zip.




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

Date: Wed, 16 Jun 2004 11:38:13 +0200
From: Fatted <fatted@spymac.com>
Subject: Re: How to compress on unix?
Message-Id: <2jaiesFver1sU1@uni-berlin.de>

Tintin wrote:
> "zeke" <mfzarno@nsa.gov> wrote in message
> news:e1810acf.0406150554.cecb944@posting.google.com...
> 
>>Running ActivePerl on Windows2000PRO.  Need perl script to 'tell'
>>connected unix workstation to compress specified files on the unix
>>drive.  Not compressing/zipping on Windows platform.  Must use unix
>>command "compress".  Any assist/direction/samples appreciated!
> 
> 
> Why use compress?  Better to use gzip or zip.
> 

I think the clue was in the line `Must use unix command "compress"`.


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

Date: Thu, 17 Jun 2004 00:15:46 +1200
From: "Tintin" <me@privacy.net>
Subject: Re: How to compress on unix?
Message-Id: <2jas30Fv3o2nU1@uni-berlin.de>


"Fatted" <fatted@spymac.com> wrote in message
news:2jaiesFver1sU1@uni-berlin.de...
> Tintin wrote:
> > "zeke" <mfzarno@nsa.gov> wrote in message
> > news:e1810acf.0406150554.cecb944@posting.google.com...
> >
> >>Running ActivePerl on Windows2000PRO.  Need perl script to 'tell'
> >>connected unix workstation to compress specified files on the unix
> >>drive.  Not compressing/zipping on Windows platform.  Must use unix
> >>command "compress".  Any assist/direction/samples appreciated!
> >
> >
> > Why use compress?  Better to use gzip or zip.
> >
>
> I think the clue was in the line `Must use unix command "compress"`.

Quite often "must" means "this is the only way I know how".




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

Date: 16 Jun 2004 02:43:20 -0700
From: gohyongkwang@hotmail.com (Goh, Yong Kwang)
Subject: How to convert MS Word document to text file?
Message-Id: <354933d6.0406160143.539e3a4a@posting.google.com>

Hi.

I'm trying to write a Perl program that can given a Microsoft Word
document file convert it into a text file, which can then be formatted
into a HTML file. So in essence it's like extracting the information
and repackaging them for the Web.

I don't use the "Save As Web Page" command from Word directly as I've
a whole bunch of Word documents to convert, doing one-by-one is slow
and laborious. And the formatting does not match the Web template I've
done.

So I'm thinking of using Win32::OLE package to create a Microsoft Word
Document OLE object and then calling its SaveAs method to export a MS
Word document to a text file.

However, to reduce the overhead of having to create a Microsoft Word
Document OLE object and then calling its SaveAs method to export a MS
Word document to a text file, I have been wondering if there is a Perl
module somewhere that does this conversion directly w/o having to call
up Microsoft Word and using OLE.

Thanks.

Regards,
Goh, Yong-Kwang
gohyongkwang@hotmail.com
Singapore


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

Date: Wed, 16 Jun 2004 05:05:19 -0500
From: John Bokma <postmaster@castleamber.com>
Subject: Re: How to convert MS Word document to text file?
Message-Id: <40d01b61$0$203$58c7af7e@news.kabelfoon.nl>

Goh, Yong Kwang wrote:

> Hi.
> 
> I'm trying to write a Perl program that can given a Microsoft Word
> document file convert it into a text file, which can then be formatted
> into a HTML file. So in essence it's like extracting the information
> and repackaging them for the Web.
> 
> I don't use the "Save As Web Page" command from Word directly as I've
> a whole bunch of Word documents to convert, doing one-by-one is slow
> and laborious. And the formatting does not match the Web template I've
> done.
> 
> So I'm thinking of using Win32::OLE package to create a Microsoft Word
> Document OLE object and then calling its SaveAs method to export a MS
> Word document to a text file.
> 
> However, to reduce the overhead of having to create a Microsoft Word
> Document OLE object and then calling its SaveAs method to export a MS
> Word document to a text file, I have been wondering if there is a Perl
> module somewhere that does this conversion directly w/o having to call
> up Microsoft Word and using OLE.

http://wvware.sourceforge.net/

http://www.google.com/search?q=MS+word+to+text+conversion
which also gave as result:

http://www.w3.org/Tools/Word_proc_filters.html

-- 
John                               MexIT: http://johnbokma.com/mexit/
                            personal page:       http://johnbokma.com/
    Experienced Perl programmer available:     http://castleamber.com/
             Happy Customers: http://castleamber.com/testimonials.html


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

Date: 16 Jun 2004 04:52:00 -0700
From: Petri <Petri_member@newsguy.com>
Subject: Re: How to convert MS Word document to text file?
Message-Id: <capc900imf@drn.newsguy.com>

In article <354933d6.0406160143.539e3a4a@posting.google.com>, Goh, Yong Kwang
says...
> I don't use the "Save As Web Page" command from Word directly as
> I've a whole bunch of Word documents to convert, doing one-by-one
> is slow and laborious. And the formatting does not match the Web
> template I've done.

Why do them one by one, when you can automate Word to do them all for you?

> So I'm thinking of using Win32::OLE package to create a Microsoft
> Word Document OLE object and then calling its SaveAs method to
> export a MS Word document to a text file.

If you are going for Word automation, why not let Word save the documents
directly as HTML, and skip the whole text-to-HTML part?

Of course, you don't need Perl for this, but you can use it if you like.
All examples are in VBScript, though:
http://msdn.microsoft.com/office/understanding/word/codesamples/default.aspx?pull=/library/en-us/dnword2k/html/odc_expwordtoxml.asp


Petri



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

Date: Wed, 16 Jun 2004 14:57:20 +0100
From: "Alan J. Flavell" <flavell@ph.gla.ac.uk>
Subject: Re: How to convert MS Word document to text file?
Message-Id: <Pine.LNX.4.53.0406161452530.12003@ppepc56.ph.gla.ac.uk>

On Wed, 16 Jun 2004, Petri wrote:

> why not let Word save the documents directly as HTML,

off-topic for Perl, but I doubt that Word can distinguish between
real HTML, and a hole in the ground!

Any mention of using its facilities to extrude its quasi-HTML needs to
be coupled with some discussion of how to limit the resulting damage,
IMNSHO.

I've had better results by having Word save as RTF, and using
third-party tools which convert RTF to web formats, preferably with
some kind of customisation facilities to "tune" the result.


h.t.h  (we now return you to your regular diet of Perls...)


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

Date: Wed, 16 Jun 2004 15:03:40 GMT
From: Chris <ceo@nospan.on.net>
Subject: Re: How to convert MS Word document to text file?
Message-Id: <gjZzc.1$p_4.0@newssvr31.news.prodigy.com>

Goh, Yong Kwang wrote:
> Hi.
> 
> I'm trying to write a Perl program that can given a Microsoft Word
> document file convert it into a text file, which can then be formatted
> into a HTML file. So in essence it's like extracting the information
> and repackaging them for the Web.
> 
> I don't use the "Save As Web Page" command from Word directly as I've
> a whole bunch of Word documents to convert, doing one-by-one is slow
> and laborious. And the formatting does not match the Web template I've
> done.
> 
> So I'm thinking of using Win32::OLE package to create a Microsoft Word
> Document OLE object and then calling its SaveAs method to export a MS
> Word document to a text file.
> 
> However, to reduce the overhead of having to create a Microsoft Word
> Document OLE object and then calling its SaveAs method to export a MS
> Word document to a text file, I have been wondering if there is a Perl
> module somewhere that does this conversion directly w/o having to call
> up Microsoft Word and using OLE.
> 

I'm not convinced that using Perl in this particular case is really 
necessary outside of the context of Win32::OLE, but if you are insistent 
on using it apart from OLE then perhaps just passing the Word document 
through 'antiword' and using the ASCII results from that to do your HTML 
processing would work?  You ask for a "module" and if you have access to 
the Win32::OLE module, then I really now of no better module to 
recommend for working with Office objects...?

-ceo


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

Date: 16 Jun 2004 02:32:03 -0700
From: leifwessman@hotmail.com (Leif Wessman)
Subject: LWP::Parallel is not giving me the accesstime for each request
Message-Id: <64beeaad.0406160132.41efe277@posting.google.com>

Hi,

I'm using the LWP::Parallel package to connect to several websites at
the same time. Now I would like to know how long time each request
takes (inluding redirects). How can I find that information?

I've tried the following but I can't get it to work. One problem is
that I don't know how to access the variable from my main script. One
other problem is that the accesstime is counted once per request, and
it doesn't take into account the redirects:

package MyUA;

use Exporter();
use LWP::Parallel::UserAgent qw(:CALLBACK);
@ISA = qw(LWP::Parallel::UserAgent Exporter);
@EXPORT = @LWP::Parallel::UserAgent::EXPORT_OK;

use Time::HiRes qw(gettimeofday tv_interval);

my $start_time;
my $end_time;
my $accesstime;

sub on_connect {
  my ($self, $request, $response, $entry) = @_;
  $start_time = [ gettimeofday ];
}

sub on_return {
  my ($self, $request, $response, $entry) = @_;
  $end_time = [ gettimeofday ];
  my $accesstime = tv_interval($start_time,$end_time);
}

1;


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

Date: Wed, 16 Jun 2004 16:43:22 +0200
From: Josef Moellers <josef.moellers@fujitsu-siemens.com>
Subject: Re: parsing a text file
Message-Id: <capm1o$r5d$1@nntp.fujitsu-siemens.com>

Suresh wrote:
> Hi,
>=20
> I have a file in the following format.
>=20
>=20
> Title 223
> Version 2324
> protocol src: 172.30.39.3
> data
>=20
> 0000  94 93 32 43 f3 h3
> 1223  23 k3 j3 3k k3 2k
> 9232 92 k3 92 k2 92 l2
>=20
> Title 3434
> Version 233
> ........ keeps on gooing in the same format.
>=20
> I want to write a script that grep/parse Title,src, and the data part(a=
ll
> the data).
> The format is same all the time.  The data always start with 0000 and t=
wo
> spaces.  After that
> the data follow the same pattern.
>=20
> What I want is that i have to go to a specific(user input) src and pars=
e the
> data for that specific src.
>=20
> I was able to go the src but don't know how to iterate one line at a ti=
me,
> from 0000 to the end of the data.
>=20
> while(<>) {
> if(src=3D$user input)
> print .....
>=20
> if(/^0000\s\s .. /end../
> ....
>=20
> I wanna way to iterate each line once it entered into a loop.

I'm pretty fond of state machines:

sub parse($) {
     my $data =3D shift;

}

my $state =3D 0;
while (<STDIN>) {
     chomp;

     if ($state eq 0) {
	$state =3D 1 if (m/^Title $user_title$/);
	next;
     } elsif ($state eq 1) {
	if (m/^Version $user_version$/) {
	    $state =3D 2;
	} else {
	    $state =3D 0;
	}
	next;
     } elsif ($state eq 2) {
	$state =3D 3 if (m/^0000  /);
     } elsif ($state eq 3) {
	$state =3D 0 if (m/^$/);
	next;
     }

     if ($state eq 3) {
	parse($_);
     }
}

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



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

Date: Wed, 16 Jun 2004 10:56:46 -0400
From: Paul Lalli <ittyspam@yahoo.com>
Subject: Re: parsing a text file
Message-Id: <20040616105421.F20623@dishwasher.cs.rpi.edu>

On Wed, 16 Jun 2004, Josef Moellers wrote:

> I'm pretty fond of state machines:
>
> sub parse($) {
>      my $data = shift;
>
> }
>
> my $state = 0;
> while (<STDIN>) {
>      chomp;
>
>      if ($state eq 0) {
> 	$state = 1 if (m/^Title $user_title$/);
> 	next;
>      } elsif ($state eq 1) {
> 	if (m/^Version $user_version$/) {
> 	    $state = 2;
> 	} else {
> 	    $state = 0;
> 	}
> 	next;
>      } elsif ($state eq 2) {
> 	$state = 3 if (m/^0000  /);
>      } elsif ($state eq 3) {
> 	$state = 0 if (m/^$/);
> 	next;
>      }
>
>      if ($state eq 3) {
> 	parse($_);
>      }
> }

Please don't confuse numeric and string contexts.  Yes, in this small
example, everything you did will 'work', but you're asking for trouble.
If you're assigning integers, you should be comparing integers.  If you're
assigning strings, you should be comparing strings.  In other words, you
need to change EITHER all instances of
$state = 0;
to
$state = '0';

or (much preferred in this case) all instances of
($state eq 0)
to
($state == 0)

Paul Lalli


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

Date: 16 Jun 2004 03:05:53 -0700
From: hallvardost@hotmail.com (Hallvard ?strem)
Subject: Re: Perl cgi on Windows 2003 Server fails
Message-Id: <79b0e251.0406160205.535e4238@posting.google.com>

Problem finally solved. 

A "ScriptMap" key was missing in the Windows 2003 Server registry, and
a reinstallation of Perl fixed it. Perl was originally installed
BEFORE the FirstClass Server software on the server, and this produced
the situation with this particular registry entry missing.

[HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\FCS\Parameters\ScriptMap]
".pl"="C:\\Perl\\bin\\perl.exe %s %s"

(FCS=FirstClass Server)

A reinstallation of Perl will get it right.

Thanks for all your help!
Hallvard

ChrisO <ceo@nospam.on.net> wrote in message news:<setzc.1568
> 
> Or the behavior of FC changed inbetween WNT 4.0 and W2K3...  More than 
> likely, if Perl is acting fine on the command line.  That's *my* guess. 
>   Last time I used FC was in 1993, so that's about as well as I can do 
> with this.  I haven't run into very many FC users in a while, so you 
> (the OP) may be a bit stuck.  FC is kinda off the beaten path... :(
> 
> -ceo


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

Date: 16 Jun 2004 05:25:29 -0700
From: debashish_mishra@persistent.co.in (Debashish Mishra)
Subject: Port forwarding utility in perl
Message-Id: <e1e0907a.0406160425.4d595229@posting.google.com>

I am searching for a port forwarding package in perl, some thing like
plugproxy in java (http://www.bbzzdd.com/plugproxy). My basic
requirement is to have a platform independent snooping tool between
two servers. The servers may be on the same m/c. So we need to replace
currently used ipthreal/iptrace.

I was wondering if there exists any package with functionality similar
to plugproxy. IPChains::PortFW seemed promising. But I couldn't
install it on Solaris. The documentation also clearly mentions it's
for linux.

In perl cook-book first edition chapter 17.18 there is a program which
probably would serve our purpose with some modification. Another
option is to make a perl wrapper over plugproxy and use it.

Could somebody point me to a module already exists or being writen
which fits into this before we reinvent the wheel?

Thanks and regards,
Debashish.


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

Date: Wed, 16 Jun 2004 12:36:28 GMT
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: Port forwarding utility in perl
Message-Id: <x7oenj1xys.fsf@mail.sysarch.com>

>>>>> "DM" == Debashish Mishra <debashish_mishra@persistent.co.in> writes:

  DM> I am searching for a port forwarding package in perl, some thing like
  DM> plugproxy in java (http://www.bbzzdd.com/plugproxy). My basic
  DM> requirement is to have a platform independent snooping tool between
  DM> two servers. The servers may be on the same m/c. So we need to replace
  DM> currently used ipthreal/iptrace.

  DM> Could somebody point me to a module already exists or being writen
  DM> which fits into this before we reinvent the wheel?

check out stem (cpan and stemsystems.com) which can be used to build a
port forwarder without any coding. i have a config file for this
which i can send you (it is not in the distribution).

uri

-- 
Uri Guttman  ------  uri@stemsystems.com  -------- http://www.stemsystems.com
--Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
Search or Offer Perl Jobs  ----------------------------  http://jobs.perl.org


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

Date: Wed, 16 Jun 2004 09:31:33 +0200
From: "Vetle Roeim" <vetro@online.no>
Subject: Re: SQL Injection and DBI placeholders
Message-Id: <opr9oe6va33hk3cf@quickfix.opera.com>

On 15 Jun 2004 16:14:35 GMT, <ctcgag@hotmail.com> wrote:

> Ulrich Herbst <ulrich.herbst@gmx.de> wrote:
>> Hi!
>>
>> I want to insert data from user input into a database (with DBI):
>>
>>   my $sth = $dbh->prepare(q(
>>     INSERT INTO table
>>            (col1,col2,col3)
>>     VALUES (?   ,?   ,?   )
>>     ));
>>   my $rc=$sth->execute($data1,$data2,$data3);
>>
>> Have I to deal with SQL Injection if I use DBI placeholders ?
>
> No.  Just by using placeholders you have already dealt with that
> problem.

   Is that independent of the database driver used? I'm wondering because I  
remember seeing in a bug a JDBC driver a while back, that made SQL  
injection possible, even *with* placeholders.



-- 
Touch eyeballs to screen for cheap laser surgery!


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

Date: Wed, 16 Jun 2004 08:13:02 -0000
From: "gnari" <gnari@simnet.is>
Subject: Re: SQL Injection and DBI placeholders
Message-Id: <caovar$553$1@news.simnet.is>


"Vetle Roeim" <vetro@online.no> wrote in message
news:opr9oe6va33hk3cf@quickfix.opera.com...
> On 15 Jun 2004 16:14:35 GMT, <ctcgag@hotmail.com> wrote:
>
> > Ulrich Herbst <ulrich.herbst@gmx.de> wrote:
> >> Have I to deal with SQL Injection if I use DBI placeholders ?
> >
> > No.  Just by using placeholders you have already dealt with that
> > problem.
>
>    Is that independent of the database driver used? I'm wondering because
I
> remember seeing in a bug a JDBC driver a while back, that made SQL
> injection possible, even *with* placeholders.

well, a bug is a bug.

if you use placeholders, it is the driver's/database's
responsibility to take care of this.

gnari






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

Date: Wed, 16 Jun 2004 11:38:47 +0200
From: "Vetle Roeim" <vetro@online.no>
Subject: Re: SQL Injection and DBI placeholders
Message-Id: <opr9ok2xjy3hk3cf@quickfix.opera.com>

On Wed, 16 Jun 2004 08:13:02 -0000, gnari <gnari@simnet.is> wrote:

>
> "Vetle Roeim" <vetro@online.no> wrote in message
> news:opr9oe6va33hk3cf@quickfix.opera.com...
>> On 15 Jun 2004 16:14:35 GMT, <ctcgag@hotmail.com> wrote:
>>
>> > Ulrich Herbst <ulrich.herbst@gmx.de> wrote:
>> >> Have I to deal with SQL Injection if I use DBI placeholders ?
>> >
>> > No.  Just by using placeholders you have already dealt with that
>> > problem.
>>
>>    Is that independent of the database driver used? I'm wondering  
>> because
> I
>> remember seeing in a bug a JDBC driver a while back, that made SQL
>> injection possible, even *with* placeholders.
>
> well, a bug is a bug.

I believe I also heard of a JDBC driver that implemented placeholders by  
replacing the ? in the string with the parameters, without checking them,  
before sending the whole string to the database. This is an extreme  
example, of course, and I doubt anyone would do it like that today.

Anyway; my point is that blindly trusting the database driver may not be a  
good idea, but that depends on what you're doing and how paranoid you are.  
I usually trust the database driver myself, but I like playing the devils  
advocate when I see someone claiming that placeholders prevent SQL  
injection, pointing out that they're not magic and that they are subject  
to the same rules as all other software. :)


> if you use placeholders, it is the driver's/database's
> responsibility to take care of this.

Sure, but it's my problem if it doesn't do it properly. ;)


-- 
Touch eyeballs to screen for cheap laser surgery!


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

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


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