[31250] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 2499 Volume: 11

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Jul 2 18:18:26 2009

Date: Thu, 2 Jul 2009 12:01:12 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Thu, 2 Jul 2009     Volume: 11 Number: 2499

Today's topics:
    Re: Unable to run built-in commands from system <tadmc@seesig.invalid>
    Re: Unable to run built-in commands from system <glex_no-spam@qwest-spam-no.invalid>
    Re: Unable to run built-in commands from system <smallpond@juno.com>
    Re: Unable to run built-in commands from system <jurgenex@hotmail.com>
    Re: Unable to run built-in commands from system <josef.moellers@ts.fujitsu.com>
        Using URI module to find and set link; how to ignore <i <jwcarlton@gmail.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Tue, 30 Jun 2009 16:01:20 -0500
From: Tad J McClellan <tadmc@seesig.invalid>
Subject: Re: Unable to run built-in commands from system
Message-Id: <slrnh4kv2k.mbp.tadmc@tadmc30.sbcglobal.net>

noauth <anon@remailer.gabrix.ath.cx> wrote:

> The following code works fine


No it doesn't.


> open(STATUS, "$CommandString1 2>&1|") || ddie "Unable to 
                                           ^
                                           ^
>   dprint "$_";
    ^
    ^
> open(STATUS, "$CommandString2 2>&1|") || ddie "Unable to 
                                           ^
                                           ^

>   dprint "$_";
    ^
    ^

The problem is that your keyboard has a wonky "d" key.


-- 
Tad McClellan
email: perl -le "print scalar reverse qq/moc.noitatibaher\100cmdat/"


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

Date: Tue, 30 Jun 2009 16:14:28 -0500
From: "J. Gleixner" <glex_no-spam@qwest-spam-no.invalid>
Subject: Re: Unable to run built-in commands from system
Message-Id: <4a4a756d$0$1333$815e3792@news.qwest.net>

noauth wrote:
> The following code works fine for CommandString1, but it does not work for CommandString2.  
> The result is a "No such file or directory" error message.  I believe this is because "cd" 
> is a built-in shell command.  Does anyone have any suggestions on how I can overcome this?

You don't provide your commands, so how can we tell what may be
causing that error?

More than likely, you're not doing the right thing in
your $CommandString2, it's a typical error when the
directory doesn't exist.

cd /bogusdir
/bogusdir: No such file or directory.

Why are you running 'cd' and 'ls' in the first place?

perldoc -f chdir
perldoc -f readdir

What do you actually want to do?

dprint..ddie??.. d'oh...

> 
> $CommandString1 = "ls ..";
> $CommandString2 = "cd ..";
> 
> local $/ = \1; # Read 1 character at a time
> open(STATUS, "$CommandString1 2>&1|") || ddie "Unable to run specified command...$!";
> while (<STATUS>) {
>   dprint "$_";
> }
> close(STATUS);
> 
> open(STATUS, "$CommandString2 2>&1|") || ddie "Unable to run specified command...$!";
> while (<STATUS>) {
>   dprint "$_";
> }
> close(STATUS);
> 
> 
> 


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

Date: Tue, 30 Jun 2009 14:38:13 -0700 (PDT)
From: smallpond <smallpond@juno.com>
Subject: Re: Unable to run built-in commands from system
Message-Id: <aa83b931-01fa-407b-b2df-c85041870730@z14g2000yqa.googlegroups.com>

On Jun 30, 3:48=A0pm, noauth <a...@remailer.gabrix.ath.cx> wrote:
> The following code works fine for CommandString1, but it does not work fo=
r CommandString2. =A0
> The result is a "No such file or directory" error message. =A0I believe t=
his is because "cd"
> is a built-in shell command. =A0Does anyone have any suggestions on how I=
 can overcome this?
>
> $CommandString1 =3D "ls ..";
> $CommandString2 =3D "cd ..";
>
> local $/ =3D \1; # Read 1 character at a time
> open(STATUS, "$CommandString1 2>&1|") || ddie "Unable to run specified co=
mmand...$!";
> while (<STATUS>) {
> =A0 dprint "$_";}
>
> close(STATUS);
>
> open(STATUS, "$CommandString2 2>&1|") || ddie "Unable to run specified co=
mmand...$!";
> while (<STATUS>) {
> =A0 dprint "$_";}
>
> close(STATUS);

It looks like you are trying to capture the output of
a shell builtin.  This does want you want:

perl -e 'open FOO,"bash -c cd ..|"; while(<FOO>) {print $_}'

Of course, cd doesn't have very much to say.


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

Date: Tue, 30 Jun 2009 14:46:27 -0700
From: Jürgen Exner <jurgenex@hotmail.com>
Subject: Re: Unable to run built-in commands from system
Message-Id: <0p1l4597imu6uobdoheb4nu6ue79nb1qtk@4ax.com>

noauth <anon@remailer.gabrix.ath.cx> wrote:
>The following code works fine for CommandString1, but it does not work for CommandString2.  
>The result is a "No such file or directory" error message.  I believe this is because "cd" 
>is a built-in shell command.  Does anyone have any suggestions on how I can overcome this?
>
>$CommandString2 = "cd ..";
[...]
>open(STATUS, "$CommandString2 2>&1|") || ddie "Unable to run specified command...$!";

What is this supposed to do? Fork a new process, run "cd .." to change
the CWD of that new process, and then close that new process
immediately?

Doesn't make much sense to me...

jue


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

Date: Wed, 01 Jul 2009 12:52:17 +0200
From: Josef Moellers <josef.moellers@ts.fujitsu.com>
Subject: Re: Unable to run built-in commands from system
Message-Id: <h2ff51$n1d$1@nntp.fujitsu-siemens.com>

Tad J McClellan wrote:
> noauth <anon@remailer.gabrix.ath.cx> wrote:
> 
>> The following code works fine
> 
> 
> No it doesn't.
> 
> 
>> open(STATUS, "$CommandString1 2>&1|") || ddie "Unable to 
>                                            ^
>                                            ^
>>   dprint "$_";
>     ^
>     ^
>> open(STATUS, "$CommandString2 2>&1|") || ddie "Unable to 
>                                            ^
>                                            ^
> 
>>   dprint "$_";
>     ^
>     ^
> 
> The problem is that your keyboard has a wonky "d" key.

And <whoever> has forgotten to insert "use warnings; use strict;"!

-- 
These are my personal views and not those of Fujitsu Technology Solutions!
Josef Möllers (Pinguinpfleger bei FTS)
	If failure had no penalty success would not be a prize (T.  Pratchett)
Company Details: http://de.ts.fujitsu.com/imprint.html


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

Date: Mon, 29 Jun 2009 23:43:00 -0700 (PDT)
From: Jason Carlton <jwcarlton@gmail.com>
Subject: Using URI module to find and set link; how to ignore <img> tag
Message-Id: <4bbc7a76-abbb-415f-9a67-df23f9ba0926@3g2000yqk.googlegroups.com>

I'm using URI::Find and URI::Escape to locate links, and to convert
them to a coded link. Like this:

$finder = URI::Find -> new(
  sub {
    ($uri, $orig_uri) = @_;
    return "<a href='$uri' target='_new'>$orig_uri</a>";
  }
);

$finder -> find(\$contents{'comment'});


If you enter http://www.somedomain.com, then it will convert it to <a
href='http://www.somedomain.com' target='_new'>http://
www.somedomain.com</a>.

This works great, unless someone enters the code for an image. Then,
it converts:

<img src='http://www.somedomain.com/image.gif'>

(which should be OK) to:

<img src='<a href='http://www.somedomain.com/image.gif'
target='_new'>http://www.somedomain.com/image.gif</a>'>

How can I modify the script to make it ignore addresses that are
within <img> tags?

TIA,

Jason


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

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 V11 Issue 2499
***************************************


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