[8046] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1671 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Jan 19 09:27:20 1998

Date: Mon, 19 Jan 98 06:01:13 -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, 19 Jan 1998     Volume: 8 Number: 1671

Today's topics:
        CGI security with internal users <dyang@mork.uni.uiuc.edu>
    Re: CGI security with internal users (Tad McClellan)
    Re: CGI security with internal users <mike@NOSPAM.interways.com>
        compiling perl using a statically linked libc.a <dfisher@adc.metrica.co.uk>
        Detecting the presence of a sub declaration <rra@stanford.edu>
    Re: Detecting the presence of a sub declaration <xxTony.Curtis@vcpc.univie.ac.at>
    Re: Exporter Question <rra@stanford.edu>
    Re: GetOpts::Std and 'Use of Uninitialized variable' er <johan_vromans@nl.compuware.com>
        Indexes in Perl (FRIHA Lamia)
    Re: installing perl5.004_04 under Linux <shimpei+nospam+nospam+caltech.edu@socrates.caltech.edu>
    Re: inverse cosine? (Andreas Karrer)
    Re: Logical 'and' in regex? <shimpei+nospam+nospam+caltech.edu@socrates.caltech.edu>
    Re: Looking for a c++ parser. <tschur@tsa.de>
    Re: LWP SSL POST requests <aas@sn.no>
    Re: MacPerl carriage returns (Paul J. Schinder)
    Re: MacPerl carriage returns <neeri@iis.ee.ethz.ch>
    Re: novice question: ranking array elements (Mick Farmer)
    Re: perl -- a language for LEARNING programming? <ckc@dmi.dk>
        Problems using Client-Server IPC (further Information) <tschur@tsa.de>
    Re: Random Access File Methods? <dgoyette@NoMoreSPAMpcisys.net>
    Re: Random Access File Methods? <dgoyette@NoMoreSPAMpcisys.net>
    Re: reexporting symbols in modules (M.J.T. Guy)
    Re: shmread from Perl <joseph@5sigma.com>
    Re: shmread from Perl (Mick Farmer)
        Symbolic Links (Chris Hamilton)
    Re: Symbolic Links (Chris Hamilton)
    Re: Symbolic Links <xxTony.Curtis@vcpc.univie.ac.at>
        The SITE commands, will it ever be implemented in Win32 <tor@kmd.dk>
    Re: The SITE commands, will it ever be implemented in W (Jeffrey R. Drumm)
        Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: 19 Jan 1998 10:48:03 GMT
From: "Steve Michaels" <dyang@mork.uni.uiuc.edu>
Subject: CGI security with internal users
Message-Id: <01bd24c6$93caade0$8a197e82@dilbert>

What are the risks I am taking as a sys admin to allow people to have perl
cgi scripts in their own cgi-bins?

Steve


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

Date: Mon, 19 Jan 1998 06:27:54 -0600
From: tadmc@flash.net (Tad McClellan)
Subject: Re: CGI security with internal users
Message-Id: <asgv96.ffj.ln@localhost>

Steve Michaels (dyang@mork.uni.uiuc.edu) wrote:
: What are the risks I am taking as a sys admin to allow people to have perl
: cgi scripts in their own cgi-bins?


The same risks as allowing C or C++ or Visual Basic or shell cgi (sic)
scripts in their own cgi-bins.


(ie. it is not a language specific question, as far as I can tell.
 This, BTW, is a language specific newsgroup  ;-)


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


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

Date: Mon, 19 Jan 1998 13:29:31 GMT
From: "Mike" <mike@NOSPAM.interways.com>
Subject: Re: CGI security with internal users
Message-Id: <01bd24d5$be8eb760$3c42100a@nl-amv-dsk5002>

Good question!
I'm not an expert in perl/cgi scripts, but I've seen some
excellent examples of security holes which I even understand.
It even doesn't have to be the evil side of the user itself,
but when they leaves holes for hackers, it could be harming!

For example: when a user offers a form input, and forget
to filter unix shell commands a web-visitor can enter,
he could simply enter EVERY command he'd like (rm -r *).

Example 2: what if a user actually places the perl executable
in the cgi-bin itself, every web-visitor can execute it's very
own scripts/command he like, without even using a users script.
He simply type: http://www.domain.com/cgi-bin/perl <commands>

I wish I could give actual source examples, but I'm not an expert.
Try to search in engines on: +perl +security
_________________________________________________________
Interways Internet Services 7 http://www.interways.com //
        p/o box 32477 7 2503 AD 7 The Hague 7 Holland
__          info@interways.com 7 +31 (0) 655 76 06 47
/////////////////////////////////////////////////////


> What are the risks I am taking as a sys admin to allow people to have
perl
> cgi scripts in their own cgi-bins?



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

Date: Mon, 19 Jan 1998 12:20:03 -0000
From: "David Fisher" <dfisher@adc.metrica.co.uk>
Subject: compiling perl using a statically linked libc.a
Message-Id: <885212410.5938.0.nnrp-02.c246a73e@news.demon.co.uk>

How do I compile perl, and incorporate the statically linked libc.a
(aparently this can improve performance by upto 20 percent).

Rgds,

D.Fisher




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

Date: 19 Jan 1998 04:02:55 -0800
From: Russ Allbery <rra@stanford.edu>
Subject: Detecting the presence of a sub declaration
Message-Id: <m3wwfwiscw.fsf@windlord.Stanford.EDU>

I'd like to be able to take different actions depending on whether a sub
has been predeclared.  In other words, consider the following code:

        sub foo;

        if (sub_exists ('foo')) {
            do_some_stuff ();
        } else {
            do_some_other_stuff ();
        }

What I'm looking for is an implementation of sub_exists().

What I have right now is this:

        sub sub_exists {
            my $sub = shift;
            defined *{$sub}{CODE};
        }

which *appears* to work, but I have no idea if this is really the right
thing to be doing.  Checking to see if &foo is defined will tell me if foo
has been *defined*, but that's not the piece of information I'm looking
for.  UNIVERSAL::can() would actually work, since I'm using a module, but
my understanding was that UNIVERSAL::* was first supported in its present
form in 5.004 and I'd rather not require a version later than 5.003 if I
can help it.

Suggestions and/or pointers are welcome.

-- 
#!/usr/bin/perl -- Russ Allbery, Just Another Perl Hacker
$^=q;@!>~|{>krw>yn{u<$$<[~||<Juukn{=,<S~|}<Jwx}qn{<Yn{u<Qjltn{ > 0gFzD gD,
 00Fz, 0,,( 0hF 0g)F/=, 0> "L$/GEIFewe{,$/ 0C$~> "@=,m,|,(e 0.), 01,pnn,y{
rw} >;,$0=q,$,,($_=$^)=~y,$/ C-~><@=\n\r,-~$:-u/ #y,d,s,(\$.),$1,gee,print


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

Date: 19 Jan 1998 13:47:16 +0100
From: Remove xx to reply <xxTony.Curtis@vcpc.univie.ac.at>
To: rra@stanford.edu
Subject: Re: Detecting the presence of a sub declaration
Message-Id: <7xlnwcr5pn.fsf@vcpc.univie.ac.at>

Re: Detecting the presence of a sub declaration, Russ
<rra@stanford.edu> said:

Russ> What I'm looking for is an implementation of
Russ> sub_exists().

defined &$subname

should be what you want, I think.

hth
tony


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

Date: 18 Jan 1998 23:38:19 -0800
From: Russ Allbery <rra@stanford.edu>
Subject: Re: Exporter Question
Message-Id: <m37m7wlxqs.fsf@windlord.Stanford.EDU>

"Verma Kakarlapudi" <vkakarla@adelphia.net> writes:

> b) Using Exporter function, one has to still include the module in the
>     calling module and access the sub or varaiable with the same above
>     notation(::, can't avoid) even after exporting the sub, and variable
>     to arrays @EXPORT or @EXPORT_OK

No, that's exactly what Exporter does for you.  It imports the symbols
into the current package for you so that you don't have to use the ::
notation.  Are you sure that you're using it correctly?

Keep in mind that Exporter works through the "use" mechanism and won't
trigger on a require.

-- 
#!/usr/bin/perl -- Russ Allbery, Just Another Perl Hacker
$^=q;@!>~|{>krw>yn{u<$$<[~||<Juukn{=,<S~|}<Jwx}qn{<Yn{u<Qjltn{ > 0gFzD gD,
 00Fz, 0,,( 0hF 0g)F/=, 0> "L$/GEIFewe{,$/ 0C$~> "@=,m,|,(e 0.), 01,pnn,y{
rw} >;,$0=q,$,,($_=$^)=~y,$/ C-~><@=\n\r,-~$:-u/ #y,d,s,(\$.),$1,gee,print


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

Date: 19 Jan 1998 11:35:42 +0100
From: Johan Vromans <johan_vromans@nl.compuware.com>
Subject: Re: GetOpts::Std and 'Use of Uninitialized variable' errors?
Message-Id: <wl3u3b0bvk1.fsf@plume.nl.compuware.com>

Mark Hazen <mhazen@franklin.uga.edu> writes:

> Now on the the crux of my question. I'm using GetOpt::Std in this
> program, and my question relates to the following block:
> 
> getopts('dhvf:');
>    $debug=1 if ($opt_d);
 ...
> 
> 1) If I try to initialize a variable ahead of time which getopts() would
> return a value in, getopts will not return a value properly. This is to
> say, if I include a line befre the call to getopts() which said "my
> $opt_v;" $opt_v will never be set to '1' by getopts() even if I call my
> program with a '-v' option. Is there a reason for this behavior?

Other modules cannot see 'my' variables.
The following code uses Getopt::Long and does what you want since you
can pass it a reference to the variable that you want to have set:

  use Getopt::Long;
  Getopt::Long::config ('bundling');
  my ($opt_v, $opt_d, $opt_v, $opt_f) = (0, 0, 0);
  GetOptions ('d' => \$opt_d, 'h' => \$opt_h, 'v' => \$opt_v,
              'f=s' => \$opt_f);

-- Johan


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

Date: 19 Jan 1998 08:18:56 GMT
From: friha@cui.unige.ch (FRIHA Lamia)
Subject: Indexes in Perl
Message-Id: <69v29g$ojd@uni2f.unige.ch>


> If you're interested in finding about indexing techniques, any good
> university's Computer Science library should be able to help you out. If
> you've found an indexing technique which you are having trouble
> implementing in Perl, we may be able to help you here. Good luck!
> 

My question was not clear!! Sorry

It is a Perl question. 
My initial investigations resulted in two suggestions:
	1- htgrep : http://iamwww.unibe.ch/~scg/Src/Doc/htgrep.html
	2- DB_File and Perltie

I'm trying the first one.

Thanks,
Lamia FRiha
	



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

Date: 19 Jan 1998 11:44:35 GMT
From: Shimpei Yamashita <shimpei+nospam+nospam+caltech.edu@socrates.caltech.edu>
Subject: Re: installing perl5.004_04 under Linux
Message-Id: <69veb3$nvi@gap.cco.caltech.edu>

Bernard M. Piller <bernard@look.in.signature> writes:
>
>Finally I give up and whine to this group.
>
>For days now I tried to install perl5.004_04 (from CPAN) on my Linux box
>(AMD K6, Kernel 2.0.33).
>At first I had the "You have a BIG! problem" error during sh configure,
>because some library paths were wrong.
>When I found this out I finally got a config.sh and Makefile.
>But during make I get a whole lot of error messages. I even installed
>gcc 2.7.2.3 (had 2.7.2 before).
>
>Could someone who succesfully installed Perl5.004 on Linux please send
>me his/her config.sh?

If your setup is screwy enough that the Configure script couldn't
figure it out, I doubt config.sh generated by the same Configure
script out of a more "normal" system would do you much good....

-- 
Shimpei Yamashita               <http://www.patnet.caltech.edu/%7Eshimpei/>
The address I have listed in the headers is a working address. It just
looks like it's an invalid address in order to fool spammers collecting
addresses from newsgroups.


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

Date: 19 Jan 1998 10:45:12 GMT
From: karrer@ife.ee.ethz.ch (Andreas Karrer)
Subject: Re: inverse cosine?
Message-Id: <slrn6c6blo.fcg.karrer@kuru.ee.ethz.ch>

In article <69oats$1k1$1@stok.co.uk>, Mike Stok wrote:
>  use POSIX qw/acos/;
>
>  $rads = acos $n;
>
>Otherwise it's back to basics which I have forgotten :-(

That's why "perldoc -f cos" reminds you of:

             For the inverse cosine operation, you may use the
             POSIX::acos() function, or use this relation:

                 sub acos { atan2( sqrt(1 - $_[0] * $_[0]), $_[0] ) }

Returns radians, of course.

 - Andi


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

Date: 19 Jan 1998 12:14:34 GMT
From: Shimpei Yamashita <shimpei+nospam+nospam+caltech.edu@socrates.caltech.edu>
Subject: Re: Logical 'and' in regex?
Message-Id: <69vg3a$nvi@gap.cco.caltech.edu>

Abigail <abigail@fnx.com> writes:
>-- 
>perl -wle 'print "Prime" if (1 x shift) !~ /^1?$|^(11+?)\1+$/'

That's really sick.

-- 
Shimpei Yamashita               <http://www.patnet.caltech.edu/%7Eshimpei/>
The address I have listed in the headers is a working address. It just
looks like it's an invalid address in order to fool spammers collecting
addresses from newsgroups.


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

Date: Mon, 19 Jan 1998 09:10:15 +0100
From: Mario Tschursch <tschur@tsa.de>
Subject: Re: Looking for a c++ parser.
Message-Id: <34C30A67.D670B4C8@tsa.de>

See http://www.zib.de/Visual/software/doc++/index.html for a (cool) C++
class documentation
software.
U don't need to reinvent the wheel again :) .

--
+----------------------------------------------------------------+
| Mario Tschursch (tschur@tsa.de)  \\   MUD:  Bert@FinalFrontier |
| Teleport Sachsen-Anhalt GmbH      \\  WWW: http://ff.mud.de/   |
| Steinfeldstr. 3 / Barleben 39179   \\ TELNET: ff.mud.de 7600   |
| Tel. 039203-82030 Fax. 039203-82031 \\EMAIL: mud@ff.mud.de     |
+----------------------------------------------------------------+





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

Date: 19 Jan 1998 10:57:12 +0100
From: Gisle Aas <aas@sn.no>
Subject: Re: LWP SSL POST requests
Message-Id: <m37m7weqh3.fsf@furu.g.aas.no>

Nick Busigin <nick@xwing.xwing.org> writes:

> Is there any work being done to enhance the LWP module to utilize the
> SSLeay-Perl features for implementing secure web transaction capabilities? 

Yes and it already works with the current LWP distribution.  You can
send requests and get replies from HTTPS-servers.  But there is no API
for getting information about ciphers and certificates used or for
verifying the server certificate.

In order to fix this I started to write the Crypt::SSLeay module
(available on CPAN), but then discovered that Eric Young was also
planning on doing this.  Now I just wait a little to see what he
intends to do.

-- 
Gisle Aas


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

Date: 19 Jan 1998 07:26:41 -0500
From: schinder@leprss.gsfc.nasa.gov (Paul J. Schinder)
Subject: Re: MacPerl carriage returns
Message-Id: <69vgq1$49v@shell.clark.net>

In <aaron-1801982151190001@digi2-059.wwa.com> "Aaron Young" <aaron@soltec.net> writes:

>Hello everyone

>I am trying to write a client that talks to a pop server on a macintosh. 
>When I send the USER command like this

>USER username\n

In *all* your Perl scripts, you should get out of this bad habit.
\n != \012. \n is a symbol that means "end of line on this platform".  On
a Macintosh, \n = \015.  I can't look at the relevant RFC's at the moment,
but I'd guess that POP3 is yet another protocol that wants \015\012 at
the end of the line.  If this is the case, then you write

USER username\015\012  (or \0xd\0xa if you want).

Even better, don't reinvent the wheel.  Graham Barr's libnet package has
a Net::POP3 module that works quite well, and libnet is included in recent
MacPerl distributions.  You should use Shuck to read the pod in
:MacPerl f:lib:Net:POP3.pm.

>The server seems to be timing out on me

>Is there another way I should be sending the carriage return since it is
>sitting on a macintosh?

>If I point it at a pop server sitting on a unix box, it works

>Aaron
-- 
--------
Paul J. Schinder
NASA Goddard Space Flight Center
schinder@leprss.gsfc.nasa.gov


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

Date: 19 Jan 1998 14:21:34 +0100
From: Matthias Neeracher <neeri@iis.ee.ethz.ch>
Subject: Re: MacPerl carriage returns
Message-Id: <864t30ppk1.fsf@iis.ee.ethz.ch>

"Aaron Young" <aaron@soltec.net> writes:
> Hello everyone
> 
> I am trying to write a client that talks to a pop server on a macintosh. 
> When I send the USER command like this
> 
> USER username\n
> 
> The server seems to be timing out on me

Most test based internet protocols want CR LF, so try to terminate the user
name with \015\012.

Some servers might be willing to accommodate sloppy Unix clients, so \n (which
is \012 in Unix perl) might work for unix perl, but not for MacPerl (where \n
translates to \015).

Matthias

-----
Matthias Neeracher   <neeri@iis.ee.ethz.ch>   http://www.iis.ee.ethz.ch/~neeri
   "One fine day in my odd past..." -- Pixies, _Planet of Sound_


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

Date: Mon, 19 Jan 1998 11:57:54 GMT
From: mick@picus.dcs.bbk.ac.uk (Mick Farmer)
Subject: Re: novice question: ranking array elements
Message-Id: <En158I.EnC@mail2.ccs.bbk.ac.uk>

Dear Ralph,

Here's a simple brute-force approach to your problem.  You
could merge the two statements in the inner block but
remember to evaluate the result of the grep function in a
scalar context.

@list = (24.2, 16, 58, 1, 245);

foreach $elem (@list) {
	$val = grep $elem >= $_, @list;
	push @rank, $val;
}
print "@rank\n";

Regards,

Mick


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

Date: 19 Jan 1998 11:02:57 +0100
From: Casper Kvan Clausen <ckc@dmi.dk>
Subject: Re: perl -- a language for LEARNING programming?
Message-Id: <wvppvlon5m6.fsf@edb.ejoper.dmi.min.dk>

ken@forum.swarthmore.edu (Ken) writes:

> I'm thinking of teaching a beginning high school class on programming next
> year (if I can convince the school...), and if I do the language will be
> Perl, not C.  This is mainly because I know it better than C, but also
> because I find it less frustrating to learn.  Anyway, I'm interested in
> following this thread to see what people say.

I think learning via Perl is a good idea. We now have sufficiently
fast processors and sufficient amounts of memory that memory
allocation should be a thing of the past. The focus should have
shifted from resource-management to ease of use - if something _can_
be done automatically, it _should_ be.

At the CS department of Copenhagen U., the first courses are taught in
ML. This is mainly to keep all students on an even level (very few
people know ML when they start), but a large part is also removing
the students as far as possible from managing memory. From ML they
move on to Emerald, an OO language with garbage collection. Only on
their second year are they, for some reason I have yet to fathom,
introduced to C++.

The way I see it, C is only good for writing compilers/interpreters
for useful languages (that oughtta net me some flames :).

Kvan, telling it the way it is.
-- 
-------Casper Kvan Clausen------ | 'Ah, Warmark, everything that passes
----------<ckc@dmi.dk>---------- |  unattempted is impossible.'
           Lokal  544            |   
I do not speak for DMI, just me. |        - Lord Mhoram, Son of Variol.      


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

Date: Mon, 19 Jan 1998 09:06:17 +0100
From: Mario Tschursch <tschur@tsa.de>
Subject: Problems using Client-Server IPC (further Information)
Message-Id: <34C30979.AA1FBF07@tsa.de>

Sorry i forgot the configuration of my Linux Box (COL1.0 Base)

Summary of my perl5 (5.0 patchlevel 3 subversion 0) configuration:
  Platform:
    osname=linux, osver=2.0.24, archname=i386-linux
    uname='linux lisa.lst.de 2.0.24 #1 fri nov 1 18:27:30 met 1996 i586
'
    hint=recommended, useposix=true, d_sigaction=define
  Compiler:
    cc='cc', optimize='-O6 -fomit-frame-pointer -pipe',
gccversion=2.7.2.1
    cppflags='-Dbool=char -DHAS_BOOL'
    ccflags ='-Dbool=char -DHAS_BOOL'
    stdchar='char', d_stdstdio=define, usevfork=false
    voidflags=15, castflags=0, d_casti32=define, d_castneg=define
    intsize=4, alignbytes=4, usemymalloc=n, randbits=31
  Linker and Libraries:
    ld='cc', ldflags =' -L/usr/local/lib'
    libpth=/usr/local/lib /lib /usr/lib
    libs=-lgdbm -ldb -ldl -lm -lc
    libc=/lib/libc.so.5.4.7, so=so
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=, ccdlflags='-rdynamic'
    cccdlflags='-fPIC', lddlflags='-shared -L/usr/local/lib'

@INC: /usr/lib/perl5/i386-linux/5.003 /usr/lib/perl5
/usr/lib/perl5/site_perl/i386-linux /usr/lib/perl5/site_perl .


--
+----------------------------------------------------------------+
| Mario Tschursch (tschur@tsa.de)  \\   MUD:  Bert@FinalFrontier |
| Teleport Sachsen-Anhalt GmbH      \\  WWW: http://ff.mud.de/   |
| Steinfeldstr. 3 / Barleben 39179   \\ TELNET: ff.mud.de 7600   |
| Tel. 039203-82030 Fax. 039203-82031 \\EMAIL: mud@ff.mud.de     |
+----------------------------------------------------------------+





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

Date: 19 Jan 1998 07:30:51 GMT
From: "Don" <dgoyette@NoMoreSPAMpcisys.net>
Subject: Re: Random Access File Methods?
Message-Id: <01bd24ac$2f1c4a80$5968d2d0@586win95>

Thank you for your suggestions.

-Don
---------------------------------------------------------------------

Martien Verbruggen <mgjv@comdyn.com.au> wrote in article
<69uduc$d8g$2@comdyn.comdyn.com.au>...
> In article <01bd247d$3ea42a60$9d664ccf@586win95>,
> 	"Don" <dgoyette@NoMoreSPAMpcisys.net> writes:
> 
> > Is there such a thing as random access files in CGI/PERL/Unix, without
> > having to buy and install a commercial database package?  By "random
> > access" I mean... where each record has a system-assigned record number
> > associated with it and any record can be "randomly" read via this
record
> > number, instead of having to sequentially read the entire file to find
a
> > single record.  Some form of ISAM would also be good.  Any ideas?
> 
> Any of the DBM modules will do something like that, most of them
> through the use of Tied Hash interfaces. If you don't want
> to have to pack and unpack data, you might try the MLDBM module. This
> is not exactly what you need, probably, but comes close. There are
> some other modules that give you these possibilities, but you'll have
> to have a look at CPAN yourself to find out which ones. Go to
> 
> http://www.perl.com/CPAN/modules/00modlist.long.html
> 
> And have a look around. You might be able to find something good.
> Specifically have a look at Section 7: Database Interfaces.
> 
> > Reply to: (dgoyette"at-sign"pcisys.net) and NOT the auto-reply address
> 
> No can do. If you want a reply, you will have to make sure the right
> address is in your Reply-To or From field. I'm too lazy to type it.

And I'm not about to get hundreds of SPAMs just because someone wants me to
post my e-mail address on a newsgroup.  Been there, done that.  I didn't
ask you, or anyone else to send me an e-mail reply, I merely put my ACTUAL
reply-to address in text.

> 
> Martien
> -- 
> Martien Verbruggen                  | 
> Webmaster www.tradingpost.com.au    | The gene pool could use a little
> Commercial Dynamics Pty. Ltd.       | chlorine.
> NSW, Australia                      | 
> 


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

Date: 19 Jan 1998 07:34:22 GMT
From: "Don" <dgoyette@NoMoreSPAMpcisys.net>
Subject: Re: Random Access File Methods?
Message-Id: <01bd24ac$ad839ae0$5968d2d0@586win95>


Thank you for your reply.  Please excuse my PREL ignorance, but could you
explain to me what a SMOP is?  I would assume, having never seen this
before, that it would be SMall OPeration?  But I'd rather know what it's
SUPPOSED to mean.  Thanks.

-Don
---------------------------------------------------------------------

Douglas McNaught <doug@tc.net> wrote in article
<m2oh19np37.fsf@ono.tc.net>...
> "Don" <dgoyette@NoMoreSPAMpcisys.net> writes:
> 
> > Is there such a thing as random access files in CGI/PERL/Unix, without
> > having to buy and install a commercial database package?  By "random
> > access" I mean... where each record has a system-assigned record number
> > associated with it and any record can be "randomly" read via this
record
> > number, instead of having to sequentially read the entire file to find
a
> > single record.  Some form of ISAM would also be good.  Any ideas?
> 
> All Unix files are "random access"--they're a stream of bytes, of
> which you can read and write chunks of any size at any offset.  See
> the sections describing 'seek' and 'read' in the 'perlfunc' manpage.
> Setting things up to behave as you specify above is just a SMOP.  ISAM
> would be a bit more work.
> 
> > Reply to: (dgoyette"at-sign"pcisys.net) and NOT the auto-reply address
> 
> How about I just post to the newsgroup?

That's fine, I didn't ask you, or anyone else to send me an e-mail reply, I
merely put my ACTUAL reply-to address in text.  Too many problems with
SPAM.

> -Doug
> -- 
> sub g{my$i=index$t,$_[0];($i%5,int$i/5)}sub
h{substr$t,5*$_[1]+$_[0],1}sub n{(
>
$_[0]+4)%5}$t='encryptabdfghjklmoqsuvwxz';$c='fxmdwbcmagnyubnyquohyhny';whil
e(
>
$c=~s/(.)(.)//){($w,$x)=g$1;($y,$z)=g$2;$w==$y&&($p.=h($w,n$x).h($y,n$z))or$
x==
> $z&&($p.=h(n$w,$x).h(n$y,$z))or($p.=h($y,$x).h($w,$z))}$p=~y/x/
/;print$p,"\n";
> 


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

Date: 19 Jan 1998 11:40:47 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: reexporting symbols in modules
Message-Id: <69ve3v$s5v$1@lyra.csx.cam.ac.uk>

Tom Dyas <tdyas@eden.rutgers.edu> wrote:
>Suppose that I have an XS module called Foo that exports some
>constants using an AUTOLOAD routine that calls a constant() function
>that was generated by h2xs.
>
>I would like make these constants that Foo exports appear as if
>another module Bar was exporting them. Bar makes some of the routines
>in Foo more friendly but I would like Bar to AUTOLOAD the constants as
>it needs them from Foo.

Just export Foo::AUTOLOAD to Bar::AUTOLOAD, e.g. by

*Bar::AUTOLOAD = \&Foo::AUTOLOAD;

(or by using Exporter in module Foo).


Mike Guy


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

Date: Mon, 19 Jan 1998 01:11:25 -0700
From: "Joseph N. Hall" <joseph@5sigma.com>
Subject: Re: shmread from Perl
Message-Id: <34C30A55.F4978F49@5sigma.com>

Have you read the corresponding Unix man pages?

	-joseph
	 http://www.effectiveperl.com

Jim Largent wrote:
> 
> I have several executables that create shared memory segments.  I want to
> write a short perl script to attach to those segments and dump them.
> I've been trying to do this, but the Perl book is rather thin on shared
> memory topics.  [...]I


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

Date: Mon, 19 Jan 1998 11:41:46 GMT
From: mick@picus.dcs.bbk.ac.uk (Mick Farmer)
Subject: Re: shmread from Perl
Message-Id: <En14HM.E4D@mail2.ccs.bbk.ac.uk>

Dear Jim,

Here are three scripts that I use to demonstrate shared
memory (Perl 5 on Solaris).

8<--------8<--------8<--------8<

First script creates the shared memory and returns the ID.

$IPC_PRIVATE = 0;
$SHM_FLAGS = 0600;
$SHM_MAX = 1000;

$id = shmget $IPC_PRIVATE, $SHM_MAX, $SHM_FLAGS
	or die "Can't shmget ($!)\n";
print "Use $id to access this shared memory\n";

8<--------8<--------8<--------8<

Second script copies standard input into shared memory
given the ID on the command line.  The ID must have been
created in advance.

$id = shift
	or die "Missing shared memory id\n";
$string = join '', <STDIN>;
shmwrite $id, $string, 0, length $string
	or die "Can't shmwrite ($!)\n";

8<--------8<--------8<--------8<

Third script copies shared memory onto standard output
given the ID on the command line.  The ID must have been
created in advance.

$SHM_MAX = 1000;

$id = shift
	or die "Missing shared memory id\n";
shmread $id, $message, 0, $SHM_MAX
	or die "Can't shmread ($!)\n";
print "From shared memory:\n$message\n";

8<--------8<--------8<--------8<

Regards,

Mick


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

Date: 19 Jan 1998 13:08:04 GMT
From: chrish@squonk.net (Chris Hamilton)
Subject: Symbolic Links
Message-Id: <69vj7k$ghs$1@duke.squonk.net>

Is there a function or combination of functions that will tell you what
file a symbolic link is pointing to?

-- 
Chris Hamilton
chrish@squonk.net
http://www.squonk.net/users/chrish


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

Date: 19 Jan 1998 13:11:52 GMT
From: chrish@squonk.net (Chris Hamilton)
Subject: Re: Symbolic Links
Message-Id: <69vjeo$gjn$1@duke.squonk.net>

Chris Hamilton (chrish@squonk.net) wrote:
: Is there a function or combination of functions that will tell you what
: file a symbolic link is pointing to?

Duh! Do I feel link a moron. readlink(). Sigh. Sorry about the post.

-- 
Chris Hamilton
chrish@squonk.net
http://www.squonk.net/users/chrish


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

Date: 19 Jan 1998 14:16:20 +0100
From: Remove xx to reply <xxTony.Curtis@vcpc.univie.ac.at>
To: chrish@squonk.net
Subject: Re: Symbolic Links
Message-Id: <7xhg70r4d7.fsf@vcpc.univie.ac.at>

Re: Symbolic Links, Chris <chrish@squonk.net> said:

Chris> Is there a function or combination of functions that
Chris> will tell you what file a symbolic link is pointing
Chris> to?

perldoc -f readlink

hth,
tony


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

Date: Mon, 19 Jan 1998 09:14:14 +0100
From: "Torfinn Keringen" <tor@kmd.dk>
Subject: The SITE commands, will it ever be implemented in Win32
Message-Id: <69v22n$hni@news1.tele.dk>

Hi
I very much enjoy using the Net::FTP module, but I often need the SITE
command like "site filetype=jes".
Is there an other way of doing this from Win32 than using the Net::FTP, or
will it be implemented in near future.

Thanks in advance

Torfinn Keringen  --> tor@kmd.dk







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

Date: Mon, 19 Jan 1998 12:15:01 GMT
From: drummj@mail.mmc.org (Jeffrey R. Drumm)
Subject: Re: The SITE commands, will it ever be implemented in Win32
Message-Id: <34c34205.3256634793@news.mmc.org>

On Mon, 19 Jan 1998 09:14:14 +0100, "Torfinn Keringen" <tor@kmd.dk> wrote:

>Hi
>I very much enjoy using the Net::FTP module, but I often need the SITE
>command like "site filetype=jes".
>Is there an other way of doing this from Win32 than using the Net::FTP, or
>will it be implemented in near future.
>
>Thanks in advance
>
>Torfinn Keringen  --> tor@kmd.dk

Are you saying that you can't issue SITE commands with Net::FTP, or that you're
looking for some way to eliminate the Net::FTP module entirely?

I issue site commands all the time via Net::FTP, using the quot() method
(example from Unix text file to VSE sequential file):

$ftp->quot ("site vsesam vsamrecfm fixblk vsamrecl 80 cisizedata 8000");

So try:

$ftp->quot ("site filetype=jes");

If you're hoping to do this without Net::FTP, you've got a lot of work ahead of
you . . . 

-- 
                Jeffrey R. Drumm, Systems Integration Specialist
        Maine Medical Center - Medical Information Systems Group
                                             drummj@mail.mmc.org
"Broken? Hell no! Uniquely implemented!" - me


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

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


Administrivia:

The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc.  For subscription or unsubscription requests, send
the single line:

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.

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

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

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

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

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


------------------------------
End of Perl-Users Digest V8 Issue 1671
**************************************

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