[23510] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 5719 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Oct 28 09:05:44 2003

Date: Tue, 28 Oct 2003 06:05:08 -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           Tue, 28 Oct 2003     Volume: 10 Number: 5719

Today's topics:
    Re: error from -  eval "do script" - unsolved: does not <sunil_franklin@hotmail.com>
    Re: error from -  eval "do script" - unsolved: does not <nobull@mail.com>
        Expanding a perl regex to a list of files with full pat <neil.shadrach@corryn.com>
    Re: Expanding a perl regex to a list of files with full (Anno Siegel)
    Re: Guide for dealing with alternate character sets? <flavell@ph.gla.ac.uk>
    Re: Guide for dealing with alternate character sets? <bernie@fantasyfarm.com>
    Re: Guide for dealing with alternate character sets? <flavell@ph.gla.ac.uk>
    Re: how to do something <jwillmore@remove.adelphia.net>
    Re: How to generate this list? (Anno Siegel)
    Re: perl -ws and "used only once" warnings <nobull@mail.com>
    Re: Perl and IIS - script runs but 'The page cannot be  (Anno Siegel)
    Re: Regular expressions (adey)
    Re: rsh & perl -Directory creation not possible <nobull@mail.com>
    Re: Running system() commands in background <kuujinbo@hotmail.com>
        runtime load of code (Alythh)
    Re: runtime load of code (Anno Siegel)
    Re: runtime load of code <nospam@bigpond.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Tue, 28 Oct 2003 17:12:57 +0530
From: "Sunil" <sunil_franklin@hotmail.com>
Subject: Re: error from -  eval "do script" - unsolved: does not set $@
Message-Id: <bMsnb.3$sF1.154@news.oracle.com>

> > This works as I expect and I am able to handle errors using $@
> >         eval do 'setvars.pl';
> >
> > but my code like
> >         my $fullFileName = 'setvars.pl';
> >         my $evalStr = "do \'$fullFileName\'";
> >         eval "$evalStr";
> > does not seem to set the $@ variable even though I am able to see the
error
> > in the console.
>
> Read perldoc -f do again. do() does not throw an exception (call
> die()) under any circumstances, so you do not need an eval. Also, do
> returns errors in either $! or $@, depending on whether it opened the
> file or not. So you want something like:
>
> my $fullFileName = 'setvars.pl';
> $@ = undef;
> do $fullFileName or die "do failed: " . ($@ || $!);
>
> You should avoid string eval at all costs: it is very slow and can do
> very unexpected things if you are not careful.
>
> Ben

Thanks Ben !!!
   That Helped !





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

Date: 28 Oct 2003 12:44:49 +0000
From: Brian McCauley <nobull@mail.com>
Subject: Re: error from -  eval "do script" - unsolved: does not set $@
Message-Id: <u9llr54jlq.fsf@wcl-l.bham.ac.uk>

Ben Morrow <usenet@morrow.me.uk> writes:

> "Sunil" <sunil_franklin@hotmail.com> wrote:
> > This works as I expect and I am able to handle errors using $@
> >         eval do 'setvars.pl';
> > 
> > but my code like
> >         my $fullFileName = 'setvars.pl';
> >         my $evalStr = "do \'$fullFileName\'";
> >         eval "$evalStr";
> > does not seem to set the $@ variable even though I am able to see the error
> > in the console.
> 
> Read perldoc -f do again. do() does not throw an exception (call
> die()) under any circumstances, so you do not need an eval. Also, do
> returns errors in either $! or $@, depending on whether it opened the
> file or not. So you want something like:
> 
> my $fullFileName = 'setvars.pl';
> $@ = undef;
> do $fullFileName or die "do failed: " . ($@ || $!);

IIRC $@ doesn't capture compilation errors on some older Perls.
Perhaps the OP is using one of those.

-- 
     \\   ( )
  .  _\\__[oo
 .__/  \\ /\@
 .  l___\\
  # ll  l\\
 ###LL  LL\\


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

Date: Tue, 28 Oct 2003 12:06:09 +0000 (UTC)
From: Neil Shadrach <neil.shadrach@corryn.com>
Subject: Expanding a perl regex to a list of files with full paths
Message-Id: <bnlm3h$30g$2@visp.bt.co.uk>

I have a situation where I'd like to specify a list of files ( full paths )
with a perl regular expression as opposed to shell wildcards.
Something like qr!/usr/path[abc]/file[123]|/user/[abc]path/longer/file[456]!
If a list of all files on the machine ( find / -print ) was cheap to get that
would be fine but it isn't since I will want to check the expansion at intervals.
A reasonable compromise would seem to be to allow individual directory or file names
to be regular expressions but for the separators to be fixed.
That is for qr!/usr/path[abc]/file[123]! I could open each directory in turn and pick
out matches. For my first example I'd have to do it as separately
qr!/usr/path[abc]/file[123]! and qr!/user/[abc]path/longer/file[456]!

Is there a better way to do this? I'd really like to be able to use a single regular expression
with no restrictions ( and without the need to split on the directory separator ).
I've looked at File::Find but couldn't see how it could be used for this case.



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

Date: 28 Oct 2003 12:40:01 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Expanding a perl regex to a list of files with full paths
Message-Id: <bnlo31$eon$1@mamenchi.zrz.TU-Berlin.DE>

Neil Shadrach  <neil.shadrach@corryn.com> wrote in comp.lang.perl.misc:
> I have a situation where I'd like to specify a list of files ( full paths )
> with a perl regular expression as opposed to shell wildcards.
> Something like qr!/usr/path[abc]/file[123]|/user/[abc]path/longer/file[456]!
> If a list of all files on the machine ( find / -print ) was cheap to get that
> would be fine but it isn't since I will want to check the expansion at
> intervals.
> A reasonable compromise would seem to be to allow individual directory
> or file names
> to be regular expressions but for the separators to be fixed.
> That is for qr!/usr/path[abc]/file[123]! I could open each directory in
> turn and pick
> out matches. For my first example I'd have to do it as separately
> qr!/usr/path[abc]/file[123]! and qr!/user/[abc]path/longer/file[456]!
> 
> Is there a better way to do this? I'd really like to be able to use a
> single regular expression
> with no restrictions ( and without the need to split on the directory
> separator ).
> I've looked at File::Find but couldn't see how it could be used for this case.

Why not?  $File::Find::name contains the complete path, you can match
against that.

In general, there is no other way but to dive into *all* directories
looking for a match.  With a general regex you won't be able to tell
from looking at a directory name whether the directory can hold
matching files or not.  Just think of /^a.*a$/ or even /^(.).*\1/.

So, unless you can divide the regex into parts that match individual
path components, you will have to walk the entire directory tree.

Anno


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

Date: Tue, 28 Oct 2003 10:58:11 +0000
From: "Alan J. Flavell" <flavell@ph.gla.ac.uk>
Subject: Re: Guide for dealing with alternate character sets?
Message-Id: <Pine.LNX.4.53.0310281042580.28979@ppepc56.ph.gla.ac.uk>

On Tue, 28 Oct 2003, Lawrence D¹Oliveiro wrote:

> For character manipulation, a fixed-length code like UTF-16

utf-16 is not "fixed length".

> is probably easier to work with than a variable-length code like
> UTF-8.

If you're working with Perl, then I'd recommend working _with_ Perl.

> The only real reason for the existence of UTF-8 is backward
> compatibility:

There's something in what you say, but it isn't the whole story.

But anyway, one can work with Unicode in Perl without tangling with
these details.  The internal representation can be kept under the
covers as long as everything goes to plan (it can, admittedly, be
useful to understand the internal representation when things start
going wrong and detailed debugging is called for).  But it would be
frankly perverse to disregard Perl's Unicode support and insist on
handling data in utf-16 format, as you seem to be suggesting - and
especially if it results in needing to tangle with surrogate pairs.

There _might_ be something to be said for working in UCS-4 (as it used
to be called) or utf-32.

> allows all the old code, that was written over decades to deal only with
> 7-bit ASCII, to be declared Unicode-compatible (after a fashion),

So how would you describe utf-7 in your terms?

cheers


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

Date: Tue, 28 Oct 2003 07:26:17 -0500
From: Bernie Cosell <bernie@fantasyfarm.com>
Subject: Re: Guide for dealing with alternate character sets?
Message-Id: <k5nspvkbh8mrrcg6hhfottj88s61lfla30@library.airnews.net>

Lawrence D¹Oliveiro <ldo@geek-central.gen.new_zealand> wrote:

} In article <a2f641ca.0310271451.40e49b4f@posting.google.com>,
}  bernie@fantasyfarm.com (Bernie Cosell) wrote:
} 
} >I note that much of my Perl code is already ugly because of a
} >character convention mismatch: on our system, the line terminator is
} >just \012, but on stuff coming in over a socket, the line terminator
} >is \015\012..,
} 
} All code for reading text files should be able to deal with all three 
} line-termination conventions: CR, LF and CR-LF. PostScript figured out 
} how to do this back in the 1980s, when is everybody else going to catch 
} up?

Actually, I think you can only handle the multiple line termination
conventions if you assume that the associated control-characters are *ONLY*
used as line-terminators.  For example, I *do* use "\r" [CR, \015] for its
"classical" effect from time to time, and get screwed up when the return is
interpreted as an endofline.

As for the other, I do things like not use chomp, but instead do what I
usually call "smartchomp" [which removes whatever end-of-line it finds at
the end of the string, rather than only "\n"]

} For writing files, the Internet standard is CR-LF.

Exactly right -- and on Windows, too.


} >Once we move to the new system, it'll get worse: *most* of the stuff
} >coming in over TCP connections will still be just ISO-Latin [with
} >\r\n] and my "local files" will be UTF-8 [with just \n], and I don't
} >know *what* I'm going to do.
} 
} My feeling is to convert everything incoming to Unicode before working 
} on it, and if necessary convert it to something else before outputting 
} it.

That's basically what I do now with Internet vs Unix: my programs are all
"Unix" internally and I convert into/outof "Internet" at the borders.  I
suppose that to do that portably, what I should be doing on input from the
Internet is:
    s/\015\012/\n/g
and viceversa on output.

And I confess that I haven't even *tried* to worry about specific char sets
[most everything from the INternet comes in with a charset specification..
but I can't deal with ISO-8859-15 or who knows what, so I just assume
[sigh!] plain ISO-Latin.  Is there some more-general way, assuming I
convert over to using UTF-8 "inside" my programs to take a string that I
think is, say, ISO-8859-15 or some Korean character set or whatever and
convert it to UTF?  I note that in perlunicode it says:

>>  As of yet, there is no method for automatically coercing
>>       input and output to some encoding other than UTF-8.  This
>>       is planned in the near future, however.

but I confess to being a bit confused by the man page: is there actual
machinery for converting to UTF-8?  Can I somehow take a string that I
believe to be ISO-Latin and in some easy way "UTF-ize" it [and vice versa:
have a UTF internal string and ISO-Latin it for pushing out to a web
browsers or SMTP server or whatever].

  /Bernie\

-- 
Bernie Cosell                     Fantasy Farm Fibers
bernie@fantasyfarm.com            Pearisburg, VA
    -->  Too many people, too few sheep  <--          


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

Date: Tue, 28 Oct 2003 13:14:44 +0000
From: "Alan J. Flavell" <flavell@ph.gla.ac.uk>
Subject: Re: Guide for dealing with alternate character sets?
Message-Id: <Pine.LNX.4.53.0310281248310.28979@ppepc56.ph.gla.ac.uk>

On Tue, 28 Oct 2003, Bernie Cosell wrote:

> And I confess that I haven't even *tried* to worry about specific
> char sets
  ^^^^^^^^^

Think "encodings".  That attribute "charset" is an unfortunate piece
of MIME terminology - a hang-over from simpler times.

In Perl 5.8 representation, the native text "character set" internally
is Unicode, or at least a subset of it, irrespective of the external
encoding of the data.

(That's excluding the situation where you read an external encoding,
effectively as binary, and manipulate it yourself, rather than taking
advantage of its native text functionality.)

> [most everything from the INternet comes in with a charset specification..
> but I can't deal with ISO-8859-15 or who knows what,

_You_ don't need to.  Perl handles that, as long as you talk to it
nicely...

> so I just assume [sigh!] plain ISO-Latin.

Iso Latin _what_???  There's at least nine of them, and some of them
exist in alternative encodings (e.g CP-1047 Latin-1 EBCDIC).

The term "ISO Latin (n)" properly defines a _repertoire_ of
characters.  Sure, it might then seem natural to represent them by
using the applicable iso-8859 encoding (iso-8859-15 for Latin-9, for
example), but it isn't the only option.  It's best to keep a clear
head when tangling with this stuff.

> Is there some more-general way, assuming I
> convert over to using UTF-8 "inside" my programs to take a string that I
> think is, say, ISO-8859-15 or some Korean character set or whatever and
> convert it to UTF?

Surely, what you want to convert to "inside" your programs is Perl's
own Unicode representation?  (Which happens to be based on utf-8, but
you don't need to deal with that directly).

>  I note that in perlunicode it says:
>
> >>  As of yet, there is no method for automatically coercing
> >>       input and output to some encoding other than UTF-8.  This
> >>       is planned in the near future, however.

Sorry, I don't find that text in the document.  Which version are you
looking at?  For any kind of sensible progress, you should be using at
least 5.8.0. Oh yeah, Google finds that text in two-year-old documents
that appear to relate to Perl 5.6.*.  I'd say give those a miss -
you're going to make yourself a lot more work trying to get this to
work in 5.6, and by the time you've got it working, 5.6 will be so
long in the tooth that no-one will care.

> but I confess to being a bit confused by the man page: is there actual
> machinery for converting to UTF-8?  Can I somehow take a string that I
> believe to be ISO-Latin and in some easy way "UTF-ize" it

Several ways.

If you were referring to iso-8859-1, then in Perl 5.8.0 you just use
it, and when Perl feels the need to do so it will automagically
upgrade it to Unicode.  Take a look at
http://www.perldoc.com/perl5.8.0/pod/perluniintro.html#Perl's-Unicode-Model

If you're dealing with, say, iso-8859-15 then you'd want to specify an
encoding layer (when doing i/o), or apply an explicit conversion.

Beware of the interaction with your locale setting!  In RedHat 9 for
example the default locale setting will imply Unicode, and Perl (5.8.0
and later) will respond to this in various ways.

> have a UTF internal string and ISO-Latin it for pushing out to a web
> browsers or SMTP server or whatever].

Not such a good idea.  Modern browsers handle utf-8 fine, and that
crusty old NN4.* handles utf-8 somewhat better than it handles
8-bit-encoded data plus &#bignumber; references.

So if you've got utf-8, flaunt it...

(WebTV excepted, I should say.  But that would take us too far OT
for this group).


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

Date: Tue, 28 Oct 2003 11:23:18 GMT
From: James Willmore <jwillmore@remove.adelphia.net>
Subject: Re: how to do something
Message-Id: <20031028062319.02f3244b.jwillmore@remove.adelphia.net>

On Mon, 27 Oct 2003 09:41:03 -0000
"Lex" <nospam@peng.nl> wrote:

> 
> "James Willmore" <jwillmore@remove.adelphia.net> wrote in message
> news:20031025135026.4493045e.jwillmore@remove.adelphia.net...
> > > my $i = 2;
> >
> > Where is ^^^ this line being declared?  Inside subroutine 1 or
> > globally?  If it's inside subroutine 1, then that's where I
> > _think_ you're issue is - the variable's scope (or where it's life
> > exists). If $i is supposed to be accessed in _both_ subroutines,
> > then declare it _outside_ of the subroutines (aka globally).
> >
> > Or did I miss what you were after?
> >
> No you didn't, and I tried your solution but alas, it wouldn't work.
> It's probably my head that is thinking wrong and I should do it in a
> different way.
> 
> for 0 to $i
> do subroutine 2
> 
> subroutine 2:
> check something and return contents. If you see something weird
> don't return contents and raise $i with 1 (so the 'no content' is
> replaced by the next record that should return contents)
> 
> Is this wrong? I mean, is there a better way to ge this done?

Hummm ... you want to increment $i ... from subroutine 2 ... when a
certain condition is met in subroutine 2, right?  So, $i is _always_
going to change and not remain fixed, dependent upon what subroutine 2
does?

If this is correct, you have the makings of an infinite loop.  So long
as subroutine 2 has the ability to change how many times subroutine 1
is executed, you have the potential of _never_ leaving subroutine 1.

Is there a way that you can combine the 2 subroutines?  Nothing says
that you _have_ to have subroutines in your code.

HTH

-- 
Jim

Copyright notice: all code written by the author in this post is
 released under the GPL. http://www.gnu.org/licenses/gpl.txt 
for more information.

a fortune quote ...
You know it's going to be a bad day when you want to put on the
<clothes you wore home from the party and there aren't any. 


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

Date: 28 Oct 2003 12:13:21 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: How to generate this list?
Message-Id: <bnlmh1$dp0$1@mamenchi.zrz.TU-Berlin.DE>

David Combs <dkcombs@panix.com> wrote in comp.lang.perl.misc:
> In article <3F7DCAF2.7DF0A772@acm.org>, John W. Krahn <krahnj@acm.org> wrote:
> >Roy Johnson wrote:
> >> 
> >> "John W. Krahn" <krahnj@acm.org> wrote in message
> news:<3F7B247C.586F33C@acm.org>...
> >> 
> >> > I don't know if this is the best way but:
> >> >
> >> > my @array = qw/ A A A A B B C D D D /;
> >> >
> >> > print "$_\n" for glob "{@{[ join ',', @array ]}}" x @array;
> >> 
> >> Would you explain the magic?
> >
> >glob uses the comma separated list in braces as alternatives in the
> >result.
> >
> >$ perl -le'print for glob "{AB,CD}XY"'
> >ABXY
> >CDXY
> >$ perl -le'print for glob "{A,B}{C,D}XY"'
> >ACXY
> >ADXY
> >BCXY
> >BDXY
> >
> >So it passes a string of all the alternatives to glob which creates a
> >list of the alternatives.
> 
> Yes, the clever curly-bracket notation from csh -- forms
> the cartesian product.
> 
> Also works if they're *nested*.
> 
> Now this, for John, Abigail, MJD, etc:
> 
>    "YOUR TASK, MR. PHELPS, IS TO PROGRAM THAT CSH ALGORITHM"
> 
> How about an efficient algorithm on doing that?
> 
> (I once saw a 5-liner in ML that did it, but what
> with the redefined-operators and other clever tricks in
> that particular program, I had no idea how it worked -- still
> don't.  (don't even have a copy -- drat!) )
> 
> Perhaps first show it in some algol-like notation --
> then, I suppose, in perl, with it's fancy data-structures,
> maps, greps, etc.

It isn't that hard.  First write a procedure that does the product
of two factors (given as arrayrefs):

    sub combine_two {
        my ( $l1, $l2) = @_;
        map { my $first = $_;
            map "$first$_", @$l2; 
        } @$l1;
    }   

Then set up recursion to do it for any number of factors:

    sub combine {
        if ( @_ ) {
            my $l = shift;
            combine_two( $l, [ combine( @_)]);
        } else {
            ('');
        }
    }

Anno


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

Date: 28 Oct 2003 12:30:56 +0000
From: Brian McCauley <nobull@mail.com>
Subject: Re: perl -ws and "used only once" warnings
Message-Id: <u9vfq94k8v.fsf@wcl-l.bham.ac.uk>

Dan Jacobson <jidanni@jidanni.org> writes:

> Perhaps if one of you know the exact bug, you could file a report for
> me.

No, you can file it yourself.

> #!/usr/bin/perl -ws
> if ($xyz) { print "$xyz\n" }
> if ($g) {print 66} else {print 55}
> $ /tmp/v
> Name "main::g" used only once: possible typo at /tmp/v line 3.
> 55
> 
> because $xyz is used twice, the perlrun page authors wouldn't have
> triggered the bug when adding -w to their example.
> 
> The bug is: g shouldn't be warned about.

No it isn't.

If there is a bug it's a documentation bug in perlrun, which should
perhaps say in the description of -s:

     When using this option on a script with warnings enabled you
     may get a lot of spurious "used only once" warnings so you may
     want to switch those off.

On the other hand, once you've had the warning this should be
self-evident so perhaps its not worth bloating perlrun.pod.

Incidently the perldiag entry for this warning says:

           (W once) Typographical errors often show up as unique
           variable names.  If you had a good reason for having a
           unique name, then just mention it again somehow to
           suppress the message.  The "our" declaration is pro-
           vided for this purpose.

The bit about mentioning the variable is correct.

The bit about our() being provided for this purpose is wrong.  The
word "provided" should be something like "useful".

-- 
     \\   ( )
  .  _\\__[oo
 .__/  \\ /\@
 .  l___\\
  # ll  l\\
 ###LL  LL\\


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

Date: 28 Oct 2003 11:23:43 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Perl and IIS - script runs but 'The page cannot be displayed'
Message-Id: <bnljjv$bon$1@mamenchi.zrz.TU-Berlin.DE>

stew dean <stewart@webslave.dircon.co.uk> wrote in comp.lang.perl.misc:
> "Jürgen Exner" <jurgenex@hotmail.com> wrote in message
> news:<QAomb.1419$%e3.256@nwrddc03.gnilink.net>...
> > stew dean wrote:
> > > Now I'm looking for a way
> > > to avoid using the command line again (except to install modules etc)
> > > so I only need one script.
> > 
> > Oh well, of course you have any right to write your programs blindfolded
> > with one hand tied to your back.
> 
> What exactly do you mean by that. Appart form seeing more errors why
> do need to use the command line when it means twice as much work for
> me?

If you use the CGI module your CGI script can be run from the command
line without any changes.  That is one of the reasons the module is
recommended.

> > But then at least neither cry for help if you can't see the bugs because of
> > your blindfold nor offend those people who are telling you how to untie your
> > hands.
> 
> But by using the commmand line it feels like you want to bind my legs.

By using the command line, you eliminate a lot of complexity from
the situation.  When a CGI script doesn't work *as a CGI* the problem
can be at three points:

- the environment the script is called in isn't what the script needs
  or expects

- the script itself doesn't work to specification

- the script's output (diagnostic or otherwise) is treated in ways
  you don't expect.

Working from the command line, you control every aspect of the environ-
ment, and output isn't post-processed.  So you can concentrate on the
script itself.  Once it does what it is supposed to do, you can put it
back in and concentrate on the other aspects.

If you change a light bulb and it doesn't light up, would you insist
in leaving it screwed in while trying to find out what's wrong?

Anno


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

Date: Tue, 28 Oct 2003 12:37:13 +0000 (UTC)
From: adey@forge.co.uk (adey)
Subject: Re: Regular expressions
Message-Id: <3f9e6384.1182228@news.btopenworld.com>

On Sun, 29 Jun 2003 21:05:50 -0500, "mark" <mark_evans029@yahoo.com>
wrote:

>i am attempting to write a script using Net::Telnet.  The script telnets to
>a machine
>logs in and issues a command to list the config.  Tthe output of the command
>pauses
>about every screenfull and gives the user the prompt " --More-- ".  The
>script
>contains the followin code to account fot the prompt.
>
>$telnet->waitfor('/-\-More\-\- $/i');
>$telnet->print('\s');
>
>the script does not proceed past the " --More-- " prompt.  this problems
>seems to have stumpt me. does anyone have any suggestions for me?
>
>Thanks
>mark
>
>
Hi Mark,

I use the module all the time. The non Perl solution to your problem
is this;

I would suggest you command the machine to dump the whole of the
config in one go.

For instance, if you are attempting to list the config on a Cisco
router, you could issue the command "term len 0" prior to issuing the
command to list the config.

Adey


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

Date: 28 Oct 2003 12:32:33 +0000
From: Brian McCauley <nobull@mail.com>
Subject: Re: rsh & perl -Directory creation not possible
Message-Id: <u9r80x4k66.fsf@wcl-l.bham.ac.uk>

qazmlp1209@rediffmail.com (qazmlp) writes:

> Here is an excerpt from the script:
> $opath=$ProtName;
> opendir(DIR,$opath)  || system("mkdir $ProtName"); 
> closedir (DIR);
> 
> I don't know whether it helps to find the cause of the problem. 

Not really.  Perhaps you should replace the system("mkdir $ProtName")
with mkdir($ProtName) and then, if it fails, print out the reason that
it reports.

-- 
     \\   ( )
  .  _\\__[oo
 .__/  \\ /\@
 .  l___\\
  # ll  l\\
 ###LL  LL\\


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

Date: Tue, 28 Oct 2003 21:28:28 +0900
From: ko <kuujinbo@hotmail.com>
Subject: Re: Running system() commands in background
Message-Id: <bnlnia$5o3$1@pin3.tky.plala.or.jp>

qazmlp wrote:

> Whenever system("command") is called in a perl script, a new
> (commandline) window opens and shows the execution of the "command".
> What do I need to do if
> I have to run the command in the background? Basically, I do not
> prefer the user to see what is happening when the perl script is being
> executed.
> 
> The test was done in Win2K & the solution is required in the same.
> 
> Thanks!

As explained in the Win32 docs, you can 'hide' windows from system() 
child process(es):

use Win32;
SetChildShowWindow();

HTH -keith



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

Date: 28 Oct 2003 03:29:33 -0800
From: alythh@netscape.net (Alythh)
Subject: runtime load of code
Message-Id: <6a25ba72.0310280329.53b6d107@posting.google.com>

<this could be one of the most basic questions you've heard, but don't
kick me on the teeth please, I've RTFM>

I'm fairly new to Perl, and was trying to develop a program that 
1) reads an input file and:
2) uses, to perform some tasks, some subroutines available in external
files, those to be loaded defined by the input file e.g.:

input file:
 ...
aux_sub1.pl
 ...

and in the code I call the functions defined in aux_sub1.pl

What I don't understand if this is <exactly> the module mechanism, or
if I have to use something new - I mean, those subs should be loaded
in someway at runtime, while which modules I load is defined once and
for all from the start, isntit?

 ... waiting for enlightenment, thanks!

Alessandro Magni


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

Date: 28 Oct 2003 11:37:34 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: runtime load of code
Message-Id: <bnlkdu$bon$2@mamenchi.zrz.TU-Berlin.DE>

Alythh <alythh@netscape.net> wrote in comp.lang.perl.misc:
> <this could be one of the most basic questions you've heard, but don't
> kick me on the teeth please, I've RTFM>
> 
> I'm fairly new to Perl, and was trying to develop a program that 
> 1) reads an input file and:
> 2) uses, to perform some tasks, some subroutines available in external
> files, those to be loaded defined by the input file e.g.:
> 
> input file:
> ...
> aux_sub1.pl
> ...
> 
> and in the code I call the functions defined in aux_sub1.pl
> 
> What I don't understand if this is <exactly> the module mechanism, or
> if I have to use something new - I mean, those subs should be loaded
> in someway at runtime, while which modules I load is defined once and
> for all from the start, isntit?

What makes you think so?  Look up "use" and "require" in perldoc
and note the difference.

Anno


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

Date: Tue, 28 Oct 2003 21:41:01 +1000
From: Gregory Toomey <nospam@bigpond.com>
Subject: Re: runtime load of code
Message-Id: <1998069.6gfjPH5L1z@gregs-web-hosting-and-pickle-farming>

It was a dark and stormy night, and Alythh managed to scribble:

> <this could be one of the most basic questions you've heard, but don't
> kick me on the teeth please, I've RTFM>
> 
> I'm fairly new to Perl, and was trying to develop a program that
> 1) reads an input file and:
> 2) uses, to perform some tasks, some subroutines available in external
> files, those to be loaded defined by the input file e.g.:
> 
> input file:
> ...
> aux_sub1.pl
> ...
> 
> and in the code I call the functions defined in aux_sub1.pl
> 
> What I don't understand if this is <exactly> the module mechanism, or
> if I have to use something new - I mean, those subs should be loaded
> in someway at runtime, while which modules I load is defined once and
> for all from the start, isntit?
> 
> ... waiting for enlightenment, thanks!
> 
> Alessandro Magni

For a start read http://perl.plover.com/FAQs/Namespaces.html

Make sure you know the difference between packages & modules.

gtoomy


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

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.  

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 5719
***************************************


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