[18307] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 475 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Mar 13 03:05:54 2001

Date: Tue, 13 Mar 2001 00:05:17 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <984470717-v10-i475@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Tue, 13 Mar 2001     Volume: 10 Number: 475

Today's topics:
    Re: $ENV{'HTTP_REFERER'} (BUCK NAKED1)
    Re: $ENV{'HTTP_REFERER'} <brondsema@my-deja.com>
        A Header Problem (BUCK NAKED1)
    Re: A Header Problem (Chris Fedde)
    Re: A Header Problem (Miguel Cruz)
        ANNOUNCE: CGI::Explorer V 1.10 <ron@savage.net.au>
        Are global variables global per instance or per class? <webmuse@my-deja.com>
    Re: Are global variables global per instance or per cla <webmuse@my-deja.com>
    Re: Assigning string from between two patterns? (Eric Bohlman)
    Re: Assigning string from between two patterns? <cmon_209@hotmail.com>
        Astro::Sunrise version 0.04  <mothra@nowhereatall.com>
    Re: cgi redirect & cookies (David Efflandt)
    Re: complex pattern matching with backslashes (Martin Vorlaender)
    Re: CPAN question (Chris Fedde)
        Exp. Perl/CGI programmer needed  <waystar@home.com>
    Re: FAQ 6.0:   Why do I get weird spaces when I print a (Chris Fedde)
    Re: FAQ 6.0:   Why do I get weird spaces when I print a (Chris Fedde)
    Re: from SETL to Perl (Damian James)
        How to get millisecond? <zhengshenyu@21cn.com>
    Re: How to get millisecond? <michael@NOSPAM.vilain.com>
    Re: How to run a Perlscript? (Damian James)
    Re: HTTP_WEFERER ???? (BUCK NAKED1)
    Re: HTTP_WEFERER ???? <rworth5@home.com>
    Re: HTTP_WEFERER ???? (Miguel Cruz)
    Re: looking for a script to count downloads <jaap@microsoft.com>
    Re: looking for a script to count downloads (Damian James)
        LWP::Simple  problem grip62501@yahoo.com
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Mon, 12 Mar 2001 22:55:49 -0600 (CST)
From: dennis100@webtv.net (BUCK NAKED1)
Subject: Re: $ENV{'HTTP_REFERER'}
Message-Id: <17760-3AADA855-1@storefull-247.iap.bryant.webtv.net>

Hmmm... I have a script that prints $ENV{HTTP_REFERER} yet if I print
out %ENV, it doesn't list a HTTP_REFERER.  --Dennis



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

Date: Tue, 13 Mar 2001 05:36:42 GMT
From: "Dave Brondsema" <brondsema@my-deja.com>
Subject: Re: $ENV{'HTTP_REFERER'}
Message-Id: <Klir6.53629$W05.10787456@news1.rdc1.mi.home.com>


"BUCK NAKED1" <dennis100@webtv.net> wrote in message
news:17760-3AADA855-1@storefull-247.iap.bryant.webtv.net...
> Hmmm... I have a script that prints $ENV{HTTP_REFERER} yet if I print
> out %ENV, it doesn't list a HTTP_REFERER.  --Dennis
>

I had some strange problems concerning %ENV.  When I printed all its values,
some were not listed.  But I could access those just like ones that were
printed.

Is the server running Microsoft?  If so you may be interested to take a look
at a thread from a few months ago.

Message 7 at
http://groups.google.com/groups?hl=en&lr=&safe=off&th=a7bfa47b7c6b5c05&ic=1&
seekd=953607740




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

Date: Mon, 12 Mar 2001 22:52:08 -0600 (CST)
From: dennis100@webtv.net (BUCK NAKED1)
Subject: A Header Problem
Message-Id: <17728-3AADA778-12@storefull-247.iap.bryant.webtv.net>

Does anyone know why 
`gtar -xzf $tmpfile -C $tmpdir 2>&1` will work if the file($tmpfile) has
no headers, but if fails if the file has headers. Seems strange because
`unzip` works on a file whether it has headers in it or not.

Thanks,
--Dennis



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

Date: Tue, 13 Mar 2001 05:43:15 GMT
From: cfedde@fedde.littleton.co.us (Chris Fedde)
Subject: Re: A Header Problem
Message-Id: <Trir6.887$T3.198099456@news.frii.net>

In article <17728-3AADA778-12@storefull-247.iap.bryant.webtv.net>,
BUCK NAKED1 <dennis100@webtv.net> wrote:
>Does anyone know why 
>`gtar -xzf $tmpfile -C $tmpdir 2>&1` will work if the file($tmpfile) has
>no headers, but if fails if the file has headers. Seems strange because
>`unzip` works on a file whether it has headers in it or not.
>

You might get an answer to your question here because some of us
use perl on unixoid oses.  You might get a better answer to this
in a group that has the word unix or linux in it's title.

good luck
chris

-- 
    This space intentionally left blank


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

Date: Tue, 13 Mar 2001 06:40:40 GMT
From: mnc@admin.u.nu (Miguel Cruz)
Subject: Re: A Header Problem
Message-Id: <Ihjr6.607$vc.280291@typhoon2.ba-dsg.net>

BUCK NAKED1 <dennis100@webtv.net> wrote:
> Does anyone know why 
> `gtar -xzf $tmpfile -C $tmpdir 2>&1` will work if the file($tmpfile) has
> no headers, but if fails if the file has headers. Seems strange because
> `unzip` works on a file whether it has headers in it or not.

tar (gtar's a symlink to it) uses the compression libraries but not the
extra parsing code found in the standalone compression utilities. So it is
less forgiving. Pipe from the appropriate decompression utility to tar and
you may have better luck.

miguel


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

Date: Mon, 12 Mar 2001 21:51:44 +1100
From: "Ron Savage" <ron@savage.net.au>
Subject: ANNOUNCE: CGI::Explorer V 1.10
Message-Id: <tar9dr51bh3t6a@corp.supernews.com>

This pure Perl module is available from CPAN and from my web site.

What it is:
CGI::Explorer is a support module for CGI scripts. It manages a tree of data, so that the script can display the tree, and:
1) the user can click on a node in the tree to open or close that node, and which selects the node and submits the form, and which
toggles the open/closed status of that node, or
2) the user can click on the text beside the node, which selects the node and submits the form, but does not change the open/closed
status of that node.

A demo, ce.pl, is provided.

Changes (V 1.00 to 1.10):

1.10  Sat Mar 11 14:00:00 2001
 - Change
  use CGI qw/fieldset legend/;
  to
  use CGI;
  in Explorer.pm. These methods are only used by ce.pl.
 - Add method image($icon_id, $new_image) to allow setting the image file name
  of any icon. See POD for a list of icon ids.
 - Add constructor option css to set the style-sheet for submit buttons.
  A default style-sheet is provided. Yes, I know the submit button text,
  using the style-sheet, is really too wide, but as you'll see from the source,
  I cannot find a style-sheet command to make it narrower.
 - Add method css() to set or retrieve the style-sheet. As with other new() options,
  you can also use method set(css => $new_css) to set the style-sheet after
  construction.
 - Rename constructor option from 'a_href' to 'click_text', since I now use
  submit buttons and not a hrefs. The default for click_text is 1,
  whereas for a_href it was 0.
  Specifically, new(click_text => 1) has the effect of making the text
  (node id and/or name) [to the right of the node] into a submit button,
  formatted nicely via the css option. Clicking this text submits the form
  and sets the current node. But, if the node has children, it does not change
  the open/closed status of the node, whereas clicking on the node icon toggles
  the status.
 - Remove restriction that there had to be a node id == 1.
 - Ship explorer_server.gif and explorer_server.png for variety, and for use
  within ce.pl.
 - Various minor changes to the docs.

--
Cheers
Ron  Savage
ron@savage.net.au
http://savage.net.au/index.html





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

Date: Tue, 13 Mar 2001 00:05:06 -0500
From: "Thomas" <webmuse@my-deja.com>
Subject: Are global variables global per instance or per class?
Message-Id: <6Uhr6.78$Y%3.35037@news1.mco>

This question relates specifically to the PerlEx environment (and probably
mod_perl),
although the question itself is about how Perl handles global variables.

I am writing a fairly simple module that uses DBI, internally, to work with
databases.
I have set $SIG{__WARN__} to a error handling function which emails me with
any
SQL errors that are generated from my calls to DBI. In order to make this
really nice,
I want it to include the actual SQL query that caused the problem, if any.

Initially I was storing the last SQL query in $self->{last_query}. I
understand that
will ensure that each instance of my perl object will have it's own copy of
that variable
when run via PerlEx (which, as I understand it, keeps compiled perl code in
memory,
and starts new threads with each incoming connection).

However, the problem here is my error handling function cannot see $self,
because
of the way the function is being called, and therefore cannot see
$self->{last_query}.

So I thought, let's make it global. I move it so that $last_query is now
declared right
up top of my module, outside of any functions. Then I get a warning from
strict that
says I need to declare $last_query to be $MyModule::last_query.

So I do.

But that gets me thinking ... is this variable global for EACH instance of
my module,
or is it global across all instances of my module (i.e. static)? If PerlEx
is running, and
five people are accessing a script at once, all of which using my module,
will they each
have a unique copy of $last_query, or are they sharing?

Reading the documentation I can find on PerlEx implies that the only
multi-threading
problems that may take place are (1) modules that use XS code and are not
thread-safe,
and (2) modules that do not correctly reset their global variables. Well, my
module does
not use XS code and I've read that DBI is thread safe, so (1) is not a
problem. And my
code either uses 'my' in the appropriate places or resets the global
variables, so that's not
a problem.

So I am assuming that I will encounter no problems with $last_query being
"shared."

Does this sound reasonable?

Thanks if you bothered to read this far. :-)

-thomas







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

Date: Tue, 13 Mar 2001 00:10:27 -0500
From: "Thomas" <webmuse@my-deja.com>
Subject: Re: Are global variables global per instance or per class?
Message-Id: <8Zhr6.79$Y%3.35066@news1.mco>

(I apologize for the horrible formatting of my original message! I
hate this client!!)

This question relates specifically to the PerlEx environment (and
probably mod_perl), although the question itself is about how Perl
handles global variables.

I am writing a fairly simple module that uses DBI, internally, to work
with databases. I have set $SIG{__WARN__} to a error handling function
which emails me with any SQL errors that are generated from my calls
to DBI. In order to make this really nice, I want it to include the
actual SQL query that caused the problem, if any.

Initially I was storing the last SQL query in $self->{last_query}. I
understand that will ensure that each instance of my perl object will
have it's own copy of
that variable when run via PerlEx (which, as I understand it, keeps
compiled perl code in memory, and starts new threads with each
incoming connection).

However, the problem here is my error handling function cannot see
$self, because of the way the function is being called, and therefore
cannot see $self->{last_query}.

So I thought, let's make it global. I move it so that $last_query is
now declared right up top of my module, outside of any functions. Then
I get a warning from strict that says I need to declare $last_query to
be $MyModule::last_query.

So I do.

But that gets me thinking ... is this variable global for EACH
instance of my module, or is it global across all instances of my
module (i.e. static)? If PerlEx is running, and five people are
accessing a script at once, all of which using my module, will they
each have a unique copy of $last_query, or are they sharing?

Reading the documentation I can find on PerlEx implies that the only
multi-threading problems that may take place are (1) modules that use
XS code and are not
thread-safe, and (2) modules that do not correctly reset their global
variables. Well, my module does not use XS code and I've read that DBI
is thread safe, so (1) is not a problem. And my code either uses 'my'
in the appropriate places or resets the global variables, so that's
not a problem.

So I am assuming that I will encounter no problems with $last_query
being "shared."

Does this sound reasonable?

Thanks if you bothered to read this far. :-)

-thomas





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

Date: 13 Mar 2001 05:39:59 GMT
From: ebohlman@omsdev.com (Eric Bohlman)
Subject: Re: Assigning string from between two patterns?
Message-Id: <98kbrf$stf$2@bob.news.rcn.net>

Brian Glass <bglass@pgtv.com> wrote:
> I am trying to create a script which will read the contents of an external 
> text file and extract a string from between two regular patterns within 
> that file. The text file is set up with data as follows:

> <tag>data string</tag><tag2>another data string</tag2>

> I need to be able to extract the text 'data string' and assign it to a 
> scalar variable. 

> I've had no problems opening the file and printing the contents, but 
> cannot figure out the expression for extracting only the data between the 
> two patterns ('<tag>' and '</tag>').

Assuming that this is not actual SGML (including HTML) or XML data in 
which tag-represented elements can be nested, just use ordinary capturing 
parentheses:

if (/<tag>([^<]*)</tag>/) {
  $data=$1;

If it's HTML, then use HTML::Parser or one of its relatives like 
HTML::TokeParser.  If it's XML, use XML::Parser or one of its relatives 
like XML::TokeParser.  If it's some other form of SGML, use James Clark's 
SP and read the results through a pipe.  If it's some pointy-bracket 
format that can nest but isn't well-formed XML or valid SGML, use Damian 
Conway's Text::Balanced.

> Oh yeah, the server is an NT box, if that makes any difference. Thanks in 
> advance for your help!

No, it doesn't make any difference.  You'd probably find it worthwhile to 
read the perlre man page a couple times (it's almost impossible to 
comprehend fully in only one reading--due to the complexity of the 
subject, not lack of clarity in the presentation).



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

Date: Tue, 13 Mar 2001 07:15:21 GMT
From: Chandramohan Neelakantan<cmon_209@hotmail.com>
Subject: Re: Assigning string from between two patterns?
Message-Id: <dOjr6.2783$54.2966@www.newsranger.com>

In article <taqn098060vh65@corp.supernews.com>, Brian Glass says...
>
>I am trying to create a script which will read the contents of an external 
>text file and extract a string from between two regular patterns within 
>that file. The text file is set up with data as follows:
>
><tag>data string</tag><tag2>another data string</tag2>
>
>I need to be able to extract the text 'data string' and assign it to a 
>scalar variable. 
>
>I've had no problems opening the file and printing the contents, but 
>cannot figure out the expression for extracting only the data between the 
>two patterns ('<tag>' and '</tag>').
>



You can try this.

$str = "<tag>data1</tag><tag>data2</tag><tag>data3</tag>"; 
#$str contains the contents of your text file

@data=$str =~ /<tag>(.*?)<\/tag>/g;
#@data will contain your data.






Chandramohan Neelakantan


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

Date: Mon, 12 Mar 2001 13:03:54 -0800
From: mothra <mothra@nowhereatall.com>
Subject: Astro::Sunrise version 0.04 
Message-Id: <tar9dilar2cd61@corp.supernews.com>

I have just released a new version of this module to CPAN
Here is the readme.

NAME
    Astro::Sunrise - Perl extension for computing the sunrise/sunset on
a given day

SYNOPSIS
      use Astro::Sunrise;
      
      ($sunrise, $sunset) = sunrise(YYYY,MM,DD,longitude,latitude,Time
Zone,DST);

DESCRIPTION
  
   This module will return the sunrise/sunset for a given day. 
   
   Eastern longitude is entered as a positive number
   Western longitude is entered as a negative number
   Northern latitude is entered as a positive number
   Southern latitude is entered as a negative number
       There are a number of altitides to chose from, I have chosen
       -0.833 because this is what most countries use. Feel free to 
       change it if you need to. Here is the list:
       h = 0 degrees: Center of Sun's disk touches a mathematical
horizon
       h = -0.25 degrees: Sun's upper limb touches a mathematical
horizon
       h = -0.583 degrees: Center of Sun's disk touches the horizon;
atmospheric refraction accounted for
       h = -0.833 degrees: Sun's supper limb touches the horizon;
atmospheric refraction accounted for
       h = -6 degrees: Civil twilight (one can no longer read outside
without artificial illumination)
       h = -12 degrees: Nautical twilight (navigation using a sea
horizon no longer possible)
       h = -15 degrees: Amateur astronomical twilight (the sky is dark
enough for most astronomical observations)
       h = -18 degrees: Astronomical twilight (the sky is completely
dark)

  sunrise

        ($sunrise, $sunset) = sunrise(YYYY,MM,DD,longitude,latitude,Time
Zone,DST);
        ($sunrise, $sunset) = sunrise( 2001, 3, 10, 17.384, 98.625, -5,
0 );

    Returns the sunrise and sunset times, in HH:MM format. (Note: Time
Zone is the offset from GMT and DST is daylight
    savings time, 1 means DST is in effect and 0 is not.

AUTHOR
    Ron Hill rkhill@pacbell.net

    Many thanks also go to Paul Schlyer, Stockholm, Sweden for his
excellent web page on the subject.

CREDITS
    Thanks very much to:

    Rich Bowen (rbowen@rbowen.com)
    for suggestions




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

Date: Tue, 13 Mar 2001 06:19:53 +0000 (UTC)
From: efflandt@xnet.com (David Efflandt)
Subject: Re: cgi redirect & cookies
Message-Id: <slrn9arevm.cdu.efflandt@efflandt.xnet.com>

On Mon, 12 Mar 2001 11:43:40 -0000, st <replytogroup@nowhere.com> wrote:
>I have a script which writes a cookie and then I want to redirect to a
>different cgi script.
>I understand using   print $q->redirect('http://www.domain.com/'):  you
>should not write a content header.  This does work but when I write the
>cookie it writes a header.  Does anyone know how to get round this problem
>
>$cookie = $q->cookie (     -name=>'sessionid',
>                                          -value=>'cookie_value',
>                                            -expires=>'+1d',
>                                             -path=>'/');
> print $q->header(-cookie=>$cookie);
>
>print $q->redirect('http://www.google.com');
>
>Is there another way to write a cookie without using the header line ?
>The code above does not result but displays the redirection code instead of
>directing the user to the next script.

You should really post questions of this nature to the cgi newsgroup.

You can include a location in the header line and drop the separate
non-functional redirect.  But a cookie only applies to the web host you
set it from, so it will not work if redirected to some other site.

print $q->header(-cookie=>$cookie,-location=>'http://www.goggle.com/');

HTTP/1.1 302 Found
Date: Tue, 13 Mar 2001 06:14:41 GMT
Server: Apache/1.3.9
Set-Cookie: sessionid=cookie_value; path=/; expires=Wed, 14-Mar-2001
06:14:41 GMT
Location: http://www.goggle.com/
Connection: close
Content-Type: text/html

-- 
David Efflandt  efflandt@xnet.com  http://www.de-srv.com/
http://www.autox.chicago.il.us/  http://www.berniesfloral.net/
http://cgi-help.virtualave.net/  http://hammer.prohosting.com/~cgi-wiz/


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

Date: Tue, 13 Mar 2001 06:51:48 +0100
From: martin@radiogaga.harz.de (Martin Vorlaender)
Subject: Re: complex pattern matching with backslashes
Message-Id: <3aadb574.524144494f47414741@radiogaga.harz.de>

Randal L. Schwartz (merlyn@stonehenge.com) wrote:
> However, MacPerl and VMS perl and OS/2 Perl are certainly not going to
> be accepting slashes. :)

I don't know about MacPerl, but my OS/2 Perl (5.004_01 [1]) and all of
the VMSPerls I've used support slashes (under VMS, because more recent
versions of the C RTL allows slashed file specs like '/dev/dir/file').

cu,
  Martin

[1] BTW: Is there a more recent port? I do have CSet/2, but no EMX devel
    environment.
--
One OS to rule them all       | Martin Vorlaender  |  VMS & WNT programmer
One OS to find them           | work: mv@pdv-systeme.de
One OS to bring them all      |   http://www.pdv-systeme.de/users/martinv/
And in the Darkness bind them.| home: martin@radiogaga.harz.de


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

Date: Tue, 13 Mar 2001 06:31:42 GMT
From: cfedde@fedde.littleton.co.us (Chris Fedde)
Subject: Re: CPAN question
Message-Id: <i9jr6.888$T3.195685888@news.frii.net>

In article <m2ae6qh8zl.fsf@aridhol.syscor.priv>,
Kevin Lacquement  <klacquement@syscor.com> wrote:
>Hello, all
>
>I have recently mirrored CPAN on my machine.  Is there an easy way to
>install everything?  How about a way, within the CPAN shell, to get a
>list of uninstalled modules to install?

The manual page for the CPAN.pm module has some examples of this kind of
thing. You should be able to cobble something together with out too much
effort.

>
>Also, if it is possible, is there a reason why I shouldn't do this?
>

Some CPAN modules depend on commercial software that you might not have
installed.  There are also lots of modules that are near conceptual
duplicates of each other.  YMMV though.

chris

-- 
    This space intentionally left blank


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

Date: Tue, 13 Mar 2001 03:17:01 GMT
From: "waystar" <waystar@home.com>
Subject: Exp. Perl/CGI programmer needed 
Message-Id: <Nigr6.241390$65.1385642@news1.rdc1.fl.home.com>

Please accept my apologies if this post is not within the rules. Good help
is hard to find these days:)

Exp. Perl/CGI programmer needed for contract work. Basic understanding of IP
tracking of unique referrers, cloaking/IP stealthing, Search engine
algorithms and search engine spider functions a plus. Please email resume
and/or sample scripts and compensation requirements to waystar@home.com.

Thank you
Wayne





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

Date: Tue, 13 Mar 2001 05:00:11 GMT
From: cfedde@fedde.littleton.co.us (Chris Fedde)
Subject: Re: FAQ 6.0:   Why do I get weird spaces when I print an array of lines?
Message-Id: <vPhr6.885$T3.170865152@news.frii.net>

In article <x7snkndfoo.fsf@home.sysarch.com>,
Uri Guttman  <uri@sysarch.com> wrote:
>>>>>> "MC" == Michael Carman <mjcarman@home.com> writes:
>
>
>  MC> The regular FAQ postings have resulted in a lot of messages like
>  MC> this.  While its great to see the folks here improving the quality
>  MC> of the answers, I've yet to see anyone say that they've submitted
>  MC> their enhancements for inclusion into future revisions. Have
>  MC> people been doing this silently? (I hope so.)
>
>i have told many to CC the FAQ poster. that makes sure he gets it. and i
>have had conversations with him and he is integrating worthwhile
>changes. also i told him to add Mail-Copies-To: faq@denver.pm.org which
>seems to be in there now but may not be obeyed by all newsreaders.
>

Infact my experiance to date indicates that the Mail-Copies-To:
header is implemented by almost no news readers.

chris

-- 
    This space intentionally left blank


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

Date: Tue, 13 Mar 2001 05:31:37 GMT
From: cfedde@fedde.littleton.co.us (Chris Fedde)
Subject: Re: FAQ 6.0:   Why do I get weird spaces when I print an array of lines?
Message-Id: <Zgir6.886$T3.170577920@news.frii.net>

In article <3AA8E158.6DC82703@home.com>,
Michael Carman  <mjcarman@home.com> wrote:
>Gwyn Judd wrote:
>> 
>> I was shocked! How could Michael Carman <mjcarman@home.com>
>> say such a terrible thing:
>> 
>> >The regular FAQ postings have resulted in a lot of messages like this.
>> >While its great to see the folks here improving the quality of the
>> >answers, I've yet to see anyone say that they've submitted their
>> >enhancements for inclusion into future revisions. Have people been
>> >doing this silently? (I hope so.)
>> 
>> Ok, just for future reference, the correct address to send things to is
>> faq@denver.pm.org?
> 
>Well, the FAQ itself says to send things to
>perlfaq-suggestions@perl.com, which is where I sent one off to
>yesterday. I wasn't sure whether or not  faq@denver.pm.org was a good
>place to send changes to or just a posting agent. From Uri's post, I now
>know that I can send suggestions there. Is this the preferred address
>now? Or do both (presumably) find their way to the same place anyway?
>

I'm the poor soul that sits at the bottom of the faq@denver.pm.org
address.  Posting the FAQ is a volunteer effort and is being done
as service to the c.l.p.m news group.  It is being done in the hope
that the FAQ answers prove useful, but with out conferring any
responsibility for the appropriateness or the accuracy of the FAQ
and it's contents.

A secondary benefit of posting the FAQ is that those with an interest
in a covered topic can provide critique and review of the current
FAQ content.  Many commentators provide additions and corrections
where necessary.  In order that these feedback are not lost I do
my best to integrate suggestions of merit into to the perlfaq pod
files.  I attempt to make these edits available to the pumpking
and the perl5porters mailing list for integration into future
releases of Perl.  I use these edited perlfaq pod files as the
basis for future "laps" posted by the faq server.

chris
-- 
    This space intentionally left blank


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

Date: 13 Mar 2001 02:33:39 GMT
From: damian@qimr.edu.au (Damian James)
Subject: Re: from SETL to Perl
Message-Id: <slrn9ar1o1.7cs.damian@puma.qimr.edu.au>

Thus spake Jay Tilton on Mon, 12 Mar 2001 20:12:29 GMT:
>On Sun, 11 Mar 2001 23:58:42 -0500, "cyberian bear"
><cyberian_bear@hotmail.com> wrote:
>
>>The thing is, if at least I knew what the
>>'Euler path construction', or 'Prime factors' are, I could just program them
>>on my own without looking at the SETL code, but i don't.
>
>You would do yourself a great favor by researching them.  Neither
>concept is especially difficult to grasp.  In fact, this would be more
>appropriately posted to a math newsgroup.  Since SETL is a
>mathematics-oriented language, you might even find a SETL guru there,
>if there is such a beast.
>

It's probably worth pointing out that _Mastering Algorithms with Perl_
by Jon Orwant, Jarkko Hietaniemi & John Macdonald includes discussions on
both Euler paths and prime factors. It even includes example Perl
implementations of algorithms to calculate them. While it might not be the
best Perl book out there (my current favourite is Damian Conway's _OOP_,
which I have read twice over now, and am about to start reading again), 
I found it to be a reasonable introduction to these topics. 

It's published by O'Reilly.

HTH

Cheers,
Damian
-- 
@;=0..23;@;{@;}=split//,<DATA>;while(1){for($;=@;;--$;;){next if($:=rand($;+
1))==0+$;;@;[$;,$:]=@;[$:,$;];print "\x"for 0..2*(@|*23)}print map{$;{$_}}(@|
,@;);push@|,shift@;if$;[0]==@|;last if!@;;print"\b"x(@;+@|)}print"\n"__END__
Just another Perl Hacker


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

Date: Tue, 13 Mar 2001 03:59:37 GMT
From: "Shenyu Zheng" <zhengshenyu@21cn.com>
Subject: How to get millisecond?
Message-Id: <JWgr6.51315$YC1.11776395@typhoon.austin.rr.com>

Greetings.
I am wondering if there is a way to get millisecond of current time.
Thanks.




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

Date: Mon, 12 Mar 2001 22:13:04 -0800
From: "Michael Vilain <michael@NOSPAM.vilain.com>"
Subject: Re: How to get millisecond?
Message-Id: <michael-4F545E.22130312032001@corp.supernews.com>

In article <JWgr6.51315$YC1.11776395@typhoon.austin.rr.com>,
 "Shenyu Zheng" <zhengshenyu@21cn.com> wrote:

> Greetings.
> I am wondering if there is a way to get millisecond of current time.

Install the perl module Time::HiRes.  Your OS must support calls for
high-resolution time keeping.

-- 
Michael Vilain
Certified Advanced Rolfer(r)
rolfer@vilain.com
http://www.vilain.com


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

Date: 13 Mar 2001 02:22:51 GMT
From: damian@qimr.edu.au (Damian James)
Subject: Re: How to run a Perlscript?
Message-Id: <slrn9ar13p.7cs.damian@puma.qimr.edu.au>

Thus spake Lasse on Mon, 12 Mar 2001 08:24:38 GMT:
>Is there a way to make a Perl-script start before you start windows ?
>Thankful for all answers
>

You don't say what type of Windows:

1) for X-Windows, see Josef Moellers followup

2) for MS Windows 95/98/ME, add the program or script to your autoexec.bat 
   file, the same as you would do for any other program or script. 

3) for MS Windows NT/2000 it can't be done (there is no such thing as
   'before you start windows'). You want to find out about running your 
   program as a service. See your local documentation. Try typing 'perldoc
   Win32' on the comand line.

Only the last of these has anything to do with Perl.

HTH

Cheers,
Damian
-- 
@;=0..23;@;{@;}=split//,<DATA>;while(1){for($;=@;;--$;;){next if($:=rand($;+
1))==0+$;;@;[$;,$:]=@;[$:,$;];print "\x"for 0..2*(@|*23)}print map{$;{$_}}(@|
,@;);push@|,shift@;if$;[0]==@|;last if!@;;print"\b"x(@;+@|)}print"\n"__END__
Just another Perl Hacker


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

Date: Mon, 12 Mar 2001 23:09:13 -0600 (CST)
From: dennis100@webtv.net (BUCK NAKED1)
Subject: Re: HTTP_WEFERER ????
Message-Id: <17726-3AADAB79-74@storefull-247.iap.bryant.webtv.net>

 
> Your web server seems to have suffered > slight brain damage... 
> LKembel 

Maybe the webserver is purposely misspelling it... perhaps a clever way
of letting people know that the HTTP referrer environmental value is as
unreliable as the spelling of it(referer).
--Dennis



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

Date: Tue, 13 Mar 2001 05:37:49 GMT
From: "Richard" <rworth5@home.com>
Subject: Re: HTTP_WEFERER ????
Message-Id: <Nmir6.3771$rB2.346500@news1.rdc1.mb.home.com>

As much as I would think the webserver would purposely misspell it. I don't
think I would do it, since I am setting it up oin a larger scale server to
keep a weblog for hundreds of domains.

This problem has started on it's own for some reason. It was working
excellent last week. I just noticed the problem a few days ago.



"BUCK NAKED1" <dennis100@webtv.net> wrote in message
news:17726-3AADAB79-74@storefull-247.iap.bryant.webtv.net...
>
> > Your web server seems to have suffered > slight brain damage...
> > LKembel
>
> Maybe the webserver is purposely misspelling it... perhaps a clever way
> of letting people know that the HTTP referrer environmental value is as
> unreliable as the spelling of it(referer).
> --Dennis
>




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

Date: Tue, 13 Mar 2001 06:36:25 GMT
From: mnc@admin.u.nu (Miguel Cruz)
Subject: Re: HTTP_WEFERER ????
Message-Id: <Jdjr6.606$vc.278305@typhoon2.ba-dsg.net>

Richard <rworth5@home.com> wrote:
> As much as I would think the webserver would purposely misspell it. I don't
> think I would do it, since I am setting it up oin a larger scale server to
> keep a weblog for hundreds of domains.
>
> This problem has started on it's own for some reason. It was working
> excellent last week. I just noticed the problem a few days ago.

Off to comp.infosystems.www.servers.[ms-windows|unix] with you. Let them
know the particular server software you're using and they can help figure
out why it's providing elmerian vawiables.

miguel


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

Date: Mon, 12 Mar 2001 19:11:53 GMT
From: "Teun" <jaap@microsoft.com>
Subject: Re: looking for a script to count downloads
Message-Id: <Zb9r6.200528$MH6.2246459@nlnews00.chello.com>


"Richard Wilkerson" <rw@dreamgate.com> schreef in bericht
news:3aab19dc.27320310@news.telocity.com...
> Hi,
>
>  I need a script that will count and log the number times a pdf file
> is downloaded by a visitor.
>
>  I realize the basic perl for this pretty simple and straightforward,
> open the file, find the number, add one and close.
>
>  But how would the visitor selecting a hyperlink initiate this
> counting in the first place?

How about you let him click on a link like this:
http://domain.com/cgi-bin/count_downloads.pl?the_file_to_download.ext

count_downloads.pl would then be the script to read the file and write it to
the client.




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

Date: 13 Mar 2001 03:05:40 GMT
From: damian@qimr.edu.au (Damian James)
Subject: Re: looking for a script to count downloads
Message-Id: <slrn9ar3jn.7cs.damian@puma.qimr.edu.au>

Thus spake Richard Wilkerson on Sun, 11 Mar 2001 06:27:20 GMT:
>Hi,
>
> I need a script that will count and log the number times a pdf file
>is downloaded by a visitor.  
>
> I realize the basic perl for this pretty simple and straightforward,
>open the file, find the number, add one and close. 
>
> But how would the visitor selecting a hyperlink initiate this
>counting in the first place? 
>

This is really a CGI question, but in brief, you need to make the link run
your program, which increments the counter as you describe above, then opens 
the pdf file as data and streams it to stdout and ultimately the browser (with
a "Content-type: application/pdf\n\n" header). Alternately, your program
could output a Location header to redirect the browser to the pdf file. 

Either way, the idea is that you have to run you program from the 
link/button/whatever, then get it send the pdf file to the browser 
(or vice versa, depending on which method you choose).

HTH

Cheers,
Damian
-- 
@;=0..23;@;{@;}=split//,<DATA>;while(1){for($;=@;;--$;;){next if($:=rand($;+
1))==0+$;;@;[$;,$:]=@;[$:,$;];print "\x"for 0..2*(@|*23)}print map{$;{$_}}(@|
,@;);push@|,shift@;if$;[0]==@|;last if!@;;print"\b"x(@;+@|)}print"\n"__END__
Just another Perl Hacker


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

Date: Tue, 13 Mar 2001 05:36:34 GMT
From: grip62501@yahoo.com
Subject: LWP::Simple  problem
Message-Id: <Clir6.2763$54.2928@www.newsranger.com>

Hi.

I have Perl 5.005_03 built for i386-linux

I recently installed LWP module from CPAN.I did not get any warnings while
installing the Module.

I tried the following script

-------------------------------------------
#!/usr/bin/perl

use LWP::Simple;
use LWP::Debug qw(+ -conns);

$content=get("http://www.washingtonpost.com");

print $content

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

and I Got the following message



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


Your vendor has not defined Socket macro AF_INET, used at
/usr/lib/perl5/5.00503/i386-linux/IO/Socket.pm line 385
--------------------------------------------

I assume  there is a compatability problem wiht the Module and OS

Is there any way by which I can rectify/re-install and get this module working?

ANy help will be appreciated 
THanks in advance

regards
CM






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

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

| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.

For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V10 Issue 475
**************************************


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