Re: In need to efficiently retrieve HTTP

2012-11-24 Thread Jenda Krynicky
- Because it's all backwards!
- Why is that?
- Because it's hard to read.
- Why?
- Please do not top post!

From: Tobias Hoellrich thoel...@adobe.com
 Hi Daniel - 
 http://stackoverflow.com/questions/6473785/improving-lwpsimple-perl-performance
  should bring you on the right track. If you want to avoid multiple 
 threads/processes then Keep-Alive most likely will give you the biggest 
 performance gain. The TCP connection stays open after you made the first 
 request and you can send more requests over the same connection.
 
 Cheers - T
 
 From: perl-win32-users-boun...@listserv.activestate.com 
 [mailto:perl-win32-users-boun...@listserv.activestate.com] On Behalf Of 
 Daniel Burgaud
 Sent: Wednesday, November 21, 2012 7:37 AM
 To: Perl-Win32-Users
 Subject: In need to efficiently retrieve HTTP
 
 Hi All
 
 Basically, I need to fetch thousands and thousands of small 200~4000 byte 
 files (map files). Opening and closing a socket connection is too slow a 
 process so much so a single file would take as much as 10 seconds!
 
 Is there any perl script out there that can be used to efficiently fetch HTTP 
 files? A non-closing script? I sure wanna do Threaded on this one, but my 
 win32 perl does not have thread capability.
 
 Or perhaps, is there a win32 API for this purpose and can be called from a 
 perl script?
 
 thanks
 
 Dan

= je...@krynicky.cz === http://Jenda.Krynicky.cz =
When it comes to wine, women and song, wizards are allowed 
to get drunk and croon as much as they like.
-- Terry Pratchett in Sourcery

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


Re: How to Use XML::Parser to Reduce an XML file to what is wanted

2012-11-01 Thread Jenda Krynicky
From: Paul Rousseau paulrousseau...@hotmail.com
 I have an .xml file that I want to search for specific items, ignoring the 
 remaining items.
 
 I want to be able to maintain the .xml file integrity, so I want to open the 
 original and after finding what I am looking for, dump the results to a 
 second file.

 I am thinking I would need logic to do the following.
  
 1. Open the .xml file.
 2. Begin parsing.
 3. If the object is not 'Item', keep it. (This will keep objects such as 
 'Session', 'Server', 'Group')
 4. If the object is 'Item', and it contains the text, '.Latched', keep it.
 5. Otherwise, ignore 'Item'
 6. Open the output file.
 7. Write out all the kept items.
 8. Close both files.
  
 Any help would be greatly appreciated.
  
 Paul Rousseau
 

See XML::Rules in the filter mode.

Jenda
= je...@krynicky.cz === http://Jenda.Krynicky.cz =
When it comes to wine, women and song, wizards are allowed 
to get drunk and croon as much as they like.
-- Terry Pratchett in Sourcery

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


Re: Win32::Fileop choose multiple directories

2012-07-30 Thread Jenda Krynicky
From:   Arjun Roychowdhury arju...@gmail.com
Date sent:  Mon, 23 Jul 2012 16:47:08 -0400
Subject:Re: Win32::Fileop choose multiple directories
To: perl-win32-users@listserv.activestate.com

 Thank you. That's unfortunate.
 Is multiple directory selection all that strange? My usecase is that I
 am writing a tool to upload a whole bunch of folders to a cloud
 service and they are not necessarily inside one neat directory...
 
 regds

In such case you usually select each directory separately as you 
browse the filesystem. The thing is that to be able to select several 
directories that do not reside in the same directory, you'd have to 
see the whole directory tree and it could be huge.

I'd let them select the directories one after another and attempt to 
transfer them even while the user is browsing for more.

Jenda
= je...@krynicky.cz === http://Jenda.Krynicky.cz =
When it comes to wine, women and song, wizards are allowed 
to get drunk and croon as much as they like.
-- Terry Pratchett in Sourcery

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


Re: Win32::Fileop choose multiple directories

2012-07-23 Thread Jenda Krynicky
From: Arjun Roychowdhury arju...@gmail.com
 Hi, I am looking for a perl API that presents a windows style dialog
 to users and allows them to select multiple folders. While perl::Tk
 has FileSelect and DirTree etc they don't have the native windows look
 and feel.
 In reading 
 http://search.cpan.org/~jenda/Win32-FileOp-0.16.00-withoutworldwriteables/FileOp.pm
 I noticed two APIs:
 
 a) OpenDialog
 b) BrowserForFolder
 
 a) seems to allow multiple selections (OFN_ALLOW_MULTISELECT) but I
 can't get it to select folders only
 b) seems to allow folder selections, but there is no BFI_ equivalent
 of multiselect.
 
 I've gone through many iterations of folder select dialogs
 (chooseDirectory, etc etc) but I seem to be stuck with either a old Tk
 looking dialog or a windows looking dialog that doesn't allow both
 multi-select + folder select

Win32::FileOp just wraps a few Win32 calls. I checked the 
SHBrowseForFolder and there doesn't seem to be a way to allow it to 
select several folders and seems the GetOpenFileName 
(http://msdn.microsoft.com/en-
us/library/windows/desktop/ms646927(v=vs.85).aspx) cannot be 
convinced to select folders.

I actually doubt there is a predefined dialog that'd allow you to do 
this as it sounds like a rather strange request.

Jenda
= je...@krynicky.cz === http://Jenda.Krynicky.cz =
When it comes to wine, women and song, wizards are allowed 
to get drunk and croon as much as they like.
-- Terry Pratchett in Sourcery

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


Re: directory listing of Computer on win32

2012-03-14 Thread Jenda Krynicky
 I am clueless how to do a directory list starting at the very root
 Computer which includes all drives.
 
 What I am doing to get a directory tree is this:
 my $directory = ;
 opendir DIR, $directory;
 my @files = readdir DIR;
 closedir DIR;
 
 But it only start at one drive - not all drives. I am missing out on where
 to start the initial directory.
 
 My main goal is to get all the drives on my computer, so I can do a
 directory tree on those drives.

use Win32::FileOp;

my %drives = Win32::FileOp::Substed();

while (my ($drive, $path) = each %drives) {
if ($path) {
print Network/substed drive $drive - $path\n;
} else {
print Local drive $drive\n;
}
}

Jenda
P.S.: Keep in mind that there is an often overlooked posibility to 
assign a drive letter to a directory on another drive!
= je...@krynicky.cz === http://Jenda.Krynicky.cz =
When it comes to wine, women and song, wizards are allowed 
to get drunk and croon as much as they like.
-- Terry Pratchett in Sourcery

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


Re: Changing Subject color using MIME::Lite

2010-08-22 Thread Jenda Krynicky
From: A F perl95...@yahoo.com
 Hi All,
 
 Is there a way to make the subject (not the body) of the email sent by 
 MIME::Lite in different color like red or something?
 
 sub sendmail {
    my ($to,$cc,$subject,$data) = @_;
  my $msg = MIME::Lite-new(
  From ='$from,
  To =$to,
  Bcc=$cc,
  Subject =$subject,
  Type ='text/html',
  Data =$data
      );
    $msg-add('X-Priority' = 1); 
    $msg-send('smtp',$mailhost,Debug=0);
 }
 
 Thanks
 A.

No. You may try to add the Priority: urgent header as well and see 
if it forces your mail client to mark the message in any way, but you 
definitely cannot control the color of the message subject. Not 
reliably. Anything you will come up with will be mail client 
specific.

Jenda
= je...@krynicky.cz === http://Jenda.Krynicky.cz =
When it comes to wine, women and song, wizards are allowed 
to get drunk and croon as much as they like.
-- Terry Pratchett in Sourcery

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


Re: How to simulate VB Casting for $perl_objects via Win32::OLE?

2009-12-18 Thread Jenda Krynicky
Date sent:  Thu, 17 Dec 2009 12:36:27 -0600
Subject:Re: How to simulate VB Casting for $perl_objects via 
Win32::OLE?
From:   w...@serensoft.com w...@serensoft.com
To: Jenda Krynicky je...@krynicky.cz
Copies to:  perl-win32-users@listserv.activestate.com

 That looks like a utility to take an existing perl program and convert it to
 a .NET-savvy executable:
 
 http://docs.activestate.com/pdk/8.1/ = click PerlNET link
 
 If that's the case, it won't resolve our issue. If it's not the case, we
 misunderstood. :)

The thing is that Win32::OLE is for accessing OLE/COM DLLs and 
processes, not .Net ones. PerlNET will let you use .Net classes from 
your Perl code. The fact that it will then have to build an 
executable is a bit inconvenient, but that's not the point.

Jenda
= je...@krynicky.cz === http://Jenda.Krynicky.cz =
When it comes to wine, women and song, wizards are allowed 
to get drunk and croon as much as they like.
-- Terry Pratchett in Sourcery

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


Re: How to simulate VB Casting for $perl_objects via Win32::OLE?

2009-12-17 Thread Jenda Krynicky
Subject:How to simulate VB Casting for $perl_objects via 
Win32::OLE?
 Short version: how can we simulate .NET/VB object-type CASTing, in
 Win32::OLE Perl?
 
 Long version:
 
 We're building a bridge between a java-web-app and a .net-based-desktop app.
 Perl is the glue language of choice, of course :)
 
 Where we've got trouble is that the .net programmers tell us we need to
 cast object_1 to be type object_2, and we haven't see how that's done in
 the Win32::OLE manual pages.

I believe you need PerlNET 
(http://www.activestate.com/perl_dev_kit/features/) not Win32::OLE.

Jenda
= je...@krynicky.cz === http://Jenda.Krynicky.cz =
When it comes to wine, women and song, wizards are allowed 
to get drunk and croon as much as they like.
-- Terry Pratchett in Sourcery

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


FYI: IIS, Windblows Jehovista SP1 and partial response

2009-08-29 Thread Jenda Krynicky
Yesterday I noticed that by webbased Perl scripts stopped working. 
That is the scripts ran OK, but the webserver (IIS7.0 under Windows 
Vista SP1) only sent part of the output. Both IE8 and Google Chrome 
kept on waiting for the rest of the pare until timeout, 
LWP::UserAgent sometimes returned the partial response immediately, 
sometimes waited for a timeout as well.

I tried it with ActivePerl builds 825, 822 and 1006. The behaviour 
did not depend on the perl version.

It looked like something related to caching because the response I 
got was a little less than 64KB and if I added some more HTTP 
headers, the body was shortened by exactly that number of characters. 
I tried to add some whitespace at the end and found out that the next 
pint at which the webserver sends some more data is 320KB. If I added 
enough whitespace it I received the generated HTML plus part of the 
added whitespace.

I tried to close(STDOUT), I tried to print CTRL+Z but neither of 
those fixed the issue. Though the attempt to close(STDOUT) caused LWP 
to wait for a timeout before returning the partial content.


In either case I installed SP2 and it SEEMS to work all right now.

I think it must have been broken by some hotfix or security patch 
for Windblows.

Jenda
= je...@krynicky.cz === http://Jenda.Krynicky.cz =
When it comes to wine, women and song, wizards are allowed 
to get drunk and croon as much as they like.
-- Terry Pratchett in Sourcery

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


RE: Win32::ODBC

2009-05-06 Thread Jenda Krynicky
From:   Paul Rogers perl-us...@coservers.net
To: perl-win32-users@listserv.ActiveState.com
Subject:RE: Win32::ODBC
Date sent:  Wed, 6 May 2009 14:43:53 -0400

 I'd suggest you strongly consider switching to DBI/DBD::ODBC (1.21).
 Win32::ODBC is obfuscated.

I believe you mean obsolete (should not be used because something 
better is available), not obfuscated (made hard to read).


With that change I generally agree. OTOH, if you want to create DSNs, 
then DBD::ODBC is not gonna help, Win32::ODBC will.

Jenda
= je...@krynicky.cz === http://Jenda.Krynicky.cz =
When it comes to wine, women and song, wizards are allowed 
to get drunk and croon as much as they like.
-- Terry Pratchett in Sourcery

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


Re: perl to dll?

2009-04-19 Thread Jenda Krynicky
From:   Daniel Burgaud burg...@gmail.com
 Hi All,
 
 I know there is a perl to exe, but what about a perl to dll?
 
 Dan


PerlCtrl from ActiveState's PDK.

That is if you want a COM/OLE DLL.
= je...@krynicky.cz === http://Jenda.Krynicky.cz =
When it comes to wine, women and song, wizards are allowed 
to get drunk and croon as much as they like.
-- Terry Pratchett in Sourcery

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


Re: IO::Socket (client program sends simple text file containing CRLF newlines)

2009-03-13 Thread Jenda Krynicky
From:   Greg Aiken gai...@visioninfosoft.com
 I have a simple 10 line ascii text file:
 
  
 line1CRLF
 line2CRLF
 .
 line10CRLF
 
 where CRLF is really two bytes (hex 0d)(hex0a).
 
 I use IO::Socket as basis for a client program.
 my program opens the above referenced file (for read), then reads each line
 of the file, then sends each record read out through the socket.
 at the same time, as I read the lines, I write them to a local log file.
 the point of this exercise is to see why the data sent through the socket
 DOES NOT MATCH the data sent to the local log file.
 in the local log file, the written file size exactly matches the file size
 of the originally read file.  all bytes are identically preserved, to
 include each CRLF byte pair.
 
 however, I use 'wireshark' to monitor the client/server communication here
 and it is able to capture all tcp data being sent through my used port
 number.  wireshark then can save to disk the captured data packet.  I
 discovered that something here seems to be amiss regarding the CRLF byte
 pair.  'wireshark' captured transmitted data reveals that only the LF byte
 was being sent!  somehow the CR byte does NOT get transmitted.

See perldoc -f binmode

The CRLF-LF conversion happens when you read the file and since you 
opened the logfile in text mode the reverse LF-CRLF conversion 
happens as you write to the logfile. But sockets do not do this.

binmode() both the file you read and the logfile and see.

Jenda
P.S.:This conversion happens only under operating systems that use 
the CRLF line ends. Thus your script would work find under Unix and 
break only once you/someone attempt to port it to Windows.
= je...@krynicky.cz === http://Jenda.Krynicky.cz =
When it comes to wine, women and song, wizards are allowed 
to get drunk and croon as much as they like.
-- Terry Pratchett in Sourcery

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


Re: query on dynamic

2008-12-03 Thread Jenda Krynicky
From:   p sena [EMAIL PROTECTED]
 Could someone pls explain me behind the hood thing for --
 $x = 041
 $y = 12
 then $z = $x + $y, how this comes to be numeric addition. 

In Perl + is always numeric addition. Always. No matter what the 
operands are. As such it first evaluated both operand in numeric 
scalar context.

 This will
 also be seen for any number of those initial zeros in $x and may also
 exist in similar way in $y too. I believe this comes for dynamic
 languages prop ? If this is so then can one do arithmetic(inclusive of
 comparison tests) freely on such situations, without taking into
 concern whether the $x (for example) above comes with zero perpended
 (for cases of digits from 0-9) or is a two digit number itself (like
 numbers  10) ? I mean I can do 04 + 12, 00104 + 01, 0101 + 2.50,
 044.25 + 02.50 etc.. 

Likewise  is always numeric comparison. Always. If you want a string 
comparison you need to use gt.

Some languages, even dynamic-typed ones, use + for both addition and  
concatenation and  or  for both numeric and string comparison and 
choose the right operation based on the types of the values. Which 
often leads to hard to find bugs. Like for example

   document.frm.fld.value += 1;

What would you expect it does? Increment the value? Nope. It appends 
1 to the value! Disambiguating numeric and string operation is yet 
another thing that Perl does right.

OTOH, be careful with the leading zeroes! 
  074 == 74
   074  != 74

The catch is that a numeric literal starting with zero (not folowed 
by 'x') is assumed to be octal, not decimal. So 074 is 7*8+4 not 
7*10+4. 074 is not a numeric literal, it's a string literal. But if 
you evaluate a string in numeric context then Perl takes everything 
that looks like a decimal number at the start of the string (skipping 
any whitespace). 

Jenda
= [EMAIL PROTECTED] === http://Jenda.Krynicky.cz =
When it comes to wine, women and song, wizards are allowed 
to get drunk and croon as much as they like.
-- Terry Pratchett in Sourcery

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


Re: Perl and XLS operation

2008-11-24 Thread Jenda Krynicky
From:   [EMAIL PROTECTED]
  I want to writting a perl script which let me override/edit
 the existing or created XLS.  But I am unable to do that. I am not sure,
 do I have to use few more CPAN module or what . Your help  in this
 regard will be
   appreciated. Please find the snippet of the code which I have
 for the creation of the XL sheet for your kind reference as below.

   #!/usr/bin/perl -w
   
   use strict;
   use Spreadsheet::WriteExcel;
   
   # Create a new Excel workbook called perl.xls
   my $workbook = Spreadsheet::WriteExcel-new(perl.xls);

You should test whether the constructor succeeded and $workbook is 
defined. And print the error Spreadsheet::WriteExcel reports.

   
   Here, at first time I am able to open a XLS and write to that,
 but if I want to do some changes next time, then it is not allowing me
 to do that.
   and getting the follwing error.

   C:\Documents and Settings\x0069183\Desktop\Mustafaperl hello.pl
 
   Can't open perl.xls. It may be in use or protected at hello.pl
 line 13
   (in cleanup) 


You opened the file in Excel and are looking at it while you attempt 
to run the script again, right? Excel locks the file!

Jenda
= [EMAIL PROTECTED] === http://Jenda.Krynicky.cz =
When it comes to wine, women and song, wizards are allowed 
to get drunk and croon as much as they like.
-- Terry Pratchett in Sourcery

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


Re: Getting the current code page, open with UTF-8

2008-08-19 Thread Jenda Krynicky
Date sent:  Tue, 19 Aug 2008 13:04:36 +0900
From:   Ben Bullock [EMAIL PROTECTED]
To: perl-win32-users@listserv.activestate.com
Subject:Getting the current code page, open with UTF-8

 I am using Win32::OLE to automate Microsoft Word/Excel, and I use utf8
 to communicate with the applications themselves. But when I send a
 UTF-8 string to a routine like
 
 my $filename = somethinginutf8;
 
 $word-Documents-Open ($filename);
 
 this produces an error. A lot of the files and directories that I need
 to open have Japanese names so it isn't possible for me to avoid the
 problem by just using ASCII. I've found that sending the unencoded
 version of the file name works. However, because I want to write a
 general module which I can release on CPAN, I would prefer to write a
 general solution where the file name was automatically decoded by
 Encode into the correct code page for the user.
 
 So my question is, how can my Perl program find out what the current
 code page of the user is?

use Win32::Registry;

{
my $r;
$::HKEY_LOCAL_MACHINE-
Open('SYSTEM\CurrentControlSet\Control\NLS\CodePage', $r)
or die Can't open 
HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\NLS\\CodePage:
 $^E\n;
$r-GetValue('ACP', $SystemEncoding);
$SystemEncoding = '1252' unless $SystemEncoding;
$SystemEncoding = 'cp' . $SystemEncoding;
}

or if you have the patch that was supposed to become the oficial 
version of the Win32::Registry module years ago

 $SystemEncoding = 'cp' . 
(Win32::Registry::GetValue('HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSe
t\Control\NLS\CodePage', 'ACP') || '1252');

Jenda
http://Jenda.Krynicky.cz/#Win32::Registry2

= [EMAIL PROTECTED] === http://Jenda.Krynicky.cz =
When it comes to wine, women and song, wizards are allowed 
to get drunk and croon as much as they like.
-- Terry Pratchett in Sourcery

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


Re: Help with DBI and SQL Server

2008-08-18 Thread Jenda Krynicky
From: [EMAIL PROTECTED]
 Hello all 
 I am trying to use a perl script to pull information from a SQL 
 2000 database
 The problem I am having is with authentication using an Active directory 
 account. The script works
 just fine if I use an account defined in SQL.
 below is my sample script
 
 
 use DBI;
 my $user='Domain\\userid';
 my $pw ='password';
 my $DSN = driver={SQL Server};Server=DEVSERVERDB09
 ;database=hwdbInfo;uid=$user;pwd=$pw;;
 my $dbh  = DBI-connect(dbi:ODBC:$DSN) or die $DBI::errstr\n;

This tries to find a login named 'Domain\userid' in the list of SQL 
Server's own logins.

 I usually just rely on the users local credentials to access the database 
 but this tool is going to be web based and we need each user to login 
 using their domain credentials

Rely on them again. If you leave the credentials checking to IIS it 
should run the scripts under the users' accounts so it should just 
work.

Jenda
= [EMAIL PROTECTED] === http://Jenda.Krynicky.cz =
When it comes to wine, women and song, wizards are allowed 
to get drunk and croon as much as they like.
-- Terry Pratchett in Sourcery

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


Re: templates for parsing similar documents ???

2008-06-22 Thread Jenda Krynicky
From:   Mike Schleif [EMAIL PROTECTED]
 We have a project in which we receive invoices from many vendors.
 
 We will parse a series of fields from each invoice  save them to a
 database.
 
 Assuming:
 
 [1] Every vendor's invoices will differ significantly by vendor.
 
 [2] All invoices for a given vendor will have a high degree of
 similarity.
 
 [3] The hash of fields to be parsed is common to all invoices from all
 vendors.
 
 
 It seems reasonable that we could develop a template system; whereby,
 given a vendor ID, one template can facilitate parsing all invoices for
 that vendor.
 
 I have seen several Perl template modules, mostly for web
 applications.
 
 Which Perl modules ought we to consider for our project, in lieu of
 reinventing the wheel?

I don't think template is the right term, though I can't think of any 
better. In either case I think you can happily start inventing, I 
can't think of any modules that'd help you extract the needed data 
from plaintext files. I assume we are talking about plaintext, right?

Jenda
= [EMAIL PROTECTED] === http://Jenda.Krynicky.cz =
When it comes to wine, women and song, wizards are allowed 
to get drunk and croon as much as they like.
-- Terry Pratchett in Sourcery

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


Re: module to convert text to tiff ???

2008-06-22 Thread Jenda Krynicky
Date sent:  Sun, 22 Jun 2008 18:41:27 -0500
From:   Mike Schleif [EMAIL PROTECTED]
To: perl-win32-users mailing list perl-win32-
[EMAIL PROTECTED]
Subject:module to convert text to tiff ???

 I'm searching cpan; but, I do not find what we need.
 
 We want to convert text documents to tiff format.
 
 What do you think?

Convert text documents to an image? Erm? What kind of documents? What 
do you mean by the conversion? If you wanted to convert between 
different image formats it would be clear, but what does it mean to 
convert a text document to an image?

Jenda
= [EMAIL PROTECTED] === http://Jenda.Krynicky.cz =
When it comes to wine, women and song, wizards are allowed 
to get drunk and croon as much as they like.
-- Terry Pratchett in Sourcery

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


Re: use FileHandle;

2008-04-17 Thread Jenda Krynicky
From: Adam R. Frielink [EMAIL PROTECTED]
 I have a basic project in which I need to break a larger file down into
 35 separate files.  I was under the impression that use FileHandle would
 store the object in $fh.  I could then create a a copy of my file, save
 the associated object in a hash array and print some header information
 for the files all in a simple loop.  So, joyfully, I wrote the
 following:
 
 use FileHandle;
  
 foreach my $key (0 .. 34) {
  
  $fh = new FileHandle  VTOL$key;

In a reasonably recent perl (newer than circa ten years old) you can 
write

   open my $fh, '', VTOL$key

  $flist{$key} = $fh;

The $key is an integer between 0 and 34 ... why don't you use an 
array?

  print $flist{$key} Header info\n;

As soon as the filehandle is something more complex than a HANDLE or 
$variable you have to enclose it in curlies, otherwise Perl is unable 
to parse the code.

  print {$flist{$key}} Header info\n;

Jenda
= [EMAIL PROTECTED] === http://Jenda.Krynicky.cz =
When it comes to wine, women and song, wizards are allowed 
to get drunk and croon as much as they like.
-- Terry Pratchett in Sourcery

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


Re: Perl-Win32-Users Digest, Vol 19, Issue 15

2008-02-25 Thread Jenda Krynicky
 David Golden [EMAIL PROTECTED] wrote on 02/23/2008 03:00:19 PM:
my $regex = join q{}, map { $num2chars[$_] } @digits;

The only thing I would object to is the q{}. There's really no point 
in using the q{} operator ... it just confuses the point here. 

my $regex = join '', map { $num2chars[$_] } @digits;

And it could actually just as well be written as

my $regex = join '', @[EMAIL PROTECTED];

which IMHO is even clearer. Join together the chars that belong to 
the digits.

Jenda
= [EMAIL PROTECTED] === http://Jenda.Krynicky.cz =
When it comes to wine, women and song, wizards are allowed 
to get drunk and croon as much as they like.
-- Terry Pratchett in Sourcery

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


Re: Happy 20th Birthday, Perl!

2007-12-18 Thread Jenda Krynicky
From:   [EMAIL PROTECTED] (Chris Wagner)
Subject:Re: Happy 20th Birthday, Perl!   

 Omedetou gozaimas Perl-san!! ^^

Vsechno nejlepsi k narozeninam, Perle.
Všechno nejlepší k narozeninám, Perle.

Jenda
(Not sure the accents will make it everywhere so once without and 
once with)
= [EMAIL PROTECTED] === http://Jenda.Krynicky.cz =
When it comes to wine, women and song, wizards are allowed 
to get drunk and croon as much as they like.
-- Terry Pratchett in Sourcery

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


Re: System Calls

2007-12-12 Thread Jenda Krynicky
From: Jerry Kassebaum [EMAIL PROTECTED]
 On my Windows XP this line:
 
 `copy $source\\$_ $dest`;
 
 will copy files from c:\whatever\whatever\file.ext to the directory
 the Perl script is in, but not to $dest. How do I make it copy to
 $dest? 
 
 FYI, $source=c:\\whatever\\whatever; so the backslash isn't the problem.

And $dest is?

Are you sure the command looks right? Try to add

print EXECUTE: copy $source\\$_ $dest\n;

above that command. I would not be surprised if you found out that 
the $source actually looked like this:

$source=c:\\whatever\\whatever\n;

Always make sure the variables contain exactly what you think they do 
and the command looks exactly as you expected!

In this particular case you should

use File::Copy;

anyway.

Jenda
= [EMAIL PROTECTED] === http://Jenda.Krynicky.cz =
When it comes to wine, women and song, wizards are allowed 
to get drunk and croon as much as they like.
-- Terry Pratchett in Sourcery

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


Re: Help with USB Printer

2007-12-10 Thread Jenda Krynicky
On 10 Dec 2007 at 10:50, Kenneth Ölwing wrote:
  I have written a PERL/Tk program to take input from a user and to
  print a report back based on the data. It works fine on my Windows
  XP system with an HP Laserjet 6MP connected to a standard parallel
  port (LPT1).  When I copy the program to a different computer
  running the same OS but with a different model HP laser printer
  (model 1012) connected to the USB port, the program hangs when I try
  to print. 

 snipped
 
 I think you should check out something like Win32::Printer (no idea if
 it's good, never used it). Or perhaps there are some printing
 abstractions in Tk that will help? Another approach would be to take
 the help of some other app - i.e. talk to Word through COM (i.e.
 Win32::OLE), feeding it the text and triggering the printing from
 there. If Word doesn't exist, maybe something else does - your needs
 seems simple...perhaps Notepad can be utilized by just reading a file
 you prepare and then trigger the print. Or, prepare your output as pdf
 and utilize Adobe reader. Etc. There are a number of ways, though
 admittedly all will require some fanciness...as noted though, the
 payoff may be great as you've then insulated yourself from the
 physical printer issues...

According the the registry the command to print a .txt file is

%SystemRoot%\system32\NOTEPAD.EXE /p %1

so you might try that. Save the text into a file and ask notepad to 
print it. Or use Win32::FileOp::ShellExecute like this:

ShellExecute 'Print' = $the_file;

this will work just as well if you later decide to generate the 
report in HTML or any other format assuming you store it with the 
correct file extension.

HTH, Jenda
= [EMAIL PROTECTED] === http://Jenda.Krynicky.cz =
When it comes to wine, women and song, wizards are allowed 
to get drunk and croon as much as they like.
-- Terry Pratchett in Sourcery

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


Re: Another Win32::ODBC issue

2007-12-03 Thread Jenda Krynicky
From: Barry Brevik [EMAIL PROTECTED]
 Now that I have got this module to work, and it IS a really cool module,
 I have encountered another mystery.

I said this a few times, maybe even to you, but anyway ... don't use 
the module. It's old and virtually unsuported anymore and even though 
it served a purpose back in times when the Windows Perl had problems 
with compatibility to some CPAN modules including DBI, now that DBI 
is available you should use that. You are more likely to get help and 
you are more likely to be supported in the future.

Apart from its ability to create DSNs there's little use for 
Win32::ODBC anymore.

 When I issue a TableList() call, I get a big array of table names like
 Parts, Customers etc.
 
 However, when I try to access those tables, I get an error that says
 unknown table/field.
 
 A co-worker who does not program, but uses MS Access with ODBC suggested
 that I try prefixing the table names with PUB.. When I use the prefix,
 everything works as expected. I figure that the PUB. prefix is
 probably implementation specific, but I have been unable to find any
 function in Win32::ODBC that returns this prefix string.

I did work with Access sometime back in '99, but don't remember 
having to do anything like that.

Can we see your code?

Jenda
= [EMAIL PROTECTED] === http://Jenda.Krynicky.cz =
When it comes to wine, women and song, wizards are allowed 
to get drunk and croon as much as they like.
-- Terry Pratchett in Sourcery

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


RE: Config::IniHash and Unicode INI file

2005-04-01 Thread Jenda Krynicky
From: Bullock, Howard A. [EMAIL PROTECTED]
 I apologize for the previous post that was sent prematurely.
 
 After reading the IniHash.pm I found that I could pass The ReadINI
 method a scalar reference. So my solution is:
 
 use Encode;
 open(FH, :encoding(UTF-16), $file);
 my $Data;
 {
 local $/;
 $Data = FH;
 close FH;
 }
 my $DomainConfig = ReadINI (\$Data, \%ReadINIoptions);

Yes, I forgot to document this. With recent versions you may use 
either of

$hashreference = ReadINI ($filename, %options);
$hashreference = ReadINI (\$data, %options);
$hashreference = ReadINI ([EMAIL PROTECTED], %options);
$hashreference = ReadINI ($filehandle, %options);

I will release a version with improved docs shortly.

Sorry, Jenda
= [EMAIL PROTECTED] === http://Jenda.Krynicky.cz =
When it comes to wine, women and song, wizards are allowed 
to get drunk and croon as much as they like.
-- Terry Pratchett in Sourcery

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


Re: 4 arg select on win32!

2003-06-25 Thread Jenda Krynicky
From: Tom Henrik Aadland [EMAIL PROTECTED]
 I have a server which I'm suppose to port from unix to win32, the
 problem
  seems to be with 4 arg select which according to different documents
 should work on win32 with sockets. The purpose is to block until a
 client tries to connect and send something. $nfound =
 select($rout=$rin, undef, undef, undef); $rin and $rout are
 constructed using vec and fileno. If this is suppose to work on win32,
 can someone please point me to an example? Or maybe a possible
 workaround. 

It should work just like under Unix assuming all the handles are 
sockets. What did you try and what happened?

Jenda
= [EMAIL PROTECTED] === http://Jenda.Krynicky.cz =
When it comes to wine, women and song, wizards are allowed 
to get drunk and croon as much as they like.
-- Terry Pratchett in Sourcery

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


Re: Random Numbers

2003-06-23 Thread Jenda Krynicky
From: Jarrett Malone [EMAIL PROTECTED]
  Let me apologize is advance if this is
  wrong list or has already been addressed etc.
  rand seems to produce an abnormally high
  number of zeros, like 20 or 30 per million
 
 active perl binary v5.8.0 Build 804
 
 
  $t = 0;
  for($k=0;$k100;$k++) {
   $t = rand(1);
   if ($t == 0.0) { print tt $t\n; }
  }

I seem to get more 0.5s than 0.0s:

$t = 0;
$zeroes = 0;
$halves = 0;
for($k=0;$k100;$k++) {
$t = rand(1);
$zeroes++ if ($t == 0.0);
$halves++ if ($t == 0.5);
}
print 0.0: $zeroes\n0.5: $halves\n;

And results:

0.0: 27
0.5: 41

0.0: 26
0.5: 33

0.0: 29
0.5: 28

0.0: 32
0.5: 38

0.0: 26
0.5: 31

Jenda
= [EMAIL PROTECTED] === http://Jenda.Krynicky.cz =
When it comes to wine, women and song, wizards are allowed 
to get drunk and croon as much as they like.
-- Terry Pratchett in Sourcery

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


Re: PPM error

2003-03-12 Thread Jenda Krynicky
From: Jan Dubois [EMAIL PROTECTED]
 On Tue, 11 Mar 2003 22:58:47 -0800, Christopher Hahn
 [EMAIL PROTECTED] wrote:
 I was about to post a question, but it seems that I know the reason
 for my difficulties now, but am going to go ahead and post the
 problem.
 
 Then I added Jenda's and Roth's package repositories to my setup,
 using the rep add call.
 
 Subsequently, attempting to execute searches fail with the error:
 === ppm search Term Searching in
 Active Repositories Missing base argument at
 D:/Perl/site/lib/PPM/Repository.pm line 174
 ===
 
 This is a typical symptom of a bug that only happens when the
 repository URL ends with a backslash.  It will be fixed in the next
 ActivePerl release, but for now, make sure that you don't have a
 trailing backslash.
 
 Cheers,
 -Jan

I guess you meant a trailing slash :-)

ppm rep add jenda2 http://Jenda.Krynicky.cz/perl/
ppm search Foo

leads to this error message.

Jenda
= [EMAIL PROTECTED] === http://Jenda.Krynicky.cz =
When it comes to wine, women and song, wizards are allowed 
to get drunk and croon as much as they like.
-- Terry Pratchett in Sourcery

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


Re: How To Create a MS Word Document

2003-01-24 Thread Jenda Krynicky
From: michael higgins [EMAIL PROTECTED]
  I want to create an MS Word document from a perl program. Would I
  use Win32::OLE or another module? Can you point me to any
  documentation / 
 sample
  code / etc.?
  
  Wes

Not sure this is useable at this time, but there is also 
http://Jenda.Krynicky.cz/#Template::RTF

It would alow you to create a template in Word and then fill in the 
data. It does support loops and conditions!

Jenda
= [EMAIL PROTECTED] === http://Jenda.Krynicky.cz =
When it comes to wine, women and song, wizards are allowed 
to get drunk and croon as much as they like.
-- Terry Pratchett in Sourcery

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



RE: Perl 5.8, Win32::OLE and exceptions

2003-01-20 Thread Jenda Krynicky
From:   Steven Manross [EMAIL PROTECTED]
 Although I don't have 5.8 to test on, is there any chance that you
 playing with the Win32::OLE::Warn value might help?
 
 $Win32::OLE::Warn = 0;
 
 I set this to 0 a lot in some scripts where I expect that OLE will
 find an error, that I am checking for.  Is it possible that OLE
 defaults to a new $Win32::OLE::Warn value in 5.8?
 
 Sorry, if you already knew this...
 
 Steven

No I did not. I did not notice this in the docs.
Thanks a lot, this is exactly it :-)

Jenda
= [EMAIL PROTECTED] === http://Jenda.Krynicky.cz =
When it comes to wine, women and song, wizards are allowed 
to get drunk and croon as much as they like.
-- Terry Pratchett in Sourcery

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



[ANN] Win32::Daemon::Simple 0.1.0

2002-10-31 Thread Jenda Krynicky
I've just uploaded a new module to my pages at 
http://Jenda.Krynicky.cz

It should help you create Windows services. 

If your service only needs to wake up once every N minutes all you 
need is to tell Win32::Daemon::Simple how to name it, what account to 
install it under, what parameters you want stored in the registry and 
a few more options, create the procedure that will do the work and 
call

ServiceLoop(\doTheJob);
exit;

The module will make sure your script may be installed with
scriptname.pl -install

uninstalled with 
scriptname.pl -uninstall

the parameters stored in registry (including the interval) set with
-scriptname.pl -parameter=value

that your script knows whether it was started from the command 
prompt, by a doubleclick or by the service manager.

It will open a log file for you and allow you to write to it with
Log(Message); # a timestamp will be added
LogNT(Message); # or not

It will read the actual values of the parameters and define constants 
for them, etc. etc. etc.

Please let me know if
1) it works for you
2) you find it helpfull
3) you think you would want some new feature
4) if you think something hardcoded should be modifyable
5) ...

Jenda
== [EMAIL PROTECTED] == http://Jenda.Krynicky.cz ==
Always code as if the guy who ends up maintaining your code will be a
violent psychopath who knows where you live.
  -- Rick Osborne, [EMAIL PROTECTED]

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



Re: [PBML] Can't access from Command Line

2002-10-22 Thread Jenda Krynicky
From: William Martell [EMAIL PROTECTED]
 I am having trouble accessing Perl from the command line.  I am
 running W2k Server, IIS 5.
 
 I have reinstalled perl after I found this problem and it still does
 not work.
 
 I also checked the register under scriptmap and I added .pl
 to/the/path/to/perl.exe.
 
 I also checked the path under system variables and it says. 
 C:/perl/bin/
 
 I just can't figure out what is wrong.
 
 When I go to the command prompt, I type
 
 C:\perl
 
 and the computer just sits there.

This is exactly what is it supposed to do. If you run perl.exe 
without any parameters it expects you to type the script right there 
and end it with
CTRL+Z
on a separate line.
Then it will run the script.

If you want an IDE you have to install one. Search for Perl IDE 
with google.com and I'm sure you'll find something.

Jenda
= [EMAIL PROTECTED] === http://Jenda.Krynicky.cz =
When it comes to wine, women and song, wizards are allowed 
to get drunk and croon as much as they like.
-- Terry Pratchett in Sourcery

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



Re: difficulties mailing on win32 - none on Unix

2002-10-22 Thread Jenda Krynicky
From:   [EMAIL PROTECTED]
 I am new to this list, (and a bit of a newbie with perl), so apologies
 if this has been covered before - I have searched the faqs but can
 only find standard examples.
 
 Anyhow, I have some scripts which use Net::SMTP to mail data, and
 these have been working fine while hosted on a Unix box.
 
 For operational reasons, I have recently installed ActivePerl Win32 on
 a Windows XP box and have moved my site and scripts to this.
 Everything works normally, except the mail routines. I have tried
 Mail::Sender and get the same problems - 
 
 In all the scripts, using the new constructor fails (returns -1).

-1 means The SMTP server ... was not found in Mail::Sender.

Are you sure you have the address right?

Jenda
= [EMAIL PROTECTED] === http://Jenda.Krynicky.cz =
When it comes to wine, women and song, wizards are allowed 
to get drunk and croon as much as they like.
-- Terry Pratchett in Sourcery

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



RE: difficulties mailing on win32 - none on Unix

2002-10-22 Thread Jenda Krynicky
From: Ronan Oger [EMAIL PROTECTED]

 Krynicky,
 
 This is just a guess, but are you relying on sendmail to send your
 emails?
 
 if so, sendmail is a *unix* script. You need an SMTP server on your
 box.
 
 Make sure you've got an SMTP server.
 
 Ronan

1. Please do not top-post.

2. Please read the message you reply to! I did not ask, I was 
replying to M.Hall. HE was having problems. And he tried Net::SMTP 
and Mail::Sender modules that are NOT dependent on sendmail 
executable being available. You are right though that he needs an 
SMTP server. But it doesn't have to be on the same computer as the 
script.

3. Krynicky is my last name. I don't know if it's the same in 
English, but in Czech using the last name only without anything else 
sounds a bit rude. Call me Jenda, please.

Jenda

 -Original Message-
 From: [EMAIL PROTECTED]
 [mailto:activeperl-admin;listserv.ActiveState.com]On Behalf Of Jenda
 Krynicky Sent: Tuesday, October 22, 2002 7:04 PM To:
 [EMAIL PROTECTED];
 [EMAIL PROTECTED] Subject: Re: difficulties mailing
 on win32 - none on Unix
 
 
 From:[EMAIL PROTECTED]
  I am new to this list, (and a bit of a newbie with perl), so
  apologies if this has been covered before - I have searched the
  faqs but can only find standard examples.
  
  Anyhow, I have some scripts which use Net::SMTP to mail data, and
  these have been working fine while hosted on a Unix box.
  
  For operational reasons, I have recently installed ActivePerl Win32
  on a Windows XP box and have moved my site and scripts to this.
  Everything works normally, except the mail routines. I have tried
  Mail::Sender and get the same problems - 
  
  In all the scripts, using the new constructor fails (returns -1).
 
 -1 means The SMTP server ... was not found in Mail::Sender.
 
 Are you sure you have the address right?
 
 Jenda

= [EMAIL PROTECTED] === http://Jenda.Krynicky.cz =
When it comes to wine, women and song, wizards are allowed 
to get drunk and croon as much as they like.
-- Terry Pratchett in Sourcery

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



RE: difficulties mailing on win32 - none on Unix

2002-10-22 Thread Jenda Krynicky
From: Ronan Oger [EMAIL PROTECTED]
 You wrote:
 
 1. Please do not top-post.
 
 2. Please read the message you reply to! I did not ask, I was
 replying to M.Hall. HE was having problems. And he tried Net::SMTP
 and Mail::Sender modules that are NOT dependent on sendmail
 executable being available. You are right though that he needs an
 SMTP server. But it doesn't have to be on the same computer as the
 script.
 
 3. Krynicky is my last name. I don't know if it's the same in
 English, but in Czech using the last name only without anything else
 sounds a bit rude. Call me Jenda, please.
 
 Jenda
 
 
 Oops. I apologize for offending you, Jenda.

No problem :-)

 Oddly enough, in Switzerland where I live, calling someone by their
 first name is offensive. Ahh, cultural misunderstandings... And in
 Canada where I come from, it is more like the Czech standard.

 I answered this post from a web browser and the formatting made it
 look like it was your first name (I had assumed it was your handle).

I see.

 Thanks for the clarification for NET::SMTP. This makes sense to me. I
 wonder if he is using the default settings and not specifically
 calling out to an externam SMTP server?

Maybe. The strange thing is that Mail::Sender reports -1 which means 
server not found. This would mean that he did specify some server 
there. If he used localhost (or did not specify anything) and there 
would be no SMTP server on the computer he would get -3 connect() 
failed:.

 What do you mean by top posting? I take it you mean posting on top of
 the original question?

Yes.

 Once again, sorry about the confusion and the odd answer from my part.
 
 Ronan

Cheers, Jenda
= [EMAIL PROTECTED] === http://Jenda.Krynicky.cz =
When it comes to wine, women and song, wizards are allowed 
to get drunk and croon as much as they like.
-- Terry Pratchett in Sourcery

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



Re: [PBML] Regex With Common Applications

2002-10-21 Thread Jenda Krynicky
From: William Martell [EMAIL PROTECTED]

 -
  Hello Perl Users,
 
 I am curious whether there is a way to search a data store for a list
 of values and if any of those values are matched, replace it with a
 single common value.
 
 Currently, I can only use a Search and Replace engine to find and
 replace a single value.

Suppose the list @strings contain the values you want to replace:

my $regexp = join ('|', map {quotemeta $_} @strings);
$regexp = qr/(?:$regexp)/;
# # or
# $regexp = qr/\b(?:$regexp)\b/;
# # if you want the values to be matched only if they are complete
# # words. That is if cat is supposed to match in 
# # The cat sleeps., but not in concatenation.

...
while (INPUT) {
s/$regexp/single common value/g;
...
}

Jenda
= [EMAIL PROTECTED] === http://Jenda.Krynicky.cz =
When it comes to wine, women and song, wizards are allowed 
to get drunk and croon as much as they like.
-- Terry Pratchett in Sourcery

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



Re: Send email in ActivePerl using SMTP

2002-06-06 Thread Jenda Krynicky

From: [EMAIL PROTECTED]

 I tried the following to use SMTP to send email:
 
use Net::SMTP;
$optServer = 'luxn.com';
$optFrom = [EMAIL PROTECTED];
$optTo = [EMAIL PROTECTED];
$smtp = Net::SMTP - new (luxn.com);
$smtp - mail($optFrom);
 ...
 
 It say:
 
 Can't call method mail on an undefined value at 
 mailtest.pl line 8
 
 line 8 is:$smtp - mail($optFrom);

From perldoc perldiag

Can't call method %s on an undefined value
(F) You used the syntax of a method call, but the slot filled 
by the
object reference or package name contains an undefined 
value.
Something like this will reproduce the error:

$BADREF = undef;
process $BADREF 1,2,3;
$BADREF-process(1,2,3);

Hmm, they could have written that better.

Basicaly, the $smtp you are trying to use as an object is 
undefined. The 
Net::SMTP - new (luxn.com);
command failed.

Most probably because the luxn.com is not a valid mailserver 
address. Keep in mind that this is to be the address of the server, 
not the doman name.

Eg. for domain krynicky.cz the mail server is amber.zine.cz
(or jenda.krynicky.cz those two names point to the same IP).

Jenda

=== [EMAIL PROTECTED] == http://Jenda.Krynicky.cz ==
There is a reason for living. There must be. I've seen it somewhere.
It's just that in the mess on my table ... and in my brain
I can't find it.
--- me
___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs



Re: Potential new module to get information on an arbitrary Win32 process

2002-04-06 Thread Jenda Krynicky

From: Thomas R Wyant_III [EMAIL PROTECTED]
 Periodically there's traffic on this list about how to get information
 about another NT process. I have needed some things along this line,
 including things I can't figure out how to get from Win32::PerfLib
 (the full pathname of the executable is what I was really interested
 in).
 
 So I have written (with assistance and advice from Dave Roth, Jenda
 Krynicky, and the authors of CygWin, among others) a module
 specifically to return process information. It requires either WMI or
 Windows NT.

Well I do not know what exactly does your module do but ... if its 
fairly small maybe it would be better to add your code into an 
existing module. Maybe into Win32::AdminMisc (though of course 
Dave would have to say yes or no here.)

Jenda

=== [EMAIL PROTECTED] == http://Jenda.Krynicky.cz ==
There is a reason for living. There must be. I've seen it somewhere.
It's just that in the mess on my table ... and in my brain
I can't find it.
--- me
___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs



Mail::Sender - authentication + design questions

2002-03-25 Thread Jenda Krynicky

I would like to get some input from the general public on a few 
issues with Mail::Sender.

1) Will anyone mind if the SendX() methods will return the 
Mail::Sender object instead of the 1 they used to?

This would allow chaining the method calls like this :

eval {
(new Mail::Sender)
-OpenMultipart({...})
-Body(...)
-SendEnc(...)
-Part(...)
-SendEnc(...)
-Attach(...)
-Close();
}
if ($@ =~ /^Can't call method/) {
die Cannot send mail : $Mail::Sender::Error\n
} elsif ($@) {
die $@,\n;
}

2) There is a beta version that contains code for the SMTP 
authentication at http://Jenda.Krynicky.cz/Sender.pm . Currently 
the only supported protcols are LOGIN, PLAIN and CRAM-DM5, 
but it should be relatively easy to add other. Especialy if anyone 
sends me a snipet of code that implements them ;-)

There is no documentation on the feature yet and the interface is 
not yet fixed (yes, THIS is the question). In the beta the new 
Mail::Sender constructor and the Open, OpenMultipart, MailMsg 
and MailFile methods accepts three new parameters :

auth = the name of the protocol. Only supports LOGIN, PLAIN
 and CRAM-MD5 now.
username = ...
password = ...

I wonder whether to use username and password or authid 
and authpwd or something else ...

I do not have access to any server that would implement PLAIN 
and CRAM-MD5 so could someone test it and let me know? Or 
create for me a temporary test account on such a server if there 
are problems so that I could test?

Thanks for opinions, suggestions, bug and success reports and 
code snipets.

Jenda

=== [EMAIL PROTECTED] == http://Jenda.Krynicky.cz ==
There is a reason for living. There must be. I've seen it somewhere.
It's just that in the mess on my table ... and in my brain
I can't find it.
--- me
___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs



Re: [Perl-unix-users] What do these errors mean and how to fix?

2002-03-17 Thread Jenda Krynicky

From:   [EMAIL PROTECTED]
 I am getting the following errors when I execute the code below.
 Any ideas why and how to fix them?
 ( I saw something similar posted in the lists before and it
 had something to do with using my and local variables and/or
 passing parameters by reference. Does this ring a bell
 to anybody?)

 Here are the errors:
 Undefined value assigned to typeglob at
 /export/fmsgml60/solbook/export2/common/jcode_pl_2_13.pl line 399.
 Undefined subroutine jcode::f called at
 /export/fmsgml60/solbook/export2/common/jcode_pl_2_13.pl line 400.

 Here is my code:
 some code snipped
 Lines 399-400 are the following:
  local(*f) = $convf{$icode, $ocode};
   f(*s, $opt);

You forgot to show us the definition of %convf.

Anyway these two lines are tryin to
1) localize and define function f() using a reference to
subrouting that is stored in hash %convf in $convf{$icode, $ocode}.
2) Call the function.

In either case I really wonder who he heck wrote that. You should
not play with TYPEGLOBs (the thingies with * in front of an
identifier) unless you have to and know how to.

I'd write the code like this:

my $f = $convf{$icode, $ocode};
die There is no conversion defined for $icode,$ocode!\n
unless $f;
$f(*s, $opt);

Actualy you should get rid of the *s as well, but I don't know
anought about your code to be sure what has to be done (there
may be a reason for using typeglobs, though I doubt there is in this
case.)

Also it's ALWAYS better to use my than local.

You may try to change the function to :

sub convert {
  my ($s, $ocode, $icode, $opt) = @_;
  return (undef, undef) unless $icode = $icode || getcode( $s );
  return (undef, $icode) if $icode eq 'binary';
  $ocode = 'jis' unless $ocode;
  $ocode = $icode if $ocode eq 'noconv';
my $f = $convf{$icode, $ocode};
die There is no conversion defined for $icode,$ocode!\n
unless $f;
$f( $s, $opt);
  wantarray ? ($f, $icode) : $icode;
}

And change the lines in
 # convert from UTF8 to SJIS
$sjis_chap_pref = jcode::convert(\$utf8_chap_pref, 'sjis', 'utf8');
...

to

$sjis_chap_pref = jcode::convert( $utf8_chap_pref, 'sjis', 'utf8');

But I can't be sure it'll work.

 I have not written the jcode_pl_2_13.pl. It's been written by somebody
 else to convert japanese chaeacters from one encoding to another.

The code looks like Perl 4. I bet there is a much better module on
CPAN.

Jenda

=== [EMAIL PROTECTED] == http://Jenda.Krynicky.cz ==
There is a reason for living. There must be. I've seen it somewhere.
It's just that in the mess on my table ... and in my brain.
I can't find it.
--- me
___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs



Re: The SMTP server was not found, error from mail::sender

2002-02-10 Thread Jenda Krynicky

From:   Forrest Payne [EMAIL PROTECTED]
To: Perl PDK \(E-mail\) [EMAIL PROTECTED],
Perl User \(E-mail\) [EMAIL PROTECTED],
Perl Win32 Admin \(E-mail\) [EMAIL PROTECTED]

Do not crosspost please!

 When I use mail::sender in a .pl everything works correctly. When I
 compile it I get the error The SMTP server was not found when the
 e-mail should be sent. If you use the following lines of code with
 mail::sender then you get an e-mail to send to you.  If you compile it
 using the PDK you will get the error SMTP server  was not found
 instead of sending an e-mail.  Can anyone see what I am doing wrong?
 
 use Mail::Sender;
 $To = payne\@berbee.com;
 $Msg = From Test;
 $Subj = From Test;
 $File = C:\\TDPEXC.LOG;
 
 SendMail;
 
 sub SendMail
 {
  ref ($sender = new Mail::Sender()) or print $Mail::Sender::Error\n;

The problem is that the Sender.config file that contains the default 
options you entered when installing Mail::Sender is either not 
packaged into the .exe or at least not found by Mail::Sender.

So you have to specify the SMTP server and from address in either 
the new Mail::Sender or -MailFile() call.

I'll try to fix this.

Jenda


=== [EMAIL PROTECTED] == http://Jenda.Krynicky.cz ==
There is a reason for living. There must be. I've seen it somewhere.
It's just that in the mess on my table ... and in my brain.
I can't find it.
--- me
___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs



Re: Modules and PLX

2001-06-07 Thread Jenda Krynicky

 Mark Bergeron asks:
 Hope everyone having a great (sometime of day),

Could be better :-)

 Question: If you should be running your scripts with the
 PerlIS.dll as PLX but you load (as you must) in most cases your .pm
 modules, do they also excecute under the .dll or do they revert
 back to the .exe? or as I am thinking they just become part of the
 main contruct for the app. This may sound ridiculous but I had to
 ask.

As you say: They just become part of the main contruct for the app.
(A bit unusual terminology, but that doesn't matter :-)

Jenda 

== [EMAIL PROTECTED] == http://Jenda.Krynicky.cz ==
: What do people think?
What, do people think?  :-)
 -- Larry Wall in [EMAIL PROTECTED]
___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users



Re: Installing packages

2001-06-07 Thread Jenda Krynicky

 How can i install for ex. DBI and DBD packages in a computer with no 
 Internet Connection?

You download the modules from 
http://www.activestate.com/PPMPackages/zips/6xx-builds-only/ 
copy them somehow to the computer in question,
unpack the ZIPs to some temporary directory, set ppm repository to
that directory and install them via PPM.

PPM set repository --remove ActiveState Package Repository
PPM set repository Local c:\perl\download
PPM set save
PPM install DBI

HTH, Jenda

== [EMAIL PROTECTED] == http://Jenda.Krynicky.cz ==
: What do people think?
What, do people think?  :-)
 -- Larry Wall in [EMAIL PROTECTED]
___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users



Re: Mapping a Home Dir during logon

2001-05-25 Thread Jenda Krynicky

   I would like to create a logon script that maps a user's home directory
 (using, let's say, the Z drive letter) during logon.  What module would I
 use?  Btw, I'm using Windows NT 4.0 TSE.  Thanks.
 
 Dean Theophilou
 Genisar

If you know where to map to you may use

use Win32::FileOp; # by PPM from http://Jenda.Krynicky.cz/perl/
Map 'Z:', 'server\share';

if you want to map to the share specified in the User Manager, you 
may ither use Win32::AdminMisc or Win32::Lanman to find out  where to 
map to or run net.exe :

system( 'net.exe', 'use', '/HOME' );

HTH, Jenda

== [EMAIL PROTECTED] == http://Jenda.Krynicky.cz ==
: What do people think?
What, do people think?  :-)
 -- Larry Wall in [EMAIL PROTECTED]
___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users



Re: Win32::FileOp possible problem on Windows ME?

2001-03-18 Thread Jenda Krynicky

 I've had a report from a user that Win32::FileOp is causing an error on
 Windows ME which reports: "shell32.dll 
 error". Is this a known problem?

Does this cause the same error?

use Win32::FileOp;
print BrowseForFolder 'Test';

Jenda

P.S.: Where do I get the Tk::Win32::FileOp and who's the author?

== [EMAIL PROTECTED] == http://Jenda.Krynicky.cz ==
: What do people think?
What, do people think?  :-)
 -- Larry Wall in [EMAIL PROTECTED]
___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users



Re: Problems sending a email with perl!!

2001-03-18 Thread Jenda Krynicky

 Hi all.
 
 i'm trying to send a confirmation email after people submit a form in my
 site.well i 'm using a Mail::Sender  module that i saw somewhere on the
 Internet.The problem is:I can received a message the tells me that the email
 was sent with success but i'm not receiving the message i sent to me just to
 confirm that it really works.
 The code seems to be ok without an error and because of that i need your
 help to solve.The SMTP server is ok but the only thing that makes me dubiuos
 is that i need to type a password when send a regular mail in my machine.i
 don't know if it can be a problem.The Module i already had installed in my
 machine using ppm.Why it does not working?
 I hope someone can help me!
 Thanks in advance
 Fabio   .
 
 
 #! C:/perl/bin/perl.exe -w
 use Mail::Sender;
 ref ($send = new Mail::Sender { from = '[EMAIL PROTECTED]',
smtp = 'smtp.locweb.com.br', boundary =
 'This-is-a-mail-boundary-435427'})
or die "Error($send) : $Mail::Sender::Error\n";

It good that you check for error here ...

 $send-Open({to = '[EMAIL PROTECTED]', subject = 'Teste'});

... but you should check here as well. The Open() method is the one 
that actualy connects to the SMTP server and tries to send the mail. 
Try to check for error here the same way like above and see.

Jenda

BTW: If your mail server requires a password to accept a messsage for 
delivery I'm afraid Mail::Sender will not work for you now. It is not 
yet implemented :-(

If this is the cause of the problem, try to use a different mail 
server if possible. I don't know a mail module that allows this.
(AUTH extension to the SMTP protocol - RFC 2554) 

== [EMAIL PROTECTED] == http://Jenda.Krynicky.cz ==
: What do people think?
What, do people think?  :-)
 -- Larry Wall in [EMAIL PROTECTED]
___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users