[11104] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4704 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Jan 20 22:05:49 1999

Date: Wed, 20 Jan 99 19:00:21 -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           Wed, 20 Jan 1999     Volume: 8 Number: 4704

Today's topics:
    Re: $0 or @ARGV in a one-liner (??) (Martien Verbruggen)
    Re: ancestry of perl features (Larry Rosler)
    Re: CGI.pm Warnings (William R. Ward)
        CHOWN problem <andy@xsite.net>
    Re: Example of Perl Cookie Implementation please <jwarner@tivoli.com>
    Re: Flatline database help <ludlow@us.ibm.com>
    Re: Flatline database help <upsetter@ziplink.net>
    Re: Help with regular expression (Tad McClellan)
    Re: help with search and replace please pault2000@my-dejanews.com
        How do I avoid automatic reference count increment? steveb@iserver.com
    Re: How do I avoid automatic reference count increment? (Ilya Zakharevich)
        How do I use modules? <chrisl@hamptons.com>
    Re: How do I use modules? (Alastair)
    Re: How do I use modules? (Martien Verbruggen)
        How to get all filepaths in my Web Site? <tses@hotmail.com>
    Re: How to get all filepaths in my Web Site? (Alastair)
    Re: JOB - CONTRACT POSITION <mymail@nospam.com>
    Re: list of hashes (Tad McClellan)
    Re: LOOP (Larry Rosler)
        minus a pound she exclaimed! (Mark)
    Re: minus a pound she exclaimed! (Sam Holden)
    Re: newbie - endless loop on simple program. (Tad McClellan)
        Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)

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

Date: Thu, 21 Jan 1999 02:10:07 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: $0 or @ARGV in a one-liner (??)
Message-Id: <30wp2.95$Rq1.4452@nsw.nnrp.telstra.net>

In article <3967a133he.fsf@ibnets.com>,
	Uri Guttman <uri@ibnets.com> writes:

>   MV> Another question:
>   MV> 	Why is the -e flag passed on in @ARGV?
> 
> actually it is being printed from $0 (not @ARGV) which makes some sense,
> as that is the 'file' that is being executed.
> 
> perl -we 'print "$0\n";'
> -e

Ah right. How could I have missed that :)

It does make sense in a weird way I guess...

Martien
-- 
Martien Verbruggen                  | 
Interactive Media Division          | If it isn't broken, it doesn't have
Commercial Dynamics Pty. Ltd.       | enough features yet.
NSW, Australia                      | 


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

Date: Wed, 20 Jan 1999 17:48:36 -0800
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: ancestry of perl features
Message-Id: <MPG.111027517359d2ef9899b2@nntp.hpl.hp.com>

In article <393e5531xn.fsf@ibnets.com> on 20 Jan 1999 19:27:32 -0500, 
Uri Guttman <uri@ibnets.com> says...
> 
> i have been pondering perl's ancestry and for curiosity's sake i have
> been thinking about which languages (if any) influenced various perl
> feature. some are borrowed from one language which borrowed from an
> earlier one. some are pure perl from the head of larry and his cohorts.
> 
> some are very obvious (or not). here is a starting list. feel free to
> add, comment or flame.
> 
> math infix ops (+, *, /, etc)		C

(from B, from BCPL, from Algol60, from Fortran, from time immemorial?)

> exponentiation (**)			PL/I	(others too)

(from Fortran)

> math comparison ops (==, >, )		C	(others used = for ==)

(from B, at least)

> assignment ops	(+=)			C

(from B, at least)

> short circuit ops (||, &&)		C	(text versions are perl)

(from B, at least.  C's ops yield Booleans, which is much less useful 
than Perl's yielding the values of the expressions.  But the syntax is 
the same.)

> bit ops ( |, &, ^, <<, >> )		C

(from B, at least)

> auto-increment/decrement		C	(magic ++ is perl)

(from B, at least)

> dereference (->)			C 	(from PL/I)
> scalar range (..)			awk	(list .. is perl)
> bind (=~)				awk
> scalars as string or number		sh
> arrays of scalars			csh?	(the $a[0] syntax is similar)
> 
> tr///					tr, sed y (does anyone use y?)

I do -- it's one character fewer, and I learned awk first :-)

> s///					sed
> m//					many unix programs (awk,sed,more,etc.)
> 
> -p option				sed
> -n option				awk
> 
> varying lenghth strings (no \0 needed)	sh, PL/I
> substr					PL/I
> 
> grep					unix
> map					lisp
> lists					lisp, apl
> slices					apl
> hashes					awk
> 
> flow control (for, while, etc)		C

(from B, at least)

> foreach					perl
> statement modifiers			perl?

I believe Snobol, but it's been SOOOO long!

> eval string				sh
> eval block				perl
> 
> file test ops				sh	(perl added many)
> file functions				C, unix
> 
> system call functions			C, unix
> 
> networking functions			C, unix
> 
> get*by* functions (gethostbyname)	C, unix
> 
> glob (<*>)				csh
> 
> 
> that's enough for me for now. all i can say is that larry is a high
> quality thief! :-)

statement terminator ; from C, from B, ...

compund statements {...} from C, from B, ...

unary ops + - ~ ! from C, from B...

ternary ?: from C, from B...

What happened to function definitions and invocations, and to classes 
and various OOP stuff?

This should turn out to be an instructive thread!

-- 
(Just Another high-quality thief!) Larry Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: 20 Jan 1999 18:50:50 -0800
From: hermit@cats.ucsc.edu (William R. Ward)
Subject: Re: CGI.pm Warnings
Message-Id: <waa7luhibjp.fsf@ese.UCSC.EDU>

"Neil Edmondson" <neiled@enteract.com> writes:
> austin@mathworks.com wrote in message <77fkff$q26$1@turing.mathworks.com>...
> >In comp.lang.perl.modules dave@mag-sol.com wrote:
> >
> >> To get round it, put values in single quotes when using it as a hash key.
> >
> >Or use -value instead of -values .
> 
> single quotes work fine ... -value gives me the same warning.  -style also
> falls victim .... so i think from now on I'm just going to put the single
> quotes around 'em all - if I remember.

Since CGI.pm is case-insensitive about these things, you can also just
use all caps for the argument names.  Since there are no all-uppercase
builtins, there can never be any conflicts.  And that way you don't
have to use any ugly quote marks.

--Bill.

-- 
William R Ward          Bay View Consulting   http://www.bayview.com/~hermit/
hermit@bayview.com     1803 Mission St. #339        voicemail +1 408/479-4072
hermit@cats.ucsc.edu  Santa Cruz CA 95060 USA           pager +1 408/458-8862
 PGP Key 0x2BD331E5; Public key at http://www.bayview.com/~hermit/pubkey.txt
-----------------------------------------------------------------------------
Much as we'd sometimes like to ignore the fact, sex isn't exactly tiddlywinks.
 - Aahz (@netcom.com)


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

Date: Wed, 20 Jan 1999 16:16:32 -0600
From: Andy Biegel <andy@xsite.net>
Subject: CHOWN problem
Message-Id: <36A655C0.40976399@xsite.net>

I have a group of files in a single directory created by a cgi script
(1.shtml ... 100.shtml). Since the script creates them, I assume that
they are set by default to owner "nobody". I understand that I can use
chown to set the owner to myself, but I am having trouble doing so. I
have:


 @delete="*.shtml";
 chown myusername, @delete;



What am I doing wrong? What should I be doing differently?

Andy B.

BTW, this newsgroup is fantastic when it comes to problem solving!





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

Date: Wed, 20 Jan 1999 13:15:24 -0600
From: John Warner <jwarner@tivoli.com>
Subject: Re: Example of Perl Cookie Implementation please
Message-Id: <36A62B4C.607D2D@tivoli.com>

Check out the CGI module documentation.  The following is taken straight from that
documentation that comes with the ActiveState 5.005_02 build 507 version of Perl.

HTH,

John Warner

=====snip=========
NAME

CGI::Cookie - Interface to Netscape Cookies



SYNOPSIS

    use CGI qw/:standard/;
    use CGI::Cookie;

    # Create new cookies and send them
    $cookie1 = new CGI::Cookie(-name=>'ID',-value=>123456);
    $cookie2 = new CGI::Cookie(-name=>'preferences',
                               -value=>{ font => Helvetica,
                                         size => 12 }
                               );
    print header(-cookie=>[$cookie1,$cookie2]);

    # fetch existing cookies
    %cookies = fetch CGI::Cookie;
    $id = $cookies{'ID'}->value;

    # create cookies returned from an external source
    %cookies = parse CGI::Cookie($ENV{COOKIE});



DESCRIPTION

CGI::Cookie is an interface to Netscape (HTTP/1.1) cookies, an innovation that
allows Web servers to store persistent
information on the browser's side of the connection. Although CGI::Cookie is
intended to be used in conjunction with
CGI.pm (and is in fact used by it internally), you can use this module
independently.

For full information on cookies see

        http://www.ics.uci.edu/pub/ietf/http/rfc2109.txt



USING CGI::Cookie

CGI::Cookie is object oriented. Each cookie object has a name and a value. The
name is any scalar value. The value is any
scalar or array value (associative arrays are also allowed). Cookies also have
several optional attributes, including:

   1.expiration date

     The expiration date tells the browser how long to hang on to the cookie. If
the cookie specifies an expiration date in
     the future, the browser will store the cookie information in a disk file and
return it to the server every time the user
     reconnects (until the expiration date is reached). If the cookie species an
expiration date in the past, the browser
     will remove the cookie from the disk file. If the expiration date is not
specified, the cookie will persist only until the
     user quits the browser.

   2.domain

     This is a partial or complete domain name for which the cookie is valid. The
browser will return the cookie to any host
     that matches the partial domain name. For example, if you specify a domain
name of ``.capricorn.com'', then
     Netscape will return the cookie to Web servers running on any of the machines
``www.capricorn.com'',
     ``ftp.capricorn.com'', ``feckless.capricorn.com'', etc. Domain names must
contain at least two periods to prevent
     attempts to match on top level domains like ``.edu''. If no domain is
specified, then the browser will only return the
     cookie to servers on the host the cookie originated from.

   3.path

     If you provide a cookie path attribute, the browser will check it against
your script's URL before returning the cookie.
     For example, if you specify the path ``/cgi-bin'', then the cookie will be
returned to each of the scripts
     ``/cgi-bin/tally.pl'', ``/cgi-bin/order.pl'', and
``/cgi-bin/customer_service/complain.pl'', but not to the script
     ``/cgi-private/site_admin.pl''. By default, path is set to ``/'', which
causes the cookie to be sent to any CGI script
     on your site.

   4.secure flag

     If the ``secure'' attribute is set, the cookie will only be sent to your
script if the CGI request is occurring on a secure
     channel, such as SSL.



Creating New Cookies

        $c = new CGI::Cookie(-name    =>  'foo',
                             -value   =>  'bar',
                             -expires =>  '+3M',
                             -domain  =>  '.capricorn.com',
                             -path    =>  '/cgi-bin/database'
                             -secure  =>  1
                            );

Create cookies from scratch with the new method. The -name and -value parameters
are required. The name must be a
scalar value. The value can be a scalar, an array reference, or a hash reference.
(At some point in the future cookies will
support one of the Perl object serialization protocols for full generality).

-expires accepts any of the relative or absolute date formats recognized by
CGI.pm, for example ``+3M'' for three months
in the future. See CGI.pm's documentation for details.

-domain points to a domain name or to a fully qualified host name. If not
specified, the cookie will be returned only to the
Web server that created it.

-path points to a partial URL on the current server. The cookie will be returned
to all URLs beginning with the specified
path. If not specified, it defaults to '/', which returns the cookie to all pages
at your site.

-secure if set to a true value instructs the browser to return the cookie only
when a cryptographic protocol is in use.



Sending the Cookie to the Browser

Within a CGI script you can send a cookie to the browser by creating one or more
Set-Cookie: fields in the HTTP header.
Here is a typical sequence:

  my $c = new CGI::Cookie(-name    =>  'foo',
                          -value   =>  ['bar','baz'],
                          -expires =>  '+3M');

  print "Set-Cookie: $c\n";
  print "Content-Type: text/html\n\n";

To send more than one cookie, create several Set-Cookie: fields. Alternatively,
you may concatenate the cookies together
with ``; '' and send them in one field.

If you are using CGI.pm, you send cookies by providing a -cookie argument to the
header() method:

  print header(-cookie=>$c);

Mod_perl users can set cookies using the request object's header_out() method:

  $r->header_out('Set-Cookie',$c);

Internally, Cookie overloads the ``'' operator to call its as_string() method when
incorporated into the HTTP header.
as_string() turns the Cookie's internal representation into an RFC-compliant text
representation. You may call
as_string() yourself if you prefer:

  print "Set-Cookie: ",$c->as_string,"\n";



Recovering Previous Cookies

        %cookies = fetch CGI::Cookie;

fetch returns an associative array consisting of all cookies returned by the
browser. The keys of the array are the cookie
names. You can iterate through the cookies this way:

        %cookies = fetch CGI::Cookie;
        foreach (keys %cookies) {
           do_something($cookies{$_});
        }

In a scalar context, fetch() returns a hash reference, which may be more efficient
if you are manipulating multiple
cookies. CGI.pm uses the URL escaping methods to save and restore reserved
characters in its cookies. If you are trying to
retrieve a cookie set by a foreign server, this escaping method may trip you up.
Use raw_fetch() instead, which has the
same semantics as fetch(), but performs no unescaping.

You may also retrieve cookies that were stored in some external form using the
parse() class method:

       $COOKIES = `cat /usr/tmp/Cookie_stash`;
       %cookies = parse CGI::Cookie($COOKIES);



Manipulating Cookies

Cookie objects have a series of accessor methods to get and set cookie attributes.
Each accessor has a similar syntax.
Called without arguments, the accessor returns the current value of the attribute.
Called with an argument, the accessor
changes the attribute and returns its new value.

name()

     Get or set the cookie's name. Example:

             $name = $c->name;
             $new_name = $c->name('fred');

value()

     Get or set the cookie's value. Example:

             $value = $c->value;
             @new_value = $c->value(['a','b','c','d']);

     value() is context sensitive. In an array context it will return the current
value of the cookie as an array. In a scalar
     context it will return the first value of a multivalued cookie.

domain()

     Get or set the cookie's domain.

path()

     Get or set the cookie's path.

expires()

     Get or set the cookie's expiration time.



AUTHOR INFORMATION

be used and modified freely, but I do request that this copyright notice remain
attached to the file. You may modify this
module as you wish, but if you redistribute a modified version, please attach a
note listing the modifications you have
made.

Address bug reports and comments to: lstein@genome.wi.mit.edu



PhelanP806 wrote:

> >-- Next time they come in, I want to be able to check for that cookie,
> >-- and if it exists, redirect elsewhere.  I know how to do the redirect,
> >-- but was hoping to see some real examples of using cookies in a perl
> >-- script.  Thanks.
> >
> >You would do it the same as in a fortran program using cookies.
> >
>
> I've never seen a FORTAN compiler that would accept Perl syntax, or a Perl
> interpreter that would accept FORTRAN syntax.  I'm not sure I'd want either of
> them, but I'd like to know where Abigail found one.
>
> On a slightly more serious note, I think Steve can find what he's looking for
> in CPAN.  I don't do cookies from within Perl, but I'm pretty sure there is
> some code in one of the modules in CPAN that does.
>
> -P
>
> --------------------
> I detest SPAM and boycott the SPAMMers, email me ads for your competitors!



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

Date: Wed, 20 Jan 1999 13:45:46 -0600
From: James Ludlow <ludlow@us.ibm.com>
Subject: Re: Flatline database help
Message-Id: <36A6326A.CF073387@us.ibm.com>

Steve wrote:
 
> I am having problems with having multiple values for one field. For example,
> I might want a CD I'm selling to be classed under 3 different genres. S-Mart
> can write all three values to the database fine, but it cannot display them
> on searches etc., but if there is only one value it displays it fine. Below
> is an example of a database entry with multiple values created by S-Mart:
> 
> itemid|itemprice|genre1,genre2,genre3|
> 
> The values are split by commas. S-Mart has a .CFG configuration file, where

> my(%ITEM);
> ($ITEM{'itemid'}, $ITEM{'price'}, $ITEM{'group'}) = split(/\|/,$LINES[$i]);

The answer is hiding in your question.  Did you notice what the split
function was doing to each line being read in?  Why not do the same
thing for $ITEM{'group'}?  split the contents of $ITEM{'group'} into an
array.

perldoc -f split

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


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

Date: Wed, 20 Jan 1999 20:09:12 GMT
From: Scratchie <upsetter@ziplink.net>
Subject: Re: Flatline database help
Message-Id: <IJqp2.129$QD2.11261@news.shore.net>

Steve <me@me.com> wrote:
: I am trying to customise a CGI shopping cart script which uses a flatline

I think the word you're looking for is "flat file". :)

: is an example of a database entry with multiple values created by S-Mart:

: itemid|itemprice|genre1,genre2,genre3|

: The values are split by commas. S-Mart has a .CFG configuration file, where
: the genre values are defined, for example:

This isn't really germane, FYI.

: %groups = (
: genre1, 'Pop',
: genre2, 'Rock',
: genre3, 'Classic'
: );

: # The search subroutine

: my(%ITEM);
: ($ITEM{'itemid'}, $ITEM{'price'}, $ITEM{'group'}) = split(/\|/,$LINES[$i]);

Here's what's happening (as you probably suspect)... the whole value of
"group" is being put into the $ITEM{'group'} variable. You need to split
*that* variable up into its constituent parts.

Take a look at the "split" function above, and check out the perl docs
on "split" (perldoc -f split). The simplest way to do this would be
something like this would be somethign like
 @my_categories = split(/,/,$ITEM{'group'}

We're taking the third value that was found by splitting on "|" and
splitting *that* on the comma character. (I'll save you some time and tell
you that if you want to allow for the possibility that there might be
spaces around the comma, you would replace /,/ above with /\s*,\s*/).

: # The print_item subroutine

: local(*ITEM) = shift;

: print "$ITEM{'itemid'}, $ITEM{'price'},\n

: ($groups{$ITEM{'group'}})";

Here's where you need to do a little work. Since you no longer have a
single value (necessarily), you have to iterate through the values in
@my_categories and print out each of them. If you're also searching on
categories, you need to alter the search routine so that *it* first splits
that category field and then examines each resulting value to see if it
matches, etc etc. How best to do this is left as an exercise for the
reader, but it will probably involve a "foreach" loop.

Good luck!

--Art

-- 
--------------------------------------------------------------------------
                    National Ska & Reggae Calendar
                  http://www.agitators.com/calendar/
--------------------------------------------------------------------------


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

Date: Wed, 20 Jan 1999 19:48:34 -0600
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Help with regular expression
Message-Id: <i11687.jsn.ln@magna.metronet.com>

Network Operations (root@coredcs.com) wrote:
                    ^^^^
                    ^^^^
   Ack!

   Please tell me that you don't do routine things, such as using
   news, from a privileged account.

   Danger Will Robinson!


: I have the following regexp that I'm attempting to decipher.  The
: input variable is text(a paragraph of regular words).

: $text =~ s/([^\012]{1,90})\s/$1\012/sg;


   Would it be more clear if it was rewritten as below?


      $text =~ s/([^\n]{1,90})\s/$1\n/g;

   or even

      $text =~ s/(.{1,90})\s/$1\n/g;    # no s///s option here


   I believe that all three of those are equivalent
   (for a Unix port of perl).


   [ none of the three need the s///s option. 

     s///s only affects the interpretation of the dot (.) regex
     metacharacter, and neither of the first two even have a dot
     to be affected. Whoever wrote that regex is being silly...

     We don't _want_ dot matching newline in the third one.
   ]


: I believe that it's trying to do something with FF characters.


   It is a Poor Man's word wrap.

   Forces line to be no longer than 91 characters (counting the
   newline)



: I'm going to poke through
: Mastering Reg Exp from ora.


   You should try to answer your own question *before* posting.


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


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

Date: Wed, 20 Jan 1999 18:01:53 GMT
From: pault2000@my-dejanews.com
Subject: Re: help with search and replace please
Message-Id: <7855mb$k3j$1@nnrp1.dejanews.com>

Thank you for your feedback. Call me thick (I have only been learning Perl
for 1 week) but which file handle should I use? I want the log file to be
overwritten each time the script is run with the new value so that the next
time the script runs, the new value will be picked up?

Thanks in advance and thank you all for your time,

Paul

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


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

Date: Thu, 21 Jan 1999 01:39:10 GMT
From: steveb@iserver.com
Subject: How do I avoid automatic reference count increment?
Message-Id: <7860ft$cqe$1@nnrp1.dejanews.com>



I have some perl code using arrays of hashes which
contain references to other arrays or "data" elsewhere.

What I want is to be able to enter those references into
my "structures" without causing the reference
count of the thing being referred to, to be incremented.

In other words, when I want to destroy
the original "data" that is being pointed to, I want perl to
immediately destroy the data and not keep track of other references
made to it, which cause the data being pointed to stay "alive" (at least
as far as the perspective of the reference pointing to it is concerned).

I want the original "data" to disappear, and those references to be
invalidated, and point to 'undef' since that is the perl notion of NULL.

I attempted to write my own extension which made use of
newRV_noinc() to create the references without perl keeping track
of the number of times the data is referenced, but it was
a lot of pain, and I haven't finished.

Can someone tell me how to do this?

Thanks,
Steve Bishop

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


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

Date: 21 Jan 1999 01:59:15 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: How do I avoid automatic reference count increment?
Message-Id: <7861lj$m6f$1@mathserv.mps.ohio-state.edu>

[A complimentary Cc of this posting was sent to 
<steveb@iserver.com>],
who wrote in article <7860ft$cqe$1@nnrp1.dejanews.com>:
> 
> 
> I have some perl code using arrays of hashes which
> contain references to other arrays or "data" elsewhere.
> 
> What I want is to be able to enter those references into
> my "structures" without causing the reference
> count of the thing being referred to, to be incremented.
> 
> In other words, when I want to destroy
> the original "data" that is being pointed to, I want perl to
> immediately destroy the data and not keep track of other references
> made to it, which cause the data being pointed to stay "alive" (at least
> as far as the perspective of the reference pointing to it is concerned).

This (together with enhancements to "kill" outstanding references) was
in my weak/soft-references patch (circa May-Jun 98).  It was killed by
TimB, who promised to redo it in different terms, but never did.

Ilya


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

Date: Thu, 21 Jan 1999 01:28:52 GMT
From: Chris <chrisl@hamptons.com>
Subject: How do I use modules?
Message-Id: <36A682D3.8FF3C912@hamptons.com>

This is a dumb question, but . .

I haven't used Perl since Perl 4, and I don't have a clue about using
modules. I don't have to write 'em, I just have to use em. Well, I
looked at a bunch of online manuals and such, looked in perlmod (which I
didn't understand at all), and CPAN - but I couldn't find how to
actually get a hold of CGI.pm, and I couldn't find anything on how to
use modules.

I'm sure there's something I overlooked, but what? What?? WHAT?!?!?!??

 - Chris



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

Date: Thu, 21 Jan 1999 02:05:27 GMT
From: alastair@calliope.demon.co.uk (Alastair)
Subject: Re: How do I use modules?
Message-Id: <slrn7ad2sj.6a.alastair@calliope.demon.co.uk>

Chris <chrisl@hamptons.com> wrote:
>This is a dumb question, but . .
>
>I haven't used Perl since Perl 4, and I don't have a clue about using
>modules. I don't have to write 'em, I just have to use em. Well, I
>looked at a bunch of online manuals and such, looked in perlmod (which I
>didn't understand at all), and CPAN - but I couldn't find how to
>actually get a hold of CGI.pm, and I couldn't find anything on how to
>use modules.
>
>I'm sure there's something I overlooked, but what? What?? WHAT?!?!?!??

Who?!?! Where?!?!

How hard did you look on CPAN?

http://www.cpan.org

Contents of --> http://www.cpan.org/ROADMAP.html

module/extensions --> http://www.cpan.org/modules/

by naming hierarchy --> http://www.cpan.org/modules/by-module/

CGI --> CGI.pm

You must have overlooked your initiative :/

-- 

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


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

Date: Thu, 21 Jan 1999 02:16:02 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: How do I use modules?
Message-Id: <C5wp2.98$Rq1.4452@nsw.nnrp.telstra.net>

In article <36A682D3.8FF3C912@hamptons.com>,
	Chris <chrisl@hamptons.com> writes:

> actually get a hold of CGI.pm, and I couldn't find anything on how to
> use modules.

Any recent version of perl comes with CGI.pm. Most modules nowadays
have documentation inside of them, in pod format. Any recent perl
comes with a program called 'perldoc' that gives you access to these
documents, as well as all the perl documentation:

# perldoc perldoc
# perldoc perl
# perldoc CGI
# perldoc perlfaq
# perldoc -f open
# perldoc -q "faq.*regexp"
# perldoc perlmod
	:)

Martien
-- 
Martien Verbruggen                  | 
Interactive Media Division          | Begin at the beginning and go on till
Commercial Dynamics Pty. Ltd.       | you come to the end; then stop.
NSW, Australia                      | 


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

Date: Wed, 20 Jan 1999 21:06:53 -0500
From: "Stefanos" <tses@hotmail.com>
Subject: How to get all filepaths in my Web Site?
Message-Id: <F_vp2.270$u%6.1088@news12.ispnews.com>

I am trying to replace a string in all .html files in my site.
How can I do that with Perl?
I cannot take a full directory tree to search for files.

Thanks in advance.

E-mail: tses@hotmail.com




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

Date: Thu, 21 Jan 1999 02:19:05 GMT
From: alastair@calliope.demon.co.uk (Alastair)
Subject: Re: How to get all filepaths in my Web Site?
Message-Id: <slrn7ad3m5.6a.alastair@calliope.demon.co.uk>

Stefanos <tses@hotmail.com> wrote:
>I am trying to replace a string in all .html files in my site.
>How can I do that with Perl?
>I cannot take a full directory tree to search for files.

Try the File::Find module. If you get stuck, show people what you tried and I'm
sure they'd be happy to help.


-- 

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


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

Date: Tue, 19 Jan 1999 07:54:06 -0500
From: JPAH-FLA <mymail@nospam.com>
Subject: Re: JOB - CONTRACT POSITION
Message-Id: <36A4806E.C59C48BC@nospam.com>

We should be making at least as much as those Y2K COBOL hosers. They'd pull
down a cool $100,000.00 for a program like this..

dave@mag-sol.com wrote:hen

> > o
> >



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

Date: Wed, 20 Jan 1999 19:35:56 -0600
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: list of hashes
Message-Id: <s90687.jsn.ln@magna.metronet.com>

Alex Farber (alex@kawo2.rwth-aachen.de) wrote:

: I have a question. Why doesn't it work to push() 
: a reference to a hash into a list, 


   What does "doesn't work"  mean to you?


: like this:

:     push @loh, $href;


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

my @loh;

my $href = { one => 1, two => 2, three => 3 };

push @loh, $href;

print "$loh[0]{two}\n";

foreach (@loh) { print "$$_{two}\n" }
-------------------


  Works for me...


: Why do I have to do an extra anonymous hash:

:     push @loh, {%$href};


   I don't know why _you_ have to, 
   because I don't have to          ;-)

   Might have something to do with some part of your code that
   you have not shared with us?


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


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

Date: Wed, 20 Jan 1999 17:18:14 -0800
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: LOOP
Message-Id: <MPG.1110202e371bb02a9899b1@nntp.hpl.hp.com>

[Posted and a courtesy copy mailed.]

In article <36a66b85.4280864@news.online.ee> on Thu, 21 Jan 1999 
00:00:45 GMT, _/ cim <cim@online.ee> says...
> 
> I use rand to get a random filename from an array @files
> Then i open the file.
> Now I get strings $a $b and $c from that file.
> Now I check if $a <= $aa or $b <= $bb or $c <= $cc
> and if any of those is true it should go to the beginning (rand ....)
> AND if all the files @files have been checked it should give up and
> print "I give up";
> 
> How could I do it fast. Tried but it didn't work like I wanted it to
> (tried many things, but no luck)

Did you try using 'le' to compare strings, instead of '<=' (which is 
used to compare numbers only)?  In the absence of code, no one can help 
you beyond that suggestion.

-- 
(Just Another Larry) Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: Thu, 21 Jan 1999 02:25:59 GMT
From: nospam@pleasereplyhere.com (Mark)
Subject: minus a pound she exclaimed!
Message-Id: <36a7901a.150106637@news.supernews.com>

Howdy;

Some people just aren't genetically predisposed  for writing code- I
know, I'm one of them. :)

I did the faq, did perl for dummies. I still can't get this line:

$base =~ s/[&()\s]|\.html//gi;

to filter out the following from a given string:

- (minus sign)
# (pound)
! (exclamation)
+ (plus sign)
 .cgi 


I am therefore offering a box of choice donuts*  to the individual who
has some insight for me.

Mark



*Donuts may be store bought or fresh, at the discretion of the poster.
Diabetics please inquire about alternative rewards. Does not include
chocolate frosting or premium fillings. Content may shift during
transport, freshness is relative and therefore not guaranteed. 


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

Date: 21 Jan 1999 02:44:31 GMT
From: sholden@pgrad.cs.usyd.edu.au (Sam Holden)
Subject: Re: minus a pound she exclaimed!
Message-Id: <slrn7ad54e.g2k.sholden@pgrad.cs.usyd.edu.au>

On Thu, 21 Jan 1999 02:25:59 GMT, Mark <nospam@pleasereplyhere.com> wrote:
>Howdy;
>
>Some people just aren't genetically predisposed  for writing code- I
>know, I'm one of them. :)
>
>I did the faq, did perl for dummies. I still can't get this line:
>
>$base =~ s/[&()\s]|\.html//gi;
>
>to filter out the following from a given string:
>
>- (minus sign)
># (pound)
>! (exclamation)
>+ (plus sign)
>.cgi 

That would be because it does of those things. Maybe you should try reading
that documentation...

perldoc perlre


-- 
Sam

Just don't create a file called -rf.  :-)
	--Larry Wall


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

Date: Wed, 20 Jan 1999 19:18:03 -0600
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: newbie - endless loop on simple program.
Message-Id: <b8v587.jsn.ln@magna.metronet.com>

Greg Ward (gward@thrak.cnri.reston.va.us) wrote:
: Robert E. John <rjohn@raptor.com> wrote:

[snip]

: >   print("$num ");

[snip]

:    print "$num ";


: Two aesthetic changes I made: remove the parens from the print
: statement; they're unneeded, 


   Leave the parens in or leave them out. 

   Makes no difference to perl...


: and would give you warning messages if you
: ran with "-w" 


   Eh?

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

my $num=0;
my $increment=0.1;

 until ($num > 1.0) {
   print("$num ");
   $num += $increment;
 }
-------------------


   No warnings, correct output.

   ???



: (which you should always, *always* do!). 


   Never a truer word was said!


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


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

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

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