RE: die() without setting $@

2005-04-19 Thread Anderson, Mark (Service Delivery)
perldoc -f goto

eval {
...
goto EOB;
...
...
EOB: return;
};if($@){
...
}

Kind regards,

Mark Anderson
Service Improvement Programme
Level 2, 113 Dundas Street
Edinburgh, EH3 5DE
Tel: 0131 523 8786
Mob: 07808 826 063


> -Original Message-
> From: [EMAIL PROTECTED]
> [SMTP:[EMAIL PROTECTED] On Behalf Of John
> Deighan
> Sent: Tuesday, April 19, 2005 4:57 PM
> To:   perl-win32-users@listserv.ActiveState.com
> Subject:  die() without setting $@
> 
> *** WARNING : This message originates from the Internet ***
> 
> I need to be able to jump to the end of the enclosing eval block, just
> like 
> a die() does, but without setting [EMAIL PROTECTED] Is there a way to do 
> that? (I've 
> checked the Perl docs, but couldn't find it). I could possibly die() with
> a 
> specific string, then use "if ($@ && ($@ ne ))" as the error trap,
> 
> but that's aesthetically unpleasing.
> 
> If you're interested in why, here's the explanation. Our web site is 
> implemented via a series of "opcodes". The opcode is passed in the URL. 
> There is a goto in our main script that dispatches to a particular opcode,
> 
> and the code implementing the opcodes is surrounded by an eval block. When
> 
> the output is generated, it's generated via a call to a library that 
> outputs a page - usually using a template file. There is, however, also a 
> function called errorPage() to which you pass a string. Now, when 
> errorPage() is called, there has to be no further HTTP output, so I'd 
> prefer, at the end of the errorPage() routine, to pass directly to the end
> 
> of the eval block in the main code. die() does just that, but after the 
> eval block, there's a "if ($@)" that handles any real errors, like
> database 
> connection errors, direct calls to die(), etc., and I don't want calls to 
> errorPage() to be treated like true errors (they're "user errors", which 
> just means that we want to display a page to the user informing them of 
> their error and how to correct it, and errorPage() does just that. Real 
> errors result in us receiving an e-mail with the error message, and the 
> error being logged to a database table). 
> 
> ___
> Perl-Win32-Users mailing list
> Perl-Win32-Users@listserv.ActiveState.com
> To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


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

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

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

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

___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: Modem File Transfer help

2005-04-19 Thread robert johnson
Title: Message



thanks, Bill and Ken, for your assistance.  i'll look into Omen and 
the other links you provided, and see what i can find from 
there.
 
--robert
 

  
  -Original Message-From: 
  Bbirthisel
   
   Ken 
  Cornetet writes:
  Omen Technology owns zmodem. To get the 
specs and reference code willcost a few $$.10+ years ago, when I licensed an MS-DOS 
  copy from Omen, it was very few $$. The Omen version ran very well from a 
  command, and included several options for controlling it that made good sense 
  to those of us with un*x backgrounds. The software included a pascal source - 
  I don't recall if it was x, y, or z though.
  Early version of the sz and rz programs were 
released as free software,but I've never heard of a windows port of 
them. If you want to codesomething up in C, they might be a good 
starting point.It would help to be very familiar with 
  embedded C techniques. Those versions were intended for porting to Un*x by at 
  least tolerable C programmers.
  http://www.ohse.de/uwe/software/lrzsz.html is 
decended from the old freerz/sz.And much improved, and easier to understand. 
  That is what is (or at least was) bundled with most linux distributions. I 
  recompiled that one to add options for custom varients of xmodem and ymodem 
  (for some other device that used an incompatible long_file_name 
  implementation).
  Here's some other 
stuff:http://web.mit.edu/afs/athena.mit.edu/astaff/project/telnet/src/omen/-Original 
Message-From:  Robert Johnson Ken Cornetet 
wrote:>> Win32::SerialPort> > 
http://members.aol.com/Bbirthisel/alpha.html> > This will let 
you send and receive bytes via serial ports, but AFAIK, > there isn't 
any perl code for doing zmodem transfers (but then I > haven't done a 
great deal of looking, either).There isn't. I one considered an xmodem 
  example - and someone started one - but there was too little real demand and 
  it would have taken quite a bit of work to have a fully functional and 
  reliable version.
  that will let me do basic communication 
and such, but wont allow filetransfers (at least not 
ZModem).> Best I remember, zmodem is not a trivial protocol 
to implement. It > would be possible to write a perl implementation, 
but not trivial.hmm.  thats what i was afearin'.   
your link (above) was interesting.got any other 
idears?Zmodem is certainly non-trivial, even with a 
  C source handy. And if you strip out all the error handling and 
  self-configuring code it is no longer zmodem (or especially useful). 
  
  > Can you have your device do xmodem 
or ymodem transfers instead? Either> of these would be fairly 
easy to implement in perl.unfortunately not.   this 
particular product only has ZModem.   whichkind of sucks, 
because I can't seem to get TeraTerm to work correctly,either, and so am 
forced to use HyperTerm as an interface.It looks like I'll have to 
try and do this in C or VB.  which is a drag,because my test suites 
so far have been entirely in Perl.I would contact Omen if I had a requirement 
  like that. They may have an option that could be run inside a perl 
  wrapper.
  > > is getting a modem connection 
via perl that difficult?Strange as it may seem, yes is the correct answer. Byte-streams are not 
  a native way of moving data on 
Windows.-bill
___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: cdo win32-ole "object model guard"

2005-04-19 Thread Chris Cappelletti

>I have a perl program that sends email via win32-ole cdo.
>I started having the 2 dialogs since "upgrading" :-( to outlook 2003.
>The dialogs read:


Here's the situation.  If I remember correctly (and I probably don't)
there are three normal ways to use MAPI to send email. 

1.  Outlook object Model
2.  Some way that I forget (this is the CDO method [I think])
3.  MAPI

Option 1 and 2 are now officially locked with 2003.  They are
unfortunately the only way you can access MAPI email from scripting
languages (that I know of).  Option 3, well I hope you're a good C
programmer.  

My solution:  I paid $195 (or something like that) for a dll file called
Redemption.  I can look up more info if you can't find it with a google
search.  Some guy (who really knows MAPI) wrote it and he gets around
all the security that 2003 uses.  I'm pretty sure that it supports
IDispatch so you can use Win32::OLE to access it.

Hope that helps.


___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


cdo win32-ole "object model guard"

2005-04-19 Thread Bob Davis
Hi
I have a perl program that sends email via win32-ole cdo.
I started having the 2 dialogs since "upgrading" :-( to outlook 2003.
The dialogs read:
1. A program is trying to access e-mail addresses you have stored in 
Outlook. Do you want to allow this?
2. A program is trying to automatically send e-mail on your behalf. Do 
you want to allow this?

The last one with the 5 second delay. I have read that this is called 
"object model guard" and there is no registry setting to turn it off. 
Since this is a work computer I can not uninstall outlook 2003. I have 
also read that extended mapi can prevent this error. I have a C++ 
program that uses extended mapi to get the addresses of names and this 
doesnt trigger the dialogs.

So I want to change my perl code so it doesnt ask for the 2 dialogs. 
Anybody have any suggestions?

Here is the code which basically listens for smtp connections and 
forwards the email to exchange. I have snipped the smtp portion to keep 
it brief. If anybody wants the ocde I can include the whole program.

use Win32::OLE;
use Net::SMTP::Server;
use Net::SMTP::Server::Client2;
my $name = "Microsoft Outlook Internet Settings";
Win32::OLE->Initialize(Win32::OLE::COINIT_OLEINITIALIZE) ;
die "Coinitialize error", Win32::OLE->LastError(),"\n" if 
Win32::OLE->LastError();

$Session = Win32::OLE->new('MAPI.Session');
die "Could not create a MAPI Session: $!", Win32::OLE->LastError(),"\n" 
if Win32::OLE->LastError();
$Session->Logon($name, "");
die "Could not login: ", Win32::OLE->LastError(),"\n" if 
Win32::OLE->LastError();

my $message = $Session->Outbox->Messages->Add($Subject, $Body);
for my $recp (@{$client->{TO}}) {
  my $recipient = $message->Recipients->Add;
  $recipient->{Name} = $recp;
  $recipient->{Type} = 1; # 1 = "To:", 2 = "Cc:", 3 = "Bcc:"
  $recipient->Resolve();
}
$message->Send(1, 0, 0);
___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Re: die() without setting $@

2005-04-19 Thread Rhesa Rozendaal
John Deighan wrote:
I need to be able to jump to the end of the enclosing eval block, just 
like a die() does, but without setting [EMAIL PROTECTED] Is there a way to do that? 
(I've checked the Perl docs, but couldn't find it). I could possibly 
die() with a specific string, then use "if ($@ && ($@ ne ))" as 
the error trap, but that's aesthetically unpleasing.
How about a simple return?
  eval {
# do stuff
# ...
return if $some_reason;
# do stuff that might break
# ...
die $some_message if $something_broke;
  };
  if($@) {
print "ouch! $@";
  }
  # on with the show
  # ...
You can also return values to outside the eval:
  my $ret = eval {
return 1;
  };
  # $ret is now 1

If you're interested in why, here's the explanation. Our web site is 
implemented via a series of "opcodes". The opcode is passed in the URL. 
Sounds a lot like CGI::Application. I can recommend it.
Rhesa
___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Re: Modem File Transfer help

2005-04-19 Thread Bbirthisel
In a message dated 4/19/2005 3:56:43 PM Eastern Daylight Time, [EMAIL PROTECTED] writes:

Omen Technology owns zmodem. To get the specs and reference code will
cost a few $$.

10+ years ago, when I licensed an MS-DOS copy from Omen, it was very few $$. The Omen version ran very well from a command, and included several options for controlling it that made good sense to those of us with un*x backgrounds. The software included a pascal source - I don't recall if it was x, y, or z though.

Early version of the sz and rz programs were released as free software,
but I've never heard of a windows port of them. If you want to code
something up in C, they might be a good starting point.

It would help to be very familiar with embedded C techniques. Those versions were intended for porting to Un*x by at least tolerable C programmers.

http://www.ohse.de/uwe/software/lrzsz.html is decended from the old free
rz/sz.

And much improved, and easier to understand. That is what is (or at least was) bundled with most linux distributions. I recompiled that one to add options for custom varients of xmodem and ymodem (for some other device that used an incompatible long_file_name implementation).

Here's some other stuff:
http://web.mit.edu/afs/athena.mit.edu/astaff/project/telnet/src/omen/

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, April 19, 2005 1:19 PM
To: Ken Cornetet; perl-win32-users@listserv.ActiveState.com
Subject: RE: Modem File Transfer help


Ken Cornetet wrote:
>
> Win32::SerialPort
> 
> http://members.aol.com/Bbirthisel/alpha.html
> 
> This will let you send and receive bytes via serial ports, but AFAIK, 
> there isn't any perl code for doing zmodem transfers (but then I 
> haven't done a great deal of looking, either).

There isn't. I one considered an xmodem example - and someone started one - but there was too little real demand and it would have taken quite a bit of work to have a fully functional and reliable version.

that will let me do basic communication and such, but wont allow file
transfers (at least not ZModem).


> Best I remember, zmodem is not a trivial protocol to implement. It 
> would be possible to write a perl implementation, but not trivial.

hmm.  thats what i was afearin'.   your link (above) was interesting.
got any other idears?

Zmodem is certainly non-trivial, even with a C source handy. And if you strip out all the error handling and self-configuring code it is no longer zmodem (or especially useful). 

> Can you have your device do xmodem or ymodem transfers instead? Either

> of these would be fairly easy to implement in perl.

unfortunately not.   this particular product only has ZModem.   which
kind of sucks, because I can't seem to get TeraTerm to work correctly,
either, and so am forced to use HyperTerm as an interface.

It looks like I'll have to try and do this in C or VB.  which is a drag,
because my test suites so far have been entirely in Perl.

I would contact Omen if I had a requirement like that. They may have an option that could be run inside a perl wrapper.

> > is getting a modem connection via perl that difficult?

Strange as it may seem, yes is the correct answer. Byte-streams are not a native way of moving data on Windows.

-bill
___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Re: Passing back results to calling command or CD

2005-04-19 Thread $Bill Luebkert
Glenn Linderman wrote:

> On approximately 4/19/2005 8:57 AM, came the following characters from 
> the keyboard of $Bill Luebkert:
...
> cd /?
> 
> tells about the  cd /d  option... which changes drives as well as paths...
> 
> And yes, that doesn't work on all versions of windows, but neither does 
> "for /F"...

Good catch - I don't play with batch files or cmd much, but that works:

@echo off
for /F "usebackq delims=?" %%I in (`perl E:\home\dbe\foo\fo.pl %1`) do cd /d %%I

-- 
  ,-/-  __  _  _ $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
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Re: die() without setting $@

2005-04-19 Thread $Bill Luebkert
John Deighan wrote:

> I need to be able to jump to the end of the enclosing eval block, just like 
> a die() does, but without setting [EMAIL PROTECTED] Is there a way to do 
> that? (I've 
> checked the Perl docs, but couldn't find it). I could possibly die() with a 
> specific string, then use "if ($@ && ($@ ne ))" as the error trap, 
> but that's aesthetically unpleasing.

There are lots of possibilites, why not just set a global vrbl (or at
least one that has scope) indicating the type of error to handle at
the end of the eval block:

my $user_err = 0;
eval {
...
$user_err = 1;
die ...
};
if ($@) {
if ($user_err) {
... # user error
} else {
... # real error
}
}

> If you're interested in why, here's the explanation. Our web site is 
> implemented via a series of "opcodes". The opcode is passed in the URL. 
> There is a goto in our main script that dispatches to a particular opcode, 
> and the code implementing the opcodes is surrounded by an eval block. When 
> the output is generated, it's generated via a call to a library that 
> outputs a page - usually using a template file. There is, however, also a 
> function called errorPage() to which you pass a string. Now, when 
> errorPage() is called, there has to be no further HTTP output, so I'd 
> prefer, at the end of the errorPage() routine, to pass directly to the end 
> of the eval block in the main code. die() does just that, but after the 
> eval block, there's a "if ($@)" that handles any real errors, like database 
> connection errors, direct calls to die(), etc., and I don't want calls to 
> errorPage() to be treated like true errors (they're "user errors", which 
> just means that we want to display a page to the user informing them of 
> their error and how to correct it, and errorPage() does just that. Real 
> errors result in us receiving an e-mail with the error message, and the 
> error being logged to a database table). 



-- 
  ,-/-  __  _  _ $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
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: Modem File Transfer help

2005-04-19 Thread Ken Cornetet
Omen Technology owns zmodem. To get the specs and reference code will
cost a few $$.

Early version of the sz and rz programs were released as free software,
but I've never heard of a windows port of them. If you want to code
something up in C, they might be a good starting point.

http://www.ohse.de/uwe/software/lrzsz.html is decended from the old free
rz/sz.

Here's some other stuff:
http://web.mit.edu/afs/athena.mit.edu/astaff/project/telnet/src/omen/

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, April 19, 2005 1:19 PM
To: Ken Cornetet; perl-win32-users@listserv.ActiveState.com
Subject: RE: Modem File Transfer help


Ken Cornetet wrote:
>
> Win32::SerialPort
> 
> http://members.aol.com/Bbirthisel/alpha.html
> 
> This will let you send and receive bytes via serial ports, but AFAIK, 
> there isn't any perl code for doing zmodem transfers (but then I 
> haven't done a great deal of looking, either).

that will let me do basic communication and such, but wont allow file
transfers (at least not ZModem).


> Best I remember, zmodem is not a trivial protocol to implement. It 
> would be possible to write a perl implementation, but not trivial.

hmm.  thats what i was afearin'.   your link (above) was interesting.
got any other idears?


> Can you have your device do xmodem or ymodem transfers instead? Either

> of these would be fairly easy to implement in perl.

unfortunately not.   this particular product only has ZModem.   which
kind of sucks, because I can't seem to get TeraTerm to work correctly,
either, and so am forced to use HyperTerm as an interface.

It looks like I'll have to try and do this in C or VB.  which is a drag,
because my test suites so far have been entirely in Perl.



> 
> Robert Johnson wrote:
> > 
> > 
> > i have some devices that send data files via ZModem.   i want to
> > automate the process of receiving these files for parsing via a perl

> > script.
> > 
> > after searching CPAN and other sites, i find that it's not as easy 
> > as i would have thought.
> > 
> > Devices::Modem doesnt allow file transfer, and is apparently very 
> > limited in the things that it can do.  mgetty/vgetty is only for
*nix
> > machines.   these are the only things i can find related to modems.
> > 
> > is getting a modem connection via perl that difficult?
> > 
> > any help will be great, thanks
> > 
> > robert
> > 



___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: Modem File Transfer help

2005-04-19 Thread rwj04
Ken Cornetet wrote:
>
> Win32::SerialPort
> 
> http://members.aol.com/Bbirthisel/alpha.html
> 
> This will let you send and receive bytes via serial ports, but AFAIK,
> there isn't any perl code for doing zmodem transfers (but then I haven't
> done a great deal of looking, either).

that will let me do basic communication and such, but wont allow file transfers 
(at least not ZModem).


> Best I remember, zmodem is not a trivial protocol to implement. It would
> be possible to write a perl implementation, but not trivial.

hmm.  thats what i was afearin'.   your link (above) was interesting.   got any 
other idears?


> Can you have your device do xmodem or ymodem transfers instead? Either
> of these would be fairly easy to implement in perl.

unfortunately not.   this particular product only has ZModem.   which kind of 
sucks, because I can't seem to get TeraTerm to work correctly, either, and so 
am forced to use HyperTerm as an interface.

It looks like I'll have to try and do this in C or VB.  which is a drag, 
because my test suites so far have been entirely in Perl.



> 
> Robert Johnson wrote:
> > 
> > 
> > i have some devices that send data files via ZModem.   i want to
> > automate the process of receiving these files for parsing via a perl
> > script.
> > 
> > after searching CPAN and other sites, i find that it's not as easy as i
> > would have thought.
> > 
> > Devices::Modem doesnt allow file transfer, and is apparently very
> > limited in the things that it can do.  mgetty/vgetty is only for *nix
> > machines.   these are the only things i can find related to modems.
> > 
> > is getting a modem connection via perl that difficult?
> > 
> > any help will be great, thanks
> > 
> > robert
> > 


___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


die() without setting $@

2005-04-19 Thread John Deighan
I need to be able to jump to the end of the enclosing eval block, just like 
a die() does, but without setting [EMAIL PROTECTED] Is there a way to do that? (I've 
checked the Perl docs, but couldn't find it). I could possibly die() with a 
specific string, then use "if ($@ && ($@ ne ))" as the error trap, 
but that's aesthetically unpleasing.

If you're interested in why, here's the explanation. Our web site is 
implemented via a series of "opcodes". The opcode is passed in the URL. 
There is a goto in our main script that dispatches to a particular opcode, 
and the code implementing the opcodes is surrounded by an eval block. When 
the output is generated, it's generated via a call to a library that 
outputs a page - usually using a template file. There is, however, also a 
function called errorPage() to which you pass a string. Now, when 
errorPage() is called, there has to be no further HTTP output, so I'd 
prefer, at the end of the errorPage() routine, to pass directly to the end 
of the eval block in the main code. die() does just that, but after the 
eval block, there's a "if ($@)" that handles any real errors, like database 
connection errors, direct calls to die(), etc., and I don't want calls to 
errorPage() to be treated like true errors (they're "user errors", which 
just means that we want to display a page to the user informing them of 
their error and how to correct it, and errorPage() does just that. Real 
errors result in us receiving an e-mail with the error message, and the 
error being logged to a database table). 

___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Re: Passing back results to calling command or CD

2005-04-19 Thread $Bill Luebkert
andrew Black wrote:

> $Bill Luebkert wrote:
> 
> 
>>Did a little searching and came up with this to replace the above 2 lines :
>>
>>   for /F "usebackq" %%i in (`perl find_dir.pl %1`) do cd %%i
>>
> 
> Cheers - that does the trick.   I was trying to look for a way of 
> putting the result of a command into a variable.
> 
> A slight refinement I found I needed - the above version stumbled on
> files involving spaces ...
> for /F "usebackq delims=,"   ... as before
> I am assuming the "," is not a valid character in a filename.

You could use '?' (wildcard char - can't be in a filename).
Note that cd on Windoze won't cross disk boundaries, so to be really
useful, you should have a way to change drives if necessary.

This seems to handle it but there ought to be a way to do it with
one line instead of 2 :

@echo off
for /F "usebackq" %%I in (`perl E:\home\dbe\test.pl %1`) do %%~dI
for /F "usebackq delims=?" %%J in (`perl E:\home\dbe\test.pl %1`) do cd %%J

-- 
  ,-/-  __  _  _ $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
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Creating multiple recipients in the Mail::Mailer module?

2005-04-19 Thread Chris Conacher








How do I create multiple recipients in the Mail::Mailer
module?

 

I currently have the following which works for a single
recipient in the 'To' field and I was wondering how to add more?

 

$mailer = new Mail::Mailer 'smtp', Server=>'SERVERNAME';

    $mailer->open ({    From    =>
'ANYNAME <[EMAIL PROTECTED]>',

    To  =>
'[EMAIL PROTECTED]',

    Subject =>
'SUBJECT MESSAGE',

    });

    print $mailer $body;

    $mailer->close();

 

Thanks

 

Chris





This electronic message and any attached documents are intended
only for the named addressee(s). This communication from
TransCanada may contain information that is privileged, confidential
or otherwise protected from disclosure and it must not be disclosed,
copied, forwarded or distributed without authorization. If you have
received this message in error, please notify the sender immediately
and delete the original message. Thank you.___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: Modem File Transfer help

2005-04-19 Thread Ken Cornetet
Win32::SerialPort

http://members.aol.com/Bbirthisel/alpha.html

This will let you send and receive bytes via serial ports, but AFAIK,
there isn't any perl code for doing zmodem transfers (but then I haven't
done a great deal of looking, either).

Best I remember, zmodem is not a trivial protocol to implement. It would
be possible to write a perl implementation, but not trivial.

Can you have your device do xmodem or ymodem transfers instead? Either
of these would be fairly easy to implement in perl.


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
Robert Johnson
Sent: Tuesday, April 19, 2005 4:40 AM
To: perl-win32-users@listserv.ActiveState.com
Subject: Modem File Transfer help


i have some devices that send data files via ZModem.   i want to
automate the process of receiving these files for parsing via a perl
script.

after searching CPAN and other sites, i find that it's not as easy as i
would have thought.

Devices::Modem doesnt allow file transfer, and is apparently very
limited in the things that it can do.  mgetty/vgetty is only for *nix
machines.   these are the only things i can find related to modems.

is getting a modem connection via perl that difficult?

any help will be great, thanks

robert


(ps, this was sent earlier from work, with the silly ATT\d+.txt webmail
attachment)

___
Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Re: Passing back results to calling command or CD

2005-04-19 Thread andrew Black
$Bill Luebkert wrote:
Did a little searching and came up with this to replace the above 2 lines :
   for /F "usebackq" %%i in (`perl find_dir.pl %1`) do cd %%i
Cheers - that does the trick.   I was trying to look for a way of 
putting the result of a command into a variable.

A slight refinement I found I needed - the above version stumbled on
files involving spaces ...
   for /F "usebackq delims=,"   ... as before
I am assuming the "," is not a valid character in a filename.
Thanks again for the very useful hint.
___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Re: Passing back results to calling command or CD

2005-04-19 Thread Chris Wagner


Quoting O'Reilly book:
Every process[2] has its own current directory. When a new process is
launched, it inherits its parent's current directory, but that's the end of
the connection. If your Perl program changes its directory, it won't affect
the parent shell (or whatever) that launched the Perl process. Likewise, the
processes that the Perl program creates cannot affect that Perl program's
current directory. The current directories for these new processes are
inherited from the Perl program's current directory.


At 09:37 AM 4/19/05 +0100, andrew Black wrote:
>In a bit more detail as to what I am trying to do at application level.
>I want to be able to type "mycd test" and this looks up test in a flat 
>file and finds
>test  :  c:\blah\blah\moreblah\test


However, if ur running the Bash shell u can do this.  Then ur mycd command
is a bash script that can optionally have a perl component.

#!/bin/bash
$destdir=`perlscript.pl $1`
cd $destdir
exit

Your bash shell will now be in that directory.








--
REMEMBER THE WORLD TRADE CENTER ---=< WTC 911 >=--
"...ne cede males"

0100

___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: trying to parse a file...

2005-04-19 Thread Thomas, Mark - BLS CTR
Bruce,

Here's a simple module that parses the Python config file format you
specified. Use it like this:

use ParseConfig;
use warnings;
use strict;

my $cfg = ParseConfig->new('viewcvs.conf');

# Print only the specified root
# use $cfg->show() to print the entire file
$cfg->show('svn_roots');

# Add a name/path pair to the specified root
$cfg->add('svn_roots', test8 => '/foo/bar');
$cfg->show('svn_roots');

# Remove a name/path pair to the specified root
# Unimplemented: this is for you to finish!
#print $cfg->remove('svn_roots', 'test8');

As you can see, I left the "remove" method as an exercise for the reader :)
If you decide to use it, you may want to add a "save" method as well.

Hope this provides enough to get you started.

- Mark.



ParseConfig.pm
Description: Binary data
___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Re: Passing back results to calling command or CD

2005-04-19 Thread $Bill Luebkert
andrew Black wrote:

> Hi
> I am trying to write a program that will allow me to CD to various 
> places (more details later). I want to call this from the windows 
> command line (cmd).
> 
> Ways I have tried are
>   - use Perl "chdir" - but this only affects the perl process. The 
> caller  doesn't see that change.
>   - write a bat file that calls the Perl which somehow returns the 
> result back to the bat file that can then CD for you.  How can you 
> return this
>  REM  mycd.bat
>  perl find_dir.pl   %1
>  cd  %directory_returned_by_find_dir%

Did a little searching and came up with this to replace the above 2 lines :

   for /F "usebackq" %%i in (`perl find_dir.pl %1`) do cd %%i


> 
> In a bit more detail as to what I am trying to do at application level.
> I want to be able to type "mycd test" and this looks up test in a flat 
> file and finds
> test  :  c:\blah\blah\moreblah\test
> and cds you to the correct directory
> 
> Any thoughts as to how to do this



-- 
  ,-/-  __  _  _ $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
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Re: Passing back results to calling command or CD

2005-04-19 Thread Chris Wagner
One MORE thing.  If u set an alias u can dispense with the . on the command
line.  Set an alias like "alias mycd='. mycd.sh'.  That way the . is taken
care of within the alias and u don't have to type it.  The mycd.sh script
can do anything u want to come up with a dir name to cd to.






--
REMEMBER THE WORLD TRADE CENTER ---=< WTC 911 >=--
"...ne cede males"

0100

___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Re: Passing back results to calling command or CD

2005-04-19 Thread Chris Wagner
#!/bin/bash
$destdir=`perlscript.pl $1`
cd $destdir
exit

I need to clarify one thing.  You have to invoke the script with a . infront
of it so that bash will *not* spawn a subshell.
[host:/c]$ . mycd blah
[host:/blah]$







--
REMEMBER THE WORLD TRADE CENTER ---=< WTC 911 >=--
"...ne cede males"

0100

___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Re: Passing back results to calling command or CD

2005-04-19 Thread Chris Wagner
Quoting O'Reilly book:
Every process[2] has its own current directory. When a new process is
launched, it inherits its parent's current directory, but that's the end of
the connection. If your Perl program changes its directory, it won't affect
the parent shell (or whatever) that launched the Perl process. Likewise, the
processes that the Perl program creates cannot affect that Perl program's
current directory. The current directories for these new processes are
inherited from the Perl program's current directory.


At 09:37 AM 4/19/05 +0100, andrew Black wrote:
>In a bit more detail as to what I am trying to do at application level.
>I want to be able to type "mycd test" and this looks up test in a flat 
>file and finds
>test  :  c:\blah\blah\moreblah\test


However, if ur running the Bash shell u can do this.  Then ur mycd command
is a bash script that can optionally have a perl component.

#!/bin/bash
$destdir=`perlscript.pl $1`
cd $destdir
exit

Your bash shell will now be in that directory.








--
REMEMBER THE WORLD TRADE CENTER ---=< WTC 911 >=--
"...ne cede males"

0100

___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Modem File Transfer help

2005-04-19 Thread Robert Johnson
i have some devices that send data files via ZModem.   i want to
automate the process of receiving these files for parsing via a perl
script.

after searching CPAN and other sites, i find that it's not as easy as i
would have thought.

Devices::Modem doesnt allow file transfer, and is apparently very
limited in the things that it can do.  mgetty/vgetty is only for *nix
machines.   these are the only things i can find related to modems.

is getting a modem connection via perl that difficult?

any help will be great, thanks

robert


(ps, this was sent earlier from work, with the silly ATT\d+.txt webmail
attachment)

___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: Passing back results to calling command or CD

2005-04-19 Thread Anderson, Mark (Service Delivery)
this is one of the standard annoyances... the concept of a CDW, PWD, OLDPWD
or whatever is a shell environment variable... 

1) so you create a new shell (perl.exe) and cs somewhere and store the
directory in a file... (or whatever)
2) your batch file (running in a cmd.exe of its own) then does a cd to this
same directory
3) then cmd.exe exits and drops you back out in the original CMD.exe in its
original working directory because each shell has its own copy which is
propagated to its kids...

on a unix box you'd be tempted just to do: 
#!/bin/sh
#mycd.bat
perl find_dir.pl   %1
  cd  %directory_returned_by_find_dir%
  export $NEWDIR=$PWD   
  exec $SHELL

which probably looks like it works on the surface, but probably doesn't if
you look hard enough (because it starts a new shell) 
You'd achieve this on unix by updating the .bashrc or whatever with a cd
$NEWDIR command however you still get a brand new shell which might not be
any use to you. 

Kind regards,

Mark Anderson
Service Improvement Programme
Level 2, 113 Dundas Street
Edinburgh, EH3 5DE
Tel: 0131 523 8786
Mob: 07808 826 063


> -Original Message-
> From: [EMAIL PROTECTED]
> [SMTP:[EMAIL PROTECTED] On Behalf Of
> andrew Black
> Sent: Tuesday, April 19, 2005 9:38 AM
> To:   perl-win32-users
> Subject:  Passing back results to calling command or CD
> 
> *** WARNING : This message originates from the Internet ***
> 
> Hi
> I am trying to write a program that will allow me to CD to various 
> places (more details later). I want to call this from the windows 
> command line (cmd).
> 
> Ways I have tried are
>   - use Perl "chdir" - but this only affects the perl process. The 
> caller  doesn't see that change.
>   - write a bat file that calls the Perl which somehow returns the 
> result back to the bat file that can then CD for you.  How can you 
> return this
>  REM  mycd.bat
>  perl find_dir.pl   %1
>  cd  %directory_returned_by_find_dir%
> 
> In a bit more detail as to what I am trying to do at application level.
> I want to be able to type "mycd test" and this looks up test in a flat 
> file and finds
> test  :  c:\blah\blah\moreblah\test
> and cds you to the correct directory
> 
> Any thoughts as to how to do this
> ___
> Perl-Win32-Users mailing list
> Perl-Win32-Users@listserv.ActiveState.com
> To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


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

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

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

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

___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Passing back results to calling command or CD

2005-04-19 Thread andrew Black
Hi
I am trying to write a program that will allow me to CD to various 
places (more details later). I want to call this from the windows 
command line (cmd).

Ways I have tried are
 - use Perl "chdir" - but this only affects the perl process. The 
caller  doesn't see that change.
 - write a bat file that calls the Perl which somehow returns the 
result back to the bat file that can then CD for you.  How can you 
return this
REM  mycd.bat
perl find_dir.pl   %1
cd  %directory_returned_by_find_dir%

In a bit more detail as to what I am trying to do at application level.
I want to be able to type "mycd test" and this looks up test in a flat 
file and finds
   test  :  c:\blah\blah\moreblah\test
and cds you to the correct directory

Any thoughts as to how to do this
___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: Win32::GUI

2005-04-19 Thread Johan Lindstrom
At 23:35 2005-04-18, Peter Eisengrein wrote:
> $W->{dialogui} = 1;
>
> Is this correct?
>
Actually it is $W->{-dialogui} = 1;
Ehrm... Sorry about that :)
/J
 --  --- -- --  --  - - --  -
Johan LindströmSourcerer @ Boss Casinos   johanl AT DarSerMan.com
Latest bookmark: "TCP Connection Passing"
http://tcpcp.sourceforge.net/
dmoz: /Computers/Programming/Languages/JavaScript/ 12
___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs