[10036] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 3629 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Sep 3 18:05:32 1998

Date: Thu, 3 Sep 98 15:00:19 -0700
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, 3 Sep 1998     Volume: 8 Number: 3629

Today's topics:
    Re: Beginner needs help <aqumsieh@tigre.matrox.com>
    Re: Blowfish crypo with perl (Jonathan Stowe)
    Re: CGI POSTing information to another CGI program. (Jonathan Stowe)
        CGI scripts <julius@clara.net>
    Re: getting browser from registry <JKRY3025@comenius.ms.mff.cuni.cz>
    Re: Getting dialup dynamic IP (David Hawker)
    Re: HELP ! Compile/Link error for PERL on Solaris (Jonathan Stowe)
        How do you pass quotes to the command line? <rtha@loc.gov>
    Re: How do you pass quotes to the command line? (Andrew M. Langmead)
    Re: How to create a file of known length? (Craig Berry)
    Re: How to remove the file's extention using perl <upsetter@ziplink.net>
    Re: How to remove the file's extention using perl (Craig Berry)
    Re: mv, move, or some way to move files in perl <JKRY3025@comenius.ms.mff.cuni.cz>
    Re: Net::SMTP Subject?? (Jonathan Stowe)
    Re: Perl compiler (Joe McMahon)
    Re: Perl documentation (David Hawker)
        PerlScript: reading/writing files? <mkruse@rens.com>
    Re: Popup login box (Jonathan Stowe)
    Re: Problem: Opening Word (ack!) doc w/ OLE <JKRY3025@comenius.ms.mff.cuni.cz>
    Re: Run Word 97 macro from Perl error? <JKRY3025@comenius.ms.mff.cuni.cz>
    Re: Tom Phoenix: ANSWERS WANTED! bitnut1@my-dejanews.com
    Re: Trolls (David A. Black)
    Re: UN-INSTALLING Perl: How can I un-install old versio <quinn@computer.org>
        Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)

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

Date: 03 Sep 1998 11:41:29 -0400
From: Ala Qumsieh <aqumsieh@tigre.matrox.com>
Subject: Re: Beginner needs help
Message-Id: <x3yr9xt8aqe.fsf@tigre.matrox.com>


"Tijs" <Jantijs@dds.nl> writes:

> 
> Hello,
> 
> After a calculation my script displays e.g. 270,7
> 
> this must be 270,70 because it's a currency.
> 
> or
> 
> 270 this must be 270,00
> 

You must use printf or sprintf.

> $n =$premie; # $premie is the result of a calculation

Instead of the above line, do the following:

$n = sprintf "%.2f", $premie;

> $n =~ s/\./\,/g; # convert . into ,

Instead of the above I suggest you use tr// (it's faster).

$n =~ tr/./,/;

> $premie="<strong> $n</strong>";
> print "$premie";
> 
> Thanks
> 
> 

The rest is the same. Hope this helps,

-- 
Ala Qumsieh             |  No .. not Just Another
ASIC Design Engineer    |  Perl Hacker!!!!!
Matrox Graphics Inc.    |
Montreal, Quebec        |  (Not yet!)


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

Date: Thu, 03 Sep 1998 19:10:56 GMT
From: Gellyfish@btinternet.com (Jonathan Stowe)
Subject: Re: Blowfish crypo with perl
Message-Id: <35eee539.6926426@news.btinternet.com>

On 3 Sep 1998 10:06:45 GMT, Anders wrote :

>Does anyone know how to crypt a string using Blowfish in Perl?
>

I dunno is that like an opposite of a Babelfish ;-?

/J\
-- 
Jonathan Stowe
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>



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

Date: Thu, 03 Sep 1998 19:10:54 GMT
From: Gellyfish@btinternet.com (Jonathan Stowe)
Subject: Re: CGI POSTing information to another CGI program.
Message-Id: <35eee365.6458191@news.btinternet.com>

On Thu, 03 Sep 1998 12:16:23 -0400, Earl Westerlund wrote :

>Josh Freeman wrote:
>> 
>> I need help with a small problem.  I want to pass information using POST
>> 
>> from an HTML form.  That program will save the information, then POST
>> that information to another CGI program.
>> 
>> The problem is the second step.  I need to know how to send information
>> from my(the first) CGI program to the second CGI program using POST.
>> 
>> I want to avoid using GET, and also want to avoid have the user have to
>> press a second submit button.
>> 
>> Any Ideas?
>
>This is not a Perl question, but since you asked here...
>
>Take a look at CGI.pm.  You can find information about it at
>http://www.genome.wi.mit.edu/ftp/pub/software/WWW/cgi_docs.htm.


I'm not entirely sure whether CGI.pm will help  entirely (although of
course it is widely recommended to be used in CGI programs) - what is
required is probably the LWP (libwww-perl) library of modules
available from CPAN this will allow you to pass POST requests to
another CGI - however one would need to learn about the correct
encoding for the POST'ed data which should be taken up with the
relevant documentation or a newsgroup concerned with CGI issues.

/J\
-- 
Jonathan Stowe
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>



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

Date: Thu, 3 Sep 1998 22:51:38 +0100
From: "Jules" <julius@clara.net>
Subject: CGI scripts
Message-Id: <6sn2nk$p9b$1@eros.clara.net>

Dear all, I got this piece of CGI script written in PERL, very simple only
a few lines of code. But it gives me an internal error on IE4 and asks me
to contact system administrator. So I take that it doesn't work or trying
to have a CGI program send mail is forbidden. And of course permission is
set to 755.

The program is supposed to reply immediately to whoever typed in an email
address and hit the button on the webpage.

Please point out the errors for me.

Thanx,
            Jules


The contents of the HTML and CGI files are as follows:

CGI script: emailist.cgi
---------------------------------------------------------------------------
--------
#! /usr/bin/perl -w
use CGI qw(:standard);

my $email = param("email");

if (defined($email)) {

open MAIL, "|mail $email";
print MAIL "You will be notified of updates\n";
close MAIL;

open MAIL, "|mail julius@clara.net";
print MAIL "$email added\n";
close MAIL;

open (MAILIST, ">>mailist");
print MAILIST "$email\n";
close (MAILIST);

print << END;
Content-type: text/html
<HTML><BODY><H1><P>Thank you for joining the list</H1></BODY></HTML>
END

}

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

HTML: test.html
---------------------------------------------------------------------------
--------------------
<HTML>
<BODY>
<FORM ACTION=emailist.cgi>
Name: <INPUT NAME=name size=25><P>
Email: <INPUT NAME=email size=25><P>
<INPUT TYPE=SUBMIT VALUE="SIGN UP"><BR>
</FORM>
</BODY></HTML>


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







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

Date: Thu, 03 Sep 1998 20:52:34 -0700
From: Jan Krynicky <JKRY3025@comenius.ms.mff.cuni.cz>
Subject: Re: getting browser from registry
Message-Id: <35EF6402.3228@comenius.ms.mff.cuni.cz>

dlynch@morrisonscientific.com wrote:
> 
> Hi,
> 
> I need to extract the default browser from the NT registry.  Does anyone know
> how I can do this, or where to read up on it?  Thanks in advance.
> 
> David.


Beware untested code follows!


1. get Win32::Registry 2 and Win32::FileOp from http://jenda.krynicky.cz

Then it's something like : 

use Win32::FileType;

$htm = Win32::FileType::Open('.htm'); # use .html if you like

$action = $htm->Action($htm->DefaultAction()); 
# $action is something like '"c:\program
files\Netscape\Navigator\Program\Netscape.exe" "%1"'

if ($action =~ /^"(.*?)") {
 $browser = $1;
} else {
 $action =~ /^.*?\s/
 and
 $browser = $1
 or 
 $browser = $action;
}

print "Default browser is at : $browser\n"



2. use Win32::Registry


$HKEY_CLASSES_ROOT->QueryValue('.htm', $htmfile)
or
$HKEY_CLASSES_ROOT->QueryValue('.html', $htmfile)
or
die "There is nob browser here!\n";

$HKEY_CLASSES_ROOT->Open($htmfile.'\shell\open', $reg);

$reg->QueryValue('command',$action);

if ($action =~ /^"(.*?)") {
 $browser = $1;
} else {
 $action =~ /^.*?\s/
 and
 $browser = $1
 or 
 $browser = $action;
}

print "Default browser is at : $browser\n"

HTH, Jenda


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

Date: Thu, 03 Sep 1998 21:01:10 GMT
From: dhawker@removethis.bigfoot.com (David Hawker)
Subject: Re: Getting dialup dynamic IP
Message-Id: <35f8038f.20871314@news.cableol.net>

On Thu, 27 Aug 1998 05:35:51 GMT, maurice@hevanet.com (Maurice Aubrey) felt
the need to post:

>On Thu, 27 Aug 1998 03:09:20 GMT, David Hawker <dhawker@removethis.bigfoot.com> 
>wrote:
>>On Sat, 22 Aug 1998 16:10:40 GMT, maurice@hevanet.com (Maurice Aubrey) felt
>>the need to post:
>>
>>>sub _determine_ip {
>>>  my $self = shift;
>>>  my($raddr, $myaddr, $socket);
>>>
>>>  $socket = new FileHandle;
>>>  $raddr = sockaddr_in(80, '1.1.1.1');
>>>  socket($socket, PF_INET, SOCK_DGRAM, getprotobyname('udp'))
>>>    or die "create socket: $!";
>>>  connect($socket, $raddr)
>>>    or die "connect: $!";
>>>  $myaddr = (unpack_sockaddr_in(getsockname($socket)))[1];
>>>  close $socket;
>>>  return inet_ntoa $myaddr;
>>>}                      
>>
>>This code generated some errors so I inserted "use Socket" and that got rid
>>of the syntax errors - but when online it dies with "connect: Cant connect,
>>unknown error"
>>
>>In particular, what is $self and the declaration of $socket for? The former
>>isn't used and the latter seems unnecessary.
>
>Yes, sorry ... you need: 
>
>use Socket;
>use FileHandle;

I thought as much and inserted both :)

>_determine_ip() is a method within a larger module, so $self is the object.
>You can remove that if you aren't creating a module.

I'm not creating a module :) just trying to get my local IP addy :) I found
out in C++ for Windows there's a winsock call "gethostname" followed by
"gethostbyname" which is supposed to do it.

>I don't see why $socket is unnecessary ... isn't it required for the
>calls to socket(), connect(), and getsockname()?

Well I never declare it like this:
>>>  $socket = new FileHandle;
and my code always works fine.

>I'm afraid I can't help you with the error ... but if you discover its
>cause, please let me know.

I'll try look into it. Thanks for your help.



































--
dhawker@bigfoot.com | ICQ 7222349
http://dhawker.home.ml.org


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

Date: Thu, 03 Sep 1998 19:10:50 GMT
From: Gellyfish@btinternet.com (Jonathan Stowe)
Subject: Re: HELP ! Compile/Link error for PERL on Solaris
Message-Id: <35eed81d.3642680@news.btinternet.com>

On Wed, 02 Sep 1998 19:58:33 -0700, Mohan Mandava wrote :

>I am  getting the following compile/link error when I install
>perl5.00404 on Solaris 2.6. I have the gcc compiler (ver. 2.7.2.3) on my
>Sun.
>
>______________________________________________________________
>
># make perl
>make: Warning: Both `makefile' and `Makefile' exist
>/opt/GCC2723/bin/gcc   -o miniperl miniperlmain.o libperl.a 
>Undefined			first referenced
> symbol  			    in file
>log                                 libperl.a(pp.o)
>pow                                 libperl.a(pp.o)
>sqrt                                libperl.a(pp.o)
>floor                               libperl.a(pp.o)
>atan2                               libperl.a(pp.o)
>exp                                 libperl.a(pp.o)
>sin                                 libperl.a(pp.o)
>cos                                 libperl.a(pp.o)


Missing libm.a  - the library is either missing (look in
/opt/GCC2723/lib ) in which case you will need to get hold or
reinstall your compiler or you will need to specify -lm when Configure
asks for any additional libraries.  However you compiler is relatively
old - gcc is up in the 2.8 range now - so you might be better of
upgrading anyhow.

/J\
-- 
Jonathan Stowe
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>



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

Date: Thu, 03 Sep 1998 15:22:43 -0400
From: Dick Thaxter <rtha@loc.gov>
Subject: How do you pass quotes to the command line?
Message-Id: <35EEEC83.3D0A@loc.gov>

Using back ticks I am able to capture the output of a grep command
containing a scalar variables as the search argument and the filename:

  @hits = `grep -i ^$query  $fname`;

I can't figure out how to pass a multiple word query with quotes; i.e.,
I want to execute:

  grep -i -e 'word1 word2' filename

What is the correct syntax to send the quotes with the expanded variable
inside?

Dick Thaxter
rtha@loc.gov


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

Date: Thu, 3 Sep 1998 21:32:45 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: How do you pass quotes to the command line?
Message-Id: <Eyq96L.M5C@world.std.com>

Dick Thaxter <rtha@loc.gov> writes:

>Using back ticks I am able to capture the output of a grep command
>containing a scalar variables as the search argument and the filename:

>  @hits = `grep -i ^$query  $fname`;

Since backquotes interpolate, use the same escape mechanism you use
for other interpolative operators. But in this case, I don't even see
why you need them.

  @hits = `grep -i ^'$query'  $fname`;

or

  $query = '\'word1 word2\''; # or "'word1 word2'" or q/'word1 word2'/ etc.
  @hits = `grep -i ^$query  $fname`;


-- 
Andrew Langmead


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

Date: 3 Sep 1998 19:14:04 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: How to create a file of known length?
Message-Id: <6smppt$q9v$1@marina.cinenet.net>

Clint Harris (charris@gte.net) wrote:
: 	Does anyone know how to create a file of a known length filled 
: with random data (Sort of like od in Unix)? Thanks.

OWTDI:


#!/usr/bin/perl -w
# randfile - create a file N bytes long filled with random binary data.
# Useage: randfile _N_ _outfile_
# Craig Berry (19980903)

use strict;

die "Useage: randfile _N_ _outfile_\n" unless @ARGV == 2;

my ($n, $outfile) = @ARGV;

open OUT, "> $outfile" or die "Can't open $outfile for writing: $!\n";
binmode OUT;    # Save us from DOS perfidy.

# Write out hefty chunks of random data until we've done N bytes.

my $block = 4096;

while ($n) {
  my $chunk = $n > $block ? $block : $n;
  print OUT pack 'C*', map { int rand 256 } (1..$chunk);
  $n -= $chunk;
}

close OUT;


---------------------------------------------------------------------
   |   Craig Berry - cberry@cinenet.net
 --*--    Home Page: http://www.cinenet.net/users/cberry/home.html
   |      "Ripple in still water, when there is no pebble tossed,
       nor wind to blow..."


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

Date: Thu, 03 Sep 1998 19:26:05 GMT
From: Scratchie <upsetter@ziplink.net>
Subject: Re: How to remove the file's extention using perl
Message-Id: <h3CH1.43$k6.272924@news.shore.net>

Josh Freeman <frejos@cswnet.com> wrote:
: <HTML>

There's something wrong with your newsreader... it keeps inserting html
tags into your posting.

Anyway, here's an easier way, which otta work:

$file = 'myfile.html';
($file_short) = ($file =~ /(.+)\.[^\.]+$/); 

--Art

--------------------------------------------------------------------------
                    National Ska & Reggae Calendar
                  http://www.agitators.com/calendar/
--------------------------------------------------------------------------


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

Date: 3 Sep 1998 19:19:04 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: How to remove the file's extention using perl
Message-Id: <6smq38$q9v$3@marina.cinenet.net>

wsayegh@lynx.neu.edu wrote:
: Well I have a simple PERL question.. I am just learning PERL so please be easy
: on me. OK.. now how could I write a function that removes any extention from
: the file's name. EX:
: 
: index.htm => index

If you define an extension as anything after the last slash (if any) and
the last period, then

  s!\.[^/.]$!!;

does the trick nicely.

---------------------------------------------------------------------
   |   Craig Berry - cberry@cinenet.net
 --*--    Home Page: http://www.cinenet.net/users/cberry/home.html
   |      "Ripple in still water, when there is no pebble tossed,
       nor wind to blow..."


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

Date: Thu, 03 Sep 1998 21:08:16 -0700
From: Jan Krynicky <JKRY3025@comenius.ms.mff.cuni.cz>
Subject: Re: mv, move, or some way to move files in perl
Message-Id: <35EF67B0.7F68@comenius.ms.mff.cuni.cz>

Thomas Frederick O'Connell wrote:
> 
> is there a good way other than
> 
> system( "mv ..." );
> 
> to move directory trees across filesystems in perl? i could have sworn
> that there used to be a mv function in File::Copy, but when i went looking
> today, it wasn't there. but my memory of looking for something similar is
> about a year old, so i could be wrong. i would also rather avoid
> 
> copy( ... );
> unlink( ... );
> 
> why isn't there a File::Move module, incidentally?
> 
> any info or pointers to info come much appreciated.
> 
> -freddie

If memory serves me rigth there is function rename() in perl.
You should search http://www.perl.com/CPAN/ , I think you will 
find some module there.

And I would also took a look into directory File in your perl library
directory.
Maybe something is already there.


If you happen to use Win95/WinNT and do not care about portability much,
you may 
	use Win32::FileOp;	
	 #http://jenda.krynicky.cz
	Move 'c:\some\directory\*.*' => 'd:\other\place';
	 # remember, you are in M$ world, *.* matches even files 
	 # with no extension whatsoever! And Move() moves directories as well.

this module will provide you with fancy progress and confirmation
dialogs as well.

HTH, Jenda


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

Date: Thu, 03 Sep 1998 19:10:52 GMT
From: Gellyfish@btinternet.com (Jonathan Stowe)
Subject: Re: Net::SMTP Subject??
Message-Id: <35eedb1e.4339294@news.btinternet.com>

On Wed, 02 Sep 1998 20:28:03 -0700, John Armstrong wrote :

>Does anyone know how to set a subject header in Net::SMTP? I didnt see a
>method for it and when I try to just append it to the datasend it just
>heaps everything onto one line with '\n' seperating the to and subject
>lines.

Follows a snippet from a larger program :

        my $smtp = Net::SMTP->new($mailhost, 
                                  Hello    => 'hastings.gov.uk', 
                                  Timeout  => 10 );
        if($smtp)
        {
          $smtp->send($my_long_email);
          $smtp->to($cemail);
          $smtp->data();
          $smtp->datasend("To: $long_team_email\n");
          $smtp->datasend("From: $my_long_email\n");
          $smtp->datasend("Organization: Hastings Information
Centre\n");
          $smtp->datasend("Subject: Enquiry referal - $enquiry\n");
          $smtp->datasend("X-Mailer: $my_name $VERSION\n");
          $smtp->datasend("\n");
          $smtp->datasend($refer_body);
          $smtp->dataend();
          $smtp->quit;
         }

As you can see you need to form the headers yourself - pay particular
to the lone \n being sent after the header and before the body of the
message - which is essential to delimit the header.  Of course you
could use Mail::Header and Mail::Internet modules which encapsulate
some of this functionality.  Check out perlfaq9 for more on this.  All
that said I wrote the above to run on an NT server and to connect to a
reliable Mail Transfer Agent -  under other circumstances (say on Unix
or where Mail Transfer is by other than a direct network connection )
it might be more appropriate to use an MTA such as sendmail directly
in order to gain more reliability.  This subject gets people on this
group excited quite regularly so you are bound to get quite a lot of
opinion about this - you could also search DejaNews and find more
views than you would care to read.

/J\
-- 
Jonathan Stowe
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>



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

Date: Thu, 03 Sep 1998 17:07:35 -0400
From: joe.mcmahon@gsfc.nasa.gov (Joe McMahon)
Subject: Re: Perl compiler
Message-Id: <joe.mcmahon-0309981707350001@prtims.stx.com>

In article <1deq96r.q60sbifsssgN@roxboro0-018.dyn.interpath.net>,
phenix@interpath.com (John Moreno) wrote:

>What I fail to understand is why you posted this in reply to my message
>without including any of what I wrote or addressing (except indirectly
>in this last paragraph) what I said.

Sorry - my news reader picks whatever I last read in the thread as what
I'm replying to; I definitely didn't intend to single out or ignore
anyone. 

>Breaking security can be more serious than breaking a contract - it
>results in jail time and not lost money (companies aren't concerned with
>this but the executives who might end up in jail probably do).

I agree, in principle, but I'll bet that it would end up at the programmer's
desk saying "he did it", plausible deniability being what it is these days...

 --- Joe M.


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

Date: Thu, 03 Sep 1998 21:00:02 GMT
From: dhawker@removethis.bigfoot.com (David Hawker)
Subject: Re: Perl documentation
Message-Id: <35eefbfa.18929774@news.cableol.net>

On Sun, 30 Aug 1998 00:14:58 GMT, Gellyfish@btinternet.com (Jonathan Stowe)
felt the need to post:

>On Sat, 29 Aug 1998 14:44:33 GMT, David Hawker wrote :
>
>>I don't think Windows 3.1 had a built-in search facility. Neither did
>>MS-DOS. That's how deprived we are (or were).
>
>I dunno, I've got Caldera OpenDos 7.01, nee DR-DOS here and the FIND

Win3.1 came with DOS 6, Win95 comes with DOS 7. Was there a FIND function
in DOS 6?

>command does go so some of the way toward being a grep clone of sorts
>[although of course it does not support regular expressions at all as
>far as I can determine].

I don't think the win95 search supports regular expressions either.



--
dhawker@bigfoot.com | ICQ 7222349
http://dhawker.home.ml.org


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

Date: Thu, 03 Sep 1998 14:28:12 -0500
From: Matt Kruse <mkruse@rens.com>
Subject: PerlScript: reading/writing files?
Message-Id: <35EEEDCC.469A@rens.com>

Using the latest PerlScript with IIS4 in ASP, I cannot open files
for reading or writing.

I haven't found any documentation on this.
Is this a known problem/bug? 
Or is it intentional for some reason?

--
Matt Kruse
mkruse@rens.com
Renaissance Worldwide


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

Date: Thu, 03 Sep 1998 19:10:58 GMT
From: Gellyfish@btinternet.com (Jonathan Stowe)
Subject: Re: Popup login box
Message-Id: <35eee651.7205830@news.btinternet.com>

On Wed, 2 Sep 1998 22:38:36 -0700, Felix Tarnarider wrote :

>How do you get the login box to popup in IIS 4, using Perl?
>

Whilst not *strictly* Perl (and actually not precisely what you are
asking) - if you are using mod_perl with the Apache HTTP server then
it is possible to create Authentication handlers in Perl - check out
the Apache::Authen* modules available from CPAN.  Now what you are
actually asking is more of a CGI question and should be asked in a
newsgroup appopriate to that subject - or evn better the FAQs and
Documentation available.

A hint though - if you have a web server that has a directory that
requires authentication then you can telnet to port 80 (or whatever
port the server listens on) on that server and type:

GET /authenticated/path<enter><enter>

and see what is displayed.

>Please email any answers as well as posting. Thanks
>
Hmm

/J\
-- 
Jonathan Stowe
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>



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

Date: Thu, 03 Sep 1998 21:21:09 -0700
From: Jan Krynicky <JKRY3025@comenius.ms.mff.cuni.cz>
Subject: Re: Problem: Opening Word (ack!) doc w/ OLE
Message-Id: <35EF6AB5.616F@comenius.ms.mff.cuni.cz>

Charles Sherman wrote:
> 
> Ok I've got NT, I've got Active PERL 5.00502, I've got Randals books
> (you name it I've got it or at least its with in walking distance). With
> all of this and a good bit of surfing and reading of MS docs, I cannot
> figure out how to map the following bit of VB code to PERL. I tried
> various combinations but I have no idea about how the method should be
> invoked from PERL. The "FileName:=" is throwing me.
> 
> VB code:
> 
>         Application.Documents.Open FileName:="C:\DOCS\MYDOC.DOC"
> 
> PERL (I think this would work or some variation):
>         use OLE;
>         $wd = CreateObject OLE "Word.Application.8" || die "CreateObject: $!";
>         $wd->{visible}=1;
>         $wd->Documents->Open('FileName:="C:\DOCS\MYDOC.DOC"');
>                 #I've tried without '' also
> 
> This will launch Word but does not bring up the document.
> If you have any suggestions, ideas, etc. I would like to know.
> 
> Thanks
> 
>         Charlie

1. You'd get more profound and quicker answer in
Perl-Win32-Users@lyris.activestate.com
mailing list.

2. AFAIK, you cannot use named parameters in perl yet. Use simple

         $wd->Documents->Open('C:\DOCS\MYDOC.DOC');

OK?


Also make always sure you escape the backslashes when necessary.

"c:\docs\mydoc.doc" is wrong.
"c:\\docs\\mydoc.doc" is OK.
'c:\docs\mydoc.doc' is OK.
'c:\\docs\\mydoc.doc' is OK.

"\\server\docs\mydoc.doc" is wrong.
"\\\\server\\docs\\mydoc.doc" is OK.
'\\server\docs\mydoc.doc' is WRONG!
'\\\\server\docs\mydoc.doc" is OK.
'\\\\server\\docs\\mydoc.doc" is OK.

HTH, Jenda


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

Date: Thu, 03 Sep 1998 21:24:41 -0700
From: Jan Krynicky <JKRY3025@comenius.ms.mff.cuni.cz>
To: paul.cao@compaq.com
Subject: Re: Run Word 97 macro from Perl error?
Message-Id: <35EF6B89.3F36@comenius.ms.mff.cuni.cz>

paulc wrote:
> 
> Hi,
>     I used the following perl script to run a Word 97 macro but doesn't
> work.
> the script is as following:
> 
> use Win32::OLE;
> my $wdapp1 = Win32::OLE->new('Word.Application.8','Quit')
> ||   die "CreateObject: $!";
> $wdapp1->{Visible} = 1;
> $doc1 = $wdapp1->Documents->Open("E:\\perl\\vba\\fdr\\word\\mix.doc");
> $wdapp1->Run("ConvertCNew6");
> $doc1->SaveAs("e:/perl/vba/fdr/word/mix.doc");
> $doc1->Close();
> $wdapp1->Quit();
> 
> The error that it produce is:
> 
> OLE exception from "Microsoft Word":
> 
> Unable to run the specified macro
> 
> OLE error 0x800a1219
>     in methodcall/getproperty "Run" at wrd3.pl line 6");
> 
> Basically, I was able to run this macro manually. The macro's function is to
> format
> the whole document to a certain font and size.
> 
> Thanks
> 
> Paul

I do not have Word 97 by hand. Could it be 

$docl->Run("ConvertCNew6");

? Is Run a method of application or document?

Jenda


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

Date: Thu, 03 Sep 1998 19:41:57 GMT
From: bitnut1@my-dejanews.com
Subject: Re: Tom Phoenix: ANSWERS WANTED!
Message-Id: <6smre4$7hk$1@nnrp1.dejanews.com>



s/anyone criticizing any(one|thing) related to Perl/troll/g;

print 'Grok, plonk, oink!';

exit -1;

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp   Create Your Own Free Member Forum


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

Date: Thu,  3 Sep 1998 17:01:11 EDT
From: dblack@saturn.superlink.net (David A. Black)
Subject: Re: Trolls
Message-Id: <6sn02n$iq2$1@earth.superlink.net>

bitnut1@my-dejanews.com writes:



>s/anyone criticizing any(one|thing) related to Perl/troll/g

>print 'Grok, oink!';

>exit -1;

orpheus:~/perl$ perl -w
s/anyone criticizing any(one|thing) related to Perl/troll/g

print 'Grok, oink!';

exit -1;
syntax error at - line 3, near "print"
Execution of - aborted due to compilation errors.



David Black
dblack@saturn.superlink.net


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

Date: Thu, 03 Sep 1998 16:13:22 -0500
From: "Quinn,M" <quinn@computer.org>
Subject: Re: UN-INSTALLING Perl: How can I un-install old versions?
Message-Id: <35EF0672.73054C7A@computer.org>

Quinn,M wrote:
> 
> I'm new to Perl and new to Linux.  I've searched FAQs
> and "Learning Perl" and "Programming in Perl".  Perhaps
> I just overlooked the answer to the following questions:
> 
> 1.  How can I UN-INSTALL Perl 3 and/or Perl 4
>     from several Linux computers?  Some do not have
>     very much space.
> 
> 2.  How can I avoid installing Perl man pages on
>     Linux computers with tiny hard disks?
> 
> Please reply by e-mail as well as replying to newsgroup.
> 
> Thank you,  Melinda Quinn    quinn@computer.org
I should have added that I intend to install Perl 5.


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

Date: 12 Jul 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Special: Digest Administrivia (Last modified: 12 Mar 98)
Message-Id: <null>


Administrivia:

Special notice: in a few days, the new group comp.lang.perl.moderated
should be formed. I would rather not support two different groups, and I
know of no other plans to create a digested moderated group. This leaves
me with two options: 1) keep on with this group 2) change to the
moderated one.

If you have opinions on this, send them to
perl-users-request@ruby.oce.orst.edu. 


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.misc (and this Digest), send your
article to perl-users@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.

The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.

The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.

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 V8 Issue 3629
**************************************

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