[9900] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 3493 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Aug 20 15:07:50 1998

Date: Thu, 20 Aug 98 12:00:21 -0700
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, 20 Aug 1998     Volume: 8 Number: 3493

Today's topics:
    Re: [Q] deprecated use of split (what? why?) (Abigail)
        CGI/Perl Permissions <patrickh@innova.net>
        Error Opening pkg-Win32-ODBC.chm in htmlhelp for Active <pan@part.net>
        Help wanted please. <lordy@tcp.co.uk>
    Re: Help wanted please. (Josh Kortbein)
    Re: Help wanted please. (Steve Linberg)
    Re: Help wanted please. <mooneer@earthlink.net>
    Re: Help: Problem with Pattern-Matching <mooneer@earthlink.net>
        How to pattern-match (1233 bytes)? wming@mailexcite.com
    Re: How to pattern-match (1233 bytes)? (Steve Linberg)
        How to sort this associative array? <rfwalker@lucent.com>
    Re: How to validate an URL? <asharp@nector.com>
    Re: Installation problems with Perl5.004 news@alameh.net
        LWP::Simple Question <jjune@midway.uchicago.edu>
    Re: NEWBIE Question: Perl Script in Unix vs. NT (Mr. Mirthful)
        Opening a MS Access database from Perl script <sucheta@nmtec.com>
    Re: Opening a MS Access database from Perl script (Steve Linberg)
    Re: perl -U don't work... help <nguyend7@msu.edu>
        Perl on AIX and setuid calls. <mrivera@platinum.com>
    Re: Same subroutine name in require files <nguyend7@msu.edu>
        Screen Scrubbing & Terminal Scripting (Scott Dudley)
    Re: Stumped! Need help! (Josh Kortbein)
    Re: such a thing as a "perl user"? (I R A Aggie)
    Re: system command (Craig Berry)
    Re: Win32 Perl rm -rf Equivalent? <JKRY3025@comenius.ms.mff.cuni.cz>
        Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)

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

Date: 20 Aug 1998 17:18:04 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: [Q] deprecated use of split (what? why?)
Message-Id: <6rhloc$njc$1@client3.news.psi.net>

Larry Rosler (lr@hpl.hp.com) wrote on MDCCCXV September MCMXCIII in
<URL: news:MPG.1045cf7d7c25fe969897d8@nntp.hpl.hp.com>:
++ [Posted to comp.lang.perl.misc and copy mailed.]
++ 
++ In article <y9izpcz7uff.fsf@mpii02700.mpi-sb.mpg.de> on 20 Aug 1998 
++ 13:40:36 +0200, Matthias Fischmann <fis@mpi-sb.mpg.de> says...
++ ...
++ > The following code should (and actually does) print out a line count
++ > of the text stored in $s:
++ > 
++ > > my $s = "foo\nbar\n";
++ > > print (scalar (split '\n', $s));
++ 
++ When what you are counting is the occurrences of single characters, the 
++ best way is to avoid actually creating an array and counting the elements 
++ in the array, by using the 'tr' operator:
++ 
++ print $s =~ tr/\n//;

You do realize that only happens to return the desired answer because
the given example ends with a single newline?

   my $s = "foo\nbar\n";
   my $t = "foo\nbar\nbaz";
   my $u = "foo\nbar\n\n\n\n";

   print scalar (split '\n', $s), ' ', $s =~ tr/\n//, "\n";
   print scalar (split '\n', $t), ' ', $t =~ tr/\n//, "\n";
   print scalar (split '\n', $u), ' ', $u =~ tr/\n//, "\n";

prints

   2 2
   3 2
   2 5

No to mention it doesn't generalize at all to splitting on something
else than a single character.

The following doesn't give warnings:

   my $s = "foo\nbar\n";
  {print scalar (my @a = split "\n", $s)} 


But that's kind of a hack. Perhaps 5.006 will get rid of this 'deprecated'
feature (why else deprecate it), and have split in scalar context return
the right thing.




Abigail
-- 
perl -we '$_ = q ;4a75737420616e6f74686572205065726c204861636b65720as;;
          for (s;s;s;s;s;s;s;s;s;s;s;s)
              {s;(..)s?;qq qprint chr 0x$1 and \161 ssq;excess;}'


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

Date: Thu, 20 Aug 1998 13:11:33 -0400
From: Patrick Herrington <patrickh@innova.net>
Subject: CGI/Perl Permissions
Message-Id: <35DC58C4.B9F66A75@innova.net>

I am a novice Perl user who has been asked to write some pretty
complicated scripts. (At least I think they're complicated) The one I am
working on now stops and starts several services, including inetd,
sendmail and others.

The problem I am having involves starting sendmail from the CGI
interface I have setup. If I run the script from the command line,
sendmail starts correctly, but if run from the web interface, sendmail
responds with a 501 Permission Denied.

Sendmail can be stopped from both the command line and the web interface
with no problem.

Does anyone have any suggestions? I am currently starting sendmail using
a subroutine that runs the following:

system "/etc/rc.d/init.d/senmail start";

I am calling Perl using #!/usr/local/bin/perl -U

If anyone could help me with this I'd appreciate it greatly.


-- 
Patrick Herrington		V: 888-8-INNOVA x227
Network Operations		V: 864-653-4638 x227
Innova Communications, LLC	F: 864-654-5174
Providers of Innova.NET		http://www.innova.net


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

Date: Thu, 20 Aug 1998 11:32:45 -0600
From: "Eric Pan" <pan@part.net>
Subject: Error Opening pkg-Win32-ODBC.chm in htmlhelp for ActivePerl.
Message-Id: <903634496.653019@gate.part.net>

I have install ActivePerl and used PPM.pl to install Win32-ODBC package.
When I go into htmlhelp directory using Window Explorer and double click on
pkg-Win32-ODBC.chm, I get the following error message:

Internet Explorer cannot open the Internet Site
mk:@MSITStore:C:\Perl\5.005\htmlhelp\pkg-Win32-ODBC.chm::/default.htm.

An unexpected error has occurred.

Do you know what's wrong?

--
-- Eric Pan




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

Date: Thu, 20 Aug 1998 18:58:08 +0100
From: "Lord M Spencer LLB" <lordy@tcp.co.uk>
Subject: Help wanted please.
Message-Id: <6rho3d$kk3$1@zeus.tcp.net.uk>

Please could somebody help me with a perl program that will read a text file
and extract email addresses from it. Unfortunately the email addresses are
in no specific order or format, so it needs to scan from the top and search
by @ signs.

Any help would be greatly appreciated.






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

Date: 20 Aug 1998 18:27:21 GMT
From: kortbein@iastate.edu (Josh Kortbein)
Subject: Re: Help wanted please.
Message-Id: <6rhpq9$bvv$1@news.iastate.edu>

Lord M Spencer LLB (lordy@tcp.co.uk) wrote:
: Please could somebody help me with a perl program that will read a text file
: and extract email addresses from it. Unfortunately the email addresses are
: in no specific order or format, so it needs to scan from the top and search
: by @ signs.

: Any help would be greatly appreciated.

In the general case, this is much harder than you would think or hope.
See perlfaq9 and Eli's mail addressing FAQ.


Josh

-- 
Prosecutors will be violated.



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

Date: Thu, 20 Aug 1998 14:42:22 -0400
From: linberg@literacy.upenn.edu (Steve Linberg)
Subject: Re: Help wanted please.
Message-Id: <linberg-2008981442220001@projdirc.literacy.upenn.edu>

In article <6rho3d$kk3$1@zeus.tcp.net.uk>, "Lord M Spencer LLB"
<lordy@tcp.co.uk> wrote:

> Please could somebody help me with a perl program that will read a text file
> and extract email addresses from it. Unfortunately the email addresses are
> in no specific order or format, so it needs to scan from the top and search
> by @ signs.
> 
> Any help would be greatly appreciated.

What the hell, I'm feeling generous (or bored) today.  Here's a freebie:

--------------------------------------------
#!/usr/bin/perl -w
use strict;

open (FILE, "foo.txt") or die "You lose: $!\n";
$_ = join ("", <FILE>);
close FILE;
my @addresses = /(\S*@\S*)/gs;
print join("\n", @addresses);
exit 0;
--------------------------------------------

Not guaranteed to be perfect.  Your homework: work with it and make it
better.  :)
_____________________________________________________________________
Steve Linberg                       National Center on Adult Literacy
Systems Programmer &c.                     University of Pennsylvania
linberg@literacy.upenn.edu              http://www.literacyonline.org


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

Date: Thu, 20 Aug 1998 11:21:00 -0700
From: Mooneer Salem <mooneer@earthlink.net>
To:  Lord M Spencer LLB <lordy@tcp.co.uk>
Subject: Re: Help wanted please.
Message-Id: <35DC690C.6BE4E721@earthlink.net>

[CC'd to sender]

Lord M Spencer LLB wrote:
> 
> Please could somebody help me with a perl program that will read a text file
> and extract email addresses from it. Unfortunately the email addresses are
> in no specific order or format, so it needs to scan from the top and search
> by @ signs.
> 
> Any help would be greatly appreciated.

Try something like this:

open(TEXT, "textfile.txt");
flock(TEXT, 2);
while(<TEXT>) {
    $line = $_;
    while(($email) = ($line =~ /\b([A-Za-z0-9_.]\@[A-Za-z0-9_.])\b/)) {
	push(@emails, $email);
	$line =~ s/$email//;
    }
}
flock(TEXT, 8);
close(TEXT);

With this code, the extracted email addresses will end up in an array
called @emails.
Hope this helps,

-- 
Mooneer Salem
Webmaster & Programmer for HyperNetMsg (http://hypernetmsg.hypermart.net


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

Date: Thu, 20 Aug 1998 11:25:48 -0700
From: Mooneer Salem <mooneer@earthlink.net>
To:  setro@my-dejanews.com
Subject: Re: Help: Problem with Pattern-Matching
Message-Id: <35DC6A2C.2804F771@earthlink.net>

[CC'd to sender]

setro@my-dejanews.com wrote:
> 
> Hi!
> 
> In a perl-script (packing Mail to a pager)
> I want to change a string!
> 
> All words should start with a big letter,
> all ofther letters of the Words should be small.
> And I want to delete all space.
> 
> So I try to make all letters small: tr/[A-Z]/[a-z]/  that's no problem Now
> make all first letters big (=letters after a space and the first in string)
> ?????  Here is the problem!!! Than delete all spaces: s/ //g that's no
> problem
> 
> Example: "Many greetings to Petra and Sebastian!"
> result:  "ManyGreetingsToPetraAndSebastian!"
> 
> Thanx for an email with a solution!
> 

Try something like this:

$text = "Many greetings to Petra and Sebastian";
$text =~ tr/A-z/a-z/;
$text =~ s/\s*(.)(*)\s*/$1$2/g;
$text =~ s/ //g;

Hope this helps.

-- 
Mooneer Salem
Webmaster & Administrator for HyperNetMsg
(http://hypernetmsg.hypermart.net)


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

Date: Thu, 20 Aug 1998 18:09:16 GMT
From: wming@mailexcite.com
Subject: How to pattern-match (1233 bytes)?
Message-Id: <6rhooc$p13$1@nnrp1.dejanews.com>

Hi,

I wanted to include the number of bytes of each message in my wwwboard setting
so I included a variable $length="ENV{"CONTENT_LENGTH"}"; in my wwwboard.pl.
Everything worked out fine until I tried to delete my messages by
executing wwwadmin.pl. The messages just didn't show up. I understand it was
because I had changed the outlook of my board (wwwboard.html).
So I tried to match (1234 bytes) with \(.*\) but didn't work neither.

Could experts here give me some suggestion?

Thanks in advance!


Jack.

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp   Create Your Own Free Member Forum


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

Date: Thu, 20 Aug 1998 14:29:44 -0400
From: linberg@literacy.upenn.edu (Steve Linberg)
Subject: Re: How to pattern-match (1233 bytes)?
Message-Id: <linberg-2008981429440001@projdirc.literacy.upenn.edu>

In article <6rhooc$p13$1@nnrp1.dejanews.com>, wming@mailexcite.com wrote:

> Hi,
> 
> I wanted to include the number of bytes of each message in my wwwboard setting
> so I included a variable $length="ENV{"CONTENT_LENGTH"}"; in my wwwboard.pl.
> Everything worked out fine until I tried to delete my messages by
> executing wwwadmin.pl. The messages just didn't show up. I understand it was
> because I had changed the outlook of my board (wwwboard.html).
> So I tried to match (1234 bytes) with \(.*\) but didn't work neither.
> 
> Could experts here give me some suggestion?

Most of the experts here will tell you not to use wwwboard.pl.  But that's
another discussion.

Remember that regexps are greedy.  /\(.*?\)/ may be closer to what you want.
_____________________________________________________________________
Steve Linberg                       National Center on Adult Literacy
Systems Programmer &c.                     University of Pennsylvania
linberg@literacy.upenn.edu              http://www.literacyonline.org


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

Date: Thu, 20 Aug 1998 14:26:40 -0400
From: Robert Walker - Lucent ASCC <rfwalker@lucent.com>
Subject: How to sort this associative array?
Message-Id: <35DC6A60.2443@lucent.com>

Hello, I have a question, how can I sort an
associative array that looks like this.

associative array is    %team

and %team looks like this


$team{A} = "4,2,6,0.67"
$team{B} = "2,8,2,0.2"
$team{C} = "3,8,4,0.25"
$team{D} = "7,1,4,0.87"

I would like %team to be sorted on the last comma
separated value of the string, the 0.67,  0.2, 
0.25, 0.87      So the sorted array 
would look like 


$team{D} = "7,1,4,0.87"
$team{A} = "4,2,6,0.67"
$team{C} = "3,8,4,0.25"
$team{B} = "2,8,2,0.2"

is there a way to split the value string such that I
get one of  comma-separated-fields and then sort on 
the last field, the 0.67, 0.2, 0.25, 0.87


My current method it to create another array
that would just contain the key and value of interest.
 
@tmp{"A", "B", "C", "D"} = (0.67, 0.2, 0.25, 0.87)

then sort this array on the values, then I have the array sorted

but maybe there is away to do this w/o a tmp array?

thanks for any help


robert 
Matt 6:33


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

Date: Thu, 20 Aug 1998 11:18:21 -0600
From: Andy Sharp <asharp@nector.com>
To: Hans Xie <hans.xie@its.csiro.au>
Subject: Re: How to validate an URL?
Message-Id: <35DC5A5D.49363F1C@nector.com>

Ahh the joys of regex.

This won't do "real verification to ensure that it's up, online and
serving documents, but....
This will tell if the URL is in the form of
protocol://hostname.domainname/[filename]

One thing I never did do was add support for urls with hostname:port -
anyone care to modify the regex?

used it for a web browser I was working on:

#
# Returns protocol, hostname, path and file
#
sub getURL {
  my ($url) = @_;
  if ($url =~ m/:\/\// ) {
    $url =~ m/^([^{:\/\/}]*):\/\/([^\/]*)(.*)$/;
    return $1,$2,$3;
  } else {
    die "Malformed URL: $url";
  }
}

--Andy

Hans Xie wrote:
> 
> Dear all,
> 
> Would any one shed some light on how to valide an URL with PERL in UNIX?
> 
> Thanks in advance.
> 
> HB XIE


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

Date: Thu, 20 Aug 1998 18:32:59 GMT
From: news@alameh.net
Subject: Re: Installation problems with Perl5.004
Message-Id: <6rhq4r$qci$1@nnrp1.dejanews.com>

I am having the same error, I am crying daily because of this, because I am
not able to run perl, can any body help to stop me from crying, my blood
gloucose is high because of this problem, well my operating system is Digital
Unix running on DEC ALPHA, version is 4.0d. the version of perl I am trying
to install is the stable perl5.004 Please I am dying for a solution,

thanks a lot, I know that there is very good, and great people over here to
help in this
Regards
Issam

In article <6qpba8$3c7$1@cletus.bright.net>,
  "Franklin L.Petersen" <orangutan@grungyape.com> wrote:
> Ben,
>
> This is a fairly basic response meaning one of many things...these may not
> be all of them.  Basically, I got this on my SCO system during first time
> install of Perl, you either do not have a gcc compiler installed...or in my
> case it was installed but SCO also requires a "multimedia library" package
> to be installed so gcc works, or gcc is installed but not set up properly
> and the program cannot locate it.
>
> For a better response, please try to indicate what system you are using.
>
> Franklin
>
> Ben Crossman <ben@highway1.com.au> wrote in message
> 35CFFBE2.17DE@highway1.com.au...
> >I'm getting the following installation problem. Any suggestions.
> >
> >Checking for GNU cc in disguise and/or its version number...
> >
> >*** WHOA THERE!!! ***
> >    Your C compiler "gcc" doesn't seem to be working!
> >    You'd better start hunting for one and let me know about it.
> >Exit 1
> >
> >
> >
> >--
> >------------------------------------
> >Ben Crossman
> >Web Consultant / Maintenance
> >ben@highway1.com.au
> >http://users.highway1.com.au/~ben
> >Highway 1 (Aust) Pty Ltd
>
>

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp   Create Your Own Free Member Forum


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

Date: Thu, 20 Aug 1998 18:00:36 GMT
From: "Joseph June" <jjune@midway.uchicago.edu>
Subject: LWP::Simple Question
Message-Id: <01bdcc64$65134700$b7128780@joe>

Hello,

I have a simple question for all the perl gurus out there... any help would
be appreciated... 

I am using LWP::Simple to load a file from the internet... something like

$page = get
"http://www.ncbi.nlm.nih.gov/htbin-post/Entrez/query?db=n&form=6&uid=$access
ion&dopt=g&save=s&html=no"

where I am specifying $accession through a form on a web page.  This
particular reference returns a document that does not have any HTML tags on
it... 

so $page has a value of 

LOCUS       DMU31961   338234 bp    DNA             INV       28-DEC-1995
DEFINITION  Drosophila melanogaster bithorax complex (BX-C), complete
sequence.
ACCESSION   U31961
NID         g969077
KEYWORDS    .
SOURCE      fruit fly.

<---snip>

How can a parse the data so that I can have $DEFINITION = "Drosophila
melanogaster... ", $ACCESSION = U31961... etc...??

I can't seem to parse it because $page does not take in value line by
line... but all at once when used with "get"


any ideas?  Any helps would be very very appreciated!..

Thank you for your help in advance!

-JJ


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

Date: Thu, 20 Aug 1998 17:07:12 GMT
From: NOjcjSPAM@mail.med.upenn.edu (Mr. Mirthful)
Subject: Re: NEWBIE Question: Perl Script in Unix vs. NT
Message-Id: <35dc5766.267568342@uphs1>


>	Use vi on UNIX to edit your script.  If you see an ^M at the end
>	of every line, this is your problem.  This is also a problem if
>	you try to read in a DOS format file, UNIX cannot find the end of
>	line.  You need to strip off all ^M.  Type
>
>		<shift>:1,$s/<ctrl>v<shift>m//g
>
>	This will strip all ^M.

In vi and Emacs, every line did have ^M (which did not show up in
Pico). Actually, vi couldn't find the pattern ^M even though i could
see it, so i loaded the page in Pico, made a small change, and
reloaded it in vi and all of the ^M characters were gone.

Thanks for the assist.

-Jerrold


--remove NOSPAM to reply

--
My Father Always Believed That   | I want        | The Acquisition
Laughter Was The Best Medicine,  |    to         |   of Information
I Guess That's Why Several Of     |   believe.    | is an Advantageous
Us Died Of Tuberculosis! :^)       |   - X-Files   |   Expedition.

http://mail.med.upenn.edu/~jcj


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

Date: Thu, 20 Aug 1998 10:15:26 -0700
From: Sucheta Khot <sucheta@nmtec.com>
Subject: Opening a MS Access database from Perl script
Message-Id: <35DC59AE.47E8@nmtec.com>

Could somebody solve my following difficulties regarding opening an 
Access database connection and performing a SQL query on that database?

Question 1.
Method I :
1. I have a database called 'Article.mdb' in the same directory as that
of the Perl script. In my Perl script line # 12 is as follows:
my($db) = new Win32::ODBC($DSN) ||
die qq{Cannot open ODBC connection to "$DSN":}, Win32::ODBC::Error,
qq{\n};

Where,
my($DSN) = "Article";

2. When I run the code given in 1, I get an error message which states:
Use of uninitialized value at Artcle.pl line 12.
Cannot open ODBC connection to "Article":911[Microsoft][ODBC Driver
Manager] Data source name not found and no default driver specified

Method II :
If I use the code:
if (Win32::ODBC::ConfigDSN(ODBC_ADD_DSN, $DriverType, ("DSN=$DSN",
"Description=The Win32 ODBC Test DSN for Perl", "DBQ=$Dir\\$DBase",
"DEFAULTDIR=$Dir", "UID=", "PWD="))){
                print "Successful!\n";
            }else{
                print "Failure\n";
	     }
Where,
$DSN = "Article";
$Dir = `cd`;
$DBase = "Article.mdb";

I am able to successfully connect to the 'Article.mdb' database and then
I can use 'new' methos as used in Method I above to make any connections
to the Article.mdb database. But at many places on the Web Perl
documentation and books suggest just the the Method I to connect to the
database. Why my Method I is not working???
 
Question 2.
How can I write a sql query in Perl with an access database?


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

Date: Thu, 20 Aug 1998 14:46:08 -0400
From: linberg@literacy.upenn.edu (Steve Linberg)
Subject: Re: Opening a MS Access database from Perl script
Message-Id: <linberg-2008981446080001@projdirc.literacy.upenn.edu>

In article <35DC59AE.47E8@nmtec.com>, sucheta@nmtec.com wrote:

> Could somebody solve my following difficulties regarding opening an 
> Access database connection and performing a SQL query on that database?

Check this and see if it helps.

http://x12.dejanews.com/getdoc.xp?AN=323833324.1&CONTEXT=903638552.1985282054&hitnum=10
_____________________________________________________________________
Steve Linberg                       National Center on Adult Literacy
Systems Programmer &c.                     University of Pennsylvania
linberg@literacy.upenn.edu              http://www.literacyonline.org


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

Date: 20 Aug 1998 17:00:56 GMT
From: Dan Nguyen <nguyend7@msu.edu>
Subject: Re: perl -U don't work... help
Message-Id: <6rhko8$cjp$2@msunews.cl.msu.edu>

In comp.lang.perl.misc sCALP <scalp@orka.fr> wrote:
First of all it's bad enough that you posted to every possible perl
groupd you can think of.  You posted it twice to comp.lang.perl.misc.

: and i set its attributes to +x and +s.

: the file work when i'm root and that i type ./myfile, but when i'm not root
: (eg: user via internet (CGi)) it don't work...

This is a UNIX question not a perl question.  If it works when your
root, but not when your not.   Try setting the uid 

: what must i do... i work on SuSE 5.2 with Perl 5.00404...

-dan

-- 
           Dan Nguyen            | There is only one happiness in
        nguyend7@msu.edu         |   life, to love and be loved.
http://www.cse.msu.edu/~nguyend7 |                   -George Sand



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

Date: Thu, 20 Aug 1998 12:38:28 -0500
From: "Miguel A. Rivera" <mrivera@platinum.com>
Subject: Perl on AIX and setuid calls.
Message-Id: <35DC5F13.B52E4101@platinum.com>

Hi Everyone,

I am having problems with perl and AIX when running on different AIX
platforms. I have a daemon which is running as root that spawns a perl
script. The script runs correctly on some AIX boxes and on the other
ones we get an error like "cannot open required file integer blah blah
blah ...". This problem only ocurr when the daemon try to run the script
as an user other than root. I have checked the file permissions and they
are correct. The script should be able to access the files correctly.
One piece of information that could be relevant is that the code was
compiled with the com architechture on a PowerPC based system and it is
failing on a RS6000 system.

Is there any know problem with AIX? Are there any security weirdness
that I am not aware?

Any help will be greatly appreciated.

Thank you in advance,
Miguel Rivera
Platinum Technology, inc.
mrivera@platinum.com




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

Date: 20 Aug 1998 17:02:52 GMT
From: Dan Nguyen <nguyend7@msu.edu>
Subject: Re: Same subroutine name in require files
Message-Id: <6rhkrs$cjp$3@msunews.cl.msu.edu>

Phuong Le <ple@mitra.com> wrote:
: require 'f1.pl';
: require 'f2.pl';

: f();

: If both f1.pl and f2.pl implement a subroutine f.  When f is call Perl
: cannot resolve to which f to call and so it hang.

Try having each pl file in it's own package.  That will create
seperate name spaces for each, and should resolve any problems.

: Is there a way to resolve this ambiguity without rename one the
: subroutine name?

-- 
           Dan Nguyen            | There is only one happiness in
        nguyend7@msu.edu         |   life, to love and be loved.
http://www.cse.msu.edu/~nguyend7 |                   -George Sand



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

Date: Thu, 20 Aug 1998 18:39:06 GMT
From: scottd@goodnet.com (Scott Dudley)
Subject: Screen Scrubbing & Terminal Scripting
Message-Id: <35dc6c3d.3514870@news.goodnet.com>


I'm looking for a tool that will afford me the ability to perform
automated screen entry/scrubbing via scripting language, etc.  I once
saw such a product used by an interactive voice response system vendor
to access/enter data via screenson legacy systems.

I'm attempting to integrate to a system that doesn't provide OAI or
API for interface.  They'll provide access via a tty port and allow me
to execute their applications but that's it.

Is anyone aware of such a tool or can you suggest another method in
which I should approach this challenge.

Many thanks.


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

Date: 20 Aug 1998 18:42:05 GMT
From: kortbein@iastate.edu (Josh Kortbein)
Subject: Re: Stumped! Need help!
Message-Id: <6rhqlt$bvv$2@news.iastate.edu>

Dave Mee (davemee@tvlistings.co.uk) wrote:
: How y'doing? Good to hear.

: I was wondering if anyone had an elegant solution to >this< problem.

: I have hundreds of files open, the filehandles for them are generated
: dynamically as I need them. Opening and closing is all handled by
: searching through other arrays and constructing filehandles it *knows*
: will be open.

: What I need to do is read one line from a file, with only a string
: pointing to the filehandle.

: I *don't* want to have to read the whole file into an array all at once.
: I have to skip between files in a random order, so I want the system to
: keep track of the position for me automaticcly.

: Excuse the crassness of my code, but the mess below is *what* I am
: trying to achieve, I hope it's obvious why it doesn't work:

:     $progs[$item]=<{$fromfile}>;

: In a fit of desperation I thought the {} might help but evidently not.
: Any ideas, pointers, tips?

: (been through Camel, Llama, FAQ, and Dejanews without any leads).

: Please help. There's a pint in it for you :)

: Cheers, Dave

Not quite sure if this is what you're looking for, but...

You say you're generating the filehandles. If so then I assume
you're using FileHandle.pm.

#!/usr/local/bin/perl -w
use strict;

use FileHandle;

my $a = new FileHandle;
$a->open("a.txt") or die "open a.txt failed: $!\n";
my $line = <$a>;
print $line;

my $b = new FileHandle;
$b->open("b.txt") or die "open b.txt failed: $!\n";
$line = <$b>;
print $line;

$line = <$a>;
print $line;

This works as expected for me; each filehandle maintains a separate
file pointer, or whatever you care to call them. If you need to access
the filehandles based on filename, I'm sure there's a way you can
keep both around and do a lookup to get the appropriate handle.

Hope this gives you some ideas.


Josh

-- 
Prosecutors will be violated.



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

Date: Thu, 20 Aug 1998 13:52:54 -0500
From: fl_aggie@thepentagon.com (I R A Aggie)
Subject: Re: such a thing as a "perl user"?
Message-Id: <fl_aggie-2008981352550001@aggie.coaps.fsu.edu>

In article <linberg-2008980846340001@projdirc.literacy.upenn.edu>,
linberg@literacy.upenn.edu (Steve Linberg) wrote:

+ Every day I learn something new here, and I'm not terribly worried about
+ the pace of my progress.

Perl isn't a destination, its a mode of transport. Like driving, you get
better with use.

+ There's an awful lot of very bad code out there, and every time I look
+ back at code I wrote even six months ago I wrinkle my nose and go "ewwww."

Wow! you're out to 6 months? for me, it's more like two or three weeks...
"what is this trash? what *was* I thinking?".

+ Well, I'm rambling... no, you and I will never be Tom Christiansen and
+ Abigail (or Randal or Tom Phoenix or ... 

We're just JPH.

James - Journeymen Perl Hackers


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

Date: 20 Aug 1998 18:45:01 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: system command
Message-Id: <6rhqrd$aq6$1@marina.cinenet.net>

Richard Kim (rkim@temple.edu) wrote:
: Is there any reason why I can't do this?
: 
: system("cp", "*.whatever", "/tmp/whatever/");
:
: If I use individual files it seems to work fine, but I can't seem to use 
: the wild card.

The multi-argument version of the system() function bypasses shell
processing, including wildcard expansion.  Use the single-arg form or do
your own globbing if you need this.

---------------------------------------------------------------------
   |   Craig Berry - cberry@cinenet.net
 --*--    Home Page: http://www.cinenet.net/users/cberry/home.html
   |      "Ripple in still water, when there is no pebble tossed,
       nor wind to blow..."


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

Date: Thu, 20 Aug 1998 20:34:45 -0700
From: Jan Krynicky <JKRY3025@comenius.ms.mff.cuni.cz>
Subject: Re: Win32 Perl rm -rf Equivalent?
Message-Id: <35DCEAD5.4ED8@comenius.ms.mff.cuni.cz>

Lauren Elizabeth Darcey wrote:
> 
> Hi, I am currently trying to convert the NT batch file line
> rd /s dirname to the equivalent in PERL. When I checked out the
> rmdir function, it only seems to delete if the directory is empty.
> 
> So I did a little research on this, and I came up with two methods
> I could use.
> 
> (1) Use rmtree(dirname, ..) uses rmdir and unlink. What are the affects
> of unlinking with the NT filesystem?
> 
> (2) Use opendir/readdir on the directory, get an array of all entries in
> the directory, delete all files and foreach -d subdirectory, call my
> function recursively.
> 
> I tested rmtree on unix and nt, and it had the desired effects, but I'm
> curious as to if its REALLY equivalent to rd /s dirname. Also,
> efficiency-wise, would it be faster for me to write my own routine?
> 
> Thanks in advance for any help.
> Laurie <sorsha@cats.ucsc.edu>

I think you should use the rmtree function. At least if you want the
script 
to be portable. 

If you want to use Win32 calls and get some fancy dialogs or move 
the files to the RecycleBin you may
	
	use Win32::FileOp;
	 # http://www.fmi.cz/private/Jenda or http://jenda.krynicky.cz/
	RecycleConfirm 'c:\the\directory'; # for example

HTH, Jenda


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

Date: 12 Jul 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Special: Digest Administrivia (Last modified: 12 Mar 98)
Message-Id: <null>


Administrivia:

Special notice: in a few days, the new group comp.lang.perl.moderated
should be formed. I would rather not support two different groups, and I
know of no other plans to create a digested moderated group. This leaves
me with two options: 1) keep on with this group 2) change to the
moderated one.

If you have opinions on this, send them to
perl-users-request@ruby.oce.orst.edu. 


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.misc (and this Digest), send your
article to perl-users@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.

The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.

The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.

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 V8 Issue 3493
**************************************

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