[23045] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 5266 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Jul 24 11:06:04 2003

Date: Thu, 24 Jul 2003 08:05:09 -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           Thu, 24 Jul 2003     Volume: 10 Number: 5266

Today's topics:
    Re: Authentication with LWP <cat@no-spam.com>
    Re: Called as method or subroutine? <REMOVEsdnCAPS@comcast.net>
    Re: Called as method or subroutine? <grazz@pobox.com>
    Re: CGI.pm problem under Redhat Linux 9.0 (perl-5.8.0) (Tad McClellan)
    Re: CGI.pm problem under Redhat Linux 9.0 (perl-5.8.0) <marmot101@yahoo.com>
    Re: CGI.pm problem under Redhat Linux 9.0 (perl-5.8.0) <dwilga-MUNGE@mtholyoke.edu>
    Re: Chomp temporarily nullifies my scalar variable. (Tad McClellan)
    Re: Chomp temporarily nullifies my scalar variable. <jandellis@hotmail.com>
    Re: Chomp temporarily nullifies my scalar variable. <noreply@gunnar.cc>
        Command too long <noway@yeahright.com>
    Re: Command too long <abigail@abigail.nl>
    Re: Command too long <shawn@magma.ca>
    Re: Correct file handling on Linux <abigail@abigail.nl>
    Re: cwd with Net::SFTP news@roaima.freeserve.co.uk
    Re: Data::Dumper vs perl -d (Peter Scott)
        DBI + mysql <galli@molgen.mpg.de>
    Re: DBI + mysql (Glenn Jackman)
    Re: how to initialize size of DOS Window? <jimbo@soundmiges.co.uk>
    Re: Larry W... out of work ??  Impossible... or... <me@privacy.net>
    Re: Larry W... out of work ??  Impossible... or... <mpapec@yahoo.com>
        Net::IMAP::Simple <hasting@agere.com>
        OLE Excel Perl Coding Problems <peter_wilson@mail.com>
    Re: pass all cgi parameters to an exe <d@d.com>
    Re: Q- Empirical usable upper limit on hash array numbe (Andrew Perrin (CLists))
    Re: recompile Perl, with new function names ? news@roaima.freeserve.co.uk
    Re: Style question regarding subroutines and lexical va (Tad McClellan)
    Re: Style question regarding subroutines and lexical va <jandellis@hotmail.com>
    Re: Style question regarding subroutines and lexical va <ubl@schaffhausen.de>
    Re:  <bwalton@rochester.rr.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Thu, 24 Jul 2003 20:39:00 +1000
From: Cat <cat@no-spam.com>
Subject: Re: Authentication with LWP
Message-Id: <3F1FB744.65044F50@no-spam.com>

Avatar wrote:
> 
> I am trying to login to this website so I can access the information.
> Here is the code I am trying:
> 
> use strict;
> use warnings;
> use LWP;
> my $browser=LWP::UserAgent->new;
> 
> $browser->credentials(
> 'http://ibol29-01-ldn.ibb.ubs.com/pages/derivatives/indexes.jsp?TabM1=3:80',
> 'Client login',
> 'usname' => 'pswd');
> 
> my $response=$browser->get(
> 'http://ibol29-01-ldn.ibb.ubs.com/pages/derivatives/indexes.jsp?TabM1=3:80'
> );
> 
> print $response->content;
> 
> I cannot give the real password, but the url is correct, though :80 is
> the port so it doesn't have to be there.
> 
> The result of running this gives me:
> 
> <html>
> <head>
> <meta http-equiv="refresh"
> content="0;URL=https://clientlogin.ibb.ubs.com/login?
> _URI=aHR0cDovL2lib2wyOS0wMS1sZG4uaWJiLnVicy5jb20vcGFnZXMvZGVyaXZhdGl2ZXMvaW5kZXh
> lcy5qc3A%2FVGFiTTE9Mzo4MA%3D%3D">
> </head>
> <body></body>
> </html>
> 
> and when I comment out browser->credentials, I get the same result.
> 
> My first question is, how to get the correct realm, because I am aware
> that 'Client login' is not accurate.
> 
> And my second quesiton is, when I do have the correct realm, how do I
> use browser-credentials correctly to get the information I want.  If I
> left anything out, please let me know, by private email or follow-up
> posts.  Thanks in advance for your help.

Untested, but it should be similar to 

#!/bin/perl
use strict;
use warnings;
use LWP::UserAgent;

my $url="http://ibol29-01-ldn.ibb.ubs.com/pages/derivatives/indexes.jsp?TabM1=3:80";
my $ua = LWP::UserAgent->new;
my $req; #Request
my $res; #Response
my $username = 'avatar';
my $password = 'password';

$req = HTTP::Request->new(GET => $url);
$req->authorization_basic($username, $password);
$res = $ua->request($req);
if ($res->is_success) {
  print($res->content);
}
else {
  print("Something not quite right!\n");
}


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

Date: Thu, 24 Jul 2003 05:32:42 -0500
From: "Eric J. Roode" <REMOVEsdnCAPS@comcast.net>
Subject: Re: Called as method or subroutine?
Message-Id: <Xns93C24286B5B1Csdn.comcast@206.127.4.25>

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

Martien Verbruggen <mgjv@tradingpost.com.au> wrote in 
news:slrnbhur9v.1le.mgjv@verbruggen.comdyn.com.au:

> The only way in which these two calls can ever be reasonably the same
> is if the first argument were ignored when it's called as
> MyClass->mySub(), and that can be done by simply discarding the first
> argument when it's equal to __PACKAGE__. 
> 
> sub MyClass::mySub
> {
>     shift if $_[0] eq __PACKAGE__;
>     # do stuff...
> }

And this is where it breaks inheritance.  If I later write a new class 
MyOtherClass and expect to inherit mySub, and someone invokes it as:

    MyOtherClass->mySub(@arguments);

the package name will not be removed.

- -- 
Eric
$_ =  reverse sort qw p ekca lre Js reh ts
p, $/.r, map $_.$", qw e p h tona e; print

-----BEGIN xxx SIGNATURE-----
Version: PGPfreeware 7.0.3 for non-commercial use <http://www.pgp.com>

iQA/AwUBPx+1tGPeouIeTNHoEQKIeACfQHGZkS3VywQ/ctUIiGldcn70JsEAoJJN
58XdGCDNN/ZhqA2grkziZLoP
=9109
-----END PGP SIGNATURE-----


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

Date: Thu, 24 Jul 2003 14:31:08 GMT
From: Steve Grazzini <grazz@pobox.com>
Subject: Re: Called as method or subroutine?
Message-Id: <M4STa.23491$0F4.22476@nwrdny02.gnilink.net>

Eric J. Roode <REMOVEsdnCAPS@comcast.net> wrote:
> Martien Verbruggen <mgjv@tradingpost.com.au> wrote:
> > The only way in which these two calls can ever be reasonably the same
> > is if the first argument were ignored when it's called as
> > MyClass->mySub(), and that can be done by simply discarding the first
> > argument when it's equal to __PACKAGE__. 
> > 
> > sub MyClass::mySub
> > {
> >     shift if $_[0] eq __PACKAGE__;
> >     # do stuff...
> > }
> 
> And this is where it breaks inheritance.  If I later write a new class 
> MyOtherClass and expect to inherit mySub, and someone invokes it as:
> 
>     MyOtherClass->mySub(@arguments);
> 
> the package name will not be removed.

You could use 

    shift if UNIVERSAL::isa($_[0], __PACKAGE__);

But that still doesn't handle Class::sub("Class").

> - -- 

And what's that supposed to be?  :-)

-- 
Steve


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

Date: Thu, 24 Jul 2003 08:10:56 -0500
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: CGI.pm problem under Redhat Linux 9.0 (perl-5.8.0)
Message-Id: <slrnbhvmn0.7pm.tadmc@magna.augustmail.com>

marmot101 <marmot101@yahoo.com> wrote:

>     use CGI /:standard/;


You should always enable warnings when developing Perl code!


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


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

Date: Thu, 24 Jul 2003 09:54:50 -0400
From: "marmot101" <marmot101@yahoo.com>
Subject: Re: CGI.pm problem under Redhat Linux 9.0 (perl-5.8.0)
Message-Id: <XyRTa.8$hn1.14408@news.uswest.net>

Thanks for your help!

1. However, on Redhat Linux 9.0, I don't find file/directory "@INC", I even
start searching it from
/,
    find . -name *@INC* -print
And no result. Funny thing is, I installed another Perl-5.8.0 at /usr/local,
there is still no "@INC"

2. So I copy CGI.pm.newcgi as CGI.pm, now it works fine. But I really don't
think that's the right way -- I can't believe that Redhat is so stupid that
forcing user to make so weird copy.

3. After this copy, perldoc -l CGI shows it at /usr/lib/perl5/5.8.0 -- it
gets satisfied now :-)

Best Regards,

marmot101


"James Willmore" <jwillmore@cyberia.com> wrote in message
news:20030724011242.554b18c5.jwillmore@cyberia.com...
> >     use CGI /:standard/;
>
> try:
> use CGI qw/:standard/;
>
> Looks like you forgot the qw
>
> > I went to perl directory: /usr/lib/perl5/5.8.0. There is no CGI.pm,
> > but there is a CGI.pm.newcgi. What should I do? rename this
> > CGI.pm.newcgi to CGI.pm? that sounds weird ...
>
> '.pm' files are going to be located, typically, in your @INC
> directories, so you won't see it in the place you were looking.  But,
> if you REALLY want to find the exact location of the file, type:
>
> perldoc -l CGI
>
> HTH
>
> Jim




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

Date: Thu, 24 Jul 2003 14:13:06 GMT
From: Dan Wilga <dwilga-MUNGE@mtholyoke.edu>
Subject: Re: CGI.pm problem under Redhat Linux 9.0 (perl-5.8.0)
Message-Id: <dwilga-MUNGE-7E1630.10130324072003@nap.mtholyoke.edu>

I would also strongly recommend you use CPAN to upgrade to the latest 
version of CGI.pm. The installation that comes with RH 9.0 seems to be 
incomplete.

use either:

  cpan

or 

  perl -MCPAN -e shell

and then "install CGI".

-- 
Dan Wilga          dwilga-MUNGE@mtholyoke.edu
** Remove the -MUNGE in my address to reply **


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

Date: Thu, 24 Jul 2003 08:31:02 -0500
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: Chomp temporarily nullifies my scalar variable.
Message-Id: <slrnbhvnsm.7pm.tadmc@magna.augustmail.com>

Joseph Ellis <jandellis@hotmail.com> wrote:

> s/\r//  does the trick.


Then this will do the trick, only faster:

   tr/\r//d;


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


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

Date: Thu, 24 Jul 2003 14:06:51 GMT
From: Joseph Ellis <jandellis@hotmail.com>
Subject: Re: Chomp temporarily nullifies my scalar variable.
Message-Id: <6upvhv44b6nham5dc4mvh5pknuejvrj4v3@4ax.com>

On Thu, 24 Jul 2003 08:31:02 -0500, tadmc@augustmail.com (Tad
McClellan) wrote:

>Joseph Ellis <jandellis@hotmail.com> wrote:
>
>> s/\r//  does the trick.
>
>
>Then this will do the trick, only faster:
>
>   tr/\r//d;

Thanks, I'll look that up.  I assume perlre would be a good place to
look?

Joseph



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

Date: Thu, 24 Jul 2003 16:22:18 +0200
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: Chomp temporarily nullifies my scalar variable.
Message-Id: <bfoq1b$h2raq$1@ID-184292.news.uni-berlin.de>

Joseph Ellis wrote:
> On Thu, 24 Jul 2003 08:31:02 -0500, tadmc@augustmail.com (Tad 
> McClellan) wrote:
> 
>> Then this will do the trick, only faster:
>> 
>>   tr/\r//d;
> 
> Thanks, I'll look that up.  I assume perlre would be a good place
> to look?

perlop is a better bet. tr/// does not make use of regular expressions.

-- 
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl



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

Date: Thu, 24 Jul 2003 06:48:30 -0700
From: "Foomy" <noway@yeahright.com>
Subject: Command too long
Message-Id: <bfoo3e$kkj$1@coset.qualcomm.com>

I have a customer with the following problem:

Perl is trying to invoke a system account but the command line is longer
than Windows 2k can handle.   Wants to know what he can do about it.  He
believes that is the problem but isn't sure.

Does this sound familiar? Please help and let me know if you need further
details.

TIA




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

Date: 24 Jul 2003 13:53:42 GMT
From: Abigail <abigail@abigail.nl>
Subject: Re: Command too long
Message-Id: <slrnbhvp76.10c.abigail@alexandra.abigail.nl>

Foomy (noway@yeahright.com) wrote on MMMDCXIV September MCMXCIII in
<URL:news:bfoo3e$kkj$1@coset.qualcomm.com>:
##  I have a customer with the following problem:
##  
##  Perl is trying to invoke a system account but the command line is longer
##  than Windows 2k can handle.   Wants to know what he can do about it.  He
##  believes that is the problem but isn't sure.
##  
##  Does this sound familiar? Please help and let me know if you need further
##  details.


What happens if you try to do the command from the command line?
What happens if you try to do the command from a C program?

If you get the same failures, it's not a Perl issue, but a W2K one.



Abigail
-- 
perl -wle'print"Κυστ αξοτθες Πεςμ Θαγλες"^"\x80"x24'


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

Date: Thu, 24 Jul 2003 10:11:56 -0400
From: Shawn Corey <shawn@magma.ca>
Subject: Re: Command too long
Message-Id: <8O2cnbAbYqIOdYKiXTWJjA@magma.ca>

Hi,

Store the command line in a file and read into the perl program. It will 
have to parse the line and set up @ARGV.

Foomy wrote:

> I have a customer with the following problem:
> 
> Perl is trying to invoke a system account but the command line is longer
> than Windows 2k can handle.   Wants to know what he can do about it.  He
> believes that is the problem but isn't sure.
> 
> Does this sound familiar? Please help and let me know if you need further
> details.
> 
> TIA
> 
> 



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

Date: 24 Jul 2003 07:21:49 GMT
From: Abigail <abigail@abigail.nl>
Subject: Re: Correct file handling on Linux
Message-Id: <slrnbhv28d.157.abigail@alexandra.abigail.nl>

Jon (jon18_uk2002@yahoo.co.uk) wrote on MMMDCXIII September MCMXCIII in
<URL:news:83bd902f.0307231416.27e72bc1@posting.google.com>:
 ..  Lately I have been reviewing how my Perl scripts handles files they
 ..  write to, as until now I have already taken for granted that it will
 ..  "just work", so many of my scripts never stopped when they could not
 ..  write to or read a file.
 ..  
 ..  My normal setup is Perl 5.6.0, Linux 2.4.x kernel, ext2 filesystem
 ..  (although our newer servers do use ext3, however unfortunately most
 ..  still use ext2).
 ..  
 ..  open(LOG,">>/path/to/file") or &bad_file;
 ..  print LOG "xx";
 ..  close(LOG);
 ..  
 ..  Now that works fine, and if the path is invalid it will error out
 ..  nicely, however, one of my scripts has the possibility of being run
 ..  regularly, each time it will write to a file.
 ..  
 ..  So my question is, if 2 scripts run at the same split second and get
 ..  around to writing to the same file at the same time what would be the
 ..  result?  Would one fail and the other succeed, or would the file be
 ..  damaged maybe (if I was using the above code for example).


It depends. Normally, when more than one process writes to a file,
you need to flock it. However, since you open the file in APPEND
mode, you might be able to get away with it, as the OS will do a
seek to the end just before each write(). You'll have to make sure
that each print results in a write though. Hence, you might want
to unbuffer your handle, and make sure no print exceeds the size
of a block. And you should also work on a local file system, not
an NFS one.

If you are not sure, flock.

Abigail
-- 
BEGIN {$^H {join "" => ("a" .. "z") [8, 13, 19, 4, 6, 4, 17]} = sub
           {["", "Just ", "another ", "Perl ", "Hacker"] -> [shift]};
       $^H = hex join "" => reverse map {int ($_ / 2)} 0 .. 4}
print 1, 2, 3, 4, "\n";


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

Date: Thu, 24 Jul 2003 12:57:39 +0100
From: news@roaima.freeserve.co.uk
Subject: Re: cwd with Net::SFTP
Message-Id: <j6u4v-glj.ln1@moldev.cmagroup.co.uk>

Inna <innaga@amdocs.com> wrote:
> There is an option to use 'cwd' with the Net::FTP. How can I perform
> this action with the SFTP (I didn't find it in the info pages of
> Net::SFTP)?

Answered in comp.lang.perl.modules. Please don't multipost.
Chris
-- 
@s=split(//,"Je,\nhn ersloak rcet thuarP");$k=$l=@s;for(;$k;$k--){$i=($i+1)%$l
until$s[$i];$c=$s[$i];print$c;undef$s[$i];$i=($i+(ord$c))%$l}


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

Date: Thu, 24 Jul 2003 14:12:05 GMT
From: peter@PSDT.com (Peter Scott)
Subject: Re: Data::Dumper vs perl -d
Message-Id: <VORTa.503822$ro6.11931986@news2.calgary.shaw.ca>

In article <NmzTa.98495$ye5.17561926@news4.srv.hcvlny.cv.net>,
 "Bill Smith" <wksmith@optonline.net> writes:
>I have noticed that many of the frequent posters recommend Data::Dumper
>for debugging data structure and reference problems.  I have always used
>the "x" command in the perl debugger.
>
>The debugger offers several advantages.  The original script does not
>have to be temporarily changed.  The dump can be limited to critical
>loop iterations.  Alternate syntax can often be tested in the debugging
>session.
>
>What advantages of the module approach am I overlooking?

It really depends on what you're dumping the data for.   If you're doing
it for debugging, then yes, the 'x' command is likely to be easier than
typing "use Data::Dumper; print Dumper...", finding out "oops, that's not
the variable I wanted after all," quitting, editing, running it again, etc.

But if you want to routinely dump out information for any other purpose,
then I don't see why you'd use the debugger.  And then there are the
environments where the debugger is difficult or impossible to use (in
addition to the ones mentioned, there are timing-critical applications
that don't give you time to enter debugger commands).

-- 
Peter Scott
http://www.perldebugged.com


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

Date: Thu, 24 Jul 2003 14:54:21 +0200
From: Raffaello Galli <galli@molgen.mpg.de>
Subject: DBI + mysql
Message-Id: <Pine.OSF.4.31.0307241451060.32421-100000@harry.molgen.mpg.de>

HI

I am using DBI and I tried the following code with Oracle and Mysql to
read query metadata:


$sth = $dbi->prepare($statement);
$sth->execute();
for ( $t=1; $t <= $sth->{NUM_OF_FIELDS} ; $t++ ) {
  push( @H, $sth->{NAME}->[$t-1] );
  }


but with Mysql $sth->{NAME} gives the following error message :

"Can't set DBI::st=HASH(0x81052a4)->{NAME}: unrecognised attribute or
 invalid value"

Did someone face this problem before ? Did someone solve it ?

 Raffaello



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

Date: 24 Jul 2003 14:31:24 GMT
From: xx087@freenet.carleton.ca (Glenn Jackman)
Subject: Re: DBI + mysql
Message-Id: <slrnbhvrdr.6tg.xx087@freenet10.carleton.ca>

Raffaello Galli <galli@molgen.mpg.de> wrote:
[...]
> $sth = $dbi->prepare($statement);
> $sth->execute();
> for ( $t=1; $t <= $sth->{NUM_OF_FIELDS} ; $t++ ) {
>   push( @H, $sth->{NAME}->[$t-1] );
>   }
> 
> but with Mysql $sth->{NAME} gives the following error message :
> 
> "Can't set DBI::st=HASH(0x81052a4)->{NAME}: unrecognised attribute or
>  invalid value"
> 
> Did someone face this problem before ? Did someone solve it ?

I haven't seen your error, but this is simpler:
    my @H = @{ $sth->{NAME} };


-- 
Glenn Jackman


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

Date: Thu, 24 Jul 2003 15:21:24 +0100
From: jimbo <jimbo@soundmiges.co.uk>
Subject: Re: how to initialize size of DOS Window?
Message-Id: <1059056502.687708@ananke.eclipse.net.uk>

John Cugini wrote:

> big.... how can I set it to other (larger) sizes.

use Win32::Console;

jimbo
;-)



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

Date: Thu, 24 Jul 2003 19:39:13 +1200
From: "Tintin" <me@privacy.net>
Subject: Re: Larry W... out of work ??  Impossible... or...
Message-Id: <bfo2c8$gkuh3$1@ID-172104.news.uni-berlin.de>


"stu7" <stuseven@hotmail.com> wrote in message
news:d7dd90b0.0307231802.40403080@posting.google.com...
> *** newsgroups/usenet are both becoming largely outmoded_

I shouldn't indulge you, but I'm saving that one to quote back in a few
years.




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

Date: Thu, 24 Jul 2003 16:33:11 +0200
From: Matija Papec <mpapec@yahoo.com>
Subject: Re: Larry W... out of work ??  Impossible... or...
Message-Id: <0uqvhvgvov7t738lt89l1qgiia6vl8cp11@4ax.com>

X-Ftn-To: stu7 

stuseven@hotmail.com (stu7) wrote:
>+
>  ...or is it ?

I think you'll find recent perl.com articles very enlightening as they might
answer more then half of your questions. ;) You've correctly noticed that
perl isn't pushed by some big company but not everybody would immediately
agree that this is a bad thing.


-- 
Matija


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

Date: Thu, 24 Jul 2003 10:58:21 -0400
From: "Joe Hasting" <hasting@agere.com>
Subject: Net::IMAP::Simple
Message-Id: <bfos6d$3jv$1@alageremail2.agere.com>

I would like to use the IMAP:Simple module to poll a IMAP server.  I want to
look at messages and search the subject and body for a string.  I got the
sample script from CPAN (below), but I can't get it to work.  I changed
someserver to my IMAP server, and someuser, somepassword, and somefolder to
the appropriate values, but when I run it it returns immediatly with no
responce (I can use a mail client and see me mesages in the folder on my
IMAP server).  Can someone let me know how I can check to see if I am
logging into the server,  or an alternate method that has worked for use to
read IMAP.

thanks
J


use Net::IMAP::Simple;


    # open a connection to the IMAP server
    $server = new Net::IMAP::Simple( $self->param( 'someserver' ) );

    # login
    $server->login( 'someuser', 'somepassword' );

    # select the desired folder
    $number_of_messages = select( 'somefolder' );

    # go through all the messages in the selected folder
    foreach $msg ( 1..$number_of_messages ) {

        # get the message
        $lines = $server->get( $msg );

        # print it
        print @$lines;
    }

    # the list of all folders
    @folders = $server->mailboxes();

    # create a folder
    $server->create_mailbox( 'newfolder' );

    # rename a folder
    $server->rename_mailbox( 'newfolder', 'renamedfolder' );

    # delete a folder
    $server->delete_mailbox( 'renamedfolder' );

    # copy a message to another folder
    $server->copy( $self, $msg, 'renamedfolder' );

    # close the connection
    $server->quit();




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

Date: Thu, 24 Jul 2003 08:59:08 +0000 (UTC)
From: "Peter Wilson" <peter_wilson@mail.com>
Subject: OLE Excel Perl Coding Problems
Message-Id: <bfo74s$m4h$1@sparta.btinternet.com>

Hi

This should be pretty simple I have recorded a macro that I would like to
convert to perl but cant seem to get it working, my coding no doubt.

Can anyone help?

As you will see I haven't got past the first hurdle of adding a pivotcache

The Perl

my $Book = $Excel->Workbooks->Open("$TMP\\WireTypes.csv");
my $Sheet = $Book->Worksheets(1);
my $datarange = $Sheet->Range("A1:C1000");
$Book->PivotCaches->Add(xlDatabase,$datarange})->CreatePivotTable("","Wire
Types");

$Excel->{'Visible'} = 1;

The Error

Win32::OLE(0.1601) error 0x80070057: "The parameter is incorrect"
    in METHOD/PROPERTYGET "Add" at main.pl line 1353


The macro

Workbooks.Open Filename:="C:\Data\CD-1\CoverLengths\wire-types.csv"

    ActiveWorkbook.PivotCaches.Add(SourceType:=xlDatabase, SourceData:= _
        "'wire-types'!R1C1:R3895C3").CreatePivotTable TableDestination:="",
_
        TableName:="PivotTable2"
    ActiveSheet.PivotTableWizard TableDestination:=ActiveSheet.Cells(3, 1)
    ActiveSheet.Cells(3, 1).Select
    ActiveSheet.PivotTables("PivotTable2").SmallGrid = False
    With ActiveSheet.PivotTables("PivotTable2").PivotFields("Harness")
        .Orientation = xlRowField
        .Position = 1
    End With
    With ActiveSheet.PivotTables("PivotTable2").PivotFields("Type")
        .Orientation = xlColumnField
        .Position = 1
    End With
    With ActiveSheet.PivotTables("PivotTable2").PivotFields("length")
        .Orientation = xlDataField
        .Position = 1
    End With
    Application.CommandBars("PivotTable").Visible = False

Many thanks

Peter




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

Date: Thu, 24 Jul 2003 13:35:37 GMT
From: "D" <d@d.com>
Subject: Re: pass all cgi parameters to an exe
Message-Id: <FgRTa.134240$N7.19759@sccrnsc03>

"D" <d@d.com> wrote in message
news:iLaTa.107825$wk6.27853@rwcrnsc52.ops.asp.att.net...
> i want to pass all cgi parameters to an exe (cgi app) and run the
executable
> and capture all of its output.
>
> use CGI;
> my $all_params;
> my $thing = `C:/Inetpub/scripts/webapp.exe $all_params`;
> print $thing;
>
> this gives me a web page that declares and error, wich is what i would
> expect, but this is good because when i pass it the right parameters i
will
> get back htm and i can parse it easily.  the problem is i want to
> impersonate what IIS would have passed if i did something like
> http://site/scripts/webapp.exe and i thing the CGI module would do this
for
> me easily but dont know how.

heres one solution maybe not the best one

my $q = new CGI;
my $url_params;
my @the_params = $q->param;
foreach my $param_name (@the_params)
  {
  my $param_value = $q->param($param_name);
  $url_params = $url_params . $param_name . "=" . $param_value . "&";
  }
my $ua = new LWP::UserAgent;
print "Content-type: text/html\r\n\r\n";
my $reg_url = "http://server/scripts/webapp.exe?$url_params";

use LWP::UserAgent;
$ua = LWP::UserAgent->new;
$ua->agent("$0/0.1 " . $ua->agent);
my $req = HTTP::Request->new( GET => $reg_url );
$req->header('Accept' => 'text/html');
my $res = $ua->request($req);
if ($res->is_success)
  {
  $thing = $res->content;
  if ($thing =~ /KEY TEXT/)
    {log_cancellation();}    ##i can change or log the output of the exe
  print $thing;
  }
else
  {print "Error: " . $res->status_line . "\n";}




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

Date: 24 Jul 2003 10:20:15 -0400
From: clists@perrin.socsci.unc.edu (Andrew Perrin (CLists))
Subject: Re: Q- Empirical usable upper limit on hash array number of elements
Message-Id: <84brvkf1ls.fsf@perrin.socsci.unc.edu>

Ted Zlatanov <tzz@lifelogs.com> writes:

> On 9 Jul 2003, carltonbrown@hotmail.com wrote:
> > I'm trying to work a simple union problem that will result in some
> > extremely large hashes (minimum 2 million elements, possibly up to
> > 100 million at some point, no key or value will be larger than 64
> > bytes).  So I'm wondering if anyone has had practical experience
> > using hashes with extremely large numbers of elements, and if so,
> > did you encounter any logical or practical limit?  Has anyone used
> > hashes of up to 100 million elements without experiencing
> > unreasonable slowness or unpredictable behavior?
> [...]
> > The essence of the problem is to take extremely large list A,
> > compare it to slightly smaller list B, and identify the elements
> > from list A that are not found in list B.
> 
> Have you considered something like BerkeleyDB instead of storing these
> hashes in memory?  Not only will it avoid memory issues, but it will
> also allow you to use C code on the resulting databases.  I'm not sure
> about the upper bound of BerkeleyDB storage (though you can probably
> split the database into hash-based buckets), so if you have any
> insight please share!  I'd certainly find it useful.
> 
> Ted

I totally concur with the recommendation to use a system other than
RAM to store and compare the lists. BerkeleyDB is fine, as would be an
SQL database, e.g., PostgreSQL.  Just for "fun", I tried a little
test:

#!/usr/local/bin/perl

use strict;
use warnings;

my %hash;

for my $i (1..100000000) {
    my $key = sprintf('%064i',$i);
    $hash{$key} = 'x' x 64;
    printf('%064i',$i);
    print "\n";
}

I ran this on my office machine, not a particularly whiz-bang
one. It's an IBM NetVista, P3-1Ghz processor, 512MB RAM, 512MB
swap, running debian linux 3.0 (woody) and Linux kernel 2.4.20. Not
much else was running at the time, so the process had the run of the
machine. It ran for a few minutes before the system started thrashing
at around 2.7 million records. It finally quit at 4,004,261 records
for lack of memory.

Moral of the story:
- The actual upper limit really is set by available RAM/swap space.
- A real data management system will be a better bet than storing it
all in memory.

ap

-- 
----------------------------------------------------------------------
Andrew J Perrin - http://www.unc.edu/~aperrin
Assistant Professor of Sociology, U of North Carolina, Chapel Hill
clists@perrin.socsci.unc.edu * andrew_perrin (at) unc.edu


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

Date: Thu, 24 Jul 2003 12:55:52 +0100
From: news@roaima.freeserve.co.uk
Subject: Re: recompile Perl, with new function names ?
Message-Id: <83u4v-glj.ln1@moldev.cmagroup.co.uk>


news@roaima.freeserve.co.uk wrote in message news:<io9vu-cf4.ln1@moldev.cmagroup.co.uk>...
> Why recompile? Take a look at the prototyping examples from "perldoc
> perlsub".

stu7 <stuseven@hotmail.com> wrote:
> *** I agree... this kind of new function is much easier...

It would help so much if you'd quit top-posting, and if you would start
to strip unnecessary quoted material. Do you really /want/ assistance,
or are you just trying to annoy the regulars?

> *** thanks for the suggestion.

Mostly no problem. But I'm not sure I'll bother next time, either.

Chris  :-(
-- 
@s=split(//,"Je,\nhn ersloak rcet thuarP");$k=$l=@s;for(;$k;$k--){$i=($i+1)%$l
until$s[$i];$c=$s[$i];print$c;undef$s[$i];$i=($i+(ord$c))%$l}


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

Date: Thu, 24 Jul 2003 08:51:28 -0500
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: Style question regarding subroutines and lexical variables
Message-Id: <slrnbhvp30.7pm.tadmc@magna.augustmail.com>

Joseph Ellis <jandellis@hotmail.com> wrote:
> On 24 Jul 2003 03:33:32 GMT, "A. Sinan Unur" <asu1@c-o-r-n-e-l-l.edu>
> wrote:
>>Joseph Ellis <jandellis@hotmail.com> wrote in 
>>news:3giuhv8v1atb61lrdorsaf41cu6pkl3q33@4ax.com:


>>> my $l, $m, $n, $o, $p;


I hope your real code makes better choices regarding names...


>>>     &two();

>>perlsub has this to say:
>>
>>   Not only does the "&" form make the argument list optional, it also
>>   disables any prototype checking on arguments you do provide. This is
     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

aka: cheating


>>   partly for historical reasons, and partly for having a convenient way  
>>   to cheat if you know what you're doing. See Prototypes below.
>>
>>You really do not need to use &two(), two() will do just fine.
> 
> I have read that, but so far I am sticking with using the &, because I
> don't think I sufficiently know what I'm doing yet to "cheat".


Errr, you have it backwards.

Using the ampersand is what allows cheating, so if you want to
eliminate the possibility of cheating, then eliminate the use
of ampersand on function calls.


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


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

Date: Thu, 24 Jul 2003 14:10:31 GMT
From: Joseph Ellis <jandellis@hotmail.com>
Subject: Re: Style question regarding subroutines and lexical variables
Message-Id: <22qvhvss72qaisal6nsa3jr86s5hetubue@4ax.com>

On Thu, 24 Jul 2003 08:51:28 -0500, tadmc@augustmail.com (Tad
McClellan) wrote:

>Joseph Ellis <jandellis@hotmail.com> wrote:
>> On 24 Jul 2003 03:33:32 GMT, "A. Sinan Unur" <asu1@c-o-r-n-e-l-l.edu>
>> wrote:
>>>Joseph Ellis <jandellis@hotmail.com> wrote in 
>>>news:3giuhv8v1atb61lrdorsaf41cu6pkl3q33@4ax.com:
>
>
>>>> my $l, $m, $n, $o, $p;
>
>
>I hope your real code makes better choices regarding names...

Yes.  These were just quickly-typed examples.

>
>
>>>>     &two();
>
>>>perlsub has this to say:
>>>
>>>   Not only does the "&" form make the argument list optional, it also
>>>   disables any prototype checking on arguments you do provide. This is
>     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>
>aka: cheating
>
>
>>>   partly for historical reasons, and partly for having a convenient way  
>>>   to cheat if you know what you're doing. See Prototypes below.
>>>
>>>You really do not need to use &two(), two() will do just fine.
>> 
>> I have read that, but so far I am sticking with using the &, because I
>> don't think I sufficiently know what I'm doing yet to "cheat".
>
>
>Errr, you have it backwards.
>
>Using the ampersand is what allows cheating, so if you want to
>eliminate the possibility of cheating, then eliminate the use
>of ampersand on function calls.

Ahh...I see.  I was right though; I really don't know what I'm doing.
I don't understand what prototypes and prototype checking are all
about.  I'll have to look that up.

Thanks for the clarification.

Joseph



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

Date: Thu, 24 Jul 2003 16:18:46 +0200
From: Malte Ubl <ubl@schaffhausen.de>
Subject: Re: Style question regarding subroutines and lexical variables
Message-Id: <bfot05$s5i$1@news.dtag.de>

A. Sinan Unur wrote:
> Regardless of language, if I see a method/function/subroutine being 
> called with 30 arguments, I am inclined to think there is a design issue. 

Just to make it clear. The design issue is not solved by using global 
variables, which are only needed is a few corner cases of programming.

malte



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

Date: Sat, 19 Jul 2003 01:59:56 GMT
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: 
Message-Id: <3F18A600.3040306@rochester.rr.com>

Ron wrote:

> Tried this code get a server 500 error.
> 
> Anyone know what's wrong with it?
> 
> if $DayName eq "Select a Day" or $RouteName eq "Select A Route") {

(---^


>     dienice("Please use the back button on your browser to fill out the Day
> & Route fields.");
> }
 ...
> Ron

 ...
-- 
Bob Walton



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

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


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