[7985] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1610 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Jan 9 17:17:21 1998

Date: Fri, 9 Jan 98 14:00:26 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Fri, 9 Jan 1998     Volume: 8 Number: 1610

Today's topics:
     Re: [Help] Capturing STDOUT under DOS ? <Jan@ChipNET.cz>
     Re: [Help] How to span a perl PACKAGE over multiple sou (Earl Hood)
     Re: CGI to CGI?? (Craig Berry)
     CGI.pm - parameters duplicated in querystring and post  <chris@ixlabs.com>
     Re: CGI.pm - parameters duplicated in querystring and p (brian d foy)
     CGI.pm checkboxes: how to create labels for redundant v <chris@ixlabs.com>
     Re: controlling browser window propertys? (brian d foy)
     Re: CRYPT() (Nathan V. Patwardhan)
     Easy way to turn on dynamic linking? (HMahaffey)
     Re: extracting text? (Michael Kelly)
     Re: extracting text? (Austin Hastings)
     Re: Finding the TITLE to a HTML page <mahe@tcs.co.at>
     ftp.pl, Winsock.ph and win32 "standard" Perl?? (doug a blaisdell)
     How do I configure Perl scripts under IIS4.0? <sridhar.madduluri@internetMCI.com>
     Re: once again print SOCK "Whatever"; <hovnania@bcstec.ca.boeing.com>
     Perl CGI script's own directory (Martin Vorlaender)
     Re: Perl for Engineering purposes (Colin Kuskie)
     Re: Perl for Engineering purposes <beadles@nortel.com>
     Re: Perl for Engineering purposes (Brandon S. Allbery KF8NH; to reply, change "void" to "kf8nh")
     perl for NT wlemke@iris.nyit.edu
     Re: Perl to Binary? (Michael Kelly)
     Re: Range operator does work with file handles! (Austin Hastings)
     Re: recomended Perl books ? <joseph@5sigma.com>
     Re: regex to escape {, } except in TeX commands (Brandon S. Allbery KF8NH; to reply, change "void" to "kf8nh")
     Re: Searching text file with perl (John Moreno)
     Re: Server error 500 (brian d foy)
     Re: Simple array initialisation question (Craig Berry)
     Re: simple perl script to add directory to PATH if not  (brian d foy)
     Re: substitution (Clay Irving)
     Re: UNIX commands via FTP on a MACINTOSH -- HAY-ELP! (Michael Budash)
     Re: UNIX commands via FTP on a MACINTOSH -- HAY-ELP! (brian d foy)
     Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: Fri, 09 Jan 1998 20:43:26 -0800
From: Jan Krynicky <Jan@ChipNET.cz>
Subject: Re: [Help] Capturing STDOUT under DOS ?
Message-Id: <34B6FC6D.2102@ChipNET.cz>

Augusto Cardoso wrote:
> 
> What can I do to capture the output of Perl programs to a disk file
> insted of screen ? I tried all "redirection" and other "piping" I
> could think of, no results!
> Ex.
> POD2TEXT C:\PERL\README.POD
> 
> ... I would like to catch the output for later printing ...
> Thanks for suggestions.

use 
c:\> perl.exe pod2text c:\perl\readme.pod

DOS/Windows are able to redirect only exe and com files
(+ .bat & .cmd in WinNT).

Jenda


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

Date: 9 Jan 1998 18:45:58 GMT
From: ehood@medusa.acs.uci.edu (Earl Hood)
Subject: Re: [Help] How to span a perl PACKAGE over multiple source files ?
Message-Id: <695r96$85m@news.service.uci.edu>
Keywords: modules, perl, package

In article <693olk$orp$1@cnn.nas.nasa.gov>,
Tarang K. Patel <maumau@nas.nasa.gov> wrote:

> As per subject line, I desire to create a "package" that spans multiple
> source files. According to the Camel book one can do just this but does
> not show how ?

The challenge is how to get "all" the package loaded with a
use or require statement.  An approach is to have the main
file (the one use or require will normally find) do the requires
of the other package files.  For example:

    package Foo;
    # any use declarations and other stuff ...
    BEGIN {
	# require other parts
	require "Foo.1.pl";
	require "Foo.2.pl";
	# etc ...
    }

The naming convention of the other files is up to you.

Another approach (which I have used) is to take advantage of the
AutoLoader module.  What you can do is manually do the routine
split yourself instead of using AutoSplit.  Example:

    package Foo;
    use Exporter;
    use AutoLoader;
    @ISA = qw( AutoLoader Exporter );

    # routine you want defined in main module file.

Then in a auto/Foo (replace "Foo" with package name), you have
 .al files where the filename is the routine name defined in the
file with ".al" appended.  For example, if I want define a routine
called "routine1", I would create the file "routine1.al" and it would
contain something like the following:

    package Foo;
    sub routine1 {
	# ...
    }
    1;

Note, you will have to also create the autosplit.ix file to keep
AutoLoader from complaining during run-time.  It will need to
be maintained if you have exportable routines, but the maintenance
is trivial.

This method does imply that you manage your package at a subroutine
level.  You can write your own custom AUTOLOAD routine if you
want to have multiple routines in a single file, but do not want
to require the entire file during initial module loading as
shown in the first method.

>
> Also if one can have "multiple" packages source in a single module (.pm) 
> file then :
>
>  1) How does one declare the "use" statement ?

The package name given to "use" has a straight translation to the
pathname to use to find the source file.  For example, "Foo::Bar"
translates to "Foo/Bar.pm".  This pathname is looked for using the @INC
array to find the file.  Therefore, the "use" statement should have the
package name that will translate to the proper source file.  However,
there is no requirement that the source file have a package statement
that is the same as the "use" statement to load the module.  If this is
the case, you will at least need a stub import routine (package
qualified to what is used in "use") to keep Perl from complaining.

A problem is if you plan to have exportable routines in you
mulitple packages in a single file.  You may have to write
your own custom import method.


>  2) What is the naming convention that one has to follow for the packages
>     aftre the first package ?

Depends on the function of the other packages.

	--ewh
-- 
             Earl Hood              | University of California: Irvine
      ehood@medusa.acs.uci.edu      |      Electronic Loiterer
http://www.oac.uci.edu/indiv/ehood/ | Dabbler of SGML/WWW/Perl/MIME


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

Date: 9 Jan 1998 18:43:58 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: CGI to CGI??
Message-Id: <695r5e$qro$2@marina.cinenet.net>

Matt Bieber (mattdb@syntrillium.com) wrote:
: Can anyone tell me if it's possible to call a perl cgi script from within a
: cgi script? I have a machine which has a script that is processing form
: contents which then need to be emailed. Sendmail, however, resides on our
: second machine so it cannot be invoked from within the form processing
: script (or can it?). I figure I could send the form contents to a cgi
: script on the sendmail machine which would then mail it. Incidently, the
: first machine is running NT and the sendmail box is BSD.

Sure, why not?  I've used this to build a (not quite functional yet)
cross-net SSI-like system, used to incorporate the output of a CGI-driven
database server on system A into pages served via CGI on system B.  Under
the covers, the system B script does an LWP get-page (with URL-encoded
request parameters) from the URL of the server script on system A, parses
the results a bit, and then incorporates them into its output (the 
generated page it's serving up).

Good luck!

---------------------------------------------------------------------
   |   Craig Berry - cberry@cinenet.net
 --*--    Home Page: http://www.cinenet.net/users/cberry/home.html
   |      Member of The HTML Writers Guild: http://www.hwg.org/   
       "Every man and every woman is a star."


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

Date: Fri, 09 Jan 1998 11:03:18 -0800
From: Chris Schoenfeld <chris@ixlabs.com>
Subject: CGI.pm - parameters duplicated in querystring and post input
Message-Id: <34B67476.7073@ixlabs.com>

How can you identify parameter name collsions in CGI.pm?

For instance, if I have a querystring parameter:
?this=that
as the action argument to a POST INPUT form with a textbox:
NAME="this" VALUE="Some Default Text"

How can I differentiate which 'this' I am examining in
$query->param('this')???

Chris


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

Date: Fri, 09 Jan 1998 15:33:40 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: CGI.pm - parameters duplicated in querystring and post input
Message-Id: <comdog-ya02408000R0901981533400001@news.panix.com>
Keywords: from just another new york perl hacker

In article <34B67476.7073@ixlabs.com>, chris@ixlabs.com posted:

>How can you identify parameter name collsions in CGI.pm?
>
>For instance, if I have a querystring parameter:
>?this=that
>as the action argument to a POST INPUT form with a textbox:
>NAME="this" VALUE="Some Default Text"
>
>How can I differentiate which 'this' I am examining in
>$query->param('this')???


CGI.pm has the unfortunate feature of combining query string data
and http message body data.  if i use an off-the-shelf CGI.pm, then
i use PATH_INFO instead.  otherwise i hack CGI.pm to not make a stew
of my data :)

you could also examine the raw query string through the environment
variable or through the method provided by CGI.pm.  however, i 
would simply advise against having collisions in the first place :)

-- 
brian d foy                                  <comdog@computerdog.com>
Fifth Avenue Disaster! <URL:http://computerdog.com/brian/fire/>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>


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

Date: Fri, 09 Jan 1998 12:08:19 -0800
From: Chris Schoenfeld <chris@ixlabs.com>
Subject: CGI.pm checkboxes: how to create labels for redundant values?
Message-Id: <34B683B3.32EF@ixlabs.com>

In the -values field of FORM elements - checkboxes, for example, the
values are the keys and the labels are the values of the hashref.

Therefore values must be unique in order to have labels.

But I'd like the possibility of values to be redundant for quiz scoring
where answers are not boolean but weighted.
(for instance, two answers to the same question have the same value).


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

Date: Fri, 09 Jan 1998 15:38:37 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: controlling browser window propertys?
Message-Id: <comdog-ya02408000R0901981538370001@news.panix.com>
Keywords: from just another new york perl hacker

In article <34B5DE6B.E1F11CDB@edt.ericsson.se>, Mikael Henrikson <mikael.henrikson@edt.ericsson.se> posted:

>Hi...
>I wan't my PERL-script to redirect the user and change the browser
>(Netscape or IE) window propertys (such as toolbar, locationbar). Can I
>do this from a PERL-script??? If so, how?

you can write a script which outputs a document that contains something
like javascript.  otherwise, normal HTTP makes no provisions for
modifying the client device.

-- 
brian d foy                                  <comdog@computerdog.com>
Fifth Avenue Disaster! <URL:http://computerdog.com/brian/fire/>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>


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

Date: 9 Jan 1998 18:57:03 GMT
From: nvp@shore.net (Nathan V. Patwardhan)
Subject: Re: CRYPT()
Message-Id: <695rtv$8mq@fridge.shore.net>

Shawn M. Nelson (anonymous@whatever.com) wrote:

: No, I am not.  What group would you post to if you were trying to update an
: .htpasswd file by first creating the file in VFP and the FTPing the file to
: an NCSA server?

Well, I'd probably post to a FoxPro group, or even a webserver group
where users were discussing htpasswd stuff.  Unless, of course, you
were really trying to ask about crypting passwords like the htpasswd
program and how you'd do it in Perl.  

But I didn't parse that question from your question.  Is that the
question you were trying to ask?

--
Nathan V. Patwardhan



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

Date: 9 Jan 1998 21:44:34 GMT
From: hmahaffey@aol.com (HMahaffey)
Subject: Easy way to turn on dynamic linking?
Message-Id: <19980109214401.QAA04749@ladder01.news.aol.com>

I downloaded/built/installed the Term::Readkey library, but when I use it, Perl
complains that Perl wasn't built to handle dynamic loading (why isn't this the
default?)  Anyway, I can see the variable to change during Configure, but I'd
rather pass a "-Dxxx" switch instead of going through the entire interview. 
Does anyone know what the switch is, and how to find out the switch names for
all of the options?  (I can't find them in the script...)   

Does anyone know of a document somewhere that describes this entire "Building
and Configuring Perl" process?  I'm new to this stuff, but it sure seems
awfully mystical to me!  :)

:)hal mahaffey
hmahaffey@aol.com


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

Date: Fri, 09 Jan 1998 18:46:37 GMT
From: mkelly99@NOSPAMgate.net (Michael Kelly)
Subject: Re: extracting text?
Message-Id: <34ba6f13.78002507@news.gate.net>

On Fri, 09 Jan 1998 09:11:42 -0600, David_D._Jones@hud.gov wrote:

>I have a text file and I want to extract all the text between two
>delimiting markes.  There can be any number of lines before and after the
>dilimeters. How would I do that?  Let'say I have the following text
>
>Line 1
>Line 2
>aaaaa
>Line 3
>Line 4
>Line 5
>aaaaa
>Line 6
>
>I want to get the text between the two aaaaa lines.  I would think I
>could use the /aaaaa(.*)aaaaa/ and that would match Line 3-5. but it
>doesn't because the . doesn't match newlines.  One solution would be to
>replace all \n with some bizzar string and then do the pattern match,
>then resubstitute the \n back in. There's got to be a better way?
>
>-David


If you can massage your data to use a blank line as delimiter
then you can set "paragraph mode" by
$/ = "";

Also you can enable multi-line patterns by
$* = 1;

at the top of your Perl script.

If you cannot have blank lines and the file is not too long
you could slurp the whole thing into an array by
@array = <INFILE>;

or

@array = <>;

if the filename is the arg on the command line.


Hope this helps.


Mike

"Genius gives birth, talent delivers."

                - Jack Kerouac

(remove NOSPAM from address, if present, to reply)


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

Date: 09 Jan 1998 16:26:17 -0500
From: hastinga@tarim.dialogic.com (Austin Hastings)
Subject: Re: extracting text?
Message-Id: <c3k9c9mj9i.fsf@tarim.dialogic.com>

>>>>> "DDJ" == David D Jones <David_D._Jones@hud.gov> writes:
In article <884294092.1668612105@dejanews.com> David_D._Jones@hud.gov writes:


DDJ> I have a text file and I want to extract all the text between two
DDJ> delimiting markes.  There can be any number of lines before and
DDJ> after the dilimeters. How would I do that?  Let'say I have the
DDJ> following text

DDJ> Line 1
DDJ> Line 2
DDJ> aaaaa		<--- top delimiter
DDJ> Line 3
DDJ> Line 4
DDJ> Line 5
DDJ> aaaaa		<--- bottom delimiter
DDJ> Line 6

DDJ> I want to get the text between the two aaaaa lines.  I would
DDJ> think I could use the /aaaaa(.*)aaaaa/ and that would match Line
DDJ> 3-5. but it doesn't because the . doesn't match newlines.  One
DDJ> solution would be to replace all \n with some bizzar string and
DDJ> then do the pattern match, then resubstitute the \n back
DDJ> in. There's got to be a better way?

And there is:

========================================
use FileHandle;

my $return_delimiters = 1;
my $stop_after_one_set = undef;
my $top_delim = "aaaaa";	
my $bot_delim = "aaaaa";	# They might be different

my $fh = new FileHandle("< /tmp/file")
    or die "Could not open input file:  $!\n";

while (<$fh>)
{
	# Use three dots here because top and bot delimiters are same.

	if ($return_delimiters)
	{
		print if /$top_delim/ ... /$bot_delim/;
	}
	else	# We don't want the delimiters
	{
		my $within = (/$top_delim/ ... /$bot_delim/) || 0;

		print if ($within > 1 && $within !~ /E0$/);
	
		last if $stop_after_one_set and $within =~ /E0$/;
	}
}

close $fh
    or die "Could not close input file(!!):  $!\n";
========================================       
Good luck.

=Austin
-- 
____________________________________
 D I A L	Austin Hastings
 _|_|_|O	SCM Administrator
 _|_|_|G	Dialogic Corporation
 _|_|_|I	1515 Rt. 10 Parsippany,NJ 07054
 _|_|_|C	(201)993-3000 ext. 6546


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

Date: Fri, 09 Jan 1998 22:03:21 +0100
From: Herbert Maier <mahe@tcs.co.at>
To: psullivan <psullivan@stlnet.com>
Subject: Re: Finding the TITLE to a HTML page
Message-Id: <34B69098.EAC50B34@tcs.co.at>

psullivan wrote:

> How would I find the title from a html file? I tried...
>
> open(HTML,$htmlfile);
> @html = <HTML>;
> close(HTML);
>
> foreach $line (@html) {
>         if ($line =~ /title/i) {
>                 $html_title = $line;
>         }
> }
>
> and then I would take out the <title> and </title> tags, but it
> returns a
> blank $html_line variable. It looks fine to me, but is there another
> way of
> finding the title without having to resort to use calls? (i.e. the
> HTML::
> ones, if such one exists). I would like to keep it as portable as
> possible.
> Thanks.
>
> Patrick Sullivan

Try this
(save file find_tag.pl and execute f.e. find_tag index.html)
____start script______
#the whole file will be taken at once with  undef $/; so it will not
harm when
#the title tags are in different lines

   undef $/;
while(<>){

if (/<title>(.*)<\/title>/si){print $1;}
}

Greetings from Salzburg/Austria
Herbert Maier



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

Date: Fri, 9 Jan 1998 19:31:41 GMT
From: dougb@world.std.com (doug a blaisdell)
Subject: ftp.pl, Winsock.ph and win32 "standard" Perl??
Message-Id: <EMJ7Ku.K0I@world.std.com>

Hi everybuddy!

Got the latest "standard" perl distrib. from CSPAN, hoping I could use
things like use ftp.pl. It wants "winsock.ph". There's no winsock.h on
the distribution to run h2ph.bat on (I did this for socket.ph, don't know
much about h2ph otherwise).

Does this type of stuff (ftp, chat, etc) work on win32 Perl? There's an
ActiveWare perl win32 FAQ that says ftp.pl is broken. Does this apply
to the "standard version" as well? The README attached said that everything
worked on NT...

Any help??

thanks,
doug



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

Date: Fri, 09 Jan 1998 21:42:41 GMT
From: Sridhar Madduluri <sridhar.madduluri@internetMCI.com>
Subject: How do I configure Perl scripts under IIS4.0?
Message-Id: <34B69AA7.6BE64AEF@internetMCI.com>

Please let me know how to make Perl scripts to work unser IIS4.0
I have added .pl to App settings under HomeDirectory Application
Settings,
but it still did not work.
Thanks for your suggestions
Sridhar
sridharm@bellatlantic.net



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

Date: Fri, 9 Jan 1998 19:44:25 GMT
From: Paul Hovnanian <hovnania@bcstec.ca.boeing.com>
Subject: Re: once again print SOCK "Whatever";
Message-Id: <34B67E19.3DE3B550@bcstec.ca.boeing.com>

Tobias Bugala wrote:
> 
> For givin' you a better imagination of my problem:
> 
> My script should make some dialogue between my machine and a POP3 server.
> 
> I open the Socket-Connection and wait for the answer which comes correctly
> to me. (Well, I can print it out..)
> Afterwards I use the command
> 
> print SOCK "USER <username>\n";
> 
> to login. My probem is: there is no response.
> It should be "+Ok <user> gets mail......" but there comes nothing. So,
> where is the misstake? Telnetting functions...

After opening the socket connection, are you setting it to
"un-buffered"?

select $SOCK;
$| = 1;


-- 
Paul Hovnanian                | spam to: Chairman Reed Hundt
hovnania@bcstec.ca.boeing.com | rhundt@fcc.gov
------------------------------+-----------------------------------
   --- MERRY CHRISTMAS TO ALL AUTHORIZED PERSONNEL ---


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

Date: Fri, 09 Jan 1998 21:29:04 +0100
From: martin@RADIOGAGA.HARZ.DE (Martin Vorlaender)
Subject: Perl CGI script's own directory
Message-Id: <34b68890.524144494f47414741@radiogaga.harz.de>

Hi everyone!

There are a couple of related Perl CGI scripts that pull in other files
(e.g. for configuration) via require. But how is perl supposed to find
these, as the scripts' cgi-bin sub-directory isn't part of @INC? Is
there a (portable) way for a Perl CGI script to get the directory it's
situated in, in order to push it into @INC before attempting to require?

cu,
  Martin
--
                          | Martin Vorlaender | VMS & WNT programmer
 Ceterum censeo           | work: mv@pdv-systeme.de
 Redmondem delendam esse. |       http://www.pdv-systeme.de/users/martinv/
                          | home: martin@radiogaga.harz.de


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

Date: 9 Jan 1998 11:18:05 -0800
From: colink@latticesemi.com (Colin Kuskie)
Subject: Re: Perl for Engineering purposes
Message-Id: <695t5d$2ts@sarek.latticesemi.com>

In article <6945kq$dut@dfw-ixnews5.ix.netcom.com>,
J. Bacon <jwbacon@ix.netcom.com> wrote:
> Is anybody out there using Perl for 'engineering' purposes?  I just
> finished up a script which communicates with GPIB instruments -- I
> intend to write most all of my product test/calibration routines in
> Perl in the future (I am tired of C compilers obsoleting themselves,
> and re-inventing the wheel).

And yes, I use perl for engineering purposes, although I suspect that
they are quite different from yours.  I use perl for front- and back-end
processing of circuit netlists and simulations, design automation, and
report generation and of course all of the mundane daily tasks of
file searching, grepping, etc.

> I have not seen any targeted groups for this use of Perl, but would
> sure be willing to participate in one if such a group exists, or maybe
> if there are other oddballs out there like myself who want to
> concentrate on this particular Perl fetish, we can get something
> going.

I think this is an excellent idea.  Perhaps we could put together
something like libwww (the great collection of modules and scripts
for web applications), maybe libeng?

Colin


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

Date: Fri, 09 Jan 1998 13:53:03 -0600
From: "John T. Beadles" <beadles@nortel.com>
Subject: Re: Perl for Engineering purposes
Message-Id: <34B6801F.31FD@nortel.com>

> In article <6945kq$dut@dfw-ixnews5.ix.netcom.com>,
> J. Bacon <jwbacon@ix.netcom.com> wrote:
> >Is anybody out there using Perl for 'engineering' purposes?  I just finished
> >up a script which communicates with GPIB instruments -- I intend to write most
> >all of my product test/calibration routines in Perl in the future (I am tired
> >of C compilers obsoleting themselves, and re-inventing the wheel).
> >
> > [ ... ]
> 

I'm using perl to process cellular telephone RF 
drive test data and switch performance data.  A 
lot of the time I'm using it to do quick data 
format translations and data analysis, but I do 
also use it for web server administration.

------------------------------------------------
John T. Beadles            Nortel CDMA RF Design                       
Office: 972-685-7813           Fax: 972-684-3767 
Email (office):    beadles@nortel.removethis.com  
Any opinions are mine and to do not represent
             those of my employer
------------------------------------------------


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

Date: Fri, 09 Jan 98 14:26:26 -0500
From: bsa@void.apk.net (Brandon S. Allbery KF8NH; to reply, change "void" to "kf8nh")
Subject: Re: Perl for Engineering purposes
Message-Id: <34b67dbf$6$ofn$mr2ice@speaker>

In <fl_aggie-0901981135560001@aggie.coaps.fsu.edu>, on 01/09/98 at 11:35 AM,
   fl_aggie@thepentagon.com (I R A Aggie) said:
+-----
| I would be, as well. I work on atmospheric/oceanographic datasets, a
| stupendous amount of which is in plain text. I hadn't thought to try 
| extracting binary data, tho. Hmmm...
+--->8

I used to use Perl4 to read IBMish data dumps (EBCDIC text, BCD data, with the
odd DISPLAY and COMP-3 values thrown in for good measure), convert them to
something useful, preprocess the data (various calculations), and feed the
result to an SQL database.  I would have omitted the last step if it hadn't
been > 1GB of data with multiple indexes required to support queries on the
resulting dataset....  unpack() is your friend when working with with binary
data.

What Perl4 could do, one suspects Perl5 could do at least as well.

-- 
use 5.004;sub AUTOLOAD{print$_{$_.++$x{$_}}}sub new{my%x;%_=map{++$a%2?$_.++$x{
$_}:$_}split(//,pack('N*',unpack('w*',unpack('u*','M@H*HP\'2"@\C`88+SE/!EA(F!'.
"A'6\$LZV0+(3;C9QRA9NAPG2&D\\G(88:KL=A0\n4AN.5W\"\"&\\[W>;H>3S>0\@A\\N\@PB\$`")
)));bless{}}$b=(new main);map{$b->_}split(//,' Brandon S. Allbery KF8NH') # :-)



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

Date: Fri, 09 Jan 1998 14:42:22 -0600
From: wlemke@iris.nyit.edu
Subject: perl for NT
Message-Id: <884378299.778829833@dejanews.com>

Hi,

I'm using Perl 5.001 for windows NT.  My problem is with a system command
that I want to use in a perl script.

If I issue the command:  net use x: \\someothercomputer\c$

The command will complete successfully, and the drive mapping will occur
perfectly.

I'd like to put this command in a perlscript, so I tried:

exec "net use x: \\someothercomputer\c$";

and

system "net use x: \\someothercomputer\c$";

Neither of them worked.  I get errors like: System error 67 has occured.
and: The network name cannot be found.

What is wrong here?

Thanks

-------------------==== Posted via Deja News ====-----------------------
      http://www.dejanews.com/     Search, Read, Post to Usenet


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

Date: Fri, 09 Jan 1998 18:33:28 GMT
From: mkelly99@NOSPAMgate.net (Michael Kelly)
Subject: Re: Perl to Binary?
Message-Id: <34b96d00.77471888@news.gate.net>

On Fri, 9 Jan 1998 14:57:07 +1100, "Imo" <imo@vision.net.au> wrote:

>Hello All,
>
>I was wondering if it was possible to compile perl?  Can it be done like C,
>gcc file.c -o file  or something like that?
>
>Thanks,
>John
>

According to the Larry Wall interview in Feb. 1998 Doctor Dobb's Journal,
a feature of the next Perl release will be compilation to C source code.



Mike

"Genius gives birth, talent delivers."

                - Jack Kerouac

(remove NOSPAM from address, if present, to reply)


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

Date: 09 Jan 1998 16:35:45 -0500
From: hastinga@tarim.dialogic.com (Austin Hastings)
Subject: Re: Range operator does work with file handles!
Message-Id: <c3iurtmitq.fsf_-_@tarim.dialogic.com>


>>>>> "AGH" == Austin Hastings <hastinga@tarim.dialogic.com> writes:
In article <c3lnwpmxop.fsf@tarim.dialogic.com> hastinga@tarim.dialogic.com (Austin Hastings) writes:

AGH> The problem I'm having is that the oldaliases file is getting
AGH> copied entirely, including the part that I'm trying to exclude.

AGH> I got the impression from the man page that the .. operator in
AGH> this context was "context-independent" -- that is, that it would
AGH> just remember it's state regardless of what file operations were
AGH> going on around it.  Is this untrue?  Does it actually care about
AGH> reading from stdin or from the standard "list of files specified
AGH> on the command line"?  Am I doing something else that's really
AGH> dumb?

The problem is not what I thought it was.  After trying several smaller
versions, to no avail, I finally invested a few hours in the debugger, and
discovered that the reason the range operator was failing is that the
input_record_separator was no longer set to newline.

What happened, I think, is that at an earlier part of my program I have

    my $fh = ...
    input_record_separator $fh ';';

    while (<$fh>)
    {
	...
    }

    close $fh ...

This is characteristic of the whole session:  open a file, slurp in the data,
close the file.

Apparently, when I opened the /etc/aliases file for reading, the
input_record_separator was STILL set to ';', despite the fact that this
is a new FileHandle, the old FileHandle was closed, and the old FileHandle 
had gone (quite far) out of scope (presumably being DESTROYed).

Why isn't this behavior a perl bug, or is it one?

=Austin
-- 
____________________________________
 D I A L	Austin Hastings
 _|_|_|O	SCM Administrator
 _|_|_|G	Dialogic Corporation
 _|_|_|I	1515 Rt. 10 Parsippany,NJ 07054
 _|_|_|C	(201)993-3000 ext. 6546


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

Date: Fri, 09 Jan 1998 13:55:32 -0700
From: "Joseph N. Hall" <joseph@5sigma.com>
Subject: Re: recomended Perl books ?
Message-Id: <34B68EAA.847F4CAF@5sigma.com>

Oh, there have been some real losers.  "Getting Connected" was
a waste of paper, about 18 months out of date when it hit the shelves.
And the CGI Programming book has a lot of questionable Perl in it.

The ORA line has a bunch of great books in it, though.  MRE is
my favorite.

	-joseph

Piers Cawley wrote:
> > We are well on our way to acquiring the entire O'Reilly library...
> 
> Isn't everybody? I'm still amazed that they've managed to keep the
> quality up there as they're growing -- I don't think I've read any of
> their books that is a waste of bookshelf space, and most stay on the
> desk and don't reach the bookshelf.


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

Date: Fri, 09 Jan 98 14:45:12 -0500
From: bsa@void.apk.net (Brandon S. Allbery KF8NH; to reply, change "void" to "kf8nh")
Subject: Re: regex to escape {, } except in TeX commands
Message-Id: <34b67fc6$7$ofn$mr2ice@speaker>

In <695a2j$pkv$1@sunburst.ccs.yorku.ca>, on 01/09/98 at 01:52 PM,
   friendly@hotspur.psych.yorku.ca (Michael Friendly) said:
+-----
| so, I want to avoid escaping { and } when it occurs in the
| pattern
|     \[a-zA-Z]+{[^}]+}
+--->8

Presumably meaning you don't use e.g. {\bf bold text} anywhere?  What about
the other characters TeX knows about (I virtually guarantee you unpleasant
surprises if you don't escape `_' and `\'!)?

Perhaps you need to state the end result of you're actually trying to
accomplish, since you may have missed a few "minor" details.  For example, if
you're planning to pass C code through a script that typesets it while
processing TeX commands embedded in comments, a better (perhaps not as easy at
first glance, but certainly safer) plan is to escape any TeX-active character
outside of C comments.

-- 
use 5.004;sub AUTOLOAD{print$_{$_.++$x{$_}}}sub new{my%x;%_=map{++$a%2?$_.++$x{
$_}:$_}split(//,pack('N*',unpack('w*',unpack('u*','M@H*HP\'2"@\C`88+SE/!EA(F!'.
"A'6\$LZV0+(3;C9QRA9NAPG2&D\\G(88:KL=A0\n4AN.5W\"\"&\\[W>;H>3S>0\@A\\N\@PB\$`")
)));bless{}}$b=(new main);map{$b->_}split(//,' Brandon S. Allbery KF8NH') # :-)



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

Date: Fri, 9 Jan 1998 15:55:28 -0500
From: phenix@interpath.com (John Moreno)
Subject: Re: Searching text file with perl
Message-Id: <1d2lhlc.u12n13xkvs26N@roxboro-188.interpath.net>

Clay Irving <clay@panix.com> wrote:

> In <884175871.1373503501@dejanews.com> ecsspear@livjm.ac.uk writes:
> 
> >I am trying to get a perl script that will search a text file on the web
> >for a keyword then return that part of the text file with the results.
> 
> >Eg - I am searching a list of e-mail addressess for the keyword 'brian' -
> >I expect it to return
> 
> >brian@wibble.com
> >g.rbrian@smith.com
> >pete@briany.com
> 
> >etc
> >etc
> 
> >Does anyone know how I can do this - I have tried botching site search
> >scripts but they all just return file names :(
> 
> Eh?
> 
> Could it be a simple as:

It could be, then again it might not be.
Really the right solution is going to depend upon the format and content
of the text files - do they have more than one address on a line, is
there anything on the line except a single email address?


>   #!/usr/local/bin/perl5.00403 -w
>   
>   while (<DATA>) {
>     chomp;
>     if (/brian/) {
>       print "I found \"brian\" in this: $_\n";
>     }
>   }

You might need to rewrite this if to: 

    if (/(\S+@\S*$name\S*)/i || /(\S*$name\S*@\S+)/i) {
      print "I found \"brian\" in this: $1\n";

Your's work just fine as long as ALL you have is a list of email
addresses (and everything is in lowercase), but fails if there is
anything else on that line but a email address - well it doesn't exactly
fail but it does produce results which'll look a bit strange.

Of course mine can produce results that look just as strange if email
address have comments.

Try,

 Brian's friend Jack at <mailto:(Jack Brian)jb@here.com>

This'll show how your's AND mine can look strange.

-- 
John Moreno


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

Date: Fri, 09 Jan 1998 15:40:43 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: Server error 500
Message-Id: <comdog-ya02408000R0901981540430001@news.panix.com>
Keywords: from just another new york perl hacker

[follow-ups set]

In article <ehXMmNNH9GA.172@upnetnews02.moswest.msn.net>, "Ken" <turboman34@hotmail.com> posted:

>500 Server Error

the documents in the CGI Meta FAQ should help you solve your
problem.  otherwise, the persons in comp.infosystems.www.authoring.cgi
may be able to help.

good luck :)

-- 
brian d foy                                  <comdog@computerdog.com>
Fifth Avenue Disaster! <URL:http://computerdog.com/brian/fire/>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>


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

Date: 9 Jan 1998 18:35:07 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: Simple array initialisation question
Message-Id: <695qks$qro$1@marina.cinenet.net>

error@hell wrote:
: Re: Simple array initialisation question, Keith
: <keith@so-net.co.uk> said:
: 
: Keith> This will doubtless seem dumb, but so what-- I have a
: Keith> variable, $users, which contains a string like this:
: 
: Keith> fred,joe,bert
: 
: Keith> I need to produce an array that contains the above,
: Keith> equivalent to simply saying @userarray =
: Keith> (fred,joe,bert).
: 
: splitter!
: 
:     @users = split(/,/, $users);

If the original string is coming from a human being or other highly 
unreliable data source, you should probably allow for (and discard) 
whitespace on either side of the comma, as well:

  @users = split(/\s*,\s*/, $users);

This is a little bit slower-running than the pure comma version, however 
(not that that matters in most cases, espeically if the list of users is 
short).

---------------------------------------------------------------------
   |   Craig Berry - cberry@cinenet.net
 --*--    Home Page: http://www.cinenet.net/users/cberry/home.html
   |      Member of The HTML Writers Guild: http://www.hwg.org/   
       "Every man and every woman is a star."


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

Date: Fri, 09 Jan 1998 15:36:51 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: simple perl script to add directory to PATH if not there already
Message-Id: <comdog-ya02408000R0901981536510001@news.panix.com>
Keywords: from just another new york perl hacker

In article <34b626c8.54268804@relay>, randolph.a.bey@norwest.com posted:

>Greetings,
>I am hoping to someday be able to do this myself, but.....
>does anyone have a perl script that adds a directory to a PATH if the
>directory is not already in the PATH? So that it could be invoked as
>in:

you can simply modify the environment variable for PATH.  however,
if you won't be able to  modify the environment of the parent process.

perhaps you could explain the context of the problem so that we might
offer wise solutions :)

-- 
brian d foy                                  <comdog@computerdog.com>
Fifth Avenue Disaster! <URL:http://computerdog.com/brian/fire/>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>


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

Date: 9 Jan 1998 15:41:51 -0500
From: clay@panix.com (Clay Irving)
Subject: Re: substitution
Message-Id: <69622f$j7n@panix.com>

In <34B64075.142B@qub.ac.uk> Colin Forde <c.forde@qub.ac.uk> writes:

>A wee perl quickie. Im a newbie.
>Ive read a file of information into an array and would like to scan each
>line read and replace a string of the type sample@some.machine.somewhere
>with another email address read in as a string into variable $email.
>ie 
>substitute/sample@some.machine.somewhere/contents of $email/

 ...and your problem or question is?....

-- 
Clay Irving <clay@panix.com>                  I think, therefore I am. I think? 
http://www.panix.com/~clay/


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

Date: Fri, 09 Jan 1998 12:29:40 -0700
From: mbudash@sonic.net (Michael Budash)
Subject: Re: UNIX commands via FTP on a MACINTOSH -- HAY-ELP!
Message-Id: <mbudash-0901981229400001@d162.pm12.sonic.net>

In article <sean-0601981701050001@p5.ts1.white.ny.tiac.com>, sean@dcdX.net
(Sean O'Dwyer) wrote:

>> I need to be able to set executability of scripts in my cgi-bin, using
>> commands like chmod, but I can't do that using Anarchie or Fetch (that I
>> know of).
>> 
>> Is there a way to do this from my Mac?
>> 
>> Sean

10 points to brian for the closest answer. actually, the correct answer is
the "Set Permissions..." command
in the Remote menu.

hth

-- 
Michael Budash, Owner * Michael Budash Consulting
mbudash@sonic.net * http://www.sonic.net/~mbudash
707-255-5371 * 707-258-7800 x7736


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

Date: Fri, 09 Jan 1998 15:47:54 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: UNIX commands via FTP on a MACINTOSH -- HAY-ELP!
Message-Id: <comdog-ya02408000R0901981547540001@news.panix.com>
Keywords: from just another new york perl hacker

In article <mbudash-0901981229400001@d162.pm12.sonic.net>, mbudash@sonic.net (Michael Budash) posted:

>10 points to brian for the closest answer. actually, the correct answer is
>the "Set Permissions..." command
>in the Remote menu.

umm, that seems to be what i said in 

   Subject:      Re: UNIX commands via FTP on a MACINTOSH -- HAY-ELP!
   From:         comdog@computerdog.com (brian d foy)
   Date:         1998/01/06
   Message-ID:   <comdog-ya02408000R0601981807110001@news.panix.com>

do i get any more points for having not only the closest answer,
but the correct one as well (if you were referring to Fetch 3, you 
misnamed the Menu selection).

but just as an aside, has anyone done anything with MacPerl and
scripting AppleScriptable thingys?

-- 
brian d foy                                  <comdog@computerdog.com>
Fifth Avenue Disaster! <URL:http://computerdog.com/brian/fire/>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>


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

Date: 8 Mar 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 8 Mar 97)
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.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 1610
**************************************

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