sending mail through Outlook

2003-08-18 Thread Mark Aycock
I am troubleshooting the following script.  I want to use Outlook for
sending the message for specific reasons.  I am having problems with one
user on one machine running the script.  The same user logged in on another
box can run the script.  The error I get is:

Win32::OLE(0.1101): GetOleTypeLibObject() Not a Win32::OLE::TypeLib object
at c:/perl/site/lib/Win32/OLE/Const.pm line 34.

WinNT 4.0sp6
perl 5.003

Help would be greatly appreciated.

= script =
use strict;
use Win32::OLE;
use Win32::OLE::Const 'Microsoft Outlook';
print "sending mail to @Recipients  \n";

my $Outlook = Win32::OLE->new('Outlook.Application');
my $ol = Win32::OLE::Const->Load($Outlook);
my $NewItem = $Outlook->CreateItem(olMailItem);
$NewItem->{'To'}= "@Recipients";
$NewItem->{'Subject'} = $sub;

if ($attach ne 'none') {
my $ErrMsg = "The attachment file could not be found";
my $Attachments = $NewItem->{'Attachments'};
$Attachments->Add("$attach") or Warn();
}

my $ErrMsg = "The comment file could not be found.";

open(COMMENTS, $file) or Warn();
while() {
$NewItem->{'Body'} = $NewItem->{'Body'} . $_ 
}

$ErrMsg = "The mail failed to send.";
$NewItem->Send or Warn();
print "mail sent.\n";



**
This email and any files transmitted with it are confidential
and intended solely for the individual or entity to 
whom they are addressed.  If you have received this email
in error destroy it immediately.
**
 Wal-Mart Stores, Inc. Confidential
**

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


Re: Environment variables on Win98

2003-08-18 Thread Jan Dubois
On Mon, 18 Aug 2003 11:23:06 -0700, "$Bill Luebkert"
<[EMAIL PROTECTED]> wrote:

>Arms, Mike wrote:
>
>> Looks like one too many "}," here:
>> 
>> 4 => {  0 => { 1 => 'Windows 95',
>>2 => 'Windows NT 4.0' }, },
>> 
>> and the close should be after:
>> 
>>   90 => { 1 => 'Windows Me' },
>> 
>> So the tested code becomes:
>> 
>>   my %maj_min_id = (
>>  3 => {  51 => { 0 => 'Windows NT 3.51' }, },
>>  4 => {   0 => { 1 => 'Windows 95', 
>>   2 => 'Windows NT 4.0' },
>>  10 => { 1 => 'Windows 98' },
>>  90 => { 1 => 'Windows Me' }, },
>>  5 => {   0 => { 2 => 'Windows 2000' },
>>   1 => { 2 => 'Windows XP' },
>>   2 => { 2 => 'Windows Server 2003' }, },
>>  );
>
>
>Caught me again - I haven't been to bed yet.  :(
>I moved the closing '},' up with the 95 line by mistake.
>I fixed the indenting above.  Going to bed now.

You may want to look at Win32::GetOSName() is Perl\site\lib\Win32.pm.
It also differentiates Win32s and the various 95 (original, a, b1, b2)
and 98 releases.

The released version still gets Win2003 wrong (microsoft changed th
minor id between the RCs and the final release), but this has already
been fixed for the future.

Cheers,
-Jan

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


RE: CPAN Module UNIX Windows newline character

2003-08-18 Thread Peter Eisengrein
Title: RE: CPAN Module UNIX Windows newline character





Thanks Ted. My way may have only been for Windows (was kinda the point), and it may been a bit long winded but it gets the job done. 

So there!



-Original Message-
From: Ted S. [mailto:[EMAIL PROTECTED]]
Sent: Monday, August 18, 2003 5:02 PM
To: [EMAIL PROTECTED]
Subject: Re: CPAN Module UNIX Windows newline character



On 18 Aug 2003, $Bill Luebkert wrote in perl:


> Peter Eisengrein wrote:
> 
>> Here's a simple unix2dos script to save you from having to do the MS
>> Word conversion in the future.
>> 
> 
> This script will only work on a Windoze system of course:


Hmmm.  This is the Perl-Win32-Users mailing list, and the first post in a 
long time that's relevant not just to Perl in general, but to Perl on 
Windows, is coming in for criticism.  :-p


BTW: What is -pi.bak?  Obviously .bak is a backup file, but I don't get 
the -pi flag.  Not all of us are whizzes at command-line mumbo-jumbo!


-- 
Ted Schuerzinger
Homer Simpson: I'm sorry Marge, but sometimes I think we're the worst 
family in town.
Marge: Maybe we should move to a larger community.

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





Re: CPAN Module UNIX Windows newline character

2003-08-18 Thread Carl Jolley
On Mon, 18 Aug 2003, $Bill Luebkert wrote:

> Peter Eisengrein wrote:
>
> > Here's a simple unix2dos script to save you from having to do the MS
> > Word conversion in the future.
> >
>
> This script will only work on a Windoze system of course:
>
> > ### unix2dos.pl
> >
> > use strict;
> > use File::Copy;
> >
> > my $file = $ARGV[0] || die "Usage: $0 filename\n";
> > my $temp = "$ENV{TEMP}/$file\.$$";
> >
> > open(FILE,$file) || die "Can't open $file for reading : $!\n";
> > open(TMP,"> $temp") || die "Can't open $temp for writing : $!\n";
> >
> > foreach my $line()
> > {
> > chomp($line);
> > print TMP "$line\n";
>
> The above two lines could just as easily be:
>   print TMP $line;
> since the newline is just being removed and added right back.
>
> > }
> >
> > close(FILE);
> > close(TMP);
> >
> > move("$file","$ENV{temp}");
> > move("$temp","$file");
> >
> > ### end
>
> Or you could just use (on either UNIX or Windoze):
>
> #!perl -pi.bak
> BEGIN { binmode STDIN; binmode STDOUT; }
> s/[\r*\n*]+$/\r\n/;
> __END__
>
> or simply from the commandline (Windoze only version):
>
>   perl -pi.bak -e "" test.txt
>
> Perl can handle either UNIX or Windoze line endings on a Windoze system.
> UNIX can handle windoze line endings (except on the shebang line when
> started as 'scriptname' instead of 'perl scriptname', since the shell
> will barf on the \r).
>

And of course in the four lines:

foreach my $line()
{
chomp($line);
 print TMP "$line\n";

could have been replaced with:

print TMP foreach ();

or if the file was of reasonable size:

print TMP ;

On the other hand with the script:

#!perl -pi.bak
BEGIN { binmode STDIN; binmode STDOUT; }
s/[\r*\n*]+$/\r\n/;
__END__


I can't figure out why you would want to replace the first string of one
or more consecutive '*' characters on each line with "\r\n" while ignoring
the ending of that line. Or, for that matter why you would want to replace
the "\r" with "\r\n" unless you were trying to create a double spaced
version of the file. I suspect you were intending to instead do:
s/\r?\n/\r\n/;

 [EMAIL PROTECTED] 
 All opinions are my own and not necessarily those of my employer 



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


RE: Environment variables on Win98

2003-08-18 Thread Arms, Mike
Looks like one too many "}," here:

4 => {  0 => { 1 => 'Windows 95',
   2 => 'Windows NT 4.0' }, },

and the close should be after:

 90 => { 1 => 'Windows Me' },

So the tested code becomes:

  my %maj_min_id = (
3 => {  51 => { 0 => 'Windows NT 3.51' }, },
4 => {   0 => { 1 => 'Windows 95', 2 => 'Windows NT 4.0' },
10 => { 1 => 'Windows 98' },
90 => { 1 => 'Windows Me' }, },
5 => {   0 => { 2 => 'Windows 2000' },
 1 => { 2 => 'Windows XP' },
 2 => { 2 => 'Windows Server 2003' }, },
);

--
Mike Arms


> -Original Message-
> From: $Bill Luebkert [mailto:[EMAIL PROTECTED]
> Sent: Monday, August 18, 2003 11:54 AM
> To: Arms, Mike
> Cc: [EMAIL PROTECTED]
> Subject: Re: Environment variables on Win98
> 
> 
> Arms, Mike wrote:
> 
> > Hi, Bill.
> > 
> > Is there a bug in this entry:
> > 
> >4 => {0 => { 1 => 'Windows 95' },
> > 10 => { 1 => 'Windows 98' },
> > 90 => { 1 => 'Windows Me' },
> >  0 => { 2 => 'Windows NT 4.0' }, },
> > 
> > The second "0 =>" effectively wipes out the first.
> > So you end up with no entry for Win95.
> 
> Thanks for the catch.  Didn't notice the dup when I built the hash.
> Try this one:
> 
> my %maj_min_id = (
>   3 => { 51 => { 0 => 'Windows NT 3.51' }, },
>   4 => {  0 => { 1 => 'Windows 95',
>  2 => 'Windows NT 4.0' }, },
>10 => { 1 => 'Windows 98' },
>90 => { 1 => 'Windows Me' },
>   5 => {  0 => { 2 => 'Windows 2000' },
>   1 => { 2 => 'Windows XP' },
> 2 => { 2 => 'Windows Server 2003' }, },
> );
> 
> > To see this, add this:
> > 
> >   use Data::Dumper;
> >   print Data::Dumper->Dump( [ \%maj_min_id ], [qw(*maj_min_id)] );
> > 
> > --
> > Mike Arms
> > 
> > 
> > 
> >>-Original Message-
> >>From: $Bill Luebkert [mailto:[EMAIL PROTECTED]
> >>Sent: Friday, August 15, 2003 10:51 PM
> >>To: Joe Camel
> >>Cc: [EMAIL PROTECTED]
> >>Subject: Re: Environment variables on Win98
> >>
> >>
> >>Joe Camel wrote:
> >>
> >>
> >>>Does anyone know where online I could find out about
> >>>env variables on win98? Some of the software I am
> >>>supporting contains the following line:
> >>>
> >>>return unless !defined $ENV{PROMPT} or (defined
> >>>$ENV{CMDLINE} and $ENV{CMDLINE}eq 'WIN');
> >>>
> >>>The purpose of the return statment is to prevent the
> >>>rest of the code from running if the user has a DOS
> >>>prompt open already. $ENV{PROMPT} is for XP/2000/NT4,
> >>>whereas $ENV{CMDLINE} is suppose to be for WIN 95/98,
> >>>but I am not sure if things are working properly since
> >>>I don't have a copy of WIN98 handy. Thanks.
> >>
> >>This may be a more useful method:
> >>
> >>use strict;
> >>my %maj_min_id = (
> >>  3 => { 51 => { 0 => 'Windows NT 3.51' }, },
> >>  4 => {  0 => { 1 => 'Windows 95' },
> >> 10 => { 1 => 'Windows 98' },
> >> 90 => { 1 => 'Windows Me' },
> >>  0 => { 2 => 'Windows NT 4.0' }, },
> >>  5 => {  0 => { 2 => 'Windows 2000' },
> >>  1 => { 2 => 'Windows XP' },
> >>  2 => { 2 => 'Windows Server 2003' }, },
> >>);
> >>
> >>my ($str, $maj, $min, $bld, $id) = Win32::GetOSVersion();
> >>print "OS Version = $maj_min_id{$maj}{$min}{$id} - $str 
> Build=$bld\n";
> 
> 
> 
> -- 
>   ,-/-  __  _  _ $Bill Luebkert
Mailto:[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: Environment variables on Win98

2003-08-18 Thread $Bill Luebkert
Arms, Mike wrote:

> Hi, Bill.
> 
> Is there a bug in this entry:
> 
>4 => {  0 => { 1 => 'Windows 95' },
>   10 => { 1 => 'Windows 98' },
>   90 => { 1 => 'Windows Me' },
>0 => { 2 => 'Windows NT 4.0' }, },
> 
> The second "0 =>" effectively wipes out the first.
> So you end up with no entry for Win95.

Thanks for the catch.  Didn't notice the dup when I built the hash.
Try this one:

my %maj_min_id = (
  3 => { 51 => { 0 => 'Windows NT 3.51' }, },
  4 => {  0 => { 1 => 'Windows 95',
 2 => 'Windows NT 4.0' }, },
 10 => { 1 => 'Windows 98' },
 90 => { 1 => 'Windows Me' },
  5 => {  0 => { 2 => 'Windows 2000' },
  1 => { 2 => 'Windows XP' },
  2 => { 2 => 'Windows Server 2003' }, },
);

> To see this, add this:
> 
>   use Data::Dumper;
>   print Data::Dumper->Dump( [ \%maj_min_id ], [qw(*maj_min_id)] );
> 
> --
> Mike Arms
> 
> 
> 
>>-Original Message-
>>From: $Bill Luebkert [mailto:[EMAIL PROTECTED]
>>Sent: Friday, August 15, 2003 10:51 PM
>>To: Joe Camel
>>Cc: [EMAIL PROTECTED]
>>Subject: Re: Environment variables on Win98
>>
>>
>>Joe Camel wrote:
>>
>>
>>>Does anyone know where online I could find out about
>>>env variables on win98? Some of the software I am
>>>supporting contains the following line:
>>>
>>>return unless !defined $ENV{PROMPT} or (defined
>>>$ENV{CMDLINE} and $ENV{CMDLINE}eq 'WIN');
>>>
>>>The purpose of the return statment is to prevent the
>>>rest of the code from running if the user has a DOS
>>>prompt open already. $ENV{PROMPT} is for XP/2000/NT4,
>>>whereas $ENV{CMDLINE} is suppose to be for WIN 95/98,
>>>but I am not sure if things are working properly since
>>>I don't have a copy of WIN98 handy. Thanks.
>>
>>This may be a more useful method:
>>
>>use strict;
>>my %maj_min_id = (
>>  3 => { 51 => { 0 => 'Windows NT 3.51' }, },
>>  4 => {  0 => { 1 => 'Windows 95' },
>>   10 => { 1 => 'Windows 98' },
>>   90 => { 1 => 'Windows Me' },
>>  0 => { 2 => 'Windows NT 4.0' }, },
>>  5 => {  0 => { 2 => 'Windows 2000' },
>>  1 => { 2 => 'Windows XP' },
>>2 => { 2 => 'Windows Server 2003' }, },
>>);
>>
>>my ($str, $maj, $min, $bld, $id) = Win32::GetOSVersion();
>>print "OS Version = $maj_min_id{$maj}{$min}{$id} - $str Build=$bld\n";



-- 
  ,-/-  __  _  _ $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: CPAN Module UNIX Windows newline character

2003-08-18 Thread Ted S.
On 18 Aug 2003, $Bill Luebkert wrote in perl:

> Peter Eisengrein wrote:
> 
>> Here's a simple unix2dos script to save you from having to do the MS
>> Word conversion in the future.
>> 
> 
> This script will only work on a Windoze system of course:

Hmmm.  This is the Perl-Win32-Users mailing list, and the first post in a 
long time that's relevant not just to Perl in general, but to Perl on 
Windows, is coming in for criticism.  :-p

BTW: What is -pi.bak?  Obviously .bak is a backup file, but I don't get 
the -pi flag.  Not all of us are whizzes at command-line mumbo-jumbo!

-- 
Ted Schuerzinger
Homer Simpson: I'm sorry Marge, but sometimes I think we're the worst 
family in town.
Marge: Maybe we should move to a larger community.

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


RE: CPAN Module UNIX Windows newline character

2003-08-18 Thread Joe Camel
The CPAN module is your friend. :) It will download
and install the modules for you. Either use PPM or
CPAN. Using CPAN is as simple as using PPM. Here is
the CPAN documentation:

http://search.cpan.org/author/JHI/perl-5.8.0/lib/CPAN.pm

Of course, you could also do it your way. But you are
taking the hard road. I used PPM to install
Term::ReadKey. As I mentioned before on this list,
sometimes you must substitute the double colons for
hyphens in the argument list to PPM. I don't know why.
Anyway, this worked for me & others: 

PPM install Term-ReadKey

--- "Michael D. Smith" <[EMAIL PROTECTED]>
wrote:
> 
> Then someone should talk to someone about this page
> 
>
http://search.cpan.org/author/JHI/perl-5.8.0/pod/perlmodinstall.pod
> 
> 
> I didn't think what it says there was right anyway.
> It says put the file in 
> C:\perl\lib. I think Win32::Foo should go in
> lib\Win32\Foo.pm
> 
> And that Term::Readkey I was trying to install
> should go in 
> C:\perl\lib\term\Readkey.pm
> 
> AT least that's the way it looks like the others are
> ordered. Of course, 
> that don't mean a whole lot, the Win32::API
> installed itself totally 
> different from the others. It's in
> C:\Perl\MSWin32-x86-multi-thread-5.8 and 
> is still a tar.gz format
> 
> but that Don't mean I have to like this -- this --
> oddness :)
> 
> ms
> 
> 
> 
> At 07:01 PM 8/17/03, you wrote:
> >You should use the CPAN.pm module to install
> modules
> >on CPAN. The CPAN module is a core Perl module, so
> you
> >already have it. I suggest you read the CPAN.pm
> >documentation to get started. CPAN.pm is similar to
> >PPM.
> >
> >Apparently, you downloaded the package via the CPAN
> >website. The CPAN.pm module will properly install
> the
> >package for you. It makes things much simpler. :)
> >
> >--- "Michael D. Smith" <[EMAIL PROTECTED]>
> >wrote:
> > >
> > > I just made first attempt at downloading a
> module
> > > from CPAN. When I opened
> > > it with Notepad, it had little back boxes
> instead of
> > > newlines. I think this
> > > is the difference between UNIX and Windows
> newline
> > > character.
> > >
> > > Anyway, I opened it with MS WORD 2000, saved it
> as a
> > > text file, renamed it
> > > PM and now it seems to have proper Windows
> newlines.
> > >
> > > Question is: Did this affect it in any other
> way?
> > > Would leaving it the way
> > > was have affected it's operation on AS PERL?
> > >
> > > I don't see how it could, the current
> ActiveState PM
> > > files all have Windows
> > > newlines, but my not seeing how it could, has
> > > created previous disasters:)
> > >
> > > Please advise.
> > >
> > > ms
> > >
> > > ___
> > > Perl-Win32-Users mailing list
> > > [EMAIL PROTECTED]
> > > To unsubscribe:
> >http://listserv.ActiveState.com/mailman/mysubs
> >
> >
> >__
> >Do you Yahoo!?
> >Yahoo! SiteBuilder - Free, easy-to-use web site
> design software
> >http://sitebuilder.yahoo.com
> 
> ___
> Perl-Win32-Users mailing list
> [EMAIL PROTECTED]
> To unsubscribe:
http://listserv.ActiveState.com/mailman/mysubs


__
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com
___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Re: CPAN Module UNIX Windows newline character

2003-08-18 Thread $Bill Luebkert
Carl Jolley wrote:

> On the other hand with the script:
> 
> #!perl -pi.bak
> BEGIN { binmode STDIN; binmode STDOUT; }
> s/[\r*\n*]+$/\r\n/;
> __END__
> 
> 
> I can't figure out why you would want to replace the first string of one
> or more consecutive '*' characters on each line with "\r\n" while ignoring
> the ending of that line. Or, for that matter why you would want to replace
> the "\r" with "\r\n" unless you were trying to create a double spaced
> version of the file. I suspect you were intending to instead do:
> s/\r?\n/\r\n/;

That's from an old script I grabbed and didn't check well.

I think originally it was s/\r*\n*$/\r\n/ and later was turned
into a character class and the *'s were left in by mistake and
was intended to be s/[\r\n]+$/\r\n/.  The $ is redundant in this
case.

I know I didn't want your version: 's/\r?\n/\r\n/' since I wanted
to be able to handle a \r after the \n (strange case) or just a
\r in the case of a Mac.  But then the read wouldn't terminate
and you would need to add an /s qualifier (s/[\r\n]+/\r\n/s).

-- 
  ,-/-  __  _  _ $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: Environment variables on Win98

2003-08-18 Thread $Bill Luebkert
Arms, Mike wrote:

> Looks like one too many "}," here:
> 
> 4 => {  0 => { 1 => 'Windows 95',
>2 => 'Windows NT 4.0' }, },
> 
> and the close should be after:
> 
>90 => { 1 => 'Windows Me' },
> 
> So the tested code becomes:
> 
>   my %maj_min_id = (
>   3 => {  51 => { 0 => 'Windows NT 3.51' }, },
>   4 => {   0 => { 1 => 'Windows 95', 
>   2 => 'Windows NT 4.0' },
>   10 => { 1 => 'Windows 98' },
>   90 => { 1 => 'Windows Me' }, },
>   5 => {   0 => { 2 => 'Windows 2000' },
>1 => { 2 => 'Windows XP' },
>2 => { 2 => 'Windows Server 2003' }, },
>   );


Caught me again - I haven't been to bed yet.  :(
I moved the closing '},' up with the 95 line by mistake.
I fixed the indenting above.  Going to bed now.

> 
>>-Original Message-
>>From: $Bill Luebkert [mailto:[EMAIL PROTECTED]
>>Sent: Monday, August 18, 2003 11:54 AM
>>To: Arms, Mike
>>Cc: [EMAIL PROTECTED]
>>Subject: Re: Environment variables on Win98
>>
>>
>>Arms, Mike wrote:
>>
>>
>>>Hi, Bill.
>>>
>>>Is there a bug in this entry:
>>>
>>>   4 => { 0 => { 1 => 'Windows 95' },
>>> 10 => { 1 => 'Windows 98' },
>>> 90 => { 1 => 'Windows Me' },
>>>  0 => { 2 => 'Windows NT 4.0' }, },
>>>
>>>The second "0 =>" effectively wipes out the first.
>>>So you end up with no entry for Win95.
>>
>>Thanks for the catch.  Didn't notice the dup when I built the hash.
>>Try this one:
>>
>>my %maj_min_id = (
>>  3 => { 51 => { 0 => 'Windows NT 3.51' }, },
>>  4 => {  0 => { 1 => 'Windows 95',
>> 2 => 'Windows NT 4.0' }, },<- move down to
>>   10 => { 1 => 'Windows 98' },
>>   90 => { 1 => 'Windows Me' }, <- here
>>  5 => {  0 => { 2 => 'Windows 2000' },
>>  1 => { 2 => 'Windows XP' },
>>2 => { 2 => 'Windows Server 2003' }, },
>>);


-- 
  ,-/-  __  _  _ $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: CPAN Module UNIX Windows newline character

2003-08-18 Thread $Bill Luebkert
Peter Eisengrein wrote:

> Here's a simple unix2dos script to save you from having to do the MS
> Word conversion in the future.
> 

This script will only work on a Windoze system of course:

> ### unix2dos.pl
> 
> use strict;
> use File::Copy;
> 
> my $file = $ARGV[0] || die "Usage: $0 filename\n";
> my $temp = "$ENV{TEMP}/$file\.$$";
> 
> open(FILE,$file) || die "Can't open $file for reading : $!\n";
> open(TMP,"> $temp") || die "Can't open $temp for writing : $!\n";
> 
> foreach my $line()
> {
> chomp($line);
> print TMP "$line\n";

The above two lines could just as easily be:
print TMP $line;
since the newline is just being removed and added right back.

> }
> 
> close(FILE);
> close(TMP);
> 
> move("$file","$ENV{temp}");
> move("$temp","$file");
> 
> ### end

Or you could just use (on either UNIX or Windoze):

#!perl -pi.bak
BEGIN { binmode STDIN; binmode STDOUT; }
s/[\r*\n*]+$/\r\n/;
__END__

or simply from the commandline (Windoze only version):

perl -pi.bak -e "" test.txt

Perl can handle either UNIX or Windoze line endings on a Windoze system.
UNIX can handle windoze line endings (except on the shebang line when
started as 'scriptname' instead of 'perl scriptname', since the shell
will barf on the \r).

-- 
  ,-/-  __  _  _ $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: Thoritical limits on perl processes

2003-08-18 Thread Ted S.
On 18 Aug 2003, Subrahmanyam Vadlamani wrote in perl:

> Suppose I want to read in large text files and want to
> do something with them.  Are there any theoritical
> limits on the process size of a perl script?

Seeing as there are about 10^85 atoms in the universe, I don't think you 
could have a file bigger than 10^85 bits.  :-)

I'm reminded of a doctored traffic sign that my high-school physics 
teacher had on the wall of his classroom: "Speed limit 3*10^8 m/s".

-- 
Ted Schuerzinger
Homer Simpson: I'm sorry Marge, but sometimes I think we're the worst 
family in town.
Marge: Maybe we should move to a larger community.

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


RE: CPAN Module UNIX Windows newline character

2003-08-18 Thread Peter Eisengrein
Title: RE: CPAN Module UNIX Windows newline character





Here's a simple unix2dos script to save you from having to do the MS Word conversion in the future.



### unix2dos.pl


use strict;
use File::Copy;


my $file = $ARGV[0] || die "Usage: $0 filename\n";
my $temp = "$ENV{TEMP}/$file\.$$";


open(FILE,$file) || die "Can't open $file for reading : $!\n";
open(TMP,"> $temp") || die "Can't open $temp for writing : $!\n";


foreach my $line()
{
    chomp($line);
    print TMP "$line\n";
}


close(FILE);
close(TMP);


move("$file","$ENV{temp}");
move("$temp","$file");


### end




-Original Message-
From: Michael D. Smith [mailto:[EMAIL PROTECTED]]
Sent: Sunday, August 17, 2003 5:42 PM
To: [EMAIL PROTECTED]
Subject: RE: CPAN Module UNIX Windows newline character




I just made first attempt at downloading a module from CPAN. When I opened 
it with Notepad, it had little back boxes instead of newlines. I think this 
is the difference between UNIX and Windows newline character.


Anyway, I opened it with MS WORD 2000, saved it as a text file, renamed it 
PM and now it seems to have proper Windows newlines.


Question is: Did this affect it in any other way? Would leaving it the way 
was have affected it's operation on AS PERL?


I don't see how it could, the current ActiveState PM files all have Windows 
newlines, but my not seeing how it could, has created previous disasters:)


Please advise.


ms 


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





Re: [Perl-unix-users] Thoritical limits on perl processes

2003-08-18 Thread Martin Moss
Title: RE: [Perl-unix-users] Thoritical limits on perl processes



Hi,
 
You may also want to ask yourself whether reading 
the whole file into memory rather than processing it line by line is a good idea 
if the file size is large.
This all depends on what you are doing with the 
file's contents of course. If it's a binary file, you can process it in chunks 
too.
 
Regards
 
Marty

  - Original Message - 
  From: 
  Peter 
  Eisengrein 
  To: 'Subrahmanyam Vadlamani' ; perl-win32 
  Sent: Monday, August 18, 2003 4:59 
  PM
  Subject: RE: [Perl-unix-users] Thoritical 
  limits on perl processes
  
  AFAIK, it is limited by your RAM not Perl. Some things you may 
  want to read: 
  perldoc -q memory perldoc 
  perlaix 
  -Original Message- From: 
  Subrahmanyam Vadlamani [mailto:[EMAIL PROTECTED]] 
  Sent: Monday, August 18, 2003 10:36 AM To: perl-unix; perl-win32 Subject: 
  [Perl-unix-users] Thoritical limits on perl processes 
  Hi: 
  Suppose I want to read in large text files and want to 
  do something with them.  Are there any 
  theoritical limits on the process size of a perl 
  script? 
  My scripts are going to be running on an AIX 5.1 
  machine with quite a bit of RAM (about 8 GB RAM).  
  I will be using perl 5.6.0. 
  thanks for the information. 
  Satish 
  __ Do 
  you Yahoo!? Yahoo! SiteBuilder - Free, easy-to-use web 
  site design software http://sitebuilder.yahoo.com ___ Perl-Unix-Users mailing list [EMAIL PROTECTED] To 
  unsubscribe: http://listserv.ActiveState.com/mailman/mysubs 



Re: Thoritical limits on perl processes

2003-08-18 Thread Carl Jolley
On Mon, 18 Aug 2003, Subrahmanyam Vadlamani wrote:

> Hi:
>
> Suppose I want to read in large text files and want to
> do something with them.  Are there any theoritical
> limits on the process size of a perl script?
>
> My scripts are going to be running on an AIX 5.1
> machine with quite a bit of RAM (about 8 GB RAM).  I
> will be using perl 5.6.0.
>

In most cases, it is not necessary to read in the entire contents of a
file but rather to work on one line at a time. In other cases when it is
really necessary to have the content of a fixed number of lines, you can
just read the fixed number of lines instead of reading all of them at
once.

 [EMAIL PROTECTED] 
 All opinions are my own and not necessarily those of my employer 

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


Thoritical limits on perl processes

2003-08-18 Thread Subrahmanyam Vadlamani
Hi:

Suppose I want to read in large text files and want to
do something with them.  Are there any theoritical
limits on the process size of a perl script?

My scripts are going to be running on an AIX 5.1
machine with quite a bit of RAM (about 8 GB RAM).  I
will be using perl 5.6.0.

thanks for the information.

Satish


__
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com
___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs