[30323] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1566 Volume: 11

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu May 22 14:09:53 2008

Date: Thu, 22 May 2008 11:09:15 -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, 22 May 2008     Volume: 11 Number: 1566

Today's topics:
        Auto-login to Facebook FeelLikeANut@gmail.com
    Re: Auto-login to Facebook (Steven M. O'Neill)
    Re: Auto-login to Facebook <ben@morrow.me.uk>
        Best Way to accomplish a Task <Ramroop@gmail.com>
    Re: Best Way to accomplish a Task <jl_post@hotmail.com>
    Re: Best Way to accomplish a Task <jurgenex@hotmail.com>
    Re: Best Way to accomplish a Task <spamtrap@dot-app.org>
        creating directory before a module is loaded. <hsggwk@gmail.com>
    Re: creating directory before a module is loaded. <slick.users@gmail.com>
    Re: finding & saving accented (unicode) chars with perl <jcmmat@gmail.com>
    Re: finding & saving accented (unicode) chars with perl <jcmmat@gmail.com>
    Re: finding & saving accented (unicode) chars with perl <JustMe@somewhere.de>
    Re: finding & saving accented (unicode) chars with perl <someone@example.com>
    Re: finding & saving accented (unicode) chars with perl <JustMe@somewhere.de>
    Re: finding & saving accented (unicode) chars with perl <JustMe@somewhere.de>
    Re: import CSV files to Excel <slick.users@gmail.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Thu, 22 May 2008 08:19:03 -0700 (PDT)
From: FeelLikeANut@gmail.com
Subject: Auto-login to Facebook
Message-Id: <befda7c8-5405-4bff-8607-676bd167243e@m3g2000hsc.googlegroups.com>

Hi. I'm trying to write a script to automatically update some
information on Facebook. For now I'm just trying to get the login part
to work. Here's what I have:

use LWP::UserAgent ();
use Data::Dumper;

my ($ua, $response, @cookieHeaders, $cookieHeader, %cookies);
$ua = LWP::UserAgent->new(
	agent => 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1)',
	max_redirect => 0,
);
%cookies = ();

# Get form (mainly just to collect any cookies)
$response = $ua->get('https://login.facebook.com/login.php');
@cookieHeaders = $response->header('Set-Cookie');
foreach $cookieHeader (@cookieHeaders) {
	$cookieHeader =~ /^(.+?)=(.+?);/;
	$cookies{$1} = $2;
}

# Submit form
$ua->cookie_jar(\%cookies);
$response =
	$ua->post('https://login.facebook.com/login.php', {
		email => '****', # would be the actual email
		pass => '****', # would be the actual password
		login => 'Login',
	});
@cookieHeaders = $response->header('Set-Cookie');
foreach $cookieHeader (@cookieHeaders) {
	$cookieHeader =~ /^(.+?)=(.+?);/;
	$cookies{$1} = $2;
}

print $response->as_string;

__END__

But all I get is a page that says cookies are not enabled. I think I'm
getting and setting the cookies correctly, but I clearly must be doing
something wrong. Can anybody help?


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

Date: Thu, 22 May 2008 15:38:05 +0000 (UTC)
From: steveo@panix.com (Steven M. O'Neill)
Subject: Re: Auto-login to Facebook
Message-Id: <g1440t$quq$1@reader2.panix.com>

 <FeelLikeANut@gmail.com> wrote:
>Hi. I'm trying to write a script to automatically update some
>information on Facebook. For now I'm just trying to get the login part
>to work. Here's what I have:

[...]

>But all I get is a page that says cookies are not enabled. I think I'm
>getting and setting the cookies correctly, but I clearly must be doing
>something wrong. Can anybody help?

I didn't look closely at your code, but I find that facebook
doesn't work so well in text-only browsers -- maybe the lack of
javascript is messing up your script?

Try to use http://m.facebook.com instead.  It's limited, but
possibly more manageable.

-smo (often uses "mobile" sites for scripting like this)

-- 
Steven O'Neill                                  steveo@panix.com
Brooklyn, NY                        http://www.panix.com/~steveo


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

Date: Thu, 22 May 2008 17:20:24 +0100
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: Auto-login to Facebook
Message-Id: <83jgg5-iq2.ln1@osiris.mauzo.dyndns.org>


Quoth FeelLikeANut@gmail.com:
> Hi. I'm trying to write a script to automatically update some
> information on Facebook. For now I'm just trying to get the login part
> to work. Here's what I have:
> 
> use LWP::UserAgent ();

WWW::Mechanize is easier to work with for this sort of task. It handles
all the nasty bits like cookies for you.

Ben

-- 
"Faith has you at a disadvantage, Buffy."
"'Cause I'm not crazy, or 'cause I don't kill people?"
"Both, actually."
                                                         [ben@morrow.me.uk]


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

Date: Thu, 22 May 2008 08:12:08 -0700 (PDT)
From: Andy <Ramroop@gmail.com>
Subject: Best Way to accomplish a Task
Message-Id: <721c1c47-ecdb-4ea2-bd6f-b608775e4c47@x41g2000hsb.googlegroups.com>

Best Way to accomplish a Task

Greets

SCOPE: Convert linux perl scripts to run on a Windows box

What is the best way to accomplish this task ?

Is there a converter to download?


There are over 100 scripts that I need to migrate to work properly on
windows.

Any direction would be greatly appreciated.

-Thanks


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

Date: Thu, 22 May 2008 08:28:46 -0700 (PDT)
From: "jl_post@hotmail.com" <jl_post@hotmail.com>
Subject: Re: Best Way to accomplish a Task
Message-Id: <5fc6c974-5da7-40c9-8a70-934b6d1a5b68@34g2000hsf.googlegroups.com>

On May 22, 9:12 am, Andy <Ramr...@gmail.com> wrote:
>
> SCOPE: Convert linux perl scripts to run on a Windows box
>
> What is the best way to accomplish this task ?
>
> Is there a converter to download?


   No converter is needed.  You do need to download Perl for Windows,
however, as a Perl interpreter is still required to run the Perl
scripts.

   I would recommend installing ActiveState Perl, which you can
download for free at http://www.activestate.com/ .

   There may be a few changes you'll have to make to the scripts.  If
your scripts use Unix-like absolute paths (like "/tmp" you'll probably
want to change them to refer to an absolute DOS/WIndows-like path,
like this:  "C:/tmp".  (Note that you can still use front-slashes (as
well as back-slashes) in your pathnames.  In fact, I recommend using
the Unix-like front-slashes over the DOS-like back-slashes, because if
you use back-slashes you'll have to remember to sometimes escape them
out, like this:  "C:\\tmp".  If you forget to escape-out the back-
slashes, what you thought was "C:\tmp" might become "C:<tab>mp", which
can be a difficult bug to track down.)

   Also, if the Linux Perl scripts make system() calls to other
programs on your Linux computer, you'll have to make sure those same
programs also exist on your Windows machine (as Windows programs).
This also applies to backticks (``), as well as any program you invoke
with the open() statement.

   If an executable that a Perl script needs does not exist for
Windows, then you'll have to find a similar one and edit the Perl
script to work with its differing output (or input).

   I hope this helps, Andy.

   -- Jean-Luc


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

Date: Thu, 22 May 2008 15:46:57 GMT
From: Jürgen Exner <jurgenex@hotmail.com>
Subject: Re: Best Way to accomplish a Task
Message-Id: <u25b34dka24vtjvku2s1g4t8on98eustq5@4ax.com>

[It would have been a better use of your one subject line if you had
mentioned the subject of your post there, e.g. something like 
	Porting Perl scripts from UNIX to Windows]

Andy <Ramroop@gmail.com> wrote:


>SCOPE: Convert linux perl scripts to run on a Windows box
>What is the best way to accomplish this task ?
>
>Is there a converter to download?

There is no converter needed and if the original author followed the
advise in 'perldoc perlport' then they should run pretty much out of the
box on any platform.
If he didn't then 'perldoc perlport' is a great information source for
what issues to look out for and how to re-code those pieces that were
originally coded in a platform-specific way.

jue


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

Date: Thu, 22 May 2008 13:25:36 -0400
From: Sherman Pendley <spamtrap@dot-app.org>
Subject: Re: Best Way to accomplish a Task
Message-Id: <m11w3u9rov.fsf@dot-app.org>

Andy <Ramroop@gmail.com> writes:

> SCOPE: Convert linux perl scripts to run on a Windows box
>
> What is the best way to accomplish this task ?

A good place to start is "perldoc perlport". Depending on how you've written
your code, there may even be no conversion needed at all.

sherm--

-- 
My blog: http://shermspace.blogspot.com
Cocoa programming in Perl: http://camelbones.sourceforge.net


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

Date: Thu, 22 May 2008 10:33:05 -0700 (PDT)
From: gsa <hsggwk@gmail.com>
Subject: creating directory before a module is loaded.
Message-Id: <d4c100e0-8225-4e6e-bda6-b02f98497c94@w34g2000prm.googlegroups.com>

I am a beginner and have a stupid question. I have this code
mainCode.cgi that uses the module example.pm. example.pm in turn uses
the CPAN module Inline.pm. Inline needs a directory to build stuff and
this directory needs to be present before Inline is loaded. How do I
tell mainCode.cgi to create a directory before it loads example.pm? I
do not want to write a wrapper that will create the directory and then
call mainCode.cgi. What is the best way to do this? Hope I am being
clear and thanks a lot for all your help.

-G


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

Date: Thu, 22 May 2008 10:39:18 -0700 (PDT)
From: Slickuser <slick.users@gmail.com>
Subject: Re: creating directory before a module is loaded.
Message-Id: <6333f43e-80db-4d3a-b7d0-bb510f0c37de@27g2000hsf.googlegroups.com>

BEGIN
{
#Create directory here
#mkdir

}

On May 22, 10:33 am, gsa <hsg...@gmail.com> wrote:
> I am a beginner and have a stupid question. I have this code
> mainCode.cgi that uses the module example.pm. example.pm in turn uses
> the CPAN module Inline.pm. Inline needs a directory to build stuff and
> this directory needs to be present before Inline is loaded. How do I
> tell mainCode.cgi to create a directory before it loads example.pm? I
> do not want to write a wrapper that will create the directory and then
> call mainCode.cgi. What is the best way to do this? Hope I am being
> clear and thanks a lot for all your help.
>
> -G



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

Date: Thu, 22 May 2008 00:35:27 -0700 (PDT)
From: "jcmmat@gmail.com" <jcmmat@gmail.com>
Subject: Re: finding & saving accented (unicode) chars with perl 5.6.1
Message-Id: <12b54f36-1718-4944-8542-f0402131aae3@m36g2000hse.googlegroups.com>

On May 22, 3:09 am, Jim Gibson <jimsgib...@gmail.com> wrote:
> In article
> <320d2308-cfe5-4bcc-b6a4-8e21666fe...@d1g2000hsg.googlegroups.com>,
>
>
>
> <"jcm...@gmail.com"> wrote:
> > Google & newsreaders exactly show my code (but indeed changed the
> > lookds of the examples of reference text) :
>
> > i am using the Questionmark symbol as placeholder in my QstnLines &
> > thus the var $wrd
> > iow $wrd = Lu?ija (a qstn-mark as 3rd char)
>
> > the referenceLines & thus the var $match contains the real life &
> > correctly written word containing accented chars
> > iow $match = Lu&#267;ija (3rd char = c-with-dot-above ; total word
> > looks like Lucija but with a different c)
>
> > so rephrased, the PERL problem seems to be that the statement
> >   $match =~ /$wrd/
> >   Lu&#267;ija =~ /Lu?ija/
> > doesn't seem to be TRUE
>
> > what the total progrm wants to achieve, is find the real/correct
> > written word in a reference file,
> > given a list of 'simplified' keywords that do not contain any accented
> > chars, those are all replaced by a Questionmark
>
> The question mark in Perl regular expressions is a quantifier that
> means "0 or 1 of the previous character". Thus the RE /Lu?ija? will
> match any string containing the substring 'Lija' or 'Liuja'. It will
> not match any string having any character between the 'u' and the 'i'.
>
> The Perl meta-character for matching a single character is period (.).
>
> You need an expression that will match a single accented character. You
> can use character classes enclosed in brackets ([...]), control
> character codes (\cX), numerical character codes (\NNN), POSIX style
> character classes ([[:ascii:]), or one of the fancier Unicode
> constructs (see pp 167-174 in Programmin Perl, 3rd Ed.). I do not have
> experience with those and can't help you. Be aware that the Unicode
> constructs probably do not exist in Perl 5.6.
>
> Good luck!
>
> --
> Jim Gibson

Hi Jim,
thx again

I do swap the ?s with dots (see $wrd =~ s/\?/\./g;)

but I got it working,
your first guess was correct :
i upgraded my perl environment last night to 5.8.8 and bingo
everything now works fine !

great suggestion, thank you

rgd
jc


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

Date: Thu, 22 May 2008 01:54:44 -0700 (PDT)
From: "jcmmat@gmail.com" <jcmmat@gmail.com>
Subject: Re: finding & saving accented (unicode) chars with perl 5.6.1
Message-Id: <5cda0cbc-a2a5-4ce2-b78a-993db68bf93c@27g2000hsf.googlegroups.com>

On May 22, 3:09 am, Jim Gibson <jimsgib...@gmail.com> wrote:
> In article
> <320d2308-cfe5-4bcc-b6a4-8e21666fe...@d1g2000hsg.googlegroups.com>,
>
>
>
> <"jcm...@gmail.com"> wrote:
> > Google & newsreaders exactly show my code (but indeed changed the
> > lookds of the examples of reference text) :
>
> > i am using the Questionmark symbol as placeholder in my QstnLines &
> > thus the var $wrd
> > iow $wrd = Lu?ija (a qstn-mark as 3rd char)
>
> > the referenceLines & thus the var $match contains the real life &
> > correctly written word containing accented chars
> > iow $match = Lu&#267;ija (3rd char = c-with-dot-above ; total word
> > looks like Lucija but with a different c)
>
> > so rephrased, the PERL problem seems to be that the statement
> >   $match =~ /$wrd/
> >   Lu&#267;ija =~ /Lu?ija/
> > doesn't seem to be TRUE
>
> > what the total progrm wants to achieve, is find the real/correct
> > written word in a reference file,
> > given a list of 'simplified' keywords that do not contain any accented
> > chars, those are all replaced by a Questionmark
>
> The question mark in Perl regular expressions is a quantifier that
> means "0 or 1 of the previous character". Thus the RE /Lu?ija? will
> match any string containing the substring 'Lija' or 'Liuja'. It will
> not match any string having any character between the 'u' and the 'i'.
>
> The Perl meta-character for matching a single character is period (.).
>
> You need an expression that will match a single accented character. You
> can use character classes enclosed in brackets ([...]), control
> character codes (\cX), numerical character codes (\NNN), POSIX style
> character classes ([[:ascii:]), or one of the fancier Unicode
> constructs (see pp 167-174 in Programmin Perl, 3rd Ed.). I do not have
> experience with those and can't help you. Be aware that the Unicode
> constructs probably do not exist in Perl 5.6.
>
> Good luck!
>
> --
> Jim Gibson

Hi Jim,
thx again

I do swap the ?s with dots (see $wrd =~ s/\?/\./g;)

but I got it working,
your first guess was correct :
i upgraded my perl environment last night to 5.8.8 and bingo
everything now works fine !

great suggestion, thank you

rgd
jc


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

Date: Thu, 22 May 2008 11:02:48 +0200
From: Hartmut Camphausen <JustMe@somewhere.de>
Subject: Re: finding & saving accented (unicode) chars with perl 5.6.1
Message-Id: <MPG.229f542a17651773989686@news.t-online.de>

Hello jcmmat,

If I got it correctly, you
  1. replaced any accented character in the given words with '?' 
  2. put the result into @AllQstLines
  3. use the inserted '?' in $wrd as a placeholder for the 
     desired '&#nnn;', contained in the respective word in @AllRefLines:

     @Matches=grep /$wrd/, @AllRefLines;

  4. use the first $wrd-matching @Matches as the desired result
If so then:


In <<320d2308-cfe5-4bcc-b6a4-8e21666fe2aa@d1g2000hsg.googlegroups.com>> 
schrieb jcmmat@gmail.com...
> so rephrased, the PERL problem seems to be that the statement
>   $match =~ /$wrd/
>   Lu&#267;ija =~ /Lu?ija/
> doesn't seem to be TRUE

How could it supposed to be ;-)
Denoted like this, Jim's hint on '?' beeing a quantifier is correct.

BUT in your code example, you previously said:

   $wrd   =~ s/\?/\./g;

so the 'rephrased' expression should look like

   Lu&#267;ija  =~ /Lu.ija/;

As you see, the to-be-matched '&#267;' is quit a bit longer then just 
one single character (that's what the '.' in 'Lu.ija' represents).

So you should say

   $wrd   =~ s/\?/.+?/g;

to make $wrd a regex that can match the longer character representation 
in $AllRefLines[n].


NOTE that this RE will find any words in @AllRefLines that contain the 
constant parts of $wrd plus ANY chars before/between/after them, 
depending of the occurence(s) of '?':

   /Lu.+?ija/ 

   will match   Lu&#267;ija
   as well as   Lu_cyinthesky_ija
          
You thus may want to be more specific about what to match.
If you know how your '?' is denoted, you could e.g. say

  /Lu&.+?;ija/

that is 

  $wrd    =~ s/\?/&.+?;/g


Hint: You are using $wrd as a RE several times. For the sake of 
efficiency you should compile it as a RE

  $wrd    = qr/\?/&.+?;/

before using it.


Hint: To get the first match of $wrd in @AllRefLines you can simply say

	foreach (@allreflines){
		m/($wrd)/ ? ($correct = $1, last) : ($correct = undef)
	} ;
 
No extra @Matches-array needed, use of $& avoided... (see perldoc 
perlre, line 387 ff.)



hth + mfg, Hartmut


-- 
  ------------------------------------------------
Hartmut Camphausen      h.camp[bei]textix[punkt]de


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

Date: Thu, 22 May 2008 10:22:43 GMT
From: "John W. Krahn" <someone@example.com>
Subject: Re: finding & saving accented (unicode) chars with perl 5.6.1
Message-Id: <TPbZj.3530$Yp.2679@edtnps92>

Hartmut Camphausen wrote:
> 
> Hint: You are using $wrd as a RE several times. For the sake of 
> efficiency you should compile it as a RE
> 
>   $wrd    = qr/\?/&.+?;/

That will produce a syntax error because of the '&.+?;/' after the 
compiled expression qr/\?/

$ perl -le'$wrd    = qr/\?/&.+?;/'
syntax error at -e line 1, near "&."
Search pattern not terminated or ternary operator parsed as search 
pattern at -e line 1.



John
-- 
Perl isn't a toolbox, but a small machine shop where you
can special-order certain sorts of tools at low cost and
in short order.                            -- Larry Wall


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

Date: Thu, 22 May 2008 12:47:59 +0200
From: Hartmut Camphausen <JustMe@somewhere.de>
Subject: Re: finding & saving accented (unicode) chars with perl 5.6.1
Message-Id: <MPG.229f6dcb266404c3989687@news.t-online.de>

Hello John,

In <<TPbZj.3530$Yp.2679@edtnps92>> schrieb John W. Krahn...
> Hartmut Camphausen wrote:
> > 
> > Hint: You are using $wrd as a RE several times. For the sake of 
> > efficiency you should compile it as a RE
> > 
> >   $wrd    = qr/\?/&.+?;/
> 
> That will produce a syntax error because of the '&.+?;/' after the 
> compiled expression qr/\?/

Arrgh. Right. Wrong logic.
The above is quite senseless anyway :-p
(I didn't want to make $wrd a RE for just '?')

In my test script, I had

   $wrd     =~ s/\?/&.+?;/g;     # prepare $wrd and THEN...
   $wrd     =  qr/$wrd/;         # ...compile it as a RE

which worked as expected, giving $wrd as e.g.

   (?-xism:Lu&.+?;ija)



Thanks for the hint!

mfg, Hartmut


-- 
  ------------------------------------------------
Hartmut Camphausen      h.camp[bei]textix[punkt]de


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

Date: Thu, 22 May 2008 12:56:38 +0200
From: Hartmut Camphausen <JustMe@somewhere.de>
Subject: Re: finding & saving accented (unicode) chars with perl 5.6.1
Message-Id: <MPG.229f6f6cb323da53989688@news.t-online.de>

In <<MPG.229f542a17651773989686@news.t-online.de>> schrieb Hartmut 
Camphausen...
> ...you should compile it as a RE
> 
>   $wrd    = qr/\?/&.+?;/
> 
> before using it.

WRONGWRONGWRONG!
Thanks to John's hint, I paste(!) the correct lines here:

   $wrd     =~ s/\?/&.+?;/g;     # FIRST prepare $wrd...
   $wrd     =  qr/$wrd/;         # ...and THEN compile it as a RE.

This will compile ok, and 

   m/$wrd/

works as expected.
Uff.


mfg, Hartmut


-- 
  ------------------------------------------------
Hartmut Camphausen      h.camp[bei]textix[punkt]de


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

Date: Thu, 22 May 2008 10:12:03 -0700 (PDT)
From: Slickuser <slick.users@gmail.com>
Subject: Re: import CSV files to Excel
Message-Id: <99c45cca-ccb6-4312-85f7-31fa0383911e@k13g2000hse.googlegroups.com>

I record a Macro.

Here is what I got but my data is not import to A1.

It did add the sheet in though. Any idea?

Perl code:

use strict;
use warnings;
use Win32::OLE;
use Win32::OLE::Const 'Microsoft Excel';
#use Win32::OLE::Variant;

print localtime() ." START \n";

	my $localTime = localtime();
	$localTime =~ s/\s/_/g;
	$localTime =~ s/\:/_/g;

	my $csv_path = "C:/slickuser/Tue_May_20_20_49_44_2008/*.csv";
	my $fileOutput = "C:/slickuser/out.xls";
	my $MAX_ROW = 65356;

	my @csvFile = glob($csv_path);
	my ($Excel,$Workbook,$Workbook_CSV,$CurrentSheet);

	$Excel = Win32::OLE->new('Excel.Application', 'Quit') || die "Can't
create Excel object \n";
	$Excel->{'Visible'} = 1;	#0 is hidden, 1 is visible
	$Excel->{DisplayAlerts}= 0;	#0 is hide alerts
	$Excel->{SheetsInNewWorkbook} = 0;

	$Workbook = $Excel->Workbooks->Add();
	$Workbook->SaveAs($fileOutput) or die "Can't save file.\n";

	foreach my $filename (sort(@csvFile))
	{
		$filename =~ s/\\/\//g;
		my @tempFile = split(/\//,$filename);
		my @sheetName = split(/\./,$tempFile[scalar(@tempFile)-1]);

		$Workbook->Worksheets->Add( {after => $Workbook-
>Worksheets($Workbook->Worksheets->{count})} );
		$CurrentSheet = $Workbook->ActiveSheet;
		$CurrentSheet->{Name} = $sheetName[0];

		my $column = "[";
		open(CSV,$filename) or die "Can't open CSV file.\n";
		while(<CSV>)
		{
			my $curLine = $_;
			my @cells = split(/\,/,$curLine);

			for (my $i=0; $i<(scalar @cells); $i++)
			{
				$column .= "1, ";
			}
			#Delete the last comma
			chop($column);
			$column .= "]";

			last;
		}
		close(CSV);

		my $file = "TEXT;$filename";
		$Excel->ActiveSheet->QueryTables->Add
		({
			Connection=>$file,
			Destination=>$CurrentSheet->Range("A1")
		});
		$Excel->ActiveSheet->QueryTables->{Name} = $sheetName[0];
		$Excel->ActiveSheet->QueryTables->{FieldNames} = 1;
		$Excel->ActiveSheet->QueryTables->{RowNumbers} = 0;
		$Excel->ActiveSheet->QueryTables->{FillAdjacentFormulas}= 0;
		$Excel->ActiveSheet->QueryTables->{PreserveFormatting} = 1;
		$Excel->ActiveSheet->QueryTables->{RefreshOnFileOpen} = 0;
		$Excel->ActiveSheet->QueryTables->{BackgroundQuery} = 1;
		$Excel->ActiveSheet->QueryTables->{RefreshStyle} =
xlInsertDeleteCells;
		$Excel->ActiveSheet->QueryTables->{SavePassword} = 0;
		$Excel->ActiveSheet->QueryTables->{SaveData} = 1;
		$Excel->ActiveSheet->QueryTables->{AdjustColumnWidth} = 1;
		$Excel->ActiveSheet->QueryTables->{RefreshPeriod}= 0;
		$Excel->ActiveSheet->QueryTables->{TextFilePromptOnRefresh} = 1;
		$Excel->ActiveSheet->QueryTables->{TextFilePlatform} = 437;
		$Excel->ActiveSheet->QueryTables->{TextFileStartRow} = 1;
		$Excel->ActiveSheet->QueryTables->{TextFileParseType} = xlDelimited;
		$Excel->ActiveSheet->QueryTables->{TextFileTextQualifier} =
xlTextQualifierDoubleQuote;
		$Excel->ActiveSheet->QueryTables->{TextFileConsecutiveDelimiter} =
0;
		$Excel->ActiveSheet->QueryTables->{TextFileTabDelimiter} = 0;
		$Excel->ActiveSheet->QueryTables->{TextFileSemicolonDelimiter} = 0;
		$Excel->ActiveSheet->QueryTables->{TextFileCommaDelimiter} = 1;
		$Excel->ActiveSheet->QueryTables->{TextFileSpaceDelimiter} = 0;
		$Excel->ActiveSheet->QueryTables->{TextFileColumnDataTypes} =
$column;
		$Excel->ActiveSheet->QueryTables->{TextFileTrailingMinusNumbers} =
1;
		$Workbook->Save();
	}

	$Workbook->Close();
	$Excel->Quit();
	Win32::OLE->FreeUnusedLibraries();

	print localtime() ." END \n";



VBA code:

    Sheets.Add
    With ActiveSheet.QueryTables.Add(Connection:="TEXT;C:/slickuser/
10.csv", _
        Destination:=Range("A1"))
        .Name = "10"
        .FieldNames = True
        .RowNumbers = False
        .FillAdjacentFormulas = False
        .PreserveFormatting = True
        .RefreshOnFileOpen = False
        .RefreshStyle = xlInsertDeleteCells
        .SavePassword = False
        .SaveData = True
        .AdjustColumnWidth = True
        .RefreshPeriod = 0
        .TextFilePromptOnRefresh = False
        .TextFilePlatform = 437
        .TextFileStartRow = 1
        .TextFileParseType = xlDelimited
        .TextFileTextQualifier = xlTextQualifierDoubleQuote
        .TextFileConsecutiveDelimiter = False
        .TextFileTabDelimiter = False
        .TextFileSemicolonDelimiter = False
        .TextFileCommaDelimiter = True
        .TextFileSpaceDelimiter = False
        .TextFileColumnDataTypes = Array(1, 1, 1, 1)
        .TextFileTrailingMinusNumbers = True
        .Refresh BackgroundQuery:=False
    End With


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

Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>


Administrivia:

#The Perl-Users Digest is a retransmission of the USENET newsgroup
#comp.lang.perl.misc.  For subscription or unsubscription requests, send
#the single line:
#
#	subscribe perl-users
#or:
#	unsubscribe perl-users
#
#to almanac@ruby.oce.orst.edu.  

NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice. 

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

#To request back copies (available for a week or so), send your request
#to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
#where x is the volume number and y is the issue number.

#For other requests pertaining to the digest, send mail to
#perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
#sending perl questions to the -request address, I don't have time to
#answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V11 Issue 1566
***************************************


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