[21884] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4088 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Nov 9 03:06:25 2002

Date: Sat, 9 Nov 2002 00:05:14 -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           Sat, 9 Nov 2002     Volume: 10 Number: 4088

Today's topics:
    Re: converting cgi scripts to java <spam@thecouch.homeip.net>
    Re: CPAN for rootless (l)users. <pa@panix.com>
    Re: CPAN for rootless (l)users. <ocscwar@h-after-ocsc.mit.edu>
    Re: CPAN for rootless (l)users. <randy@theoryx5.uwinnipeg.ca>
    Re: free GUI debugger for perl (eddie wang)
    Re: GUI with Perl ?? <lusol@Pandora.cc.lehigh.edu>
    Re: GUI with Perl ?? <ronwolf@screwthebots.com>
    Re: How to globally override a module function? (Phlip)
        How to kill a system or process open  call on timeout (Seth Brundle)
    Re: How to kill a system or process open  call on timeo <jurgenex@hotmail.com>
    Re: Object in @INC returning Tie::Handles from INC meth (Bryan Castillo)
    Re: Object in @INC returning Tie::Handles from INC meth <goldbb2@earthlink.net>
    Re: Pause in perl ??? <usenet@dwall.fastmail.fm>
    Re: Pause in perl ??? <spam@thecouch.homeip.net>
    Re: Pause in perl ??? (Beau Schwabe)
    Re: Pause in perl ??? <bdonlan@users.sf.net>
    Re: Pause in perl ??? <admin@-NOSPAM-2host.com>
    Re: performance characteristics of embedded perl? <pkent77tea@yahoo.com.tea>
    Re: Perl Tk Memory Leak <smackdab1@hotmail.com>
    Re: Perl Tk Memory Leak <lusol@Pandora.cc.lehigh.edu>
    Re: problems with DB_File password database <bwalton@rochester.rr.com>
        Safest way to convert $d.cc to $DCC ? <kirkspam@alienbill.com>
    Re: Safest way to convert $d.cc to $DCC ? (Tad McClellan)
        Special Characters from HTML form to Oracle DB <dsolbach@web.de>
    Re: Special Characters from HTML form to Oracle DB <goldbb2@earthlink.net>
    Re: Substrings <bwalton@rochester.rr.com>
    Re: system("rm filename") <Dave.BarnettNOSPAM@westerngeco.com>
        What is this doing? <rafaelg@earthlink.net>
    Re: What is this doing? <spam@thecouch.homeip.net>
    Re: What is this doing? <admin@-NOSPAM-2host.com>
    Re: What is this doing? <admin@-NOSPAM-2host.com>
    Re: What is this doing? <jurgenex@hotmail.com>
    Re: What is this doing? <admin@-NOSPAM-2host.com>
        wish fast method of counting of characters <newsComments17@sellers.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Fri, 08 Nov 2002 18:29:01 -0500
From: Mina Naguib <spam@thecouch.homeip.net>
Subject: Re: converting cgi scripts to java
Message-Id: <3DCC48BD.7080400@thecouch.homeip.net>

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



Jay Tilton wrote:
| 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!

Are you the same person who posts these instructions on slashdot stories
;-) ?


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

iD8DBQE9zEi9eS99pGMif6wRAkulAKDN2rH9QEgTIei5GscxU9bMOdb/lQCgpHhq
dA2v93u7DqNTr2ozqZsgD6U=
=RjT6
-----END PGP SIGNATURE-----



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

Date: Fri, 8 Nov 2002 23:54:38 +0000 (UTC)
From: Pierre Asselin <pa@panix.com>
Subject: Re: CPAN for rootless (l)users.
Message-Id: <aqhirr$ih5$1@reader1.panix.com>

In <octisz8hqb0.fsf@no-knife.mit.edu> Omri Schwarz <ocscwar@h-after-ocsc.mit.edu> writes:

>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?

IIRC you can specify that when you first run "perl -MCPAN -e shell".
Wipe out your ~/.cpan/ tree (or move it out of the way) and start
over;  answer the questions slowly...



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

Date: 08 Nov 2002 20:34:25 -0500
From: Omri Schwarz <ocscwar@h-after-ocsc.mit.edu>
Subject: Re: CPAN for rootless (l)users.
Message-Id: <oct4rara5lq.fsf@no-knife.mit.edu>

Pierre Asselin <pa@panix.com> writes:

> In <octisz8hqb0.fsf@no-knife.mit.edu> Omri Schwarz <ocscwar@h-after-ocsc.mit.edu> writes:
> 
> >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?
> 
> IIRC you can specify that when you first run "perl -MCPAN -e shell".

No go. That sets my build and cache directories, 
but never asks about the install prefix.

I presume I should just be able to add something
to ~/.cpan/CPAN/MyConfig.pm. I just don't know what.

> Wipe out your ~/.cpan/ tree (or move it out of the way) and start
> over;  answer the questions slowly...
> 

-- 
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: Sat, 9 Nov 2002 01:12:48 -0600
From: "Randy Kobes" <randy@theoryx5.uwinnipeg.ca>
Subject: Re: CPAN for rootless (l)users.
Message-Id: <Pz2z9.8995$b5.41833@news1.mts.net>


"Omri Schwarz" <ocscwar@h-after-ocsc.mit.edu>
   wrote in message news:oct4rara5lq.fsf@no-knife.mit.edu...
> Pierre Asselin <pa@panix.com> writes:
>
> > In <octisz8hqb0.fsf@no-knife.mit.edu> Omri Schwarz
<ocscwar@h-after-ocsc.mit.edu> writes:
> >
> > >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?
> >
> > IIRC you can specify that when you first run "perl -MCPAN -e shell".
>
> No go. That sets my build and cache directories,
> but never asks about the install prefix.
>
> I presume I should just be able to add something
> to ~/.cpan/CPAN/MyConfig.pm. I just don't know what.

You'd want to add the appropriate PREFIX=... to
CPAN.pm's makepl_arg setting.

best regards,
randy kobes





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

Date: 8 Nov 2002 16:02:28 -0800
From: eddiekwang@hotmail.com (eddie wang)
Subject: Re: free GUI debugger for perl
Message-Id: <879e0e64.0211081602.64c8dc15@posting.google.com>

Hi, everyone.
thanks for the info!

Ron Reidy <rereidy@indra.com> wrote in message news:<3DC1E583.4C9932DA@indra.com>...
> eddie wang wrote:
> > 
> > Hi, everyone.
> > what are my options if i want to get a free GUI debugger for perl? is
> > avaiable for both Windows and Unix?
> > 
> > thank you in advance!
> > 
> > eddy
>  ptkdb (needs Tk).  Works everywhere you need Perl to be.


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

Date: 8 Nov 2002 23:00:27 GMT
From: "Stephen O. Lidie" <lusol@Pandora.cc.lehigh.edu>
Subject: Re: GUI with Perl ??
Message-Id: <aqhfmb$h78@fidoii.CC.Lehigh.EDU>

> And the reason I ask was because it's my understanding that the
> perl/tk scripts look like x-windows, while the win32:gui scripts look
> like any other windows app.

Hmm, I answered that a message or two back (;

On Unix, Perl/Tk applications look "Unix-like", but on Win32 they look
"Win32-like".  As I said, write a small program on Unix and run it. Try
the identical code on Win32 and note the difference ...

BTW, listen in on c.l.p.tk as well.

Steve
-- 
@_=map{eval"100${_}"}split/!/,'/5!*2!+$]!/10+$]';use Tk;$m=tkinit;$t='just an'.
'other perl hacker';$z='createText';$c=$m->Canvas(-wi,$_[1],-he,25)->grid;$c->$
z(@_[2,3],-te,$t,-fi,'gray50');$c->$z($_[2]-$],$_[3]-$],-te,$t);$m->bind('<En'.
'ter>',sub{$y=int(rand($m->screenheight));$m->geometry("+$y+$y")});MainLoop;


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

Date: Fri, 08 Nov 2002 23:33:31 GMT
From: ronwolf <ronwolf@screwthebots.com>
Subject: Re: GUI with Perl ??
Message-Id: <ihiosugljm9dl325ga3hn8fn4i4c63elma@4ax.com>

On 8 Nov 2002 23:00:27 GMT, "Stephen O. Lidie"
<lusol@Pandora.cc.lehigh.edu> wrote:

>> And the reason I ask was because it's my understanding that the
>> perl/tk scripts look like x-windows, while the win32:gui scripts look
>> like any other windows app.
>
>Hmm, I answered that a message or two back (;
>
>On Unix, Perl/Tk applications look "Unix-like", but on Win32 they look
>"Win32-like".  As I said, write a small program on Unix and run it. Try
>the identical code on Win32 and note the difference ...
>
>BTW, listen in on c.l.p.tk as well.
>
>Steve

Thanks- didn't mean to be repetitive. Saw the other group, and will
lurk there for a bit.

Thanks,

ronwolf


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

Date: 8 Nov 2002 18:15:48 -0800
From: phlip_cpp@yahoo.com (Phlip)
Subject: Re: How to globally override a module function?
Message-Id: <63604d2.0211081815.72cf2c43@posting.google.com>

Brian McCauley wrote:

> no warnings 'redefine';
> 
> Note: switching off warnings globally and/or completely should usually be avoided.

Not writing statement coverage-level unit tests (even in Perl) should
always also be avoided! ;-)

> BCP is to put "use warnings" at the top of every file.  Switch off
> unwanted warnings in the smallest enclosing lexical scope.

Ja. But is "use warnings" -w? (I'd Grep the Fine Manual if -w were
greppable ;-)
 
> Hang on... could the two be related.  What line number is appearing in
> the "redefined" warning?  Perhaps something is redefining it back again.

Nope. I put this below the last importing-looking thing:

use base 'Test::Unit::TestCase';

*Test::Unit::Debug::debug = sub {
    print "git t'the skateboards, boys - there's rustlers on the east
20\n";
    };

I even put it inside a method, but the debugger told me the '= sub'
line is not executable, hence it wasn't really a statement.

Per my traffic on the users' mailing list inside
http://sourceforge.net/projects/perlunit , I have given up trying to
diplomatically change the package code, and resorted to surgically
changing it. Hope there wasn't any collateral damage ;-]

-- 
Phlip
                http://andstuff.org/HarryPotter
  --  MCCD - Microsoft Certified Co-Dependent  --


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

Date: 8 Nov 2002 20:51:30 -0800
From: brundlefly76@hotmail.com (Seth Brundle)
Subject: How to kill a system or process open  call on timeout
Message-Id: <53e2ec95.0211082051.718aff8@posting.google.com>

I would like to be able to kill a system call or piped open process if
it runs over, say a minute.

Is this possible?


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

Date: Sat, 09 Nov 2002 06:05:27 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: How to kill a system or process open  call on timeout
Message-Id: <HA1z9.3647$XH4.1538@nwrddc02.gnilink.net>

Seth Brundle wrote:
> I would like to be able to kill a system call or piped open process if
> it runs over, say a minute.

Please see "perldoc -q timeout":   How do I timeout a slow event?

jue




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

Date: 8 Nov 2002 21:08:51 -0800
From: rook_5150@yahoo.com (Bryan Castillo)
Subject: Re: Object in @INC returning Tie::Handles from INC method
Message-Id: <1bff1830.0211082108.3bcfa1e7@posting.google.com>

Brian McCauley <nobull@mail.com> wrote in message news:<u97kfn52p6.fsf@wcl-l.bham.ac.uk>...
> rook_5150@yahoo.com (Bryan Castillo) writes:
> 
> > 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;
> > }
> 
> I've not played with 5.8's new @INC but making a tied filehandle where
> the object to which it is tied is the GLOB _itself_ seems unecessarily
> convoluted.  Perhaps this is confusing Perl.  Perhaps it isn't.  But
> it certainly confused me!

It works in other situations I have used before to tie STDERR and
STDOUT to text entries in tk  (It would be cool if the tie would
persist across a fork, but I don't think it does).  Keeping the glob
as the object also, allows you to call methods using the same object
you use for IO.  It's similar to the way
Net::(FTP|SMTP) IO::Socket, etc use blessed glob refs. But after
looking at their source, they don't seem to use ties, which I always
assumed they did.  Im curious to find out now if an object derived
from IO::Handle can be returned by INC.

The module Ben suggested (ex::lib::<zip or something>, is written in
C/XS and returns a pointer to a PerlIO (something or other).  I'm a
little confused now, how the different IO mechanisms work and if they
all work in the same situations.  Do open handles, tied handles,
objects derived from IO::Handle and the PerlIO thing all work under
the same iterface/conditions?

Time for some serious reading and googling.


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

Date: Sat, 09 Nov 2002 02:10:53 -0500
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: Object in @INC returning Tie::Handles from INC method
Message-Id: <3DCCB4FD.DB5BB9B6@earthlink.net>

Bryan Castillo wrote:
[snip]
> The module Ben suggested (ex::lib::<zip or something>, is written in
> C/XS and returns a pointer to a PerlIO (something or other).

The module ex::lib::zip pushes a blessed object with a ->INC method;
calling that method returns a GLOBref, which is a perfectly ordinary
open filehandle.

Well, almost perfectly ordinary -- that filehandle has two PerlIO layers
pushed onto it, a ":subfile(..stuff..)" layer, and a ":gzip(none)"
layer.

Ordinary filehandles with PerlIO layers pushed on are not the same
things as tied filehandles.

> I'm a little confused now, how the different IO mechanisms work and if
> they all work in the same situations.  Do open handles, tied handles,
> objects derived from IO::Handle and the PerlIO thing all work under
> the same iterface/conditions?

Well, ordinary open filehandles and tied handles *should* work about the
same.  Objects derived from IO::Handle are, in fact, ordinary open
handles, except that in addition to being able to use the builtin io
operators, you can use object-oriented methods on them, too.

PerlIO layers are a bit different... however, there should be little
enough need for you to concern yourself there, since you generally don't
have to deal with PerlIO objects directly; they're hidden inside the
internal data of the IO-ref part of the filehandle.

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


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

Date: Fri, 08 Nov 2002 23:21:52 -0000
From: "David K. Wall" <usenet@dwall.fastmail.fm>
Subject: Re: Pause in perl ???
Message-Id: <Xns92C0BAD058252dkwwashere@216.168.3.30>

Linux.ie <mail@eircom.net> wrote on 09 Nov 2002:

> How do i make my script do :
> 
> a) pause for 5 seconds and then continue on

Tell it to go to sleep.

> b)stop after it says e.g "Welcome to your ping program" and then i hit
> enter and it continues ?

This sounds like homework, which probably explains the lack of responses.

Try asking *yourself* how you would go about finding basic information on a 
subject which has considerable online and offline documentation.

-- 
David K. Wall - usenet@dwall.fastmail.fm
"We've come to help you learn to help yourself"


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

Date: Fri, 08 Nov 2002 18:29:57 -0500
From: Mina Naguib <spam@thecouch.homeip.net>
Subject: Re: Pause in perl ???
Message-Id: <3DCC48F5.5030501@thecouch.homeip.net>

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



Linux.ie wrote:
| How do i make my script do :
|
| a) pause for 5 seconds and then continue on

sleep 5;

| b)stop after it says e.g "Welcome to your ping program" and then i hit
enter
| and it continues ?

<>;


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

iD8DBQE9zEj0eS99pGMif6wRAgKwAJ4060CPssHwJH/uDneL6kHSaJVzdACeN5qu
NIoZowzD9osCNynQak7iKoc=
=UwNF
-----END PGP SIGNATURE-----



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

Date: Fri, 08 Nov 2002 23:55:27 GMT
From: bschwabe@atlanta.nsc.com (Beau Schwabe)
Subject: Re: Pause in perl ???
Message-Id: <3dcc41f6.27854437@usenet.nsc.com>

On Fri, 8 Nov 2002 21:37:17 -0800, "Linux.ie" <mail@eircom.net> wrote:

>How do i make my script do :
>
>a) pause for 5 seconds and then continue on

how about ... 

sleep 300;

>b)stop after it says e.g "Welcome to your ping program" and then i hit enter
>and it continues ?
>
>

$keyboard = <STDIN>;



----------------------------------------------------------------------
Beau Schwabe                       Mask Designer II - ATL
National Semiconductor             Enterprise Networking Business Unit
500 Pinnacle Court, Suite 525      Wired Communications Division
Mail Stop GA1  Norcross, GA 30071
----------------------------------------------------------------------


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

Date: Sat, 09 Nov 2002 03:14:31 GMT
From: bd <bdonlan@users.sf.net>
Subject: Re: Pause in perl ???
Message-Id: <0guhqa-jdg.ln@ID-151211.user.cis.dfn.de>

Linux.ie wrote:

> How do i make my script do :
> 
> a) pause for 5 seconds and then continue on

Read perldoc -f sleep

> b)stop after it says e.g "Welcome to your ping program" and then i hit
> enter and it continues ?

Use <>;



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

Date: Fri, 08 Nov 2002 21:10:18 -0800
From: "2Host.com - Robert" <admin@-NOSPAM-2host.com>
Subject: Re: Pause in perl ???
Message-Id: <3DCC98BA.C1ECAC74@-NOSPAM-2host.com>



"Linux.ie" wrote:
> 
> How do i make my script do :
> 
> a) pause for 5 seconds and then continue on

perldoc -f sleep

> b)stop after it says e.g "Welcome to your ping program" and then i hit enter
> and it continues ?

I assume you want it to wait for input then and not literally stop. Look
at "while".
-- 
Regards,
Robert McGregor - Email: admin@(remove)2host.com. Phone: 530-941-0690
Server admin, support & programing for shared & dedicated web servers
Secure, reliable hosting you expect and deserve! http://www.2host.com


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

Date: Sat, 09 Nov 2002 02:53:17 GMT
From: pkent <pkent77tea@yahoo.com.tea>
Subject: Re: performance characteristics of embedded perl?
Message-Id: <pkent77tea-ACA162.02531609112002@news-text.blueyonder.co.uk>

In article <aqfsll$125v$1@agate.berkeley.edu>,
 Ilya Zakharevich <nospam-abuse@ilyaz.org> wrote:

> [A complimentary Cc of this posting was sent to
> pkent 
> <pkent77tea@yahoo.com.tea>], who wrote in article 
> <pkent77tea-89D5AF.22114407112002@news-text.blueyonder.co.uk>:
> 
> > Once any perl has been compiled it runs comparably as fast as C
> Only if you consider something which is potentially 200x slower being
                                          ^^^^^^^^^^^

Yeah, a slightly suboptimal choice of words. Sure a compiled perl 
program may be *potentially* 200x slower than the same C program, but it 
may be faster. All depends doesn't it on the actual code in question. 
So, how does this sound to you all:

once you've compiled a perl program.routine/whatever, like mod_perl does 
for example, it may run faster[1] than a functionally equivalent C 
executable run as a new process each time, it may even run faster than C 
code already linked in to the current binary[1], or it may run several 
orders of magniude slower!

As we all know the golden rule is to benchmark and optimize your 
particular program after writing it, _if_ you think you need to. 
Sometimes it's fast enough already, or is I/O bound, for example. 
Sometimes that means jumping in and writing XS bits or even rewriting 
the whole thing in Assembler. Heaven forbid.

P

[1] Oh yes it might, because you might be a bad C programmer, or have a 
bad compiler ;-) but be a good perl programmer

-- 
pkent 77 at yahoo dot, er... what's the last bit, oh yes, com
Remove the tea to reply


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

Date: Sat, 09 Nov 2002 01:59:20 GMT
From: "smackdab" <smackdab1@hotmail.com>
Subject: Re: Perl Tk Memory Leak
Message-Id: <YZZy9.16392$Ku.1834440@news2.west.cox.net>

I think this is a know Tk issue...

The solution is to make sure you wrap all anonymous subroutines in square
brackets.

$mw->repeat(50,sub{print "This Leaks\n"});
$mw->repeat(50,[sub{print "This doesn't leak\n"} ] );



"TD" <tushar08@yahoo.com> wrote in message
news:584a8362.0211080717.383da3c2@posting.google.com...
> Hello all,
>
> Perl TK Module has a memory leak. I am not sure of this. I am running
> Perl on Win 32
> ***************************************************************
> This is perl, v5.6.1 built for MSWin32-x86-multi-thread
> (with 1 registered patch, see perl -V for more detail)
>
> Copyright 1987-2001, Larry Wall
>
> Binary build 631 provided by ActiveState Tool Corp.
> http://www.ActiveState.com
> Built 17:16:22 Jan  2 2002
> ****************************************************************
>
> Here is the program I am running
>
>     use Tk;
>     $top = MainWindow -> new;
>     $top->withdraw;
>
> $cb = sub {
> do_func();
>   };
>
>
> $top->repeat(100,$cb);
>
> MainLoop();
>
>
> sub do_func() {
>
> my $x = "Sample String\n";
> my $y = $x;
> print STDOUT $x;
> undef $x;
> undef $y;
> return;
> }
>
>
> if you run this through DOS Command prompt, you will notice perl.exe
> taking up ~4000K. Minimize the command window and restore again. NOW
> you will memory growing continuously. Can anybody please explain if
> this is memory leak or normal behaviour.
>
>
> Thanks for you help.
> Tushar




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

Date: 9 Nov 2002 03:54:09 GMT
From: "Stephen O. Lidie" <lusol@Pandora.cc.lehigh.edu>
Subject: Re: Perl Tk Memory Leak
Message-Id: <aqi0t1$li6@fidoii.CC.Lehigh.EDU>

smackdab <smackdab1@hotmail.com> wrote:
> I think this is a know Tk issue...

> The solution is to make sure you wrap all anonymous subroutines in square
> brackets.

> $mw->repeat(50,sub{print "This Leaks\n"});
> $mw->repeat(50,[sub{print "This doesn't leak\n"} ] );

And goto c.l.p.tk for followups and/or more details.




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

Date: Sat, 09 Nov 2002 06:47:02 GMT
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: problems with DB_File password database
Message-Id: <3DCCAF48.60709@rochester.rr.com>

Ron wrote:

> Hi All:
> 
> 	I'm trying to validate readers to sections of my site with
> mod_auth_db. Here's the syntax that I'm using:
> 
> =-================
> tie %database, 'DB_File', "$pwddbfile" or die "Can't initialize
> database: $!\n";
> foreach (keys %database) {
> 	print "key: $_\t\t";
> }
> untie %database;
> =================
> 
> 	What I'm trying to do here is to print out the contents of the
> database so I can check my programming. I don't want to clobber the
> wrong stuff. What's happening here is that the database prints out
> records alright, and in chronological order which is fine except that
> it skips records. i.e. 22 then skips to 24, 25 ...
> 
> 	I've logged in as user number 23 and it validates me but
> everytime I try to print out the database is skips this _or_ other
> records.
> 
> 	I then tried this syntax:
> 
> ===============
> dbmopen(%DBM, "$pwddbfile", 0644) || die "Cannot open file: $!\n";
> 	while (($key, $value) = each %DBM) {
> 		print "key=$key, value=$value\n";
> 	}
> dbmclose(%DBM);
> ===============
> 
> 	Exactly the same thing happened. It skipped records. What am I
> doing wrong?
> 
> 	Thanks for the help.
> 
> 	Ron Woodall
> 
> Ron Woodall
 ...


Are you certain the "missing" records are actually skipped?  Records 
from a tied-hash database do not come out in the order they were put in, 
but rather in an order which appears to be random.  Your "missing" 
records will be output later on.  The appearance of chronological order 
to the records is most likely a very unusual occurrence, which is not 
likely to continue throughout a large database.

-- 
Bob Walton



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

Date: Fri, 08 Nov 2002 23:36:12 GMT
From: Kirk Is <kirkspam@alienbill.com>
Subject: Safest way to convert $d.cc to $DCC ?
Message-Id: <MTXy9.287$Y2.11984@news.tufts.edu>

If I have a dollar amount represented as a floating point number, i.e. 1.3 
for $1.30 or $2 for two bucks, and I want that as DDDCC (i.e. 130 and 200 
for those two examples) is it safe to multiply by 100, or might I get 
rounding errors?

-- 
QUOTEBLOG: http://kisrael.com   SKEPTIC MORTALITY: http://kisrael.com/mortal
"If you feel it, but it isn't right, don't do it and don't 
 believe it. We can be better than natural -- we're human."--Penn Jillette


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

Date: Fri, 8 Nov 2002 18:05:40 -0600
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: Safest way to convert $d.cc to $DCC ?
Message-Id: <slrnasokak.2ht.tadmc@magna.augustmail.com>

Kirk Is <kirkspam@alienbill.com> wrote:

> If I have a dollar amount represented as a floating point number, 


The safest way is to not use floating point numbers.

Use cents (integers) instead of dollars.

The safest way to convert from floating point dollars to
integer cents is also to avoid treating them as floating
point numbers.

   my($d, $c) = split /\./;
   $c += $d * 100;             # no floating point here


> i.e. 1.3 
> for $1.30 or $2 for two bucks, and I want that as DDDCC (i.e. 130 and 200 
> for those two examples) is it safe to multiply by 100, or might I get 
> rounding errors?


$19.95 *already* has rounding errors, even before multiplying by 100.

See for yourself:

    $_ = 19.95;
    printf "%30.20f\n", $_;


See also:

   perldoc -q 99999


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


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

Date: Sat, 9 Nov 2002 01:47:29 +0100
From: "David Solbach" <dsolbach@web.de>
Subject: Special Characters from HTML form to Oracle DB
Message-Id: <aqhlus$hbo$02$1@news.t-online.com>

Hi all,

this is my first post in this group and I already searched for a solution of
this issue in several FAQs and of course google, without any luck.

Here's the problem:

I read data from textfields and write them into an oracle db using DBI/DBD
modules. unfortunately all special characters like german umlauts or any
french special chars get screwed up in the database. (they are converted to
common ascii chars)
But the oracle settings seem to be corrrect, because if I try to write
literals to the DB it works fine.

I think this should be a common problem, pherhaps you can tell me where to
find a solution, if you need extra information just tell me what you need to
know.

Thanks,

    David




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

Date: Sat, 09 Nov 2002 02:16:37 -0500
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: Special Characters from HTML form to Oracle DB
Message-Id: <3DCCB655.C8915139@earthlink.net>

David Solbach wrote:
> 
> Hi all,
> 
> this is my first post in this group and I already searched for a
> solution of this issue in several FAQs and of course google, without
> any luck.
> 
> Here's the problem:
> 
> I read data from textfields

What format is the data encoded in?

> and write them into an oracle db using DBI/DBD
> modules. unfortunately all special characters like german umlauts or
> any french special chars get screwed up in the database.

These german umlauts and french special chars, are they in utf, latin2,
or some other format?

> (they are converted to common ascii chars)

Which ascii characters are they converted to?

> But the oracle settings seem to be corrrect, because if I try to write
> literals to the DB it works fine.

From what program, through DBI, or through Oracle's sql-shell?

> I think this should be a common problem, pherhaps you can tell me
> where to find a solution, if you need extra information just tell me
> what you need to know.

The solution is to convert all of the data to a common encoding before
putting it in, and then convert it to whatever encoding you want when
taking it out.

Usually utf8 encoding or utf16 encoding is preferred, though latin1,
latin2, etc, ... might suite your data better, depending on the
language.  But whichever you choose, you *must* store all the strings in
the same encoding, otherwise your data will be corrupted.

Either Encode.pm or Text::Iconv should be used for converting from one
encoding to another.

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


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

Date: Sat, 09 Nov 2002 06:38:07 GMT
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: Substrings
Message-Id: <3DCCAD31.8010900@rochester.rr.com>

Kasp wrote:

 ...
> I have to detect all possible substring combinations.
> The rules are:
> 1. The string starts with ABC
> 2. The string can end with PQR or XYZ
> 3. The string length should be a multiple of 3.
> 
> Some examples are:
> ABCXYZ is Valid but ABCPXYZ or ABCPQXYZ are invalid because their
> length is not a multiple of 3.
> 
> Apart from this, is it possible to detect all the substrings that
> match such a regular expression?
> 
> Eg. PQABCGHKABCPQRAAAXYZ
> The answers for this are:
>   ABCGHKABCPQR
>   ABCGHKABCPQRAAAXYZ
>   ABCPQR
>   ABCPQRAAAXYZ
> 
> Can someone please tell me what the regular expression will be? I have
> been trying a lot and the closet I could come was this
> ~/ABC(.*)?XYZ/;
 ...


> Kasp.
> 


    $string="PQABCGHKABCPQRAAAXYZ";
    @out=();

     $string=~/(ABC(?:...)*(?:PQR|XYZ))(?{push @out,$+})(?<=Q)/g;
     print join "\n",@out;

-- 
Bob Walton



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

Date: Fri, 08 Nov 2002 20:50:14 -0500
From: Dave Barnett <Dave.BarnettNOSPAM@westerngeco.com>
Subject: Re: system("rm filename")
Message-Id: <aqhpls$ojt$1@news.sinet.slb.com>

Lois:

Why not use the built-in "unlink" function?

perldoc -f unlink

It always returns 1 on success or 0 on failure, so:
unlink("/tmp/dave") or DoSomething("Cannot delete /tmp/dave: $!\n";

works exactly as expected.

Lois wrote:

> Hi all,
> 
>     If  I need to delete a file and prompt message for failure to do so.
> 
> if (-e "filename")
> {
>        system("rm filename")   || die "error\n";
> }
> 
> but this code always end with a die. I tried to capture the value for
> system("rm filename") and I got a 0 for success and 256 for non-success.
> can i just negate the command to obtain the correct answer?

The reason for this is quite straight-forward.  See the "perldoc -f system" 
documentation, but system returns 0 on success, as most *nix systems return 
0 upon successful completion, and > 0 on failed execution.

From the documentation (5.6.1):
               The return value is the exit status of the program
               as returned by the "wait" call.  To get the actual
               exit value divide by 256.  See also the exec entry

The docs also have code for "decoding" if a signal was generated, did the 
program dump core, etc....

Cheers,
Dave

> 
> 
> thanks,
> lois

-- 
Dave Barnett
"Why do you press harder on a remote-control when you know the battery
 is dead?"
        - George Carlin


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

Date: Sat, 09 Nov 2002 01:51:07 GMT
From: rafael <rafaelg@earthlink.net>
Subject: What is this doing?
Message-Id: <fSZy9.1851$tW4.215496@newsread1.prod.itd.earthlink.net>

Is there any way to tell what this perl file is doing? I believe it is 
collecting hotmail passwords.

http://194.226.216.72/cgi-bin/s/upload.pl



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

Date: Sat, 09 Nov 2002 00:24:20 -0500
From: Mina Naguib <spam@thecouch.homeip.net>
Subject: Re: What is this doing?
Message-Id: <3DCC9C04.8060707@thecouch.homeip.net>

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



rafael wrote:
| Is there any way to tell what this perl file is doing? I believe it is
| collecting hotmail passwords.
|
| http://194.226.216.72/cgi-bin/s/upload.pl


An inherent part of the security of CGIs is that you can't see the code.

Yes, security through obscurity is bad, but in the case of CGIs,
especially custom-built ones, it's somewhat of a cornerstone.

It's the same reason you configure your OS to use truly random TCP/IP
initial sequence numbers, or configure your FTP server not do give out
it's version number in the welcome message.  The less info you reveal to
the world, the harder you make it for the bad guys.

And so the answer is no, unless you have commandline/ftp/etc.. access to
that server and that particular file, you can't see what it does.


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

iD8DBQE9zJwEeS99pGMif6wRAij8AJwLQxlKNv0n/6WvwA0v6sliSHyhBgCgov02
C2FSABwL2g/b58sX+J68zH4=
=+8nw
-----END PGP SIGNATURE-----



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

Date: Fri, 08 Nov 2002 21:33:45 -0800
From: "2Host.com - Robert" <admin@-NOSPAM-2host.com>
Subject: Re: What is this doing?
Message-Id: <3DCC9E39.F3E2AA63@-NOSPAM-2host.com>



rafael wrote:
> 
> Is there any way to tell what this perl file is doing? I believe it is
> collecting hotmail passwords.
> 
> http://194.226.216.72/cgi-bin/s/upload.pl

That script doesn't do anything other than output a META tag to do a
refresh. In fact, using a script in that process at all, is not too
bright. It's only HTML, no need to use a script.

META HTTP-EQUIV="Refresh" CONTENT="0;
URL=https://loginnet.passport.com/ppsecure/post.srf"

You'll need to ask the site it's forwarding to of their
intention/purpose.
-- 
Regards,
Robert McGregor - Email: admin@(remove)2host.com. Phone: 530-941-0690
Server admin, support & programing for shared & dedicated web servers
Secure, reliable hosting you expect and deserve! http://www.2host.com


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

Date: Fri, 08 Nov 2002 21:43:31 -0800
From: "2Host.com - Robert" <admin@-NOSPAM-2host.com>
Subject: Re: What is this doing?
Message-Id: <3DCCA083.33C17F2C@-NOSPAM-2host.com>



"2Host.com - Robert" wrote:
> 
> rafael wrote:
> >
> > Is there any way to tell what this perl file is doing? I believe it is
> > collecting hotmail passwords.
> >
> > http://194.226.216.72/cgi-bin/s/upload.pl
> 
> That script doesn't do anything other than output a META tag to do a
> refresh. In fact, using a script in that process at all, is not too
> bright. It's only HTML, no need to use a script.
> 
> META HTTP-EQUIV="Refresh" CONTENT="0;
> URL=https://loginnet.passport.com/ppsecure/post.srf"
> 
> You'll need to ask the site it's forwarding to of their
> intention/purpose.

I should be clear; "That is what its _output_ is". Not that it isn't
doing something else -- we simply can't know. Accessing via the browser
will run the script, which is all we can see from a URL.
-- 
Regards,
Robert McGregor - Email: admin@(remove)2host.com. Phone: 530-941-0690
Server admin, support & programing for shared & dedicated web servers
Secure, reliable hosting you expect and deserve! http://www.2host.com


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

Date: Sat, 09 Nov 2002 06:10:51 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: What is this doing?
Message-Id: <LF1z9.3670$XH4.3359@nwrddc02.gnilink.net>

2Host.com - Robert wrote:
> "2Host.com - Robert" wrote:
>>
>> rafael wrote:
>>>
>>> Is there any way to tell what this perl file is doing? I believe it
>>> is collecting hotmail passwords.
>>>
>>> http://194.226.216.72/cgi-bin/s/upload.pl
>>
>> That script doesn't do anything other than output a META tag to do a
>> refresh. In fact, using a script in that process at all, is not too
>> bright. It's only HTML, no need to use a script.
>>
>> META HTTP-EQUIV="Refresh" CONTENT="0;
>> URL=https://loginnet.passport.com/ppsecure/post.srf"
>>
>> You'll need to ask the site it's forwarding to of their
>> intention/purpose.
>
> I should be clear; "That is what its _output_ is". Not that it isn't
> doing something else -- we simply can't know. Accessing via the
> browser will run the script, which is all we can see from a URL.

To be more precise: this is what you observed as output when you accessed
this URL once.
It might output or do something totally different at different times of the
day or for different people or different browsers or if the admin has hay
fever or the moon is in the third quarter or Mars is in the fourth house of
the sun or .....

jue




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

Date: Fri, 08 Nov 2002 23:30:45 -0800
From: "2Host.com - Robert" <admin@-NOSPAM-2host.com>
Subject: Re: What is this doing?
Message-Id: <3DCCB9A5.D6236302@-NOSPAM-2host.com>



"Jürgen Exner" wrote:
> 
> 2Host.com - Robert wrote:
> > "2Host.com - Robert" wrote:

 ...

> >
> > I should be clear; "That is what its _output_ is". Not that it isn't
> > doing something else -- we simply can't know. Accessing via the
> > browser will run the script, which is all we can see from a URL.
> 
> To be more precise: this is what you observed as output when you accessed
> this URL once.
> It might output or do something totally different at different times of the
> day or for different people or different browsers or if the admin has hay
> fever or the moon is in the third quarter or Mars is in the fourth house of
> the sun or .....
> 
> jue

:-)
-- 
Regards,
Robert McGregor - Email: admin@(remove)2host.com. Phone: 530-941-0690
Server admin, support & programing for shared & dedicated web servers
Secure, reliable hosting you expect and deserve! http://www.2host.com


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

Date: Sat, 09 Nov 2002 06:30:16 GMT
From: John Sellers <newsComments17@sellers.com>
Subject: wish fast method of counting of characters
Message-Id: <3DCCAB67.1070708@sellers.com>

I am going to be doing a lot of counting of characters from a large list 
of strings.

What is the fastest way to do this?  I know that unpack is pretty fast. 
  But is this the way to do it?

Here is some self contained working sample code, do I have as good an 
answer as I am going to get with pure Perl?

#Typical string
$nextString = "bbxslkfjlskjflksdjflksdjfljsdfljsdflkjsdlfkj\n";


# START TIME CRITICAL CODE
@asciiList = unpack( "C*", $nextString );
foreach $anAsciiNumber (@asciiList) {
     # does the hash context conversion of $anAsciiNumber to string slow
     # things down?
     $count{$anAsciiNumber}++
}
# END TIME CRITICAL CODE


$ordNewline = ord("\n");
delete $count{$ordNewline};

@charStrings =sort map( chr, keys %count);

foreach $charString ( @charStrings ) {
     $asciiValue = ord( $charString);

     print "$charString: $count{$asciiValue}\n";
}



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

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


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