[11248] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4848 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Feb 8 19:07:24 1999

Date: Mon, 8 Feb 99 16:02:06 -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           Mon, 8 Feb 1999     Volume: 8 Number: 4848

Today's topics:
    Re: 8-bit input (or, "Perl attacks on non-English langu (Tramm Hudson)
        [Q] URI/URL/http/path_query.al <wade@cs.ualberta.ca>
    Re: a perl/cgi language reference? aonghus.onia@ucg.ie
    Re: address of a webpage that links to a perl cgi scrip <gellyfish@btinternet.com>
        aWebVisit 0.1.5 - last update for a Web Visit / Session (Michel Dalle)
        command line interface for save as text in netscape <ssridhar@raven.pnu.com>
    Re: contains? (Greg Ward)
    Re: cookies pointers <delonad@netdoor.com>
    Re: DBI - Creating an array of results from a query <yong@shell.com>
    Re: find where .pl was called from <yong@shell.com>
        Following a Redirect <mwatkins@promotion4free.com>
    Re: Help!! ping? finger? whois? (Alastair)
    Re: Help!! ping? finger? whois? (Greg Ward)
    Re: how do I get a date in perl? (Alastair)
    Re: how do I get a date in perl? <gellyfish@btinternet.com>
    Re: How fo have non blocking STDIN <gellyfish@btinternet.com>
    Re: HTML File Upload <mwatkins@promotion4free.com>
    Re: HTML File Upload <gellyfish@btinternet.com>
    Re: I Need Help On Forms & CGI. <gellyfish@btinternet.com>
        locking files <webmaster@macdaddyusa.com>
    Re: My SQL <gellyfish@btinternet.com>
    Re: Parsing output from a program called within perl (Tad McClellan)
        performance penalty: bareword, single quoting, double q mlehmann@prismnet.com
    Re: Perl Includes? <cdlawson@xnet.com>
    Re: Perl, PHP, Python, ColdFusion, MS Frontpage, which  <jglascoe@giss.nasa.gov>
        processor definitition in PERL header files <robert.stadter.jr@sap-ag.de>
    Re: Question: Arrays of associative arrays <ludlow@us.ibm.com>
    Re: Question: using write to format strings in a $varia <gellyfish@btinternet.com>
    Re: Remote Login (Greg Ward)
    Re: Remote Login <gellyfish@btinternet.com>
    Re: Serial Port in WinNT and OS/2 (Ilya Zakharevich)
    Re: Set Group Id (Greg Ward)
    Re: Sorting on multiple fields <gellyfish@btinternet.com>
    Re: String splitting. <gellyfish@btinternet.com>
        system call works in command line mode but not from web <bwlang@nospam.genome.wi.mit.edu>
    Re: Viewing remote Perl script before executing <ludlow@us.ibm.com>
    Re: Viewing remote Perl script before executing <gellyfish@btinternet.com>
        Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)

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

Date: 8 Feb 1999 13:40:21 -0700
From: hudson@swcp.com (Tramm Hudson)
Subject: Re: 8-bit input (or, "Perl attacks on non-English language communities!")
Message-Id: <79ni3l$m8l@boofura.swcp.com>
Keywords: Emacs vs. vi, Perl vs. Lisp, Holy Wars, Let's see what I can start

In article <xlxiudcizfn.fsf@gold.cis.ohio-state.edu>,
Matt Curtin  <cmcurtin@interhack.net> wrote:
[Snipage]
>I've been thinking a lot about languages lately.  Languages are cool.
>Lest you get the impression that I mean programming languages, which
>can also be cool, I'm talking about natural languages.  English,
>German, Russian ... that sort of thing.

I feel the need to plug my favorite lost cause -- Plan 9.  It has
had UTF support from the beginning and have no problems with Kanji,
Hebrew or accented characters anywhere.  The compilers (cc, acid, etc)
happily accept non-8-bit clean characters as variable names, string
constants or whatnot.

Check out

	http://plan9.bell-labs.com/plan9/doc/utf.html

for details on UTF in Plan 9 and a "Hello, World!" that makes use of
these cool features.

Tramm
-- 
  o   hudson@swcp.com                 tbhudso@cs.sandia.gov   O___|   
 /|\  http://www.swcp.com/~hudson/          H 505.266.59.96   /\  \_  
 <<   KC5RNF @ N5YYF.NM.AMPR.ORG            W 505.284.24.32   \ \/\_\  
  0                                                            U \_  | 


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

Date: 08 Feb 1999 13:53:03 -0700
From: Wade Holst <wade@cs.ualberta.ca>
Subject: [Q] URI/URL/http/path_query.al
Message-Id: <r7lni8k47k.fsf@rimbey.cs.ualberta.ca>

@cs.ualberta.ca>
Path: alberta!rover.ucs.ualberta.ca!tribune.usask.ca!canopus.cc.umanitoba.ca!cyclone.mbnet.mb.ca!sunqbc.risq.qc.ca!newsfeed.corridex.com!nntp2.savvis.net!news.aa.net!news.aa.net!not-for-mail
Lines: 46
Approved: Self-Moderation <authoring-cgi@boutell.com>
Message-ID: <79li6d$90b$1@slave1.aa.net>
NNTP-Posting-Host: 206.125.69.81
Xref: alberta comp.infosystems.www.authoring.cgi:74359

I am using LWP::UserAgent and related classes to obtain web-pages within a perl-script.
Recently, my code has died on me, and I am at a loss as to why it is failing.  

     my $req = HTTP::Request->new($self->requestMethod(), $self->url());
     my $res = $self->agent()->request( $req, $reqarg, $self->codeChunkSize() );

A quick look at the HTTP::Response structure returned indications that the following
error occurred:

     Can't locate auto/URI/URL/http/path_query.al in @INC (@INC contains:
     /usr/perl/lib/perl5/5.00502/sun4-solaris
     /usr/perl/lib/perl5/5.00502
     /usr/perl/lib/perl5/site_perl/5.005/sun4-solaris
     /usr/perl/lib/perl5/site_perl/5.005
     .)   

Sure enough, there is no path_query.al in auto/URI/URL/http, which contains the
following:
    autosplit.ix   keywords.al    query_form.al


Questions:
    1) Could someone check their auto/URI/URL/http directory and see whether
       path_query.al _should_ exist there.
    2) If it does not exist, then what is going on?  


My versions of URI::URL::http and LWP::UserAgent are up-to-date
according to the interactive CPAN installer ('perl -MCPAN -e shell').
Using perl, version 5.005_02 built for sun4-solaris, with all modules
added within the last month via the CPAN installer.


Thank in advance,

--
Wade Holst                wade@cs.ualberta.ca
University of Alberta     http://www.cs.ualberta.ca/~wade



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

Date: Mon, 08 Feb 1999 22:17:23 GMT
From: aonghus.onia@ucg.ie
Subject: Re: a perl/cgi language reference?
Message-Id: <79nnpa$nn2$1@nnrp1.dejanews.com>

try:

tutorials:
http://agora.leeds.ac.uk/nik/Cgi/start.html
http://voorhout.denhaag.dataweb.net/docs/CGI/cgi1.html
http://www.itp.tsoa.nyu.edu/~student/jamie/help/cgi-perl/
http://www.itlibrary.com/reference/dir.programminglanguages.perlandcgi1.html
http://www.speakeasy.org/~cgires/index.html
http://www.cc.ukans.edu/~acs/docs/other/cgi-with-perl.shtml
http://www.wdvl.com/Authoring/Scripting/Tutorial/day_two_index.html
http://www.cgi101.com/class/

full text online books:
http://www.speakeasy.org/~cgires/index.html
http://pbs.mcp.com

Perl 5 Desktop Reference:
http://reference.perl.com/guides/perl5.html

faqs:
ftp://uiarchive.uiuc.edu/pub/lang/perl/CPAN/doc/FAQs/cgi/idiots-guide.html
ftp://ftp.archive.de.uu.net/pub/CPAN/doc/FAQs/cgi/perl-cgi-faq.html


-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: 8 Feb 1999 22:36:26 -0000
From: Jonathan Stowe <gellyfish@btinternet.com>
Subject: Re: address of a webpage that links to a perl cgi script
Message-Id: <79nota$t9$1@gellyfish.btinternet.com>

On Mon, 08 Feb 1999 09:05:56 GMT aonghus.onia@ucg.ie wrote:
> Is it possible to find address of a webpage that links to a perl cgi script in
> your script.
> 

If you are using CGI.pm then you will be able to find out about
http_referer() from the documentation - however this is generally not a
perl question and is more appropriately taken up with the CGI FAQ or an
appropriate newsgroup.

/J\
-- 
Jonathan Stowe <jns@btinternet.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>


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

Date: Mon, 08 Feb 1999 23:00:49 GMT
From: michel.dalle@usa.net (Michel Dalle)
Subject: aWebVisit 0.1.5 - last update for a Web Visit / Session Analyser ?
Message-Id: <79nq9f$1kd$2@xenon.inbe.net>

Hi,

the latest version of aWebVisit (0.1.5) is available at :
http://gallery.uunet.be/Michel.Dalle/awv.html

Changes include :
- the long-awaited graphical web maps
- a huge reduction in memory requirements for those of you with large logfiles
- some changes in table layout
- visits can now cross over midnight

Plans for the future ? That's about as far as I'll go on my own.
You tell me,

Michel.

P.S.: I could use some help cleaning up the mess I made out of the Perl
code :-)


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

Date: Mon, 08 Feb 1999 17:35:33 -0500
From: SSridhar <ssridhar@raven.pnu.com>
Subject: command line interface for save as text in netscape
Message-Id: <36BF66B5.25F242D8@raven.pnu.com>

Is there a way I can call netscape with a URL and make it save as text
without opening a browser window (in UNIX). Currently there is nothing
as far as I know, that does as good a job as netscape does for saving
tables as text, esp. if you want to pipe the resulting text output
through some perl script. I tried, lynx -dump, its output is not
suitable  for further processing esp. if there are no entries for some
table fields. I cannot get LWP parser module in perl to work; it always
ignores tables.

thanks
SS


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

Date: 8 Feb 1999 22:50:48 GMT
From: gward@cnri.reston.va.us (Greg Ward)
Subject: Re: contains?
Message-Id: <79npo8$6id$2@news0-alterdial.uu.net>

BLUESRIFT <bluesrift@aol.com> wrote:
> Please forgive me.  I have been unsuccessful looking for an online or
> downloadable language reference for writing CGI scripts in perl such
> as one can find at Netscape for the JavaScript language versions.  I
> would greatly appreciate a link!!!
> 
> In the meantime, I would like to learn how to perform a conditional
> based on a test of the contents of a query string.  Here's as close as
> I can get on my own without such a reference guide:
> 
> if ($ENV{QUERY_STRING} contains "this string") {...}

It sounds as if you first need to learn Perl itself, and then learn how
to write CGI scripts.  I recommend *Learning Perl* by Randal Schwartz
and Tom Christiansen for the first task; for the second, you can
probably get by with the documentation provided with the CGI module
('perldoc CGI'), but Lincoln Stein (the author of CGI.pm) has written a
book called something like *The Official Guide to Programming with
CGI.pm*.  I have no idea how good it is, as I've never looked at it.  I
would guess that it's a bit slower-going than the module documentation.

Oh, your Perl question: there's more than one way to do it.  First, with
a regular expression:

   if ($ENV{'QUERY_STRING'} =~ /this string/) { ... }

Second, with the 'index' function:

   if (index ($ENV{'QUERY_STRING'}, 'this string') >= 0) { ... }

The reasons for choosing one over the other are many and complex.  Go
read *Learning Perl* and you too will start to understand.

        Greg
-- 
Greg Ward - software developer                    gward@cnri.reston.va.us
Corporation for National Research Initiatives    
1895 Preston White Drive                      voice: +1-703-620-8990 x287
Reston, Virginia, USA  20191-5434               fax: +1-703-620-0913


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

Date: Mon, 8 Feb 1999 15:39:08 -0600
From: Aaron Delong <delonad@netdoor.com>
Subject: Re: cookies pointers
Message-Id: <Pine.GSO.4.10.9902081537280.3125-100000@lance.netdoor.com>

To read the cookie, check the value for the var $ENV{'HTTP_COOKIE'}.  The
cookie is given as a semi-colon delimited list of name=value pairs.

To set the cookie, output a Set-Cookie header before your HTML headers.
For instance, to set the cookie PERL to the value TRUE do the following:

print "Set-Cookie: PERL=TRUE;\r\n";
print "Content-type: text/html\n\n";

On Sun, 7 Feb 1999, dan wrote:

> can somebody give me a quick rundown on how to read and write cookies
> with perl, or refer me to some documentation? thanks
> 
> 
> 
> 



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

Date: Mon, 08 Feb 1999 16:11:30 -0600
From: yong <yong@shell.com>
Subject: Re: DBI - Creating an array of results from a query
Message-Id: <36BF6112.E6470BB7@shell.com>

If you just want to store the results in @results, why not just
@results = $sth->fetchrow_array;

Correct me if I'm wrong. I think $results[++$#results] is 1 too many in the
arrary index. If @results is (1,2,3), ++$#results is 3, not 2.

Yong

Gary O'Keefe wrote:

> while ( @{ $results[++$#results] = \( $sth -> fetchrow_array ) } ) {}



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

Date: Mon, 08 Feb 1999 15:56:55 -0600
From: yong <yong@shell.com>
Subject: Re: find where .pl was called from
Message-Id: <36BF5DA7.4909225E@shell.com>

How about checking the Web server access log?

Yong

el_pollo_diablo wrote:

> Is there any way for a perl script to know where it has been called from?
> (specifically called from a #exec SSI)?



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

Date: Mon, 8 Feb 1999 20:49:18 -0000
From: "Mike Watkins" <mwatkins@promotion4free.com>
Subject: Following a Redirect
Message-Id: <egTj4S6U#GA.272@ntawwabp.compuserve.com>

Hi there,

I'm currently making a URL submission script which will submit to
serveral FFA pages.  The actual submission works fine, but I would
like to be able to verify that the link was actually submitted a little
better.  Most FFA scripts will redirect the user, instead of give any
actual output, so $HTML = $reponse->content() doesn't really work.

I've finally figured out how to tell if the script redirects the user or
not.  I do this will the following code:

use HTTP::Status;
my $scode = $response->code()
if (is_redirect($scode)) { ... }

I would like the script to check the page it gets redirected to for a
pre-defined block of text, like "Thanks For The Link".  My question is,
how do I get the content of the web page which the FFA script
redirects to?

Any help would be much appreciated,
Mike Watkins





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

Date: Mon, 08 Feb 1999 21:30:43 GMT
From: alastair@calliope.demon.co.uk (Alastair)
Subject: Re: Help!! ping? finger? whois?
Message-Id: <slrn7bulua.5c.alastair@calliope.demon.co.uk>

MekaGames Staff <support@mekagames.com> wrote:
>I'm currently writing a perl script that will get a list of ip addresses
>from a text file and write back to the screen the ip addresses which are
>currently active (i.e. they are online) First of all, what do I use? (ping?
>finger? whois?)  Secondly, how do I use it? =)

use Net::Ping;

Check the docs : perldoc Net::Ping

HTH.

-- 

Alastair
work  : alastair@psoft.co.uk
home  : alastair@calliope.demon.co.uk


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

Date: 8 Feb 1999 22:57:08 GMT
From: gward@cnri.reston.va.us (Greg Ward)
Subject: Re: Help!! ping? finger? whois?
Message-Id: <79nq44$6id$4@news0-alterdial.uu.net>

MekaGames Staff <support@mekagames.com> wrote:
> I'm currently writing a perl script that will get a list of ip addresses
> from a text file and write back to the screen the ip addresses which are
> currently active (i.e. they are online) First of all, what do I use? (ping?
> finger? whois?)  Secondly, how do I use it? =)

Use ping for this -- finger refused by most hosts nowadayas for security
reasons, and whois doesn't query the host you're asking about -- it
queries the InterNIC database.  Plus, I don't think you can do 'whois'
queries on IP addresses -- it's a domain-name thing.  You'd have to use
DNS to translate the IP address to a hostname, and then figure out what
the domain name is.  Ugh.

As for how to ping in Perl: use the Net::Ping module.  It comes standard
with 5.005, so 'perldoc Net::Ping' should tell you how to use it.  If
you're not running 5.005 yet, I think you'll have to download it from
CPAN.

        Greg
-- 
Greg Ward - software developer                    gward@cnri.reston.va.us
Corporation for National Research Initiatives    
1895 Preston White Drive                      voice: +1-703-620-8990 x287
Reston, Virginia, USA  20191-5434               fax: +1-703-620-0913


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

Date: Mon, 08 Feb 1999 21:39:30 GMT
From: alastair@calliope.demon.co.uk (Alastair)
Subject: Re: how do I get a date in perl?
Message-Id: <slrn7bumep.5c.alastair@calliope.demon.co.uk>

Duc Le <bamboo@best.com> wrote:
>Hi!
>
>I don't know if Perl has any function for date manipulation besides
>localtime().  I just want to do a simple task like getting the week date
>from any given day of the month.  For example, given "02/12/1999", I
>would like to know what date of the week this day falls on.

There are various Date modules on CPAN.

http://www.cpan.org/modules/by-module/Date/

HTH.

-- 

Alastair
work  : alastair@psoft.co.uk
home  : alastair@calliope.demon.co.uk


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

Date: 8 Feb 1999 22:11:07 -0000
From: Jonathan Stowe <gellyfish@btinternet.com>
Subject: Re: how do I get a date in perl?
Message-Id: <79nndr$ri$1@gellyfish.btinternet.com>

On Mon, 08 Feb 1999 01:45:13 +0000 Duc Le wrote:
> Hi!
> 
> I don't know if Perl has any function for date manipulation besides
> localtime().  I just want to do a simple task like getting the week date
> from any given day of the month.  For example, given "02/12/1999", I
> would like to know what date of the week this day falls on.
> 

The module Date::Calc available from CPAN should be able to help with t
this.

/J\
-- 
Jonathan Stowe <jns@btinternet.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>


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

Date: 8 Feb 1999 22:19:05 -0000
From: Jonathan Stowe <gellyfish@btinternet.com>
Subject: Re: How fo have non blocking STDIN
Message-Id: <79nnsp$t3$1@gellyfish.btinternet.com>

On Mon, 08 Feb 1999 01:04:54 GMT gurdeeps@qualcomm.com wrote:
> I want to check a keystroke in perl. When I use getch () function, it blocks
> input
> till one or more character is entered followed by carriage return.
> 
> In C there is a function kbhit() which do the desired job. How can be
> implement, same kind of functionality in perl.
> 

I think the library function kbhit is only available in th MS libraries.

You might find the module Term::ReadKey available from CPAN helpful in
doing what you want.

/J\
-- 
Jonathan Stowe <jns@btinternet.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>


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

Date: Mon, 8 Feb 1999 20:45:33 -0000
From: "Mike Watkins" <mwatkins@promotion4free.com>
Subject: Re: HTML File Upload
Message-Id: <el38wQ6U#GA.232@nih2naaf.prod2.compuserve.com>

Hi there,

I've been screwing around for a couple weeks trying to get this to work for
me.  Then I found out it was in my HTML form, not the script.  First,
remember to add "ENCTYPE='multipart/form-data'" in your <FORM> tag.

Here's a basic example of what I use to allow member to upload new banners:

use CGI;
$query = new CGI;

$filename = $query->param('file-to-upload');
my ($bytes, $buffer);

open (IMAGE, ">image.gif");
    while ($byte = read($filename, $buffer, 1024)) {
    print FILE $buffer;
}
close (IMAGE);

print "Content-type: text/html\n\n";
print "Done Uploading Image";
exit;

Hope that helps,
Mike Watkins



Adam Grayson wrote in message <36BE2E99.C8F9DB8F@nwu.edu>...
>I am trying to create an HTML form for uploading graphics, and
>understand how to set up the form, print the results into a jpeg file,
>but I'm confused on bringing in the actual girth of the image so that I
>can print FILE $in{"graphic"}. Any good example of how to do this,
>either with cgi.pm or cgi-lib.pl?
>
>Thanks
>Adam
>--
>
>Adam Grayson
>Northwestern University, Evanston, IL.  USA
>a-grayson@nwu.edu




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

Date: 8 Feb 1999 22:09:06 -0000
From: Jonathan Stowe <gellyfish@btinternet.com>
Subject: Re: HTML File Upload
Message-Id: <79nna2$r9$1@gellyfish.btinternet.com>

On Sun, 07 Feb 1999 18:23:53 -0600 Adam Grayson wrote:
> I am trying to create an HTML form for uploading graphics, and
> understand how to set up the form, print the results into a jpeg file,
> but I'm confused on bringing in the actual girth of the image so that I
> can print FILE $in{"graphic"}. Any good example of how to do this,
> either with cgi.pm or cgi-lib.pl?
> 

This is simply done using CGI.pm - there is a section in the documentation
entitled:

       CREATING A FILE UPLOAD FIELD

There is also an article at <http://wwww.webreview.com>
bu Brent Michalski that covers this subject with a useful example.

/J\
-- 
Jonathan Stowe <jns@btinternet.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>


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

Date: 8 Feb 1999 22:31:12 -0000
From: Jonathan Stowe <gellyfish@btinternet.com>
Subject: Re: I Need Help On Forms & CGI.
Message-Id: <79nojg$t6$1@gellyfish.btinternet.com>

On Mon, 08 Feb 1999 04:12:00 GMT willie888@my-dejanews.com wrote:
> Hi,
> I made a Form on my Web Page.
> But when I try to fill-in the Form, where the Data send to?
> And how am I able to see the Data Filled by my customers?

I would read the CGI documentation available at :

<http://hoohoo.ncsa.uiuc.edu>

There is always the CGI Faq and other resources referenced in my .sig .

However bear in mind that Perl IS NOT SYNONOMOUS WITH CGI and this
group is not the proper forum for the asking of (Or indeed answering)
general CGI questions.

/J\
-- 
Jonathan Stowe <jns@btinternet.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>


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

Date: Mon, 08 Feb 1999 14:09:10 -0800
From: dan <webmaster@macdaddyusa.com>
Subject: locking files
Message-Id: <36BF6086.18B25F2B@macdaddyusa.com>

can someone give me a quick rundown on what locking files is? thanks




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

Date: 8 Feb 1999 22:50:32 -0000
From: Jonathan Stowe <gellyfish@btinternet.com>
Subject: Re: My SQL
Message-Id: <79npno$tj$1@gellyfish.btinternet.com>

On Mon, 8 Feb 1999 20:28:01 -0000 Bruce Davidson wrote:
> Using Active Perl on W95. (GS port also available).
> I've installed W32 mysql shareware server.
> Could anyone offer a shopping list for modules needed to fire mysql commands
> and a sample perl sub to e.g., create table.
> Trying to build and populate tables off line.


DBD::ODBC or Win32::ODBC if you prefer

/J\
-- 
Jonathan Stowe <jns@btinternet.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>


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

Date: Mon, 8 Feb 1999 15:08:37 -0600
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Parsing output from a program called within perl
Message-Id: <lojn97.lb5.ln@magna.metronet.com>

kalikste@uiuc.edu wrote:
: How can I parse input from a program called from system() as if it were
: comming from <STDIN>?  


   You can't do it with system() because system() does not
   capture the output of the called program.


: For example: I would like to treat the output from system (dir), as if I was
: reading the output from a file.

: Logically, it seems to me this should be relaivly
: easy with perl.


   It _is_ easy with Perl.

      perldoc -f open

   See the paragraph that starts with "If the filename begins with |..."

   You want one where the filename ends with a vertical bar.


--
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


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

Date: Mon, 08 Feb 1999 23:21:04 GMT
From: mlehmann@prismnet.com
Subject: performance penalty: bareword, single quoting, double quoting
Message-Id: <79nrgl$qou$1@nnrp1.dejanews.com>

I have been wondering for a while if I should use barewords for the keys in
hashes.  I started off using:

   $hash{'key_value'}

because I thought it was the least amount of work for perl to determine what I
want.

Because perl interpolates double quoted strings I avoided using:

   $hash{"key value"}

Using that logic I figured that perl has to look through some table containing
the method/function names to determine if a bareword is an executable.

However, many perl developers write aesthetically pleasing readable code using
the barewords.  I prefer barewords.  Is there a noticable performance hit for
barewords?  Is there any performance hit at all?

Thanks.

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: 8 Feb 1999 23:13:28 GMT
From: Chad Lawson <cdlawson@xnet.com>
Subject: Re: Perl Includes?
Message-Id: <79nr2o$rm9$1@flood.xnet.com>

I should try to be more clear.

Instead of maintaining one large perl script, I would like to break down
the file into pieces with each piece containing the routines related to
one type of function.  

I.e. all my address book functions in one file, the threaded message board
functions in another.

Then, at run time, the main file (index.cgi) will load all the files with
thier pieces into itself.  Meaning each of these snipits of code are all
part of the main:: namespace.

Is there a way to have a script be broken up into multiple files, but at
runtime be treated as ONE file.  As if I WAS maintaining one large file
with all the functions in it?

If I'm still not being clear, please let me know.

Thanks in advance,
Chad Lawson

PS: Use 'open sesame' for the subject if you email your reply.

"He deals the cards as a mediation...the sacred geometry of chance,
the hidden law of a probable outcome, the numbers lead a dance."
--Sting, "Shape of My Heart"


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

Date: Mon, 08 Feb 1999 16:43:00 -0500
From: Jay Glascoe <jglascoe@giss.nasa.gov>
To: ghill@n2.net
Subject: Re: Perl, PHP, Python, ColdFusion, MS Frontpage, which one for beginner
Message-Id: <36BF5A64.EC3EBABE@giss.nasa.gov>

hello,

ghill@n2.net wrote:
> 
> I've been doing alot of reading and a little testing trying to decide what
> language I should commit to.

<snip>

> - Cold Fusion  (real high, Windows only)
> - PHP (med high, multiplatform)
	 ^^^^^^^^
what is this height factor thingy?

> - Python (med high, multiplatform)
> - Perl (high/low, multiplatform)

Yes, the P* languages.  You can't go wrong either way.
In my experience, hmmm... well, they're both really damn cool.
You ought to play around a bit with both.

I learned Perl first, and then Python a bit later on.  I use
them both on a daily basis more or less.

> I do want to end up with a multiplatform product and I know that Perl will run
> on all the popular OS's, it seems like that is the way I should go.

okay.  Yes, you should choose a language available on all popular
(and many not-so-popular) platforms.  Perl is one such language.

> I've have Perl on my system, and I'm delving into it with the help of
> O'reilly's "Learning Perl".  It seems like the learning curve is satisfactory,
> but I'm still very green to it, I just know I like what I see so far.
> BUT do I really need to know Perl to get the jog done efficiently?

yeah, use Perl (or whatever your choice) as often as possible.
Fluency in Perl (or any decent VHLL) is so overwhelmingly beneficial...

> Please e-mail me at ghill@n2.net

done.

--
	"The early bird gets the worm, but
	 the second mouse gets the cheese."


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

Date: Mon, 08 Feb 1999 15:36:05 -0500
From: Bob Stadter <robert.stadter.jr@sap-ag.de>
Subject: processor definitition in PERL header files
Message-Id: <36BF4AB5.C1FB054D@sap-ag.de>

Hi,
I am trying to use the PERL ftp lib on an ultra2 running solaris 2.6
and I am running into an error on the isa_defs.ph file.  When I
installed PERL, the make scripts found the definition for "sparc"
for the processor type, but when I run my ftp program, I get an
error saying "ISA not supported".  Looking at the isa_defs.ph file,
ISA should be supported if sparc is defined.

Can anyone give me any ideas on where to look to try and fix this?

Thanks,
Bob Stadter



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

Date: Mon, 08 Feb 1999 15:26:35 -0600
From: James Ludlow <ludlow@us.ibm.com>
Subject: Re: Question: Arrays of associative arrays
Message-Id: <36BF568B.533BCD46@us.ibm.com>

Steve Chen wrote:
> 
> Hey thanks guys for all the tips.  My inexperience probably showed but
> then I'm working with a half-baked perl installation (no perldoc available,
> e.g.)
> trying to get some work done.  Going to try to install the perl package
> myself
> after this round.

In the meantime, don't forget that www.perl.com has links to all of the
Perl documentation and the faq.  In some respects, it's more convenient
to use than perldoc.  (Still install a full version of perl though. 
It's a _good_ idea.)

-- 
James Ludlow (ludlow@us.ibm.com)
(Any opinions expressed are my own, not necessarily those of IBM)


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

Date: 8 Feb 1999 22:52:12 -0000
From: Jonathan Stowe <gellyfish@btinternet.com>
Subject: Re: Question: using write to format strings in a $variable or @list
Message-Id: <79npqs$u1$1@gellyfish.btinternet.com>

On Mon, 08 Feb 1999 15:23:32 -0500 Ben Smith wrote:
> I would like to be able to use format and write to generate a page held
> only in
> memory, without having to write to a file and then read it back in. Does
> anyone
> have an idea of how I might be able to do this?

A tied filehandle - see the perltie manpage.

/J\
-- 
Jonathan Stowe <jns@btinternet.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>


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

Date: 8 Feb 1999 22:54:16 GMT
From: gward@cnri.reston.va.us (Greg Ward)
Subject: Re: Remote Login
Message-Id: <79npuo$6id$3@news0-alterdial.uu.net>

Narasimha G. Pai <pai@cadence.com> wrote:
>     I have a perl script that has to login to a remote machine .
>     Do some tasks and logout/comeback to the current machine
>     where the rest of the tasks have to be done .
> 
>     Any PERL way of doing this ?

Yes, most likely.  Assuming Unix-like operating systems on both
machines: why don't you just put a script on the remote machine to do
whatever has to be done there, and run it via rsh or ssh from the first
script running on the first machine?  That much is trivial... it gets
more interesting when you have to worry about error-handling, of
course. ;-)

        Greg
-- 
Greg Ward - software developer                    gward@cnri.reston.va.us
Corporation for National Research Initiatives    
1895 Preston White Drive                      voice: +1-703-620-8990 x287
Reston, Virginia, USA  20191-5434               fax: +1-703-620-0913


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

Date: 8 Feb 1999 22:37:54 -0000
From: Jonathan Stowe <gellyfish@btinternet.com>
Subject: Re: Remote Login
Message-Id: <79np02$tc$1@gellyfish.btinternet.com>

On Mon, 08 Feb 1999 14:57:26 +0531 Narasimha G. Pai wrote:
> Hi ,
> 
>     I have a perl script that has to login to a remote machine .
>     Do some tasks and logout/comeback to the current machine
>     where the rest of the tasks have to be done .
> 

The module Net::Telnet (or perhaps Net::Rexec) available from CPAN will
be able to help you do this.

/J\
-- 
Jonathan Stowe <jns@btinternet.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>


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

Date: 8 Feb 1999 21:08:30 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: Serial Port in WinNT and OS/2
Message-Id: <79njoe$c07$1@mathserv.mps.ohio-state.edu>

[A complimentary Cc of this posting was sent to Peter Prinz 
<peter.prinz@siemens.at>],
who wrote in article <36BF1F0B.FCCDF171@siemens.at>:
> Hi, 
> 
> Im trying to open the serial ports for read and 
> write access in WinNT and OS/2. I have read the 
> Perl FAQ (Part 8), but it was of little help.
> (The link for the sysopen command was wrong!)
> 
> 1.) Up to now I tried the following program
> 
>  open (PORT, "+<com2")  || die("Could not open com2 \n");
>  for(;;) {
>    $line = <PORT>;
>    print $line;
>  }
>  close(PORT);
> 
> WinNT: OK 
> OS/2:  About 1-2 minutes (!!!) after sending a files to the com2  I got
> the output on the screen !! 
> (I also use +>com)

You may try switching the buffering off by setvbuf (from IO::*).

Ilya


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

Date: 8 Feb 1999 23:01:34 GMT
From: gward@cnri.reston.va.us (Greg Ward)
Subject: Re: Set Group Id
Message-Id: <79nqce$6id$5@news0-alterdial.uu.net>

Einar Gudmundsson <einar.gudmundsson@realtime.co.uk> wrote:
> I'm trying to get a script to change the group associated with
> some files. However the script or rather the chown command reports
> that I am not allowed to do this. I'll explain the problem in more 
> detail: My perl script is running under the userid and groupid of
> 'etg:etg'. However user 'etg' belongs to the group 'ca'. Thus I 
> thought that a script run by user 'etg' would allow files created
> by 'etg' to be shared by group 'ca'. But when I issue
> the following commands nothing happens:

This is (probably) not a Perl question, but a Unix question.  It's hard
to help you since you didn't specify which flavour of Unix you're
running, but I'll toss out a few ideas:

  * can you chgrp these files in the shell?
  * can you write a tiny C program that calls chown() to change the group?

If the answer to both of these is "yes", then you do have a Perl
question.  Otherwise, it's a problem with your OS.

Another tip: this
> chown(-1,$ca_gid, $file) or error("The group of '$file' could not be
> changed");
should be like this:
> chown(-1,$ca_gid, $file) or error("The group of '$file' could not be
> changed: $!");

$! is *very* useful.  Use it!

        Greg
-- 
Greg Ward - software developer                    gward@cnri.reston.va.us
Corporation for National Research Initiatives    
1895 Preston White Drive                      voice: +1-703-620-8990 x287
Reston, Virginia, USA  20191-5434               fax: +1-703-620-0913


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

Date: 8 Feb 1999 22:57:07 -0000
From: Jonathan Stowe <gellyfish@btinternet.com>
Subject: Re: Sorting on multiple fields
Message-Id: <79nq43$u4$1@gellyfish.btinternet.com>

On Mon, 08 Feb 1999 14:55:07 -0500 Gregory Rohman wrote:
> 
> Is there a way to sort the records in reverse-chronological order? I
> don't need them sorted in the actual text data file... they just need to
> be sorted by day, month, and year when they are printed back out.
> 

As well as referring to perlfaq4 you might also search this group on
DejaNews for 'sort' paying particular attention  to the recent threads
contributed to by Messrs Rosler,Guttman and Porter who had a bit of a
sortfest a couple of months ago.

/J\
-- 
Jonathan Stowe <jns@btinternet.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>


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

Date: 8 Feb 1999 22:46:01 -0000
From: Jonathan Stowe <gellyfish@btinternet.com>
Subject: Re: String splitting.
Message-Id: <79npf9$tg$1@gellyfish.btinternet.com>

On Mon, 8 Feb 1999 13:45:27 -0600 Spike White wrote:
> $firstpart = (split /\./, $string)[0];
> 
> or
> 
> $string =~ s/(\w+)\..*\n//;
> 

Fine, but by *not* pointing the poster to the relevant documentation you 
are simply compounding his ignorance - almost ensuring a followup post.

perldoc -f split

perldoc perlre

/J\
-- 
Jonathan Stowe <jns@btinternet.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>


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

Date: Mon, 08 Feb 1999 18:26:34 -0500
From: "Bradley W. Langhorst" <bwlang@nospam.genome.wi.mit.edu>
Subject: system call works in command line mode but not from web
Message-Id: <36BF72AA.26E7095C@nospam.genome.wi.mit.edu>



i have the following system call

    $tmp1 = $TmpDir . "in.lp";
    $tmp2 = $TmpDir . "lp.out";
    print "<br>\ndollar! is : " . $! ."\n";
    $tmp = system
("/net/speedo/local5/cvar_files/SRC/LP_SOLVE/lp_solve_2.3/lp_solve <
$tmp1 > $tmp2");
    print "<br>System call to lp_solve returned: " . $tmp .
"<br>\ndollar! is : " . $! ."<br>\n";

$tmp is 1 (system call failed)but $! does not change from  "Operation
would block" between before and after the system call

this works fine if i run my script
and supply parameters to it from the command line.

However it creates the $tmp2 (the output file)
but puts no data into it when i run it from the web.

yes lp_solve is world executable
and yes the user "web" has write access to the $TmpDir listed

any hints?

thanks

brad
bwlang@nospam.genome.wi.mit.edu







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

Date: Mon, 08 Feb 1999 15:35:02 -0600
From: James Ludlow <ludlow@us.ibm.com>
Subject: Re: Viewing remote Perl script before executing
Message-Id: <36BF5886.95B3F2B0@us.ibm.com>

brackett@pobox.com wrote:

> Oh, I thought there was a way to do it. For some reason I thought that was the
> one of the reasons why so many people always wanted to be able to compile Perl
> code (to make it less readable).

That is one reason why people want to compile Perl.  (The other is that
they want to distribute their program to someone who doesn't have perl
installed.)  However, they're not trying to hide the code from the users
of web clients.  A properly configured web server will either let you
view the source code, or execute the code, but not both from the same
URL.  The point is to hide the code from the people running the server. 
(I'm not making a judgment call on whether that's a good thing or not.)

-- 
James Ludlow (ludlow@us.ibm.com)
(Any opinions expressed are my own, not necessarily those of IBM)


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

Date: 8 Feb 1999 23:11:52 -0000
From: Jonathan Stowe <gellyfish@btinternet.com>
Subject: Re: Viewing remote Perl script before executing
Message-Id: <79nqvo$ua$1@gellyfish.btinternet.com>

On Mon, 08 Feb 1999 17:44:27 GMT brackett@pobox.com wrote:
> In article <79n2fb$5nh$1@nnrp1.dejanews.com>,
>   droby@copyright.com wrote:
> 
>> No.
>>
>> In fact, not only is there no easy way, there is no way at all.
> 
> Oh, I thought there was a way to do it. For some reason I thought that was the
> one of the reasons why so many people always wanted to be able to compile Perl
> code (to make it less readable).
> 

The point is that a 'Remote Perl Script' (By which I believe you mean a
CGI program) Is executed and the output is returned.  If the author has
chosen to make the program source available to you then all well and good.
Most people who want to compile their programs either dont believe in
'Open Source' or are acting in the mistaken belief that this will somehow
help them protect their 'intellectual property'.

However there is no way of of seeing the Source of a CGI program before
you run it.  Of course if this was ASP on an unpatched server then that
would be a different matter :-)

/J\
-- 
Jonathan Stowe <jns@btinternet.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>


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

Date: 12 Dec 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 Dec 98)
Message-Id: <null>


Administrivia:

Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing. 

]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body.  Majordomo will then send you instructions on how to confirm your
]subscription.  This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.

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

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