[19639] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1834 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Sep 28 03:05:58 2001

Date: Fri, 28 Sep 2001 00:05:08 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <1001660707-v10-i1834@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Fri, 28 Sep 2001     Volume: 10 Number: 1834

Today's topics:
        AutoSplitting referenced subroutines (Brendon Ryniker)
    Re: faster execution (venus)
    Re: Forcing reevaluation of code in mod_perl scripts? (Damian James)
    Re: Help with system() on win32 <novastar@novastar.dtdns.net>
    Re: how do I know if Perl:TK is installed? (Abigail)
        install perl module (eric ng)
    Re: install perl module (Chris Fedde)
    Re: install perl module <comdog@panix.com>
        mount system call <Naseer.Syed@Compaq.Com>
    Re: mount system call (Logan Shaw)
    Re: mount system call <please@no.spam>
    Re: Not sure what type of cgi script I need! (Snipes)
    Re: Parsing a string (Ian Boreham)
    Re: procmail-like task in Perl? <mbudash@sonic.net>
    Re: procmail-like task in Perl? (David Wall)
    Re: Push into an array (Abigail)
    Re: Push into an array <pne-news-20010928@newton.digitalspace.net>
        Running system programs from CGI <stratvio@aol.com>
    Re: Sourcing Things in Perl ? (Abigail)
    Re: Sourcing Things in Perl ? <tony_curtis32@yahoo.com>
    Re: Sourcing Things in Perl ? (Tim Hammerquist)
    Re: Sourcing Things in Perl ? <tony_curtis32@yahoo.com>
    Re: Term::ANSIColor in Windows 2000's CMD <novastar@novastar.dtdns.net>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Fri, 28 Sep 2001 02:08:03 GMT
From: brendonr@web.co.nz (Brendon Ryniker)
Subject: AutoSplitting referenced subroutines
Message-Id: <3bb3d78a.862938750@10.1.1.5>

I have this worry in an application that's actually working just
fine...

But I have a worry.

It includes a large module: Template.pm - which contains a bunch of
subroutines to render various HTML forms...so many, in fact, that I
judged it prudent to use the AutoSplit/Autoload modules - as only one
of the many subroutines is required in any particular evocation.

The way the Module is used involves calls to an exported routine. An
argument is passed to this routine identifying which of the internal
HTML-rendering subroutine should be called.

The setup is something like this (much is ommited):

	package OES::Template;

	use AutoLoader;
	*AUTOLOAD = \&AutoLoader::AUTOLOAD;

	my %Dispatcher = (
		11 => \&subroutine11,
		12 => \&subroutine12,
		13 => \&subroutine13,
		14 => \&subroutine14,
		etc...
	);

	sub OESform($) {
		my $id = shift;
		my $sub = $Dispatcher{$id};
		return &$sub(@_);
	}

	__END__

	# autoloaded routines

	sub subroutine11 {}
	sub subroutine12 {}
	sub subroutine13 {}
	sub subroutine14 {}
	etc...

Get the picture?

So anyway, the question is:

Does the use of references to the autoloaded subroutines (in
%Dispatcher) make all this auto-splitting/loading business a waste of
time?

By introducing these code references in the *non* autoloaded section
of the module, am I forcing the AutoSplit routines to be instantiated
in memory regardless?

thoughts appreciated.

/b/




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

Date: 27 Sep 2001 20:15:31 -0700
From: train2venus@hotmail.com (venus)
Subject: Re: faster execution
Message-Id: <bce84cea.0109271915.30b97d98@posting.google.com>

Hi...

Yes, you are right. I've tried your suggestion and it works.
Thanks to you and others as well for giving me many options...

> 
> while(my($k, $v) = each %LOCATION) {
>     push @{$LOCATIONS{$v}}, $k;
> }
> 
> while (<INPUT_FILE>) {
>     s/^\s+//;
>     s/\r?\n$//;
>     ($city, $statecode, $countrycode, $date1, $max1, $min1, $cond1,
>      $date2, $max2, $min2, $cond2,
>      $date3, $max3, $min3, $cond3, $date4, $max4, $min4, $cond4,
>      $date5, $max5, $min5, $cond5, $date6, $max6, $min6, $cond6 )
>         = split (/,/);
>   
>     $location = "$city,$statecode,$countrycode";
> 
>     if (exists $LOCATIONS{$location}) {
>         foreach (@{$LOCATIONS{$location}}) {
>             print OUTPUT_FILE "$_,$date1,$max1,$min1,$cond1\n";
>         }
>     }
> }
> 
> -- Dave Tweed


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

Date: 27 Sep 2001 22:57:44 GMT
From: damian@qimr.edu.au (Damian James)
Subject: Re: Forcing reevaluation of code in mod_perl scripts?
Message-Id: <slrn9r7big.l18.damian@puma.qimr.edu.au>

On Thu, 27 Sep 2001 15:04:11 GMT, Andrew Cady said:
>damian@qimr.edu.au (Damian James) writes:
>> [my JAPH, which appears below anyway]
>That's really cool.

Why, thank you :-).

If you're interested, it is mostly derived (almost to the point of
Cargo Cult) from the Fisher-Yates shuffle implementation in perlfaq4.

One interesting feature is the only instance I have ever seen where
the auto-flush variable ($|) is *usefully* incremented rather than just
set to 1. You might want re-work it into readable code to work out why.

Cheers,
Damian
-- 
@:=grep!(m!$/|#!..$|),split//,<DATA>;@;=0..$#:;while($:=@;){$;=rand
$:--,@;[$;,$:]=@;[$:,$;]while$:;push@|,shift@;if$;[0]==@|;select$,,
$,,$,,1/80;print qq x\bxx((@;+@|)*$|++),@:[@|,@;],!@;&&$/}  __END__
Just another Perl Hacker,### http://home.pacific.net.au/~djames.hub


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

Date: Fri, 28 Sep 2001 02:19:50 +0200
From: "novastar" <novastar@novastar.dtdns.net>
Subject: Re: Help with system() on win32
Message-Id: <9p0c6l$d9$1@usenet.otenet.gr>

give a shot to this :

use Win32::Process;
$appl=Win32::Process;
$appl->Create('c:/winnt/notepad.exe','notepad
f:/work/test.txt',0,NORMAL_PRIORITY_CLASS,"c:/winnt");




"JRoot" <awkster@yahoo.com> wrote in message
news:9efa6216.0109270719.d975faa@posting.google.com...
> I'm running perl 5.005.03 (which I must stay with for reasons
> I won't go into)
> Running NT 4.0
>
> I have been through the faq, perltoot, perlfunc and many samples
> garnered off the web.
>
> In the most simple terms, I want to open a text file in notepad.exe
> and while the text file is open, have the program return to the
> calling script to continue.
>
> This is a very simple example
>
> #!perl -w
>
> use strict;
>
> my $file = "c:\\file.txt":
> system("notepad $file");
> print "Howdy\n";
>
> This will open the text file but does not return to the perl
> script to print the line "Howdy" until I close notepad.
>
> So far I have tried various was of using system,
> various ways of using exec() and was going to try
> fork(), exec() but according to perldocs fork is
> not available for win32.
>
> SO far nothing has worked satisfactorily.
>
> Thought about trying the win32::spawn and ::process
> but do not have it loaded in the application which
> is calling this perl script (the application comes
> with a perl load and I am not allowed to modify it)
>
> Am I chasing my tail with this???
> Does anyone know a way this can be done???
>
> Any help is greatly appreciated
>
> Thanks and regards




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

Date: 27 Sep 2001 23:49:27 GMT
From: abigail@foad.org (Abigail)
Subject: Re: how do I know if Perl:TK is installed?
Message-Id: <slrn9r7elm.ngn.abigail@alexandra.xs4all.nl>

Marc Ulrich (mdulrich@unity.ncsu.edu) wrote on MMCMXLIX September
MCMXCIII in <URL:news:3BB36904.2FFDA1D6@unity.ncsu.edu>:
;; I'm writing a script which would like to test for the installation of
;; Perl/Tk. What is the best / appropriate way to do that?

    eval {require "Tk.pm"};

And then check $@. If $@ isn't set, Tk is there and loaded ok. Otherwise,
inspect $@ to find out why it didn't load properly - if it's not there,
$@ will have an appropriate message.



Abigail
-- 
perl -we 'print split /(?=(.*))/s => "Just another Perl Hacker\n";'
#    A pair of weeping
#    warriors. A thrush flying
#    south. A soaring eagle.


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

Date: Fri, 28 Sep 2001 01:47:18 GMT
From: m_010@yahoo.com (eric ng)
Subject: install perl module
Message-Id: <3bb3d19f.31504671@enews.newsguy.com>

As far as I see, all perl module always has the following file:

Makefile.PL
xxx.pm (where xxx is the module name)

Is that all perl module installs the same way like follows: 
perl Makefile.PL 
make 
make test
make install 

Can I just manually copy the xxx.pm file into any of the following
path -OR- copy to my home dir and use perl -I:
/usr/local/lib/perl5/5.00503/sun4-solaris
/usr/local/lib/perl5/5.00503
/usr/local/lib/perl5/site_perl/5.005/sun4-solaris
/usr/local/lib/perl5/site_perl/5.005

Why I need to do a make? what's the make does? 

thanks


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

Date: Fri, 28 Sep 2001 02:28:19 GMT
From: cfedde@fedde.littleton.co.us (Chris Fedde)
Subject: Re: install perl module
Message-Id: <7fRs7.730$Owe.277278720@news.frii.net>

In article <3bb3d19f.31504671@enews.newsguy.com>,
eric ng <m_010@yahoo.com> wrote:
>As far as I see, all perl module always has the following file:
>
>Makefile.PL
>xxx.pm (where xxx is the module name)
>
>Is that all perl module installs the same way like follows: 
>perl Makefile.PL 
>make 
>make test
>make install 
>

Some modules require more than one file. Others require a compilation step.
Yet other modules require special customization to the local system.
It's best to follow this to insure that all the bits and pieces of the
module are properly installed.

Good Luck

-- 
    This space intentionally left blank


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

Date: Fri, 28 Sep 2001 02:31:23 -0400
From: brian d foy <comdog@panix.com>
Subject: Re: install perl module
Message-Id: <comdog-6390E8.02312328092001@news.panix.com>

In article <3bb3d19f.31504671@enews.newsguy.com>, m_010@yahoo.com (eric 
ng) wrote:

> As far as I see, all perl module always has the following file:

> Makefile.PL
> xxx.pm (where xxx is the module name)

 
> Is that all perl module installs the same way like follows: 
> perl Makefile.PL 
> make 
> make test
> make install 

> Why I need to do a make? what's the make does? 

make ensures things happen correctly. if you have to ask
how to get around using it then you should still use it. :)

-- 
brian d foy <comdog@panix.com> - Perl services for hire
CGI Meta FAQ - http://www.perl.org/CGI_MetaFAQ.html
Troubleshooting CGI scripts - http://www.perl.org/troubleshooting_CGI.html



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

Date: Fri, 28 Sep 2001 10:48:45 +0800
From: "Naseer" <Naseer.Syed@Compaq.Com>
Subject: mount system call
Message-Id: <hxRs7.747$YP.22273@news.cpqcorp.net>

Is there a equivalent function in perl that implements the "mount" and
"umount" system calls of unix ?

I am preparing a perl script that allows normal users to mount/umount
specific NFS directories.

Thanks.
Naseer.




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

Date: 27 Sep 2001 22:15:17 -0500
From: logan@cs.utexas.edu (Logan Shaw)
Subject: Re: mount system call
Message-Id: <9p0q05$qrm$1@charity.cs.utexas.edu>

In article <hxRs7.747$YP.22273@news.cpqcorp.net>,
Naseer <Naseer.Syed@Compaq.Com> wrote:
>Is there a equivalent function in perl that implements the "mount" and
>"umount" system calls of unix ?

There isn't a built-in one.  You could do this kind of thing:

	system ("/sbin/mount", "/dev/dsk/c0t2d0s7", "/some/dir");
	system ("/sbin/umount", "/some/dir");

If you'd rather call functions instead of running external programs,
you could write a Perl mode that serves as a wrapper for the C function
calls and then use that, but it seems like a lot of work for not much
benefit.

A few other comments:

(1)  Since you're trying to allow non-root users to be able to mount
     and unmount things, be careful about security.  In addition to
     abusing your Perl script in some way, the users could mount a
     filesystem with a setuid file on it and use that to get root
     access.

(2)  You might consider using the "sudo" program to allow certain
     users to run certain "mount" and "umount" commands only.

(3)  If your version of Unix has an automounter, you might want to
     look at it.

Hope that helsp.

  - Logan
-- 
"Everybody
 Loves to see              
 Justice done
 On somebody else"     ( Bruce Cockburn, "Justice", 1981 )


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

Date: Fri, 28 Sep 2001 05:54:49 GMT
From: Andrew Cady <please@no.spam>
Subject: Re: mount system call
Message-Id: <87k7yj3lqz.fsf@homer.cghm>

"Naseer" <Naseer.Syed@Compaq.Com> writes:

> Is there a equivalent function in perl that implements the "mount"
> and "umount" system calls of unix ?

perldoc -f syscall


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

Date: 27 Sep 2001 15:07:17 -0700
From: pilotsnipes@yahoo.com (Snipes)
Subject: Re: Not sure what type of cgi script I need!
Message-Id: <ae7dfa3b.0109271407.4a2be65f@posting.google.com>

> \\ I would like to be able to have a "mailing list" or something similar,
> \\ that the users can subscribe to which allows them to select which of
> \\ the 6 files they want to receive to their own e-mail. When the e-mail
> \\ arrives on Friday to my account, I would like the server to run a
> \\ script/program that takes each attachment and "forwards" or
> \\ "auto-responds" it to the people who are looking for it.
> 
> Two things.
>   1) I fail to see why you need a CGI program to do this stuff. It's
>      not impossible, but it sounds as useful as using the Queen Elizabeth II
>      to travel from Pittsburg to Chicago.

Well seeing as you like to give the impression you are a perl coding
God, it would be slighty more constructive to give an alternative
rather than a poor attempted put down.

>   2) What's got this to do with Perl? So far, you've done zero coding,
>      and apparently, you need handholding all the way. Perhaps you want
>      comp.programs.gimme.gimme.gimme.


I fail to see any reason for your hostility to my question. Next time,
try banging your keyboard with some thought, instead of banging your
mum without.


> wrote on MMCMXLVII September MCMXCIII in
 
Wow. Impressive, did you code that yourself?

Snipes


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

Date: 27 Sep 2001 18:22:27 -0700
From: ianb@ot.com.au (Ian Boreham)
Subject: Re: Parsing a string
Message-Id: <f02c4576.0109271722.31c2b7df@posting.google.com>

Andrew Cady <please@no.spam> wrote in message news:<87k7yk4qxu.fsf@homer.cghm>...
> "Rob - Rock13.com" <rob_13@excite.com> writes:
> 
> > Brady Doll <news:9oub86$hhs$1@news-int.gatech.edu>:
> > 
> > > I am attempting to parse a string which has an attribute followed
> > > by a value... Attribute="value"
> > >
> > > this was the code i was attempting to use, however the (.*) causes
> > > it to freeze.

As in "not return from the match (for a long time)"? Is it a very
large string, by any chance?


> > >
> > > m/(?:\s*)([\w])(?:\=)(?:[\'\"])(.*)(?:[\'\"])/;
> 
> Some problems in your (OP's) use of regexes:
> 
> (?:\s*) <-- entirely unnecessary to specify precedence with
> parentheses here, the default precedence is what you want.  Use \s*

Note also that putting an un-anchored uncaptured \s* here is
completely meaningless. It can match anything (zero characters in
particular). If the regex were anchored to the start of the string (as
Andrew Cady shows below), it would confirm that nothing but whitespace
exists at the start of the line. If it were captured (why you would do
that, I don't know, but there could be a reason), then the captured
data could be affected. But as it stands, it does not affect the match
at all, and could be removed entirely.

 
> (.*) <-- * is greedy, so this will match to the end of the line, even
> if the line ends with a ' or ".  Either use (.*?)['"] or use
> ([^'"]*)['"].  The former is more correct and the latter faster.  Or,
> use alternation as in the first regex I have listed below.

I'd be careful about saying that use of .*? is more correct. It might
suffice in this case, but it opens the regex up to matching things it
shouldn't match (badly-formed lines, for example), since the
non-greedy quantifier can still escape the quoted string if necessary
to force a match. Not only can this cause false matches, it can also
cause the match to "freeze" in the same way, since the regex is tried
over the entire string again, but in the reverse order to the greedy
version, before it fails.

Non-greedy quantifiers are almost never the best solution. In a case
like this, you are better off defining clearly what the quoted string
can contain, how embedded quotes are escaped etc, and expressing that
in the regex, or banning quote characters from the quoted string
entirely. If you take the lazy option of extracting everything between
the first and last quotes, including any internal quote characters,
then the quotes no longer serve any purpose, and might as well be
omitted from the format.
 
> > > What should be put in place of the (.*)...is there anything or am
> > > I just going to have to result to a different method to parse this
> > > string then using a reg. ex.?
> > 
> > My first thought would be, perhaps?  m/(.*)=['|"]([^"]+)['|"]/;

This allows an empty key, and includes whitespace in the key, which is
probably undesirable.
 
> You don't use | to mean "or" in a character class like you do outside
> one; or is implied, you just list the characters.  Also your regex
> would match the closing single-quote in the field 

 ...although it would then have to backtrack to allow it to match the
closing quote.

> and wouldn't handle an empty field 

 ...and would allow mismatched delimiting quotes

> (and the first greedy .* would cause performance
> problems and would match a second = in the line).  Something like this
> would be a little better: 
> 
> m/^\s*([^=]*)=(?:'([^']*)'|"([^"]*)")/; ($attr,$val) = ($1, $2||$3);

Don't forget to check if the match succeeds before using $1 etc. And
use "defined" to work out if $2 actually matched, since some valid
values will fail the truth test.
 
Regards,


Ian


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

Date: Thu, 27 Sep 2001 22:43:14 GMT
From: Michael Budash <mbudash@sonic.net>
Subject: Re: procmail-like task in Perl?
Message-Id: <mbudash-627452.15431427092001@news.sonic.net>

In article <9p0628$po6$1@panix3.panix.com>, Cynthia Burns 
<burns_cindy@hotmail.com> wrote:

> How can I write a Perl script that periodically
> checks a mail server, scans the messages, and
> removes (possibly after resending to a different
> address) those that match certain criteria?  Is
> there a Perl module that facilitates this task?
> 
> This is functionality similar to procmail, but
> I want to write my own script to do it.  It
> should be able to provide authentication info
> to the mail server.
> 
> Thanks,
> 
> Cynthia

the Net::POP3 perl module is the ticket. as far as the 'periodically' 
part, just have the script kicked off via cron.

hth-
-- 
Michael Budash ~~~~~~~~~~ mbudash@sonic.net


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

Date: Thu, 27 Sep 2001 22:47:26 -0000
From: darkon@one.net (David Wall)
Subject: Re: procmail-like task in Perl?
Message-Id: <Xns9129BF08F5DC0darkononenet@207.126.101.97>

Cynthia Burns <burns_cindy@hotmail.com> wrote on 27 Sep 2001:
> How can I write a Perl script that periodically
> checks a mail server, scans the messages, and
> removes (possibly after resending to a different
> address) those that match certain criteria?  Is
> there a Perl module that facilitates this task?
> 
> This is functionality similar to procmail, but
> I want to write my own script to do it.  It
> should be able to provide authentication info
> to the mail server.

You might be interested in Mail::Audit.  I've never used it myself, but 
there was an article about it on perl.com recently:

http://www.perl.com/pub/a/2001/07/17/mailfiltering.html

Otherwise, I'd check to see what other modules are around to make something 
like this easier.

-- 
David Wall
darkon@one.net


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

Date: 27 Sep 2001 23:51:24 GMT
From: abigail@foad.org (Abigail)
Subject: Re: Push into an array
Message-Id: <slrn9r7epa.ngn.abigail@alexandra.xs4all.nl>

Michael Carman (mjcarman@home.com) wrote on MMCMXLIX September MCMXCIII
in <URL:news:3BB34DE4.42DC88CD@home.com>:
&& 
&& That's a very unperlish way of doing things.
&& 
&& @items = (0 .. 9);


Useless use of parenthesis. Parenthesis don't create a list, context does.

    @items = 0 .. 9;


Abigail
-- 
#!/opt/perl/bin/perl -w
$\ = $"; $SIG {TERM} = sub {print and exit};
kill 15 => fork for qw /Just another Perl Hacker/;


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

Date: Fri, 28 Sep 2001 08:31:32 +0200
From: Philip Newton <pne-news-20010928@newton.digitalspace.net>
Subject: Re: Push into an array
Message-Id: <4668rtk6che6qnegfutvls6324ua5ev6hq@4ax.com>

On 27 Sep 2001 23:51:24 GMT, abigail@foad.org (Abigail) wrote:

> Michael Carman (mjcarman@home.com) wrote on MMCMXLIX September MCMXCIII
> in <URL:news:3BB34DE4.42DC88CD@home.com>:
> && 
> && That's a very unperlish way of doing things.
> && 
> && @items = (0 .. 9);
> 
> Useless use of parenthesis. Parenthesis don't create a list, context does.
> 
>     @items = 0 .. 9;

Hm...

    @items = 2, 4, 6;

vs

    @items = (2, 4, 6);

Does "precedence" fall under "context"?

Someone who was bitten by "2, 4, 6" may prefer to write "(0 .. 9)".

Cheers,
Philip
-- 
Philip Newton <nospam.newton@gmx.li>
That really is my address; no need to remove anything to reply.
If you're not part of the solution, you're part of the precipitate.


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

Date: Fri, 28 Sep 2001 01:24:05 -0400
From: "Eric" <stratvio@aol.com>
Subject: Running system programs from CGI
Message-Id: <tr82frpftqcu06@corp.supernews.com>

Hi,
  I'm trying to write a program to register computers to receive dhcp ip's
and to go through a firewall.  I have the firewall set up such that 1-128 is
allowed through, and 128 and above is stopped.  Users go to a registration
page served through apache and enter a system username and password, and are
then authenticated via PAM.  If they are a real user, the mac address is
obtained (by pinging their ip and searching "arp -a" for it) and is entered
in the dhcpd.conf file.  There they are given a static ip under 128.  The
only thing that isn't working correcty is restarting the dhcp server.  I'm
trying to just run `/etc/rc.d/init/dhcpd restart`, but it doesn't work and I
don't get any error messages.  I've tried printing "test 2" and "test 3"
around the line in question, and the "test 3" doesn't get printed.  I've
also tried just running "print `date`", and that doesn't work either.  Is
there some problem with running programs from a CGI environment?  I'm able
to ping and run arp, so I'm not sure why I can't restart the dhcp server.
BTW, to modify the dhcpd.conf file I suid-ed the cgi program, so it's
running as root.  I'm sure this is probably a security problem, but I'm not
too concerned as the scripts in question are only able to be served to the
localnet (it's a virtual host on 192.168.1.x, and it's in a directory not
accessible from the normal web structure).  If I could get some help on
restarting the dhcpd server (or having it just check when the config is
updated), I'd appreciate it.  Also, any slicker ways to get mac address
would be appreciated.
Thanks in advance,
-Eric




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

Date: 27 Sep 2001 22:43:07 GMT
From: abigail@foad.org (Abigail)
Subject: Re: Sourcing Things in Perl ?
Message-Id: <slrn9r7ap9.mse.abigail@alexandra.xs4all.nl>

slightlysprintingdog@ntlworld.com (slightlysprintingdog@ntlworld.com) wrote
on MMCMXLIX September MCMXCIII in <URL:news:3BB2F80C.B65EFD0E@ntlworld.com>:
{} Okay, forgive my ignorance.
{} I have a program called ModelSim that I execute from a Perl Tk script.
{} It needs certain environment variables set up before it is run.
{} There are two files that need sourcing.  One a one point in time and theSNIP
{} I have limited knowledge of the source files, they have lots of 'setenv'SNIP
{} them and various 'echos' to let you know whats going on but thats all.
{} Using a Solaris Unix system, I usually type :
{} source <filename> in a terminal when needed and away we go.
{} This process needs to be automated into the Perl script.
{} As explained I have just tried to use perls 'system' command to perform SNIP
{} that I type at the prompt and this did not have the desired affect - wheSNIP
{} source the file or not.
{} I'd assume any changes need to be visible when ModelSim is run.

Use one system command, not two.

    system "source $sourceme; modelsim";


That will start *one* shell, which first uses source (setting environment
variables), then executes modelsim.



Abigail
-- 
perl -we '$| = 1; $_ = "Just another Perl Hacker\n";  print
          substr  $_ => 0, 1 => "" while $_ && sleep 1 => 1'


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

Date: Thu, 27 Sep 2001 19:22:06 -0500
From: Tony Curtis <tony_curtis32@yahoo.com>
Subject: Re: Sourcing Things in Perl ?
Message-Id: <87u1xop3kh.fsf@limey.hpcc.uh.edu>

>> On 27 Sep 2001 22:43:07 GMT,
>> abigail@foad.org (Abigail) said:

> Use one system command, not two.
>     system "source $sourceme; modelsim";
> That will start *one* shell, which first uses source
> (setting environment variables), then executes modelsim.

system() invokes the Bourne shell (/bin/sh).

Using "." instead of "source" would probably make more
sense (bash is not masquerading as sh everywhere, nor is
one's login shell involved).

hth
t
-- 
Yes way!  Mmmmkay?


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

Date: Fri, 28 Sep 2001 01:50:30 GMT
From: tim@vegeta.ath.cx (Tim Hammerquist)
Subject: Re: Sourcing Things in Perl ?
Message-Id: <slrn9r7mk6.37s.tim@vegeta.ath.cx>

Me parece que Tony Curtis <tony_curtis32@yahoo.com> dijo:
> >> On 27 Sep 2001 22:43:07 GMT,
> >> abigail@foad.org (Abigail) said:
> 
> > Use one system command, not two.
> >     system "source $sourceme; modelsim";
> > That will start *one* shell, which first uses source
> > (setting environment variables), then executes modelsim.
> 
> system() invokes the Bourne shell (/bin/sh).
> 
> Using "." instead of "source" would probably make more
> sense (bash is not masquerading as sh everywhere, nor is
> one's login shell involved).

btw, how would /bin/sh handle all the setenv's in a csh script?

-- 
/earth: file system full.


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

Date: Thu, 27 Sep 2001 21:02:35 -0500
From: Tony Curtis <tony_curtis32@yahoo.com>
Subject: Re: Sourcing Things in Perl ?
Message-Id: <87pu8coyx0.fsf@limey.hpcc.uh.edu>

>> On Fri, 28 Sep 2001 01:50:30 GMT,
>> tim@vegeta.ath.cx (Tim Hammerquist) said:

> Me parece que Tony Curtis <tony_curtis32@yahoo.com>
> dijo:
>> 
>> system() invokes the Bourne shell (/bin/sh).
>> 
>> Using "." instead of "source" would probably make more
>> sense (bash is not masquerading as sh everywhere, nor
>> is one's login shell involved).

> btw, how would /bin/sh handle all the setenv's in a csh
> script?

It wouldn't.  At least, not directly.  You could use
system() to invoke csh and call the C-shell script though.

Of course, as we all know, only nuts write C-shell
scripts (google: csh why not christiansen) :-)

-- 
Yes way!  Mmmmkay?


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

Date: Fri, 28 Sep 2001 01:37:52 +0200
From: "novastar" <novastar@novastar.dtdns.net>
Subject: Re: Term::ANSIColor in Windows 2000's CMD
Message-Id: <9p09o8$se1$1@usenet.otenet.gr>


In Win2000 you have to use for this purpose the module "Win32::Console"

"noms" <dont@mail.me> wrote in message news:9i6fa8$qsk$1@bob.news.rcn.net...
> Has anyone successfully used the Term::ANSIColor module in Windows 2000's
> CMD using ActivePerl?  I've tried using code straight from the module's
> documentation, but still see the standard colors.  If I run the same
script
> on a Linux console, everything works as expected.  Is this a limitation of
> CMD or is there a special option to allow for ANSI colors in it?  Thanks
for
> your help.
>
> PS: Russ, if you're reading, sorry for the email.  I read your "ask
> questions in public" a bit too late :(
>
>




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

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


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