List Info

Thread: Re: STDIN not available/@ARGV empty




Re: STDIN not available/@ARGV empty
country flaguser name
United States
2007-03-09 20:02:36
It doesn't work for me either.  On my system it opens
printargs.pl in
notepad. Editing is the default action under Explorer.  The
shell shouldn't
care about Explorer's settings.  Now if I change the default
action to Run,
it works as expected.  Better to use bash for these sorts of
things. 
D:backups>assoc .pl
.pl=Perl

D:backups>ftype Perl
Perl="C:Perlbinperl.exe" "%1" %*

D:backups>echo %pathext%
.pl;.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH

D:backups>printargs a b c      ## opens in notepad
## Change default action to Run
D:backups>printargs a b c
ARGS:
'a'
'b'
'c'

At 04:55 PM 3/9/2007 -0800, Bill Luebkert wrote:
>For some reason, that's never really worked for me :




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

00000100

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

RE: STDIN not available/@ARGV empty
user name
2007-03-09 20:26:36
On Fri, 09 Mar 2007, Chris Wagner wrote:
> 
> It doesn't work for me either.  On my system it opens
printargs.pl in
> notepad. Editing is the default action under Explorer. 
The shell shouldn't
> care about Explorer's settings.  Now if I change the
default action to Run,
> it works as expected.  Better to use bash for these
sorts of things. 

As I wrote before, cmd.exe is using the ShellExecuteEx()
function to run
files via file associations (anything but .bat, .cmd, .com,
and .exe files).
The later 4 filetypes are started by a call to
CreateProcess().

In the Microsoft Windows lingo "Shell" means the
same as "Windows Explorer".

If you are curious, take a list of the parameter block for
ShellExecuteEx():

http://msdn.microsoft.com/library/default.a
sp?url=/library/en-us/shellcc/platform/shell/reference/struc
tures/shellexecuteinfo.asp

It shows you the rules for executing a file without
specifying a verb:

| * For systems prior to Windows 2000, the default verb is
used if it
|   is valid and available in the registry. If not, the
"open" verb
|   is used.
|
| * For Windows 2000 and later systems, the default verb is
used if
|   available. If not, the "open" verb is used. If
neither verb is
|   available, the system uses the first verb listed in the
registry.

You'll also notice that SHELLEXECUTEINFO has no mechanism to
specify that
file handles should be inherited, which is the reason why
STDIO redirection
on the commandline doesn't work.  The reason there is no
flag for this is
that there may not even be a new process to run the file. 
The filename
may just be passed via DDE to an already running instance of
a program.
And any ways, the new process would be a child of the shell,
and not of
the process calling ShellExecuteEx().

Cheers,
-Jan
 

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

Compiling Perl
country flaguser name
United States
2007-03-20 16:34:21
In order to avoid installing Perl on a bunch of PC's, I'd
like to compiler
a couple of Perl programs. Any recommendations? I didn't see
anything
recently in the archives but I might have missed it. Thanks
in advance.
Nelson

 --Nelson R. Pardee, Support Analyst, Information Technology
& Services--
 --Syracuse University, CST 4-191, Syracuse, NY 13244       
          --
 --(315) 443-1079         NRPARDEESYR.EDU                    
        --
_______________________________________________
Perl-Win32-Users mailing list
Perl-Win32-Userslistserv.ActiveState.com
To unsubscribe: http:/
/listserv.ActiveState.com/mailman/mysubs

Eval and Error Trapping
country flaguser name
United States
2007-03-21 16:10:45
I seem to be running into all kinds of Perl problems, and
you folks have
been really helpful.

Here's one more: I'm using eval to trap errors in code.
Here's an example:

Here's the code:
$x=eval("$ret=$data=~$not$filter");

and here's the error that I get

Use of uninitialized value at (eval 23) line 1,
<STDIN> chunk 147.
        eval '$ret=$data=~/Take This $30 Reward Survey/i
;' called at eg.pl line 964
        main::checkNewSyntax called at eg.pl line 850

Unfortunately, $ is not trapping the error (yes, I
understand why I'm
getting the error). The code seemed to be working previously
on other
errors. I seem to recall a situation where it was trapping
one error, and
then the error didn't seem to get cleared from $ for the
next iteration
through the loop. So I set $="". However,
removing that line of code to
reset $ doesn't seem to get me back to working now. I
thought it might be
an issue of being in debug mode or not, but that doesn't
seem to be the
case. Any ideas?

Thanks again for all the help.

 --Nelson R. Pardee, Support Analyst, Information Technology
& Services--
 --Syracuse University, CST 4-191, Syracuse, NY 13244       
          --
 --(315) 443-1079         NRPARDEESYR.EDU                    
        --
_______________________________________________
Perl-Win32-Users mailing list
Perl-Win32-Userslistserv.ActiveState.com
To unsubscribe: http:/
/listserv.ActiveState.com/mailman/mysubs

Re: Eval and Error Trapping
country flaguser name
United States
2007-03-22 10:16:53
Mark,
I don't think I can use the block form, or am I confused?
Maybe if I
change the form slightly I can do it. But the values of the
variable do
change
eval("$ret=$data=~$filter");

I suppose I could strip the slashes and any modifiers from
$filter and
rewrite it thus:
eval{"$ret=$data=~/$filter/$mods"}

I understand this may be faster, but it's not clear from my
documentation what it would do differently. Is that what you
had in mind?

And- how can I trap the warning? In this case it's coming
from an embedded
$ in my string (which I can look for), but I'm concerned
about other
warnings that I might not anticipat Thanks
again for the help!

On Wed, 21 Mar 2007, Mark Dootson wrote:

> Hi,
>
> I think 'Use of uninitialized value' is a warning, not
an error.
>
> You may find the block form of eval better suited for
your purpose.
>
> eval {
>   $ret= $data =~ /$mymatch/;
>   .....
>   .....
> };
>
> if($) { .....
>
>
> read 'perlfunc' on eval for usage.
>
> Regards
>
> Mark
>
>
>
>
>
>
>

 --Nelson R. Pardee, Support Analyst, Information Technology
& Services--
 --Syracuse University, CST 4-191, Syracuse, NY 13244       
          --
 --(315) 443-1079         NRPARDEESYR.EDU                    
        --
_______________________________________________
Perl-Win32-Users mailing list
Perl-Win32-Userslistserv.ActiveState.com
To unsubscribe: http:/
/listserv.ActiveState.com/mailman/mysubs

Re: Eval and Error Trapping
country flaguser name
United States
2007-03-22 11:21:36
I've done some research and I've successfully trapped the
warnings using

local $SIG=sub {
	print messages here, etc. _[0] returns the error
	}; # End WARN sub

That's great! Any gotcha's that anyone can think of?
How about scoping this for the entire program? Any gotchas
there you can
think of? It would really help this application which runs
as a sendmail
alias and I never see the errors I don't trap for myself.
 --Nelson R. Pardee, Support Analyst, Information Technology
& Services--
 --Syracuse University, CST 4-191, Syracuse, NY 13244       
          --
 --(315) 443-1079         NRPARDEESYR.EDU                    
        --
_______________________________________________
Perl-Win32-Users mailing list
Perl-Win32-Userslistserv.ActiveState.com
To unsubscribe: http:/
/listserv.ActiveState.com/mailman/mysubs

[1-6]

about | contact  Other archives ( Real Estate discussion Medical topics )