[25560] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 7804 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Feb 20 18:05:36 2005

Date: Sun, 20 Feb 2005 15:05:15 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Sun, 20 Feb 2005     Volume: 10 Number: 7804

Today's topics:
    Re: compacting '..' path segments using File::Spec ofer@netapt.com
    Re: Converting Word Control characters to an ASCII form <nospam@bigpond.com>
    Re: Converting Word Control characters to an ASCII form <1usa@llenroc.ude.invalid>
    Re: Importing records with both space and quoted text q <tadmc@augustmail.com>
    Re: Importing records with both space and quoted text q <ljames@apollo3.com>
    Re: Importing records with both space and quoted text q <ljames@apollo3.com>
    Re: Importing records with both space and quoted text q <1usa@llenroc.ude.invalid>
    Re: ithreads + signals on modern Unices <Thomas.Jahns@epost.de>
    Re: locking directories ofer@netapt.com
    Re: Parameters in command line <postmaster@castleamber.com>
    Re: Parameters in command line <1usa@llenroc.ude.invalid>
    Re: Parameters in command line <nobull@mail.com>
    Re: Parameters in command line <postmaster@castleamber.com>
    Re: Parameters in command line <postmaster@castleamber.com>
    Re: Problem with IO::Socket [... on Mac OS X] <news@chaos-net.de>
        user login cljlk@hotmail.com
    Re: user login <1usa@llenroc.ude.invalid>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: 20 Feb 2005 13:57:05 -0800
From: ofer@netapt.com
Subject: Re: compacting '..' path segments using File::Spec
Message-Id: <1108936625.775258.142910@z14g2000cwz.googlegroups.com>

> You'll note that I mentioned this in my response dated 2005-02-01.

Yes, you did.  I didn't respond to that post because it didn't contain
anything resembling a solution, but you deserve credit for informing us
about that trap (and it is a nasty one).

> On Unix the _physically_ cannonical path to a file is typically
subject
> to change as filesystems are expediently reorganised.  If the user
> chooses to specify their perferred _logically_ cannonical path that
> resolves via a twisty maze of symlinks then is is counterproductive
for
> a program to second guess the user.

(sigh)  Why do you keep assuming that I'm writing some app that will be
released to users?  Why do you assume the situation is such that I
probably shouldn't be cannonicalizing paths?  I know you're trying to
be helpful, but I know my application, and I know what I'm trying to
accomplish and why.  The only thing I asked for help with was how.

I'm writing back-end code that works off other back-end systems in my
company.  I need to cannonicalize paths in order to log which exact
file was processed in a run, which would otherwise be hidden by the
symlink, which is not version specific.  This is done on purpose to
make it easier to figure out what file to process.  Something like
this:

/somedir/thefile.txt -> thefile.2005021802.txt
/somedir/thefile.2005021801.txt  (old)
/somedir/thefile.2005021802.txt  (current)
/somedir/thefile.2005021803.txt  (in the middle of being created)

So the script processes /somedir/thefile.txt, which is wonderful.  But
then I log the fact that it was pointing to
/somedir/thefile.2005021802.txt at the time, so we can investigate
problems later.

The moral of the story is... if you feel someone might be approaching a
problem from the wrong angle, it's extremely thoughtful of you to
mention this, but phrase it like "if the situation is thus, then know
that this is probably not the way to go...", and then preferably also
answer the question.  Don't simply assume the situation IS thus, and
say "you're wrong".

-ofer



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

Date: Mon, 21 Feb 2005 05:39:58 +1000
From: Gregory Toomey <nospam@bigpond.com>
Subject: Re: Converting Word Control characters to an ASCII format
Message-Id: <37s7cfF5gvr7jU2@individual.net>

Murali wrote:

> Hi,
> 
> I support a web application the customers use to update information
> regarding various products.
> A lot of times, they copy and paste from a Word Document into the
> textbox in the provided form.
> 
> The cgi beind, reads in this data and stores it in an ASCCI text file.
> When the product
> information is updated, and this new information is displayed, all the
> Word special
> characters are displayed as ?  (including the apostrophes, hyphens and
> other stuff).
> 
> I tried dos2unix program to convert this, but it's not working. Is
> there a Perl regular
> expression out there which can do this job? So I clean up the text
> before storing it in a
> text file?
> 
> Thanks,
> 
> -Murali

First use a unix program like od (octal dump) to get a hex dump of the
characters. This gives you an idea of what you're dealing with.

Hex use tr within Perl to remove what you dont want. Or just remove
non-acceptable ascii characters (ie characters other than
a-z,A-Z,0-9,!@#$%^&*() etc).

gtoomey


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

Date: 20 Feb 2005 20:20:03 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: Converting Word Control characters to an ASCII format
Message-Id: <Xns96039C4B6818Easu1cornelledu@132.236.56.8>

"Murali" <murali@muralichari.com> wrote in
news:1108924152.271594.263610@f14g2000cwb.googlegroups.com: 

> I support a web application the customers use to update information
> regarding various products. A lot of times, they copy and paste from a
> Word Document into the textbox in the provided form.
> 
> The cgi beind, reads in this data and stores it in an ASCCI text file.
> When the product information is updated, and this new information is 
> displayed, all the Word special characters are displayed as ?  
> (including the apostrophes, hyphens and other stuff).

http://brent.epicserve.com/blog.php?id=20

might help.

I also found 

http://www.indwes.edu/Faculty/bcupp/things/Characters/www/windows-
chars.html

informative.

On the other hand, please note that this is not particularly on-topic here. 
The problem descriptions and solutions would be the same regardless of the 
language you use in the CGI script.

Sinan


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

Date: Sun, 20 Feb 2005 14:49:44 -0600
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: Importing records with both space and quoted text qualifiers...
Message-Id: <slrnd1htv8.ll8.tadmc@magna.augustmail.com>

L. D. James <ljames@apollo3.com> wrote:


>      The example I found in the faq works perfect with comma separated
> records.  I'm spending time now trying to figure out which commas to remove
> from the following to replace with what would specify the separator as a
> space.


All of the commas that appear in the regex need to be replaced
with a space, not removed.

Since the pattern is using m//x, you need to backslash the new 
space (yuck!) or use a char class with a space in it.

> ----------------
>          @new = ();
>          push(@new, $+) while $text =~ m{
>              "([^\"\\]*(?:\\.[^\"\\]*)*)",?  # groups the phrase inside the
> quotes
>            | ([^,]+),?
>            | ,
>          }gx;
>          push(@new, undef) if substr($text,-1,1) eq ',';
> ----------------


     push(@new, $+) while $text =~ m{
         "([^\"\\]*(?:\\.[^\"\\]*)*)"[ ]?  # groups the phrase inside the quotes
       | ([^ ]+)[ ]?
       | [ ]
     }gx;



Do not top post!

It is not nice!


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


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

Date: Sun, 20 Feb 2005 16:47:59 -0500
From: "L. D. James" <ljames@apollo3.com>
Subject: Re: Importing records with both space and quoted text qualifiers...
Message-Id: <111i1cg8f87q3bd@corp.supernews.com>


"A. Sinan Unur" <1usa@llenroc.ude.invalid> wrote in message 
news:Xns96038F203F1A1asu1cornelledu@127.0.0.1...
> "L. D. James" <ljames@apollo3.com> wrote in
> news:111hfe4hn7ero80@corp.supernews.com:
>
>> "A. Sinan Unur" <1usa@llenroc.ude.invalid> wrote in message
>> news:Xns960361AF285BBasu1cornelledu@127.0.0.1...
>>> "L. D. James" <ljames@apollo3.com> wrote in
>>> news:111gqh5aese1j98@corp.supernews.com:
>>>
>>>>      Thank you, Brian.
>>
>>>
>>> For what? Oh, you are top-posting. Please don't do that.
>>>
>>
>>      I thanked him for responding to my message,
>
> You can express your gratitude by choosing not to top-post.

     If I'm doing wrong and misunderstanding something, I appreciate the 
advice.  However, from my understanding, the message you just replied to was 
not a top-post.  If it were, please help me with the definition.  I did what 
I could to copy your style in my follow-up.  I went and read all the rules 
you recommended.  I thought I was following them.  That was my expression of 
gratitude along with my words to the effect.



     I'm gad you, in spite of all the time you spent scolding me, you choose 
to also help.  I believe a lot of it (the scolding) was unnecessary since 
you might have notice had you choose to that I had done a lot of home work 
after the first message (and scold).


>
>>> The Text::CSV_XS module allows you to specify various separators etc.
>>> The module is mentioned in the FAQ you claim to have read. I would
>>> suggest reading the docs for the said module, and saving yourself
>>> some trouble.
>>>
>>
>>      The faq mentions that TEXT:CSV_XS module.  I guess I didn't make
>>      it clear enough, but I thought I had expressed that an answer to
>>      how to manipulate the example I posted would answer many
>>      questions about data formatting.
>
> I am not sure what your purpose is: Do you want to solve your problem or
> just rant?


     No, I don't want to rant.  I'd be glad to be understood, because I 
believe there's a lot of legitimacy in my quest.  On one hand you express 
that I wasn't clear, and possibly should have said more to make it clearer. 
On the other hand you're scolding as ranting when I try to explain, where it 
seems you miss the point.



     I'm trying to understand how to use the effect of the lines I posted. 
I have many questions that could be trivial if I understood some of the 
basic elements of those lines.


>
> use strict;
> use warnings;
>
> use Text::CSV_XS;
>
> print "SSV:\n";
> use constant SSV_STRING => q{one two "three, four" five six};
> my $parse_ssv = Text::CSV_XS->new({ sep_char => ' '});
> if( $parse_ssv->parse(SSV_STRING) ) {
>    my @fields = $parse_ssv->fields;
>    print qq{"$_"\n} for @fields;
> }
>
> __END__
> D:\Home\asu1\UseNet\clpmisc> c
> SSV:
> "one"
> "two"
> "three, four"
> "five"
> "six"
>
>>      I appreciate that you have taken the time to may your
>>      expressions.
>
> Don't take this the wrong way, show some respect, and try and compose
> your messages in somewhat comprehensible English. I read and re-read
> various parts of your messages, and I cannot even begin to imagine what
> you mean by them.
>
>>      For your information, I not only did a lot of experimenting in
>>      trying to decipher the FAQ,
>
> ...
>>      I didn't immediately explore the TEXT:CSV module
>
> Text::CSV_XS is what I suggested. There is no TEXT:CSV module. Text::CSV
> is the pure Perl version of Text::CSV_XS.
>
>> example using the function I posted.  I thought the function would
>> have been easy enough for a few gurus to read and respond on how to
>> handle the white spaces.
>
> Someone has already solved the problem you are trying to solve, and put
> it in the Text::CSV_XS module. I have zero interest in even trying to
> decipher that RegEx, because I like the transparency of being able to
> say "this is the separator character I want to use" as in

     I appreciate all the work that has already been done in all the 
modules.  I did download and install the module.  It worked.  However, I was 
very interested in the "RegEx" (of which I'm glad you gave me a term for). 
So I asked the question.  I expressed my appreciation to you and the first 
one who posted the suggestion.  If I were going to just use what's already 
there, rather than try to explore and learn some of the details, then I may 
as well use the webalizer project that has already come with the Linux 
Package, or download any of hundreds of ready made programs.



     Please don't feel that I take your input and suggestions lightly.  I 
appreciate the input.  However, I believe a lot of the scolding just might 
not be so necessary in my case.  However, I'm open to learn.  If I have 
continued to ignore the rules, please point out which ones I'm breaking 
after the first reprimand.


>
> my $p = Text::CSV_XS->new({ sep_char => ' '});
>
> rather than fiddling with a multiline regex.
>
>> delaminated fields.
>
> De-lamination is probably the process of peeling off lamination from an
> ID card. What you want to say is "delimited". I am only pointing this
> out because of the consistency with which you refer to 'delaminated'
> fields.

     Again, I appreciate your input, though I had mentioned that misnomer 
numerous times in my first message, it was changed in my second, as you 
might have noticed that I was taking your advise to do more research.  Also, 
I had learned more of how to research because I was learning the terminology 
from you and this forum.  It might appear that you can lighten up on the 
scolding if you can see positive efforts on my part.  If you can't see them, 
either I'm wrong, or would like to clarify something you might be missing.



>
>>      By the way, at present I found that changing most of the commas
>>      to a
>> string set as $sp="\s" was a start.  However, it has glitches because
>> I can't tell which of the commas is a necessary part of the function
>> or is the designed delimiter.
>>
>>
>>      I'm hoping that you (or someone will notice) that I am doing the
>> homework.
>
> Please read the posting guidelines for suggestions on how to help others
> help you.
>
>> I hope you'll remember when you got stuck while the answer
>> was right in you face.
>
> Well, you were not there to help me, so I fail to see how this is
> relevant to anything.

     Actually I've been there helping many people for years.  I've been 
using the Internet longer than anyone I know.  I'd be surprised is some of 
what I have contributed to the network haven't made it to you.  Perl isn't 
the only thing from which a person might appreciate help.  Even some of the 
elements of respect that you might me missing when you respond to my message 
and my attempt to enlighten you might benefit you.  I contribute with good 
intentions.


                                       -- L. James

---------------------
L. D. James
ljames@apollo3.com
www.apollo3.com/~ljames 




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

Date: Sun, 20 Feb 2005 17:00:49 -0500
From: "L. D. James" <ljames@apollo3.com>
Subject: Re: Importing records with both space and quoted text qualifiers...
Message-Id: <111i24kslgk8j9f@corp.supernews.com>


"Tad McClellan" <tadmc@augustmail.com> wrote in message 
news:slrnd1htv8.ll8.tadmc@magna.augustmail.com...
> L. D. James <ljames@apollo3.com> wrote:
>
>
>>      The example I found in the faq works perfect with comma separated
>> records.  I'm spending time now trying to figure out which commas to 
>> remove
>> from the following to replace with what would specify the separator as a
>> space.
>
>
> All of the commas that appear in the regex need to be replaced
> with a space, not removed.
>
> Since the pattern is using m//x, you need to backslash the new
> space (yuck!) or use a char class with a space in it.

     Thanks, Tad.  It works like a charm.  I was interested in the, I 
believe it's called, RegEx, elements because I use a lot of quick command 
line functions when I'm working.

     All the input has been very helpful and appreciative.  I've also added 
more modules to my Perl environment and am learning a lot about how to 
utilize those additional features.

     Have a nice day.

                                                                    -- L. 
James

-----------------
L. D. James
ljames@apollo3.com
www.apollo3.com/~ljames 




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

Date: 20 Feb 2005 22:18:31 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: Importing records with both space and quoted text qualifiers...
Message-Id: <Xns9603B060FC48Basu1cornelledu@132.236.56.8>

"L. D. James" <ljames@apollo3.com> wrote in
news:111i1cg8f87q3bd@corp.supernews.com: 

> On one hand you express that I wasn't clear, and possibly should 
> have said more to make it clearer. 

Oh, no. In fact, I am begging you to post shorter queries that get right to 
the point. I humbly think your intentions are being drowned in the torrent 
of words and some severe grammatical errors.

> On the other hand you're scolding as ranting when I try to explain, 
> where it seems you miss the point.

Well, your original question was how to handle fields separated by some 
character except when in quotation marks.

The FAQ points out several possible avenues. You immediately focused on the 
least attractive one. Are you going to now copy and paste that regex in all 
sorts of different places in your code with commas replaced with whatever 
the separator-of-the-day might be? That is a bad habit to get into in the 
name of "learning-by-doing".

Compare the two methods side-by-side. Which one is going to be more 
transparent six months from now?

#! perl;

use strict;
use warnings;


use Text::CSV_XS;

use constant STRING => q{one two "three, four" five six};

print "Using Text::CSV_XS\n";

my $parse_ssv = Text::CSV_XS->new({ sep_char => ' '});
if( $parse_ssv->parse(STRING) ) {
    my @fields = $parse_ssv->fields;
    print qq{"$_"\n} for @fields;
}

{
    print "Using regex from FAQ:\n";
    my $text = STRING;
    my @fields;
    push(@fields, $+) while $text =~ m{
        "([^\"\\]*(?:\\.[^\"\\]*)*)"\ ?
           | ([^\ ]+)\ ?
           | ,
       }gx;
    push(@fields, undef) if substr($text, -1, 1) eq ',';
    print qq{"$_"\n} for @fields;
}

__END__

Finally, if this not something you are messing around with in your free 
time, but is actually going to be used by other people, yes, in that case I 
firmly believe you should stop trying to analyze web logs with your custom 
scripts, and download and install one of the ready made solutions. Those 
solutions will be supported long after you have left your current position.

Sinan


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

Date: 20 Feb 2005 21:43:01 +0100
From: Thomas Jahns <Thomas.Jahns@epost.de>
Subject: Re: ithreads + signals on modern Unices
Message-Id: <87y8djvu7e.fsf@ID-48333.user.dfncis.de>

brianr@liffe.com writes:
> If it is any of those reasons, it is likely to be the last, as I would
> expect (hope?) that not many people want to combine signals and
> threads. It is generally considered to be a bad idea. David Butenhof
> in his book "Programming with POSIX Threads" gives a good explanation
> of why.

If you refer to pages 215 ("It is always best to avoid using signals in
conjunction with threads.") he does also state just in the next sentence
why avoiding is also not the only solution.

> If you do have to use threads and signals together the usual advice is
> to use signal masks to block signals from all threads, and collect
> signals in a dedicated thread which blocks on one of the sigwait
> variants. Unfortunately, I believe that this is part of the POSIX API
> that Perl doesn't provide (as mentioned in perlthrtut).

Which is really annoying, because I really can't see why not make
pthread_sigmask available. I think I'll try to find out how perl
implements ithreads and if I can pry the necessary information from the
threads module to make the additional C functions useful.

> I would recommend finding a different way of doing what you want.

As it seems, I don't have any easy way to do this. One of the threads is
blocked in a recv (which AFAIK is actually libc's recvfrom) and on
certain conditions I need to wake it, immediately.

Thomas Jahns
-- 
"Computers are good at following instructions,
 but not at reading your mind."
D. E. Knuth, The TeXbook, Addison-Wesley 1984, 1986, 1996, p. 9


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

Date: 20 Feb 2005 13:48:10 -0800
From: ofer@netapt.com
Subject: Re: locking directories
Message-Id: <1108936090.859566.218590@o13g2000cwo.googlegroups.com>

> I belive the conventional approach is to lock a pre-arranged file
> withing the directory.  (Not, of course, that this has anything to do
> with Perl).

Yes, I'll probably implement something like this.  And you're right
that this has nothing to do with perl... I probably should have posted
this elsewhere.  I guess when I'm working on perl code, and I can't
figure something out, my first instinct is to come here, because then
I'll get a perlish solution.  :)



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

Date: 20 Feb 2005 21:23:01 GMT
From: John Bokma <postmaster@castleamber.com>
Subject: Re: Parameters in command line
Message-Id: <Xns96039C7D6183Fcastleamber@130.133.1.4>

Brian McCauley wrote:

> yusufdestina wrote:
> 
>> Can someone point me to a direction for this?
>> I have an application that opens another perl execuatable file. [PAR]
>> How can I pass vars to the perl appl.?
>> ex: testfile.exe name=value ...
> 
> It it confusing to use an .exe suffix on a Perl script.

Read a bit more about PAR and pp and then you understand.

>> Tnx for ur time and help.
>> sorry for my poor english.. 
> 
> Then write Perl.  Show us what you have tried.
> 
> You call external executables with argument using system().  RTFM for 
> details.
> 
> But the real answer is that you should probably not do it.
> 
> Do not have the first script call the second.
> 
> Cut out the guts of the second Perl script and make it into a module 
> that is used by both scripts.

Again, read more about PAR and pp, RTFM so to speak :-D.

-- 
John                   Small Perl scripts: http://johnbokma.com/perl/
               Perl programmer available:     http://castleamber.com/
            Happy Customers: http://castleamber.com/testimonials.html
                        


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

Date: 20 Feb 2005 21:47:56 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: Parameters in command line
Message-Id: <Xns9603AB31594FAasu1cornelledu@132.236.56.8>

John Bokma <postmaster@castleamber.com> wrote in 
news:Xns96039C7D6183Fcastleamber@130.133.1.4:

> Brian McCauley wrote:
> 
>> yusufdestina wrote:
>> 
>>> Can someone point me to a direction for this?
>>> I have an application that opens another perl execuatable file. [PAR]
>>> How can I pass vars to the perl appl.?
>>> ex: testfile.exe name=value ...
>> 
>> It it confusing to use an .exe suffix on a Perl script.
> 
> Read a bit more about PAR and pp and then you understand.

I am not so sure the answer to the OP's question has anything whatsoever to 
do with PAR.

There are two possibilities:

1. testfile.exe's source is under the OP's control. In this case, brian's 
advice applies.

2. testfile.exe's source is not under the OP's control. In this case, the 
original language testfile.exe was written in and the fact that it was 
compiled with PAR becomes irrelevant. If testfile.exe does expect and 
handle parameters specified on the command line, then the OP can use the 
system function to do so.

If testfile.exe is not designed and written to expect command line 
parameters, then it is not possible to pass command line parameters to 
testfile.exe.

To sum up,

If (1) applies, refactor code as per Brian's suggestion.
If (2) applies read testfile.exe's documentation and 

perldoc -f system

This answer does not depend on the precise way in which testfile.exe came 
to existence.

Sinan


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

Date: Sun, 20 Feb 2005 21:59:25 +0000
From: Brian McCauley <nobull@mail.com>
Subject: Re: Parameters in command line
Message-Id: <cvb0tr$3s7$1@sun3.bham.ac.uk>



John Bokma wrote:

> Brian McCauley wrote:
> 
> 
>>yusufdestina wrote:
>>
>>
>>>Can someone point me to a direction for this?
>>>I have an application that opens another perl execuatable file. [PAR]
>>>How can I pass vars to the perl appl.?
>>>ex: testfile.exe name=value ...
>>
>>It it confusing to use an .exe suffix on a Perl script.
> 
> 
> Read a bit more about PAR and pp and then you understand.

Ah sorry I've heard of PAR but never used it  - I hadn't made the 
connection.

>>>Tnx for ur time and help.
>>>sorry for my poor english.. 
>>
>>Then write Perl.  Show us what you have tried.
>>
>>You call external executables with argument using system().  RTFM for 
>>details.
>>
>>But the real answer is that you should probably not do it.
>>
>>Do not have the first script call the second.
>>
>>Cut out the guts of the second Perl script and make it into a module 
>>that is used by both scripts.
> 
> 
> Again, read more about PAR and pp, RTFM so to speak :-D.

Sorry I don't get it.  Everything I say above applies equally - or 
indeed more so to PAR.

Having two separate PAR packed .exes is even more horrendous than two 
ordinary scripts.

 From the point of view of the calling application a Perl PAR executable 
is no different from any other executable.  From the point of view of 
the called script the arguments are just in @ARGV as they would be if 
you weren't using PAR.



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

Date: 20 Feb 2005 22:37:48 GMT
From: John Bokma <postmaster@castleamber.com>
Subject: Re: Parameters in command line
Message-Id: <Xns9603A92B2F8CBcastleamber@130.133.1.4>

A. Sinan Unur wrote:

> John Bokma <postmaster@castleamber.com> wrote in 
> news:Xns96039C7D6183Fcastleamber@130.133.1.4:
> 
>> Brian McCauley wrote:
>> 
>>> yusufdestina wrote:
>>> 
>>>> Can someone point me to a direction for this?
>>>> I have an application that opens another perl execuatable file.
>>>> [PAR] How can I pass vars to the perl appl.?
>>>> ex: testfile.exe name=value ...
>>> 
>>> It it confusing to use an .exe suffix on a Perl script.
>> 
>> Read a bit more about PAR and pp and then you understand.
> 
> I am not so sure the answer to the OP's question has anything
> whatsoever to do with PAR.

Oh, I didn't say that. Only that what comes out of pp *has* an exe 
extension.

> There are two possibilities:
> 
> 1. testfile.exe's source is under the OP's control. In this case,
> brian's advice applies.

Why? It's perfectly valid, legal, etc. to just call a perl script, or 
perl2exe exe or pp generated exe.

> 2. testfile.exe's source is not under the OP's control. In this case,
> the original language testfile.exe was written in and the fact that it
> was compiled with PAR becomes irrelevant.

True.

> If testfile.exe does expect
> and handle parameters specified on the command line, then the OP can
> use the system function to do so.
> 
> If testfile.exe is not designed and written to expect command line 
> parameters, then it is not possible to pass command line parameters to
> testfile.exe.
> 
> To sum up,
> 
> If (1) applies, refactor code as per Brian's suggestion.

If it ain't broke.... Why refactor if you can just call it with system?


-- 
John                   Small Perl scripts: http://johnbokma.com/perl/
               Perl programmer available:     http://castleamber.com/
            Happy Customers: http://castleamber.com/testimonials.html
                        


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

Date: 20 Feb 2005 22:41:57 GMT
From: John Bokma <postmaster@castleamber.com>
Subject: Re: Parameters in command line
Message-Id: <Xns9603A9DF2F5D1castleamber@130.133.1.4>

Brian McCauley wrote:

> John Bokma wrote:
> 
>> Brian McCauley wrote:
>> 
>>>yusufdestina wrote:
>>>
>>>
>>>>Can someone point me to a direction for this?
>>>>I have an application that opens another perl execuatable file.
>>>>[PAR] How can I pass vars to the perl appl.?
>>>>ex: testfile.exe name=value ...
>>>
>>>It it confusing to use an .exe suffix on a Perl script.
>> 
>> Read a bit more about PAR and pp and then you understand.
> 
> Ah sorry I've heard of PAR but never used it  - I hadn't made the 
> connection.

It's quite nice. I used it recently in a project, a Perl program with
GUI and my customer didn't want to bother his customers with installing
Perl etc. It uses WxWindows and with pp you can specify an icon, so for
most people it just looks like an exe. 

> Sorry I don't get it.  Everything I say above applies equally - or 
> indeed more so to PAR.
> 
> Having two separate PAR packed .exes is even more horrendous than two 
> ordinary scripts.
> 
>  From the point of view of the calling application a Perl PAR
>  executable 
> is no different from any other executable.  From the point of view of 
> the called script the arguments are just in @ARGV as they would be if 
> you weren't using PAR.

Oh, agreed, but I wouldn't refactor the whole stuff just because you
want to call from script (a) an exe (b), even if one I have access to
the source of (b), or even if I wrote it myself. 

I call SpamAssassin from a Perl script for example. It works, and I am
too lazy to embed SpamAssassin as a module into the Perl script (which
is possible as far as I know). 

-- 
John                   Small Perl scripts: http://johnbokma.com/perl/
               Perl programmer available:     http://castleamber.com/
            Happy Customers: http://castleamber.com/testimonials.html
                        


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

Date: Sun, 20 Feb 2005 20:18:16 +0100
From: Martin Kissner <news@chaos-net.de>
Subject: Re: Problem with IO::Socket [... on Mac OS X]
Message-Id: <slrnd1hojo.5aa.news@maki.homeunix.net>

Anno Siegel wrote :

> Something is fishy on Darwin.  I also see it hang when the service is
> given by name and reply as expected when given by port number.  However,
> just *calling* getservbyname() before opening the socket makes it work
> with a name too.

After I had proved that servicenames can be resolved by Perl on Mac OS X
with the function 'getservbyname()' I was interested if I could find out
how IO::Socket::INET gets the servicenames and how this might be
different from 'getservbyname()'.
As far as I can see IO::Socket::INET uses 'getservbyname()'.
In Version 1.26 of IO::Socket::INET the conversion is done in line 58/59
of 'INET.pm'.

After all I tried the script once again without making any changes and
to my very great surprise it ran flawlessly with servicenames and with
portnumbers.
If Anno had not seen it hang when servicenames were given, I'd probably
doubted my mental health ;-).

I report this not because I expect that someone could explain this
but to give some final feedback to everybody who had to helped.

Best regards
Martin

-- 
perl -e 'print 7.74.117.115.116.11.32.13.97.110.111.116.104.101.114.11
 .32.13.112.101.114.108.11.32.13.104.97.99.107.101.114.10.7'


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

Date: 20 Feb 2005 14:08:22 -0800
From: cljlk@hotmail.com
Subject: user login
Message-Id: <1108937302.423727.188030@c13g2000cwb.googlegroups.com>

We have Windows 2000 in computer room, and we need to track user login
and save the user in a log file.
Would anyone provide perl scripts program.

Thanks



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

Date: 20 Feb 2005 22:21:20 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: user login
Message-Id: <Xns9603B0DB24573asu1cornelledu@132.236.56.8>

cljlk@hotmail.com wrote in 
news:1108937302.423727.188030@c13g2000cwb.googlegroups.com:

> We have Windows 2000 in computer room, and we need to track user login
> and save the user in a log file.
> Would anyone provide perl scripts program.

No. Please read the posting guidelines for this group. You can make an 
attempt at solving your problem first, and then ask for specific points 
where you need help. This group does not function as an automatic script 
dispenser.

> Thanks

You are most welcome.

Sinan


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

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


Administrivia:

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

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

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

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

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


------------------------------
End of Perl-Users Digest V10 Issue 7804
***************************************


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