RE: fork didn't work

2004-10-27 Thread Jutu Subramanian, Srinivasan (Cognizant)
Title: Message




If anybody know to sort out the problem for the following
exception "run out of memory".It is
throwing for the scenario,
1. Whenevermy tool
call another perl script using fork and
exec.
2. Wheneverto read the CRC
value for the the invalid compressed data to inflate feed file used in
the zip file.
If it is sortable, Please let
me know.
ERROR:
The instruction at "0x023b1c53" referenced memory at "0x0002". The memory
could not be "read". 
Click on OK to terminate the program
Click on CANCEL to debug the program.
script :Perl script version 5.6
OS:windows OS 2000 Service pack 4
regards
Srinivas



  -Original Message-From: Michael G. Jung
  [mailto:[EMAIL PROTECTED]Sent: Tuesday, October 26, 2004
  5:45 PMTo: Jutu Subramanian, Srinivasan (Cognizant);
  [EMAIL PROTECTED]Subject: RE: fork didn't
  work
  
  Each fork under activestate runs as a
  thread. There is a compiled in limit of 64active threads. 
  Why dont you use
  Win32::Process::Create instead or fork?
  Hope this helps.
  --mikejMichael
  Jung
  

-Original Message-From:
[EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
Jutu Subramanian, Srinivasan (Cognizant)Sent: Tuesday,
October 26, 2004 7:56 AMTo:
[EMAIL PROTECTED]Subject: fork didn't
work
Hi,

If
Iexecute the following program, It executes fine tillthe loop
64. fork didn't work at the 65th loop and exit.
Error thrown: fork didn't work: 65=Resource temporarily
unavailablePerl version : 5.6
OS
: windows 2000 SP4
May I know
the reason and how to handle this?


start
program-use Win32::Process;use
Cwd;for(my
$i=1;$i=100;$i++){execFile("$i");}
sub
execFile{ my
$FILTERFILEPATH="D:/PerlEx/perleg/perltoperl/filter.pl";
my($logfile)[EMAIL PROTECTED];  #child process
is created with fork. my $newpid =
fork(); if( $newpid == 0
) { exec
"perl.exe $FILTERFILEPATH $logfile";
} else
{ print("PARENT
PROCESS=$logfile\n"); }}#end of execFileend
program-

regards
Srinivas

  
  
This e-mail and any files
  transmitted with it are for the sole use of the intended recipient(s)
  and may contain confidential and privileged information.If you are
  not the intended recipient, please contact the sender by reply e-mail
  and destroy all copies of the original message. Any unauthorized
  review, use, disclosure, dissemination, forwarding, printing or
  copying of this email or any action taken in reliance on this e-mail
  is strictly prohibited and may be unlawful.Visit us at
  http://www.cognizant.com

This e-mail and any files transmitted with it are for the sole use of the intended recipient(s) and may contain confidential and privileged information.
If you are not the intended recipient, please contact the sender by reply e-mail and destroy all copies of the original message. 
Any unauthorized review, use, disclosure, dissemination, forwarding, printing or copying of this email or any action taken in reliance on this e-mail is strictly 
prohibited and may be unlawful.

  Visit us at http://www.cognizant.com
___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Re: external library

2004-10-27 Thread Sisyphus
[EMAIL PROTECTED] wrote:
We have a centrally located perl directory. I want to have a module of
utility objects I use frequently stored somewhere else that I can reference.
Currently I use something like this:
BEGIN {
push (@INC,v:\\utilities\\perlutil);
}
use utils;
which is in the directory shown. This doesn't seem very elegant to me - is
there a better way to do this? I don't have control over the centrally
located perl files and the scripts are run throughout the organisation based
on this.
Perhaps you prefer:
use lib 'v:\utilities\perlutil';
use utils;
See 'perldoc lib'.
Cheers,
Rob
___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Re: Problem installing DBD::DB2

2004-10-27 Thread Sisyphus
Dave Kazatsky wrote:
Hey Perlers,
Trying to install Bundle::DBD::DB2 but getting the following error:
removing previously used \.cpan\build\DBD-DB2-0.78 Couldn't find a Bundle
in \.cpan\build\DBD-DB20.78 at D:\Perl\lib\cpan.pm line2081
Using perl -MCPAN install Bundle::DBD:DB2
Windows 2000 Server
Perl v5.8.3
DBI v1.45
Any pointers appreciated.
If you want to try for a ppm package try Googling for DBD-DB2 ppd 
(without the quotes).

I don't know if that helps or not.
Other than that, in the absence of a response from anyone familiar with 
the use of CPAN.pm for building modules, you might like to try building 
the module by the old fashioned manual method - where you download the 
module source from CPAN, extract the source to some folder, cd to that 
folder and run (successively) 'perl makefile.pl', 'nmake test' and 
'nmake install' (after first checking the README that comes with the 
source). That way there might be a chance that you (and/or I) are able 
to make sense of any errors produced :-)

I certainly can't make sense of the errors that CPAN.pm reports ... and 
I've no interest in trying.

Cheers,
Rob
___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: external library

2004-10-27 Thread Anderson, Mark (Service Delivery)
Or you can simply:

use lib 'v:/utilities/perlutil';
use utils;

This should work just as well with an ENV var representing your list of
extra INC dirs, too.

Kind regards,

Mark Anderson
Service Improvement Project
Ground Floor, 34 Fettes Row
Edinburgh, EH3 6UY
Tel: 07808 826 063


 -Original Message-
 From: [EMAIL PROTECTED] [SMTP:[EMAIL PROTECTED]
 Sent: Tuesday, October 26, 2004 4:40 PM
 To:   [EMAIL PROTECTED]
 Subject:  external library
 
 *** WARNING : This message originates from the Internet ***
 
 We have a centrally located perl directory. I want to have a module of
 utility objects I use frequently stored somewhere else that I can
 reference.
 Currently I use something like this:
 
 BEGIN {
   push (@INC,v:\\utilities\\perlutil);
 }
 
   use utils;
 
 which is in the directory shown. This doesn't seem very elegant to me - is
 there a better way to do this? I don't have control over the centrally
 located perl files and the scripts are run throughout the organisation
 based
 on this.
 
 Thanks in advance
 
 Peter.
 
 
 
 
 
 __
 This message may contain privileged information. If you have received this
 message by mistake, please keep it confidential and return it to the
 sender.
 
 Although we have taken steps to minimise the risk of transmitting software
 viruses, the EBRD accepts no liability for any loss or damage caused by
 computer viruses and would advise you to carry out your own virus checks. 
 The contents of this e-mail do not necessarily represent the views of the
 EBRD.
 __
 
 ___
 Perl-Win32-Users mailing list
 [EMAIL PROTECTED]
 To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


The Royal Bank of Scotland plc, Registered in Scotland No. 90312. Registered Office: 
36 St Andrew Square, Edinburgh EH2 2YB

The Royal Bank of Scotland plc is authorised and regulated by the Financial Services 
Authority and represents The Royal Bank of Scotland Marketing Group. The Bank sells 
life policies, collective investment schemes and pension products and advises only on 
the Marketing Group's range of these products and on a With-Profit Bond produced by 
Norwich Union Life (RBS) Limited.

This e-mail message is confidential and for use by the addressee only. If the message 
is received by anyone other than the addressee, please return the message to the 
sender by replying to it and then delete the message from your computer. Internet 
e-mails are not necessarily secure. The Royal Bank of Scotland plc does not accept 
responsibility for changes made to this message after it was sent.

Whilst all reasonable care has been taken to avoid the transmission of viruses, it is 
the responsibility of the recipient to ensure that the onward transmission, opening or 
use of this message and any attachments will not adversely affect its systems or data. 
No responsibility is accepted by The Royal Bank of Scotland plc in this regard and the 
recipient should carry out such virus and other checks as it considers appropriate.

___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


WWW::Mechanize question

2004-10-27 Thread assistent
hi ALL!
MY questions are :
1) How to click on image in the page ?/not on button/
2) How to work with dropdown boxes ?
3) how to find coordinates x and y on page ?
___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: fork didn't work

2004-10-27 Thread Jutu Subramanian, Srinivasan (Cognizant)

Hi.,
 If I try with fork, Eventhough parent process is not there, Child process is created 
and child process runs the secondary application. I hope It is not possible instead of 
fork using Win32::Process::Create. Create makes the another process and it is dead 
when the parent process dead. Is there any other way to handle the child process 
should be running though parent is dead. Thanks in advance.

regards
Srinivas

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of
Michael Jung
Sent: Tuesday, October 26, 2004 5:47 PM
To: [EMAIL PROTECTED]
Subject: RE: fork didn't work


I understand that each fork under activestate runs as a thread and I
understnat that there is a compiled in limit of 64 active threads.

Why don't you use Win32::Process::Create instead or fork?

Hope this helps.

--mikej
Michael Jung

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
Jutu Subramanian, Srinivasan (Cognizant)
Sent: Tuesday, October 26, 2004 7:56 AM
To: [EMAIL PROTECTED]
Subject: fork didn't work


Hi ,

If I execute the following program, It executes fine till the loop 64.
fork didn't work at the 65th loop and exit.
Error thrown:  fork didn't work: 65=Resource temporarily unavailable
Perl version :  5.6
OS:  windows 2000 SP4
May I know the reason and how to handle this?


start
program-
 use Win32::Process;
use Cwd;
for(my $i=1;$i=100;$i++)
{
 execFile($i);
}
sub execFile
{
my $FILTERFILEPATH=D:/PerlEx/perleg/perltoperl/filter.pl;

my($logfile)[EMAIL PROTECTED];

#child process is created with fork.
my $newpid = fork();

if( $newpid == 0 )
{
exec perl.exe $FILTERFILEPATH $logfile;
}
else
{
print(PARENT PROCESS=$logfile\n);
}
}#end of execFile
end
program-

regards
Srinivas
This e-mail and any files transmitted with it are for the sole use of the
intended recipient(s) and may contain confidential and privileged
information.
If you are not the intended recipient, please contact the sender by reply
e-mail and destroy all copies of the original message.
Any unauthorized review, use, disclosure, dissemination, forwarding,
printing or copying of this email or any action taken in reliance on this
e-mail is strictly
prohibited and may be unlawful.

Visit us at http://www.cognizant.com

___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

This e-mail and any files transmitted with it are for the sole use of the intended 
recipient(s) and may contain confidential and privileged information.
If you are not the intended recipient, please contact the sender by reply e-mail and 
destroy all copies of the original message.
Any unauthorized review, use, disclosure, dissemination, forwarding, printing or 
copying of this email or any action taken in reliance on this e-mail is strictly
prohibited and may be unlawful.

  Visit us at http://www.cognizant.com

___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


perl -e 'comand' doesn't work

2004-10-27 Thread gliu25
Hi, 
  I am using Perl v5.6.0 623 build from ActivePerl. When I issue perl -e 'command', it 
should execute the command as described in the documentation.  Could anybody shed any 
light on this?  Thanks.

D:\Perl\binperl -e 'print xxx'
Can't find string terminator ' anywhere before EOF at -e line 1.

D:\Perl\binperl -e 'print xxx;'
Can't find string terminator ' anywhere before EOF at -e line 1.

D:\Perl\binperl -e print ;

D:\Perl\binperl -e print xxx



___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Re: perl -e 'comand' doesn't work

2004-10-27 Thread Dana Doten
gliu25,

Try this:

perl -e print \xxx\;

Have to escape the quotes in the code.

Have fun,

Dana

Wednesday, October 27, 2004, 10:21:38 AM, you wrote:

 Hi, 
   I am using Perl v5.6.0 623 build from ActivePerl. When I issue
 perl -e 'command', it should execute the command as described in the
 documentation.  Could anybody shed any light on this?  Thanks.

D:\Perl\binperl -e 'print xxx'
 Can't find string terminator ' anywhere before EOF at -e line 1.

D:\Perl\binperl -e 'print xxx;'
 Can't find string terminator ' anywhere before EOF at -e line 1.

D:\Perl\binperl -e print ;

D:\Perl\binperl -e print xxx



 ___
 Perl-Win32-Users mailing list
 [EMAIL PROTECTED]
 To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Re: perl -e 'comand' doesn't work

2004-10-27 Thread $Bill Luebkert
[EMAIL PROTECTED] wrote:

 Hi, 
   I am using Perl v5.6.0 623 build from ActivePerl. When I issue perl -e 'command', 
 it should execute the command as described in the documentation.  Could anybody shed 
 any light on this?  Thanks.
 
 D:\Perl\binperl -e 'print xxx'
 Can't find string terminator ' anywhere before EOF at -e line 1.
 
 D:\Perl\binperl -e 'print xxx;'
 Can't find string terminator ' anywhere before EOF at -e line 1.
 
 D:\Perl\binperl -e print ;
 
 D:\Perl\binperl -e print xxx

None of those are valid syntax in both the cmd shell and perl.

perl -e print qq{xxx\n}

perl -e print 'xxx'

PS: You should always end a line with \n to make sure it's forced out
with buffering on - so I don't recommend the seccond form.

-- 
  ,-/-  __  _  _ $Bill LuebkertMailto:[EMAIL PROTECTED]
 (_/   /  )// //   DBE CollectiblesMailto:[EMAIL PROTECTED]
  / ) /--  o // //  Castle of Medieval Myth  Magic http://www.todbe.com/
-/-' /___/__/_/_http://dbecoll.tripod.com/ (My Perl/Lakers stuff)
___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: perl -e 'comand' doesn't work

2004-10-27 Thread Joseph Discenza
[EMAIL PROTECTED] wrote, on Wednesday, October 27, 2004 10:22 AM
:I am using Perl v5.6.0 623 build from ActivePerl. When I 
:  issue perl -e 'command', it should execute the command as 
:  described in the documentation.  Could anybody shed any 
:  light on this?  Thanks.

Your subject line says it all.

Single quotes don't work in the DOS shell for perl -e. Maybe someone knows
why, but it's a shell thing. You also have to use qq(..) instead of double
quotes inside your one-liners, or the shell thinks it's the end of the
command.

Good luck,

Joe

==
  Joseph P. Discenza, Sr. Programmer/Analyst
   mailto:[EMAIL PROTECTED]
 
  Carleton Inc.   http://www.carletoninc.com
  574.243.6040 ext. 300fax: 574.243.6060
 
Providing Financial Solutions and Compliance for over 30 Years
* Please note that our Area Code has changed to 574! *  



___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: list of random integers

2004-10-27 Thread Dinger, Tom
Obsessive-Compulsive

1234567890123456789012345678901234567890123456789012345678901234567890123456
7890
When I first thought about the problem, I thought of suffling algorithms,
just
as Charles did, because it guarantees that the N of x+1 distributions
(selecting N numbers out of a list of x+1) fairly can be guaranteed. If you
simply get another random number when you have a collision, you might
skew the results probabilistically.

Shuffling algorithms work as follows:
1. Select the first item from the x+1 items with a random number from
   0 to x.  Remove that item from the set remaining
2. Select the next item from the x items remaining with a random number
   from 0 to x-1.  Remove that item from the set remaining.
...

This continues until enough items have been selected.  A full shuffle uses
x random numbers for a set of x+1 items (the last one selected is the
only one left, so no random number is needed).  For a uniform random 
number generator, this guarantees the generation of the subsets with the
correct probability.

Then it occurred to me that in the case of a large starting set (x being
very large), you really don't want to have to construct the entire list
just to select a few items from the list.  In this case, most of the list
of numbers from 0 to x will simply contain a copy of the index, so a
space-efficient approach will store just the exceptions: those in the
the virutal list being shuffle-selected that do not contain their own
index.

So I implemented the partial shuffle with an explicit list (below in
function RandomList_TD1()) and with a virtual list (in function
RandomList_TD2()).

Then I said, what the heck, let's Benchmark those routines with the ones
you folks have already posted to the list, and see how they do for various
values of N and x.

So below, you will find the test script containing all the versions so far,
as well as a version of Bill Luebkert's that I modified somewhat to get
another 10% speedup (roughly 8% to 13%), mostly from replacing use of $_
with a my variable.

Enjoy!

=== Results 
-
Small numbers: N == 5, x == 6 (numbers from 0 to 6):

RateBill Bob   BobTD TD1 TD2 Charles
Bill 20467/s  ---56%-59%-62%-63%-88%
Bob  46880/s129%  -- -7%-13%-16%-73%
BobTD50471/s147%  8%  -- -7% -9%-71%
TD1  54080/s164% 15%  7%  -- -3%-69%
TD2  55684/s172% 19% 10%  3%  ---68%
Charles 173514/s748%270%244%221%212%  --

All of them do pretty well, except Bill; Charles does great, because
the shuffle() function in List::Util is implemented with XS code.
Those routines that keep picking random numbers until a non-duplicate
is chosen suffer from all those collisions.

-
More typical for the OP: N == 5, x == 200:

   Rate TD1 CharlesBill TD2 Bob   BobTD
TD1 11196/s  ---22%-52%-74%-77%-79%
Charles 14434/s 29%  ---39%-67%-71%-73%
Bill23544/s110% 63%  ---46%-52%-56%
TD2 43685/s290%203% 86%  ---11%-18%
Bob 49297/s340%242%109% 13%  -- -8%
BobTD   53418/s377%270%127% 22%  8%  --

This time Charles doesn't do so well, because his function is shuffling
many elements that are not needed, i.e. calling rand() too often,
with int -- float -- int conversions.

-
As N nears x, we see another change: N == 180, x == 200:

   RateBill Bob   BobTD TD2 TD1 Charles
Bill  393/s  ---64%-67%-76%-76%-96%
Bob  1105/s181%  -- -6%-34%-34%-89%
BobTD1175/s199%  6%  ---29%-29%-88%
TD2  1664/s323% 51% 42%  -- -0%-83%
TD1  1667/s324% 51% 42%  0%  ---83%
Charles 10058/s   2457%811%756%505%503%  --

Those routines that keep picking random numbers until a non-duplicate
is chosen suffer from too many collisions; again, Charles does well
because shuffle() is XS code.  For me, the finish order is nearly the
same as for the first test above.

-
For very large x: N == 180, x == 1_000_000:

  Rate Charles TD1Bill TD2 Bob   BobTD
Charles 2.00/s  ---15%   -100%   -100%   -100%   -100%
TD1 2.35/s 17%  --   -100%   -100%   -100%   -100%
Bill 740/s  36979%  31469%  ---44%-55%-58%
TD2 1331/s  66553%  56647% 80%  ---20%-25%
Bob 1662/s  83136%  70766%124% 25%  --  

RE: Mark's brain teasing JAPH [LONG]

2004-10-27 Thread Thomas, Mark - BLS CTR
 That's one convoluted JAPH!

Thanks.

 I like to pick through admirable JAPH's like this in an 
 attempt to learn more Perl idiosyncrasies [...]
 Anyone care to explain what's going on?

How about I tell you how I created it, which I think makes it easier to see
what's going on.

Every JAPH starts out with a small idea on some transormation of the phrase
Just Another Perl Hacker. I noticed there are repeated letters in that
phrase, so I decided to collapse the phrase down to just the unique letters
and then rebuild the phrase by indexing them.

  # Reduce to unique characters
  $japh = 'Just another Perl hacker';
  $letter{$_}++ foreach split//, $japh;
  print join , sort keys %letter;

So now I'm working with the string  JPacehklnorstu. But that string
doesn't have to be in any particular order, so it's off to the Internet
Anagram Server (http://www.wordsmith.org/anagram/) to make things
interesting. There are lots of funny results, and I ended up making a few
different versions of the JAPH with them. The one you saw was steal Porch
Junk.

So now, I just create a list of indices to extract the proper phrase back
out. I could simply use the following:

  @indices = (12,13,0,1,5,3,14,7,1,10,2,8,5,6,2,8,4,5,10,3,9,15,2,8);

But that would be boring. And take up quite a bit of space. I noticed that
the range is 0..15 or one nybble (half a byte). I could pack all 24 indices
in just 12 bytes! I decided to represent the bytes as hex characters:

  # pack 'em into bytes.
  while (@indices) {
$byte = (shift(@indices)4)|shift(@indices);
printf('%x',$byte);
  }

So now I'm working with the string cd0153e71a28562845a39f28. To extract
the indices, I just have to use hex() on each character in that string.

So now, let's put together a first cut at the JAPH, using the techniques
above:

  $_=steal Porch Junk; @_=split //;  # put the letters in @_
  $_=cd0153e71a28562845a39f28;   # put the indices in $_
  s/(.)/$_[hex($1)]/ge;# replace each index with its letter
  print;   # print it out

Now the fun part... let's obfuscate it a bit. Adding another e to the
regex is low-hanging fruit. We just assemble the '$_[hex($1)]' part via
concatenated strings:

  s/(.)/'$_[' . 'hex' . '($1)]'/gee;

I don't like the quotes. Too obvious. Lets change them to q() but use '.'
instead of the parens (anyone who gets confused by this needs to read
perldoc perlop):

  s/(.)/q.$_[. . q.hex. . q.($1)]./gee;

Looking better, but that 'hex' stands out like a sore thumb. Noticing that
the h and e are in our letter list (@_), I decide to assemble the 'hex',
which is just a string at this point, from those letters (h = $_[10], e
= $_[2]), leaving the 'x':

  s/(.)/q.$_[. . $_[10] . $_[2] . q.x. . q.($1)]./gee

Better. Now let's get rid of the quotes from the rest of the JAPH too, using
q.. and q==

  $_=q;steal Porch Junk;;split //;
  $_=q=cd0153e71a28562845a39f28=;
  s/(.)/q.$_[. . $_[10] . $_[2] . q.x. . q.($1)]./gee;
  print;

Now let's break up that hex string in the second line. I see it has three
28's, so we can do a substitution. What should we replace it with? The
string s/ is about as diabolical as any. ;q would have been a good one
too. I chose the former. In our y// (or y;; to be tricky) lets also replace
the a's with ;. We'll also insert a newline, which we take back out with
a s/\n//;

  $_=q;steal Porch Junk;;split//;$_=q=cd0153e71;
  s/56s/45;39fs/=;
  y;\;s/;a28;;
  s;\n;;;
  s/(.)/q.$_[. . $_[10] . $_[2] . q.x. . q.($1)]./gee;
  print;

Now let's smash it up a bit:

  $_=q;steal Porch Junk;;split//;$_=q=cd0153e71;
  s/56s/45;39fs/=;y;\;s/;a28;;s;\n;;;
  s/(.)/q.$_[..$_[10].$_[2].q.x..q.($1)]./gee;print;
  
Looking kinda JAPHy now, isn't it? There's a few more things we can do. The
y operator can take extra chars at the end without consequence. We'll add
another decoy 's/'. In the first substitution, let's replace '\n' with '$/'.

  $_=q;steal Porch Junk;;split//;$_=q=cd0153e71;
  s/56s/45;39fs/=;y;\;s/;a28s/;;s;$/;;;
  s((.))/q.$_[..$_[10].$_[2].q.x..q.($1)]./gee;print;

Now, let's work on the substitution again. We can split it between lines,
and change s/// to s()//. Also we can change the ';' before print to a '/',
which is interpreted as a divide, but will still evaluate the 'print' with a
warning under -w which we don't care about.

  $_=q;steal Porch Junk;;split//;$_=q=cd0153e71;
  s/56s/45;39fs/=;y;\;s/;a28s/;;s;$/;;;s((.))/
  q.$_[..$_[10].$_[2].q.x..q.($1)]./gee/print;

More stuff: Let's insert some ';' where they won't make a difference, and
remove one from the end. Then I want to pad the last line by 2 chars because
I like to make the lines equal length. We can add $. (which contains nothing
outside a loop) to the substitution string.

  $_=q;steal Porch Junk;;split//;$_=q=cd0153e71;
  s/56s/45;39fs/=;y;\;s/;a28s/;;;s;$/;;;s((.))/;
  q.$_[.$..$_[10].$_[2].q.x..q.($1)]./gee/print;

More can always be done, but at this point it looks good enough for me.


Prepared database handle problem

2004-10-27 Thread John Deighan
The following simple script gives me the error message Can't rebind 
placeholder 3 at C:\Scripts\temp.pl line 14. (i.e. at the execute() call) 
and I can't figure out why. I'm using the DBD-ODBC driver and a SQL Server 
database. The SqlStmtTestUtils.pm library just provides the getConn() 
function, and I've verified that the database handle is OK. The table 
involved was created with:

create table TestTable (
ID integer primary key,
Name varchar(32)   unique,
DateEntered smalldatetime null
)
If I change SQL_DATE to SQL_VARCHAR, it works, but I'm using the ODBC 
standard date format, just like it says in the DBI documentation. Any ideas?

---
use strict;
use DBI qw(:sql_types);
use SqlStmtTestUtils;
my $db = getConn();
my $sth = $db-prepare();
insert into TestTable
(ID,Name,DateEntered)
values(?,?,?)
$sth-bind_param(1, 1,  SQL_INTEGER);
$sth-bind_param(2, 'John Doe', SQL_VARCHAR);
$sth-bind_param(3, '2004-05-05', SQL_DATE);
$sth-execute();
___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: Prepared database handle problem

2004-10-27 Thread Peter Guzis
I've never had any luck using date/time specific data types with DBD::ODBC.  Just use 
SQL_VARCHAR and you'll be fine.

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of
John Deighan
Sent: Wednesday, October 27, 2004 3:00 PM
To: [EMAIL PROTECTED]
Subject: Prepared database handle problem


The following simple script gives me the error message Can't rebind 
placeholder 3 at C:\Scripts\temp.pl line 14. (i.e. at the execute() call) 
and I can't figure out why. I'm using the DBD-ODBC driver and a SQL Server 
database. The SqlStmtTestUtils.pm library just provides the getConn() 
function, and I've verified that the database handle is OK. The table 
involved was created with:

create table TestTable (
ID integer primary key,
Name varchar(32)   unique,
DateEntered smalldatetime null
)

If I change SQL_DATE to SQL_VARCHAR, it works, but I'm using the ODBC 
standard date format, just like it says in the DBI documentation. Any ideas?

---

use strict;
use DBI qw(:sql_types);
use SqlStmtTestUtils;

my $db = getConn();
my $sth = $db-prepare();
insert into TestTable
(ID,Name,DateEntered)
values(?,?,?)

$sth-bind_param(1, 1,  SQL_INTEGER);
$sth-bind_param(2, 'John Doe', SQL_VARCHAR);
$sth-bind_param(3, '2004-05-05', SQL_DATE);
$sth-execute();

___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: Prepared database handle problem

2004-10-27 Thread Steven Manross
I initially was having issues with the same thing, but through some
digging, found GOOGLED articles that suggest this as a fix...  I never
thought to use a VARCHAR though.

$sth-bind_param(3, '2004-05-05',{TYPE = SQL_DATETIME});

I'm not 100% sure about the syntax differences from just sending the
SQL_DATETIME as opposed to wrapping it in a hash as a TYPE and
remember some issues, but it could be that I was still banging my head
on the SQL_DATE problem at the time, so...  I always say..  Use what
works.

:)

Good luck.  HTH

Steven

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
Peter Guzis
Sent: Wednesday, October 27, 2004 3:09 PM
To: John Deighan; [EMAIL PROTECTED]
Subject: RE: Prepared database handle problem


I've never had any luck using date/time specific data types with
DBD::ODBC.  Just use SQL_VARCHAR and you'll be fine.

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of
John Deighan
Sent: Wednesday, October 27, 2004 3:00 PM
To: [EMAIL PROTECTED]
Subject: Prepared database handle problem


The following simple script gives me the error message Can't rebind 
placeholder 3 at C:\Scripts\temp.pl line 14. (i.e. at the execute()
call) 
and I can't figure out why. I'm using the DBD-ODBC driver and a SQL
Server 
database. The SqlStmtTestUtils.pm library just provides the getConn() 
function, and I've verified that the database handle is OK. The table 
involved was created with:

create table TestTable (
ID integer primary key,
Name varchar(32)   unique,
DateEntered smalldatetime null
)

If I change SQL_DATE to SQL_VARCHAR, it works, but I'm using the ODBC 
standard date format, just like it says in the DBI documentation. Any
ideas?

---

use strict;
use DBI qw(:sql_types);
use SqlStmtTestUtils;

my $db = getConn();
my $sth = $db-prepare();
insert into TestTable
(ID,Name,DateEntered)
values(?,?,?)

$sth-bind_param(1, 1,  SQL_INTEGER);
$sth-bind_param(2, 'John Doe', SQL_VARCHAR);
$sth-bind_param(3, '2004-05-05', SQL_DATE);
$sth-execute();

___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs