[17853] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 13 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Jan 8 06:05:52 2001

Date: Mon, 8 Jan 2001 03:05:09 -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: <978951909-v10-i13@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Mon, 8 Jan 2001     Volume: 10 Number: 13

Today's topics:
        - Seeking Online Content Management program... <vemba72@hotmail.com>
    Re: - Seeking Online Content Management program... <jackklein@spamcop.net>
    Re: A Socket Server Problem <rps@no_spam.hostedscripts.com>
    Re: A Socket Server Problem <bart.lateur@skynet.be>
        ANNOUNCE:  DDL::Oracle v0.30 <rvsutherland@yahoo.com>
        ANNOUNCE: Switch 2.00 (Damian Conway)
    Re: bash says: No such file or directory when I try to  (Joe Smith)
        Beside $SIG{__WARN__}, what about capturing STDERR? <johnlin@chttl.com.tw>
    Re: Could I remotely zip a file before I get it by FTP (David H. Adler)
        DOS window won't stay open 2obvious@my-deja.com
    Re: DOS window won't stay open <jbuff1856@my-deja.com>
    Re: DOS window won't stay open <wyzelli@yahoo.com>
        Enumerating Processes? viggen_conv@hotmail.com
    Re: Enumerating Processes? (Bernard El-Hagin)
    Re: Enumerating Processes? viggen_conv@hotmail.com
    Re: Enumerating Processes? (Bernard El-Hagin)
    Re: FAQ 8.20: How can I call my system's unique C funct active_ingy@my-deja.com
    Re: Going from unix to windows server <lincwils@teleport.com>
        how to use a perl module outside /lib marjou@my-deja.com
    Re: last access time win32 (Helgi Briem)
    Re: Modules for generating HTML Table of Contents <Michael.Schlueter@philips.com>
    Re: multiple setCookies nobull@mail.com
    Re: neural networks smittod@my-deja.com
        open MAIL - code won't work <philipp.landolt@swisscom.com>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Sun, 7 Jan 2001 22:25:55 -0500
From: "Jon" <vemba72@hotmail.com>
Subject: - Seeking Online Content Management program...
Message-Id: <eqa66.25983$903.93686@weber.videotron.net>

Looking for a web content management program... something that will make
updating the site a lot easier.

Anyone know anything?




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

Date: Mon, 08 Jan 2001 04:03:12 GMT
From: Jack Klein <jackklein@spamcop.net>
Subject: Re: - Seeking Online Content Management program...
Message-Id: <azxZOlpI8xxU4Aa760DPqewOlwYf@4ax.com>

On Sun, 7 Jan 2001 22:25:55 -0500, "Jon" <vemba72@hotmail.com> wrote
in comp.lang.c:

> Looking for a web content management program... something that will make
> updating the site a lot easier.
> 
> Anyone know anything?

So why are you cross-posting this to two programming language groups?

I don't know about comp.lang.perl.misc, but your question if off-topic
and unwanted in comp.lang.c since it has nothing at all to do with the
C language.

Jack Klein
-- 
Home: http://jackklein.home.att.net


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

Date: Mon, 08 Jan 2001 07:08:42 GMT
From: "Brett Foster" <rps@no_spam.hostedscripts.com>
Subject: Re: A Socket Server Problem
Message-Id: <_Hd66.242999$_5.54858523@news4.rdc1.on.home.com>

I've writen a bunch of socket programs before, I use code that looks like
this:
my $listener = IO::Socket::INET->new (LocalPort => 8080, Listen => 1, Reuse
=> 1);
my $selector = IO::Select->new ($listener);
my @ready;
my $socket;
while (@ready = $selector->can_read()) {
    for $socket(@ready) {
        if ($socket == $listener) {
            my $newSock = $listener->accept();
            $selector->add($socket);
        } else {
            my $line;
            $socket->recv($line,512) || do {
                $selector->remove($socket);
                $socket->close();
            };
            if ($line ne '') {
                #Process Socket
                $socket->send("blah") || do {
                    $selector->remove($socket);
                    $socket->close();
                };
            }
        }
    }
}



Pardon any typos in there, I did this off the top of my head.


Regards,
Brett Foster

"Bernhard Schelling" <schelling@bluewin.ch> wrote in message
news:3A574E9C.E3C8B763@bluewin.ch...
> Hi
>
> mmh, what you mean?
> I accept the connection, and add it to a select. The client never send any
> data after the connection (I read this with sysread out).
> Then I go through all handles with @handles = $select->handles and give
them
> the new data.
> But before this, I want to close all connection, who "closed their
browser".
> I tried
>   for ($i=1;$i<@handles;$i++)
>   {
>       $select_thishandle=IO::Select->new($handles[$i]);
>       @selhandles = $select_thishandle->handles;
>       if ($select_thishandle->can_read(0.1) > 0)
>       {
>           $select_telnet->remove($handles[$i]);
>           $handles[$i]->close;
>       }
>   }
> This only worked if I connected locally, but not over a proxy.
>
> thanks a lot for your help!
>
> bye
>
> Per Kistler schrieb:
>
> > Hi
> >
> > Does the standard thing, that the socket says it's readable but if
> > you read nothing shows up, not work here?
> >
> > Per.
> >
> > Bernhard Schelling wrote:
> >  I have a Perl socket server connecting with a httpclient.
> >  I need a longer multipart connection, but thats not the problem.
> >  How do I know, when a client disconnects? (closes his browser)
> >  My program just doesn't know, when the socket connection isn't open
> >  anymore. My program can close the connection at any time, and the
> >  browser puts up a messagbox.
> >
> > --
> > Per Kistler, Zurich, Switzerland
> > ------------------------------------------------------------------------
>




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

Date: Mon, 08 Jan 2001 09:57:04 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: A Socket Server Problem
Message-Id: <1n3j5t8n8d1pohs0hm5p16loibgfdc9np3@4ax.com>

Brett Foster wrote:

>I've writen a bunch of socket programs before, I use code that looks like
>this:
 ...
>Pardon any typos in there, I did this off the top of my head.

Huh? Do yo ualways start again from scratch when you write a new
variation on the same theme? What's wrong with cut'n'paste?

-- 
	Bart.


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

Date: Sat, 6 Jan 2001 13:24:43 -0500
From: "Richard Sutherland" <rvsutherland@yahoo.com>
Subject: ANNOUNCE:  DDL::Oracle v0.30
Message-Id: <t5j6ve5tmhqj19@corp.supernews.com>

==========================================================================
             Release of version 0.30 of DDL::Oracle
==========================================================================


NAME
    DDL::Oracle - a DDL generator for Oracle 7.3, 8.0 and 8i databases

CHANGES

DDL::Oracle has been updated to produce DDL for Oracle 7.3 and 8.0 databases
for the following:

 TABLES
 INDEXES
 CONSTRAINTS
 TABLESPACES

It also has added the following DDL statements (for versions 7.3, 8.0 and
8i):

 CREATE SNAPSHOT
 CREATE SNAPSHOT LOG
 CREATE MATERIALIZED VIEW
 CREATE MATERIALIZED VIEW LOG

Program defrag.pl now does an ANALYZE TABLE/INDEX after the import for
objects which were previously analyzed.  It also has been revised to handle
tables containing '$' in their names.  Some changes for robustness have been
made, such as verifying that log directories are writeable before file
creation.  And a few bugs were squashed.

Fixed a bug in routine which determines Oracle version.

DESCRIPTION
  Overview

Designed for Oracle DBA's and users. It reverse engineers database objects
(tables, indexes, users, profiles, tablespaces, roles, constraints, etc.).
It generates DDL to *resize* tables and indexes to the provided standard or
to a user defined standard.

We originally wrote a script to defrag tablespaces, but as DBA's we
regularly find a need for the DDL of a single object or a list of objects
(such as all of the indexes for a certain table). So we took all of the DDL
statement creation logic out of defrag.pl, and put it into the general
purpose DDL::Oracle module. DDL::Oracle was then expanded to include
tablespaces, users, roles, and all other dictionary objects. The completely
revised program 'defrag.pl' is included with the distribution.

Oracle tablespaces tend to become fragmented (now THAT's an understatement).
Even when object sizing standards are adopted, it is difficult to get 100%
compliance from users. And even if you get a high degree of compliance,
objects turn out to be a different size than originally thought/planned --
small tables grow to become large (i.e., hundreds of extents); what was
thought would be a large table ends up having only a few rows. And so forth.
So the main driver for creating DDL::Oracle was the object management needs
of Oracle DBA's. The "resize" method generates DDL for a list of tables or
indexes. For partitioned objects, the "appropriate" size of EACH partition
is calculated and supplied in the generated DDL.

  Initialization and Constructor

    configure

    The configure method is used to define the DBI connection and to
    set several session level options. These are:

          dbh     A reference to a valid DBI connection (obtained via
                  DBI->connect).  This is a mandatory argument.

                  NOTE:  The user connecting MUST have SELECT privileges
                         on the following (in addition to the DBA or USER
                         views):

                             V$INSTANCE
                             V$PARAMETER

          schema  Defines whether and what to use as the scema for DDL
                  on objects which use this syntax.  "1" means use the
                  owner of the object as the schema; "0" means omit the
                  schema syntax; any other arbtrary string will be
                  imbedded in the DDL as the schema.  The default is "1".

          resize  Defines whether and what to use in resizing segments.
                  "1" means resize segments using the default algorithm;
                  "0" means keep the current INITIAL and NEXT values; any
                  other string will be interpreted as a resize definition.
                  The default is "1".

          view    Defines which Dictionary views to query:  DBA or USER
                  (e.g., DBA_TABLES or USER_TABLES).  The default is DBA.

    new

    The new method is the object constructor. The two mandatory
    object definitions are defined by calling this method, to wit:

          type    The type of object (e.g., TABLE, INDEX, SYNONYM, table
                  family, etc.).

                  For 'table family', supply the name(s) of tables -- the
                  DDL will include the table and its:
                      Comments (Table and Column)
                      Indexes
                      Constraints
                      Triggers

          list    An arrayref to an array of arrayrefs (as in the DBI's
                  "fetchall_arrayref" method) containing pairs of owner and
                  name.

  Object methods

    create

    The create method generates the DDL to create the list of Oracle
    objects.

    drop

    The drop method generates the DDL to drop the list of Oracle
    objects.

    resize

    The resize method generates the DDL to resize the list of Oracle
    objects. The 'type' defined in the 'new' method is limited to
    'index' and 'table'. For tables, this generates an ALTER TABLE
    MOVE statement; for indexes, it generates an ALTER INDEX REBUILD
    statement. If the table or index is partitioned, then a
    statement for each partition is generated.

    To generate DDL for a single partition of an index or table,
    define the 'name' as a colon delimited field (e.g.,
    'name:partition').

    compile

    The compile method generates DDL to compile the list of Oracle
    objects.  The 'type' defined in the 'new' method is limited to
    'function', 'package', 'procedure', 'trigger' and 'view'.

SYNOPSIS
     use DBI;
     use DDL::Oracle;

     my $dbh = DBI->connect(
                             "dbi:Oracle:dbname",
                             "username",
                             "password",
                             {
                              PrintError => 0,
                              RaiseError => 1
                             }
                           );

     # Use default resize and schema options.
     # query default DBA_xxx tables (could use USER_xxx for non-DBA types)

::Oracle->configure( 
                             dbh    => $dbh,
                             resize => 1
                             schema => 1
                             view   => 'dba'
                           );

     # Create a list of one or more objects
     my $sth = $dbh->prepare(
            "SELECT
                    owner
                  , name
             FROM
                    dba_tables
             WHERE
                    tablespace_name = 'MY_TBLSP'    -- your mileage may vary
            "
         );

     $sth->execute;
     my $list = $sth->fetchall_arrayref;

     my $obj = DDL::Oracle->new(
                                 type  => 'table',
                                 list  => $list, 
                               );

     my $ddl = $obj->create;      # or $obj->resize;  or $obj->drop;

     print $ddl;    # Use STDOUT so user can redirect to desired file.

FILES
     ddl.pl
     defrag.pl
     copy_user.pl
     copy_user.sh
     README
     README.defrag

AUTHOR
     Richard V. Sutherland
     rvsutherland@yahoo.com

COPYRIGHT
    Copyright (c) 2000, Richard V. Sutherland. All rights reserved.
    This module is free software. It may be used, redistributed,
    and/or modified under the same terms as Perl itself. See:

        http://www.perl.com/perl/misc/Artistic.html


==========================================================================

AVAILABILITY

DDL::Oracle has been uploaded to the CPAN and is also available from:

    http://sourceforge.net/projects/ddl-oracle

==========================================================================







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

Date: 8 Jan 2001 06:14:31 GMT
From: damian@cs.monash.edu.au (Damian Conway)
Subject: ANNOUNCE: Switch 2.00
Message-Id: <t5j6v1404lld14@corp.supernews.com>
Keywords: perl, module, release

==============================================================================
                      Release of version 2.00 of Switch
==============================================================================


NAME
    Switch - A switch statement for Perl

DESCRIPTION

    Switch.pm provides the syntax and semantics for an explicit case
    mechanism for Perl. The syntax is minimal, introducing only the
    keywords C<switch> and C<case> and conforming to the general pattern
    of existing Perl control structures. The semantics are particularly
    rich, allowing any one (or more) of nearly 30 forms of matching to
    be used when comparing a switch value with its various cases.

AUTHOR
    Damian Conway (damian@conway.org)

COPYRIGHT
    Copyright (c) 1997-2000, Damian Conway. All Rights Reserved. This module
    is free software. It may be used, redistributed and/or modified under
    the terms of the Perl Artistic License (see
    http://www.perl.com/perl/misc/Artistic.html)


==============================================================================

CHANGES IN VERSION 2.00


	- Complete revamp (including syntactic and semantic changes)
	  in line with proposed Perl 6 semantics. Major changes:
		+ switch statements now require a block, in which
		  case statements reside
		+ cases no longer fall-through by default


==============================================================================

AVAILABILITY

Switch has been uploaded to the CPAN
and is also available from:

	http://www.csse.monash.edu.au/~damian/CPAN/Switch.tar.gz

==============================================================================




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

Date: 8 Jan 2001 08:16:31 GMT
From: inwap@best.com (Joe Smith)
Subject: Re: bash says: No such file or directory when I try to execute a perl script
Message-Id: <93bt0v$7sv$1@nntp1.ba.best.com>

In article <935llk$f7v$1@nnrp1.deja.com>,  <wayne_willson@my-deja.com> wrote:
>Hi,
>
>This is a strange problem, but I've seen it on several boxes that run
>different UNIX, bash, and perl versions - so it's probably something
>I'm doing wrong.
>
>I always start my perl script with the normal line "#!/usr/bin/perl"
>
>When I try to execute the perl script I type ./script_name.pl
>
>Bash says  "bash: ./script_name.pl: No such file or directory"

That is the usual error if you misspell the name of the interpreter
on the hash-bang line.  It is also the error that you will get if
the first line of the file is "#!/usr/bin/perl\r\n".
Bash is complaining that there is no such file as "/usr/bin/perl\r".

Here's how to check if this is your problem:
  unix%  od -c mybin/list-pics.pl | head -2
  0000000    #   !       /   u   s   r   /   l   o   c   a   l   /   b   i
  0000020    n   /   p   e   r   l   5  \n   #       N   a   m   e   :    

Note that in the good case there is a \n by itself, not \r \n.

You need to remember to use TEXT mode instead of BINARY mode when
using FTP to copy scripts from Win-32 to Unix.
	-Joe
--
See http://www.inwap.com/ for PDP-10 and "ReBoot" pages.


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

Date: Mon, 8 Jan 2001 10:59:35 +0800
From: "John Lin" <johnlin@chttl.com.tw>
Subject: Beside $SIG{__WARN__}, what about capturing STDERR?
Message-Id: <93baia$sfo@netnews.hinet.net>

Dear all,

I know error messages generated by 'warn' come out from STDERR.
One day I try to capture them by TIEHANDLE.
Of course you can do it by $SIG{__WARN__}.  It's just an experiment.

package Catch;
sub TIEHANDLE { bless [] }
sub PRINT { print "Gachu" }
sub WRITE { print "Try this" }
sub PRINTF { print "Or this" }

package main;
tie *STDERR,'Catch';
print STDERR "Hello?";
warn "How are you?\n";

__END__
Gachu
How are you?

The experiment showed print STDERR was captured while 'warn' was not.
Doesn't 'warn' use STDERR's 'PRINT','PRINTF' or 'WRITE'?
Can I capture 'warn' in that way?

Thank you.

John Lin





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

Date: 8 Jan 2001 06:46:15 GMT
From: dha@panix6.panix.com (David H. Adler)
Subject: Re: Could I remotely zip a file before I get it by FTP
Message-Id: <slrn95iohn.m8u.dha@panix6.panix.com>

On Sun, 07 Jan 2001 16:24:56 GMT, Monte Phillips <montep@hal-pc.org>
wrote:

>For crying out loud! If the OP wants to compress and transfer a file
>from a remote location it is assumed (by optimists) that the OP is
>intelligent enough to know they would need certain permissions on that
>remote system.

Traffic on clpmisc has left very few optimists extant.

dha

-- 
David H. Adler - <dha@panix.com> - http://www.panix.com/~dha/
Goldfish: The wimp-ass knight never comes out of the castle to fight
me for dominion over the fish tank.  So I must continue patrolling,
for I am lord and master!	- top5 list: Pet Peeves of Pets


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

Date: Mon, 08 Jan 2001 04:08:47 GMT
From: 2obvious@my-deja.com
Subject: DOS window won't stay open
Message-Id: <93begc$n5i$1@nnrp1.deja.com>

I am a Windows 98 user, and I'm more adept with Windows' GUI than the
command line, so I like to run my perl scripts by double clicking on
them.  So long as my code has no mistakes, everything works fine.  But
the scripts run in an MSDOS box that pops on and off the screen too
fast for me to read error messages.  I can lock it open with a cheat
such as including <STDIN>; as the last line in all my programs.  But it
only reads this line if there are no errors before it in the code, so
this cheat I'm using to help me catch errors ironically only works
correctly when my script is error free.  Does anyone have a solution
(or are you all going to suggest that I learn to use the command line)?


Sent via Deja.com
http://www.deja.com/


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

Date: Mon, 08 Jan 2001 04:51:23 GMT
From: jbuff <jbuff1856@my-deja.com>
Subject: Re: DOS window won't stay open
Message-Id: <93bh09$p24$1@nnrp1.deja.com>

In article <93begc$n5i$1@nnrp1.deja.com>,
  2obvious@my-deja.com wrote:
> I am a Windows 98 user, and I'm more adept with Windows' GUI than the
> command line, so I like to run my perl scripts by double clicking on
> them.  So long as my code has no mistakes, everything works fine.  But
> the scripts run in an MSDOS box that pops on and off the screen too
> fast for me to read error messages.  I can lock it open with a cheat
> such as including <STDIN>; as the last line in all my programs.  But
it
> only reads this line if there are no errors before it in the code, so
> this cheat I'm using to help me catch errors ironically only works
> correctly when my script is error free.  Does anyone have a solution
> (or are you all going to suggest that I learn to use the command
line)?
>
>

Put that <STDIN> inside an END block.

END { <STDIN> }

--jbuff


Sent via Deja.com
http://www.deja.com/


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

Date: Mon, 8 Jan 2001 16:19:20 +0930
From: "Wyzelli" <wyzelli@yahoo.com>
Subject: Re: DOS window won't stay open
Message-Id: <Ahd66.21$hk3.3282@vic.nntp.telstra.net>

<2obvious@my-deja.com> wrote in message
news:93begc$n5i$1@nnrp1.deja.com...
> I am a Windows 98 user, and I'm more adept with Windows' GUI than the
> command line, so I like to run my perl scripts by double clicking on
> them.  So long as my code has no mistakes, everything works fine.  But
> the scripts run in an MSDOS box that pops on and off the screen too
> fast for me to read error messages.  I can lock it open with a cheat
> such as including <STDIN>; as the last line in all my programs.  But
it
> only reads this line if there are no errors before it in the code, so
> this cheat I'm using to help me catch errors ironically only works
> correctly when my script is error free.  Does anyone have a solution
> (or are you all going to suggest that I learn to use the command
line)?

Run Perl from a command prompt "perl script.pl"

put

system (pause);

as the last line...

Wyzelli
--
($a,$b,$w,$t)=(' bottle',' of beer',' on the wall','Take one down, pass
it around');
for(reverse(1..100)){$s=($_!=1)?'s':'';$c.="$_$a$s$b$w\n$_$a$s$b\n$t\n";
$_--;$s=($_!=1)?'s':'';$c.="$_$a$s$b$w\n\n";}print"$c*hic*";





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

Date: Mon, 08 Jan 2001 09:48:40 GMT
From: viggen_conv@hotmail.com
Subject: Enumerating Processes?
Message-Id: <qn2j5ts979hl5tl5h806djppht6nhuvvbs@4ax.com>

I would like to list all the processes owned by a particular user.
Any ideas on how to tackle this?

TIA


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

Date: Mon, 8 Jan 2001 09:44:02 +0000 (UTC)
From: bernard.el-hagin@lido-tech.net (Bernard El-Hagin)
Subject: Re: Enumerating Processes?
Message-Id: <slrn95j2v1.2q0.bernard.el-hagin@gdndev25.lido-tech>

On Mon, 08 Jan 2001 09:48:40 GMT, viggen_conv@hotmail.com
<viggen_conv@hotmail.com> wrote:
>I would like to list all the processes owned by a particular user.
>Any ideas on how to tackle this?

%ps aux | grep username

Cheers,
Bernard
--
perl -le '$#="Just another Perl hacker,"; print \Bernard'


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

Date: Mon, 08 Jan 2001 10:53:18 GMT
From: viggen_conv@hotmail.com
Subject: Re: Enumerating Processes?
Message-Id: <0g6j5t023bhvtciur2es8t6e1pppqalaun@4ax.com>

I know how to do this under unix. What I want is to be able to do
it under Perl. I need to be able to list all the PIDs of a certain
user account and then kill each process.

bernard.el-hagin@lido-tech.net (Bernard El-Hagin) wrote:

>On Mon, 08 Jan 2001 09:48:40 GMT, viggen_conv@hotmail.com
><viggen_conv@hotmail.com> wrote:
>>I would like to list all the processes owned by a particular user.
>>Any ideas on how to tackle this?
>
>%ps aux | grep username
>
>Cheers,
>Bernard



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

Date: Mon, 8 Jan 2001 11:00:06 +0000 (UTC)
From: bernard.el-hagin@lido-tech.net (Bernard El-Hagin)
Subject: Re: Enumerating Processes?
Message-Id: <slrn95j7dd.2q0.bernard.el-hagin@gdndev25.lido-tech>

[fixed quoting]

On Mon, 08 Jan 2001 10:53:18 GMT, viggen_conv@hotmail.com
<viggen_conv@hotmail.com> wrote:
>bernard.el-hagin@lido-tech.net (Bernard El-Hagin) wrote:
>
>>On Mon, 08 Jan 2001 09:48:40 GMT, viggen_conv@hotmail.com
>><viggen_conv@hotmail.com> wrote:
>>>I would like to list all the processes owned by a particular user.
>>>Any ideas on how to tackle this?
>>
>>%ps aux | grep username
>
>I know how to do this under unix. What I want is to be able to do
>it under Perl. I need to be able to list all the PIDs of a certain
>user account and then kill each process.

Here's one way to do it:

1) Read the output of `ps aux` into an array:

	my @ps = `ps aux`;

2) Weed out the lines which have the username you want;

	@ps = grep /username/, @ps;

3) Split each remaining entry on whitespace and retrieve the second
field (which will be the PID) and use it to kill the process:

	foreach (@ps){
		my $pid = (split/\s+/)[1];
		`kill -9 $pid`;
	}

Cheers,
Bernard
--
perl -le '$#="Just another Perl hacker,"; print \Bernard'


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

Date: Mon, 08 Jan 2001 03:34:38 GMT
From: active_ingy@my-deja.com
Subject: Re: FAQ 8.20: How can I call my system's unique C functions from Perl?
Message-Id: <93bcge$lnl$1@nnrp1.deja.com>

In article <hy866.753$B9.190387712@news.frii.net>,
  PerlFAQ Server <faq@denver.pm.org> wrote:
>   How can I call my system's unique C functions from Perl?
>
>     In most cases, you write an external module to do it - see the
answer to
>     "Where can I learn about linking C with Perl? [h2xs, xsubpp]".
However,
>     if the function is a system call, and your system supports
syscall(),
>     you can use the syscall function (documented in the perlfunc
manpage).
>
>     Remember to check the modules that came with your distribution,
and CPAN
>     as well - someone may already have written a module to do it.

Alternatively you could write your own wrapper with Inline.pm. This
gives you more control than syscall because you can determine how the
function is called and how arguments get passed back and forth. Here is
a modified example from the Inline C Cookbook distributed with Inline:

--------------------------------8<-------------------------------
use Inline C => DATA;
print map {"$_\n"} my_localtime(time);

__END__

__C__
#include <time.h>

void my_localtime(int utc) {
  struct tm *ltime = localtime(&utc);
  Inline_Stack_Vars;

  Inline_Stack_Reset;
  Inline_Stack_Push(newSViv(ltime->tm_year));
  Inline_Stack_Push(newSViv(ltime->tm_mon));
  Inline_Stack_Push(newSViv(ltime->tm_mday));
  Inline_Stack_Push(newSViv(ltime->tm_hour));
  Inline_Stack_Push(newSViv(ltime->tm_min));
  Inline_Stack_Push(newSViv(ltime->tm_sec));
  Inline_Stack_Push(newSViv(ltime->tm_isdst));
  Inline_Stack_Done;
}
--------------------------------8<-------------------------------

It calls the system's localtime() function directly. It also let's you
pass back a list of values in the order of your choosing. syscall()
makes you call the function from Perl the same way it is called from C,
which can be ugly and problematic. That's because C only allows one
return value. If you want more, they must be variables passed in by
reference and modified in place.

BTW, the '#include' line shown above is optional since Inline includes
the Perl header files which include the standard C headers. But it makes
for good self-documenting code.

Cheers, Brian

--
perl -le 'use Inline C=>q{SV*JAxH(char*x){return newSVpvf
("Just Another %s Hacker",x);}};print JAxH+Perl'


Sent via Deja.com
http://www.deja.com/


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

Date: Sun, 7 Jan 2001 19:15:02 -0800
From: "Dennis Wilson" <lincwils@teleport.com>
Subject: Re: Going from unix to windows server
Message-Id: <2ea66.52$Z4.36076@nntp3.onemain.com>

There isn't a shebang line for Windows NT, and I don't know from your post
which webserver you are using. From my experience Apache will find the
relevant perl interpreter using the shebang.

If you are using Activestate perl, it has registered some extensions. You
would find these be plumming the registry. What I have done in the past is
add these to the CMDEXT system variable under NT to get it to recognize perl
for scripting. The most relevant for you may be the .pls. This is Perlscript
and may be recognized by IIS( if that is your web server) to load and
interprete web pages.

Hope this helps and good luck. I won't say welcome to the world of windows
because I would not wish that on you.


sandywadkins123@my-deja.com wrote in message
<9376vn$ivn$1@nnrp1.deja.com>...
>Help...
>what should I use instead of shebang line???
>here's error message I keep getting..
>Is it me or server config, I don't have any path saying c:\web
>
>thanks sandy
>
>CGI Error
>The specified CGI application misbehaved by not returning a complete
>set of HTTP headers. The headers it did return are:
>
>
>Can't open perl script "C:\web": No such file or directory
>
>
>Sent via Deja.com
>http://www.deja.com/




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

Date: Mon, 08 Jan 2001 10:07:55 GMT
From: marjou@my-deja.com
Subject: how to use a perl module outside /lib
Message-Id: <93c3hq$75c$1@nnrp1.deja.com>

Hello,

I would like to use a perl module (foo.pm) that is not located into the
directory ~perl/lib/ . Is it possible ? If yes what is the syntax of
the directive line "use ..." (or "require ...") to be able to use it in
my perl files ?

Thanks,
Xavier Marjou


Sent via Deja.com
http://www.deja.com/


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

Date: Mon, 08 Jan 2001 10:17:32 GMT
From: helgi@NOSPAMdecode.is (Helgi Briem)
Subject: Re: last access time win32
Message-Id: <3a59934b.2761674578@news.itn.is>

On Fri, 05 Jan 2001 10:45:39 GMT, rfiedler@my-deja.com
wrote:

>Hi all,
>I want to get the last access time with perl
>under win32 like the "dir filename /t:w" command.
>any idea?
>
$accessed  = (-A $filename);
gives you the last access time in days.

Regards,
Helgi Briem



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

Date: Mon, 8 Jan 2001 08:49:29 +0100
From: "Michael Schlueter" <Michael.Schlueter@philips.com>
Subject: Re: Modules for generating HTML Table of Contents
Message-Id: <3a597116$0$8790$4dbef881@businessnews.de.uu.net>

Freddy,

Did you check out

    http://www.cpan.org

or
    http://search.cpan.org

?

Michael Schlueter




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

Date: 08 Jan 2001 08:35:03 +0000
From: nobull@mail.com
Subject: Re: multiple setCookies
Message-Id: <u9snmu4b0v.fsf@wcl-l.bham.ac.uk>

steve a <sarbayo@telis.org> writes:

> On 07 Jan 2001 15:35:30 +0000, nobull@mail.com wrote:
> :You are forgetting the transactional nature of HTTP.  
> 
> I'm am well aware of the "transactional nature of HTTP".

Ah yes, you are aware of the "transactional nature of HTTP", but are
you are aware of the transactional nature of HTTP?  In other words
you know the phrase, but do you know what it means?

> :There is no way for the processing of a single HTTP
> :tranastion to observe effects that are dependant on the outcome of the
> :transaction. 

> Not exactly true.

Yes, exactly true.  Maybe not relevant but exactly true.  (Actually I
still think it is relevant in this case).

> 1) set_Cookie,
> 2) fetch_Cookie,
> 3) print to browser, results of Cookie transaction,
> 
> Distinctly three HTTP transactions.

Three?  Further evidence that you don't understand what an HTTP
transation is. Steps 2 and 3 must be in the same transaction.

The pseudo code you showed clearly implied you were trying to do all
this inside a single HTTP transaction.  If your pseudo code was
misleading then it may lead to irrelevant responses.  Remember that in
CGI a single execution of the CGI program relates to a single HTTP
transaction.

> I can provide source if you like.

Yes, always (if at all practicable) when posting a programming to a
comp.* newsgroup produce a minimal _working_ program that illustrates
your point.

> :This has nothing whatever to do wiht Perl.
> It has everything to do with perl.

I see no evidence to support that assertion.  Can you explain why you
think this may have anything to do with Perl?

> If I can do the above steps; 1, 2 and 3, why not a step #4 ?
> ie: set_Cookie#2

So you are asking why in CGI you can't set a cookie (something that
happens in the CGI/HTTP headers) _after_ the CGI script has already
passed the headers down its STDOUT pipe to the HTTP server?
Err.... and you think that's a Perl question?

Well actually, if the HTTP response content-type is text/html you may
(on some browsers) still be able to set cookies in the message body
using a META tag.  Note: this is true regardless of your choice of
implementation language for your GCI script.

I don't think this will help you because I still think you are trying
to observe the outcome of a transaction within the same transaction.
If there were two transactions the question you are asking simply
would not arrise as you'd simply print cookie 2 in the headers of the
second transaction's response.

-- 
     \\   ( )
  .  _\\__[oo
 .__/  \\ /\@
 .  l___\\
  # ll  l\\
 ###LL  LL\\


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

Date: Mon, 08 Jan 2001 10:38:45 GMT
From: smittod@my-deja.com
Subject: Re: neural networks
Message-Id: <93c5bl$8e4$1@nnrp1.deja.com>

oops- my bad

In article <ISb46.575$B9.189435904@news.frii.net>,
  cfedde@fedde.littleton.co.us (Chris Fedde) wrote:
> In article <92refn$v1h$1@nnrp1.deja.com>,  <smittod@auburn.edu> wrote:
> >Is there a perl module that deals with neural networks (there's not
one
> >at CPAN), or a perl-oriented tutorial for building neural networks
> >anywhere?
> >
>
> Among other things CPAN was able to show me
>
>     AI::NeuralNet::BackProp
>
> And the readme file for that contained
>
>     ** What is this?
>
>     AI::NeuralNet::BackProp is a simply back-propagation,
>     feed-foward neural network designed to learn using
>     a generalization of the Delta rule and a bit of Hopefield
>     theory.
>
> I think that your searching technique was not as complete as you
> are trying to lead us to believe. Or then again maybe it was :-X
>
> --
>     This space intentionally left blank
>


Sent via Deja.com
http://www.deja.com/


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

Date: Mon, 8 Jan 2001 11:49:31 +0100
From: "Phil" <philipp.landolt@swisscom.com>
Subject: open MAIL - code won't work
Message-Id: <93c5vr$s1e$1@exnews.swisscom.com>

hello,

I've tried to send me an E-Mail in that I'll open a filehandle (look below),
but I've already get the 500 Internal Server Error. Without this code the
script works well.

open MAIL, " | mail philipp.landolt@swisscom.com";
print MAIL "Attentation: New Fault reportet";
close MAIL;

This solution is described from Randal L. Schwartz in this way (german
edition from "first steps in Perl")

Please support me and suggest a version which work.

regards Phil




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

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


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