[17400] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4820 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Nov 6 09:05:29 2000

Date: Mon, 6 Nov 2000 06: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: <973519509-v9-i4820@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Mon, 6 Nov 2000     Volume: 9 Number: 4820

Today's topics:
    Re: #! syntax <ianb@ot.com.au>
    Re: atoi for Perl (Ilya Zakharevich)
    Re: beginner need some help <james@NOSPAM.demon.co.uk>
        character replacements ASCII > 127 only <watsondk@my-deja.com>
    Re: efficiently passing objects <dale@emmons.dontspamme.com>
    Re: embedded variables in a file <nospam.newton@gmx.li>
    Re: embedded variables in a file (Martien Verbruggen)
    Re: Flock problem <mikecook@cigarpool.com>
    Re: getopt doesn't seem work as expected (Martien Verbruggen)
        Google module help <jpmcgowan@ireland.com>
        how to access object variables <john_prokopek@instinet.com>
    Re: how to make $ARGV[0] numeric <james@NOSPAM.demon.co.uk>
    Re: i'm new. will someone direct me? <bart.lateur@skynet.be>
    Re: kill on Win32 <Peter.Dintelmann@dresdner-bank.com>
        Listing X items on each page <eirik@netmaking.com>
    Re: network security <danny@lennon.postino.com>
        Passing Hash to Perl Module Update spcman@my-deja.com
    Re: Performance/scaleablility question:  Perl/CGI vs. J (Eric Bohlman)
        perl gallery script <edward_whittaker@bigfoot.com>
        Problems executing C program through perl via web <dcuaron@cs.nmsu.edu>
        read last line only... (Enjoyer)
    Re: read last line only... (Logan Shaw)
    Re: read last line only... (Martien Verbruggen)
    Re: Where does a core dump come from? <dale@emmons.dontspamme.com>
    Re: Where to find IO/Pty.pm? (Martien Verbruggen)
        win32 net send perl interface? (Alexander Harth)
    Re: win32 net send perl interface? <carvdawg@patriot.net>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Mon, 06 Nov 2000 16:35:04 +1100
From: Ian Boreham <ianb@ot.com.au>
Subject: Re: #! syntax
Message-Id: <3A064305.F15DF500@ot.com.au>

Kuang-chun Cheng wrote:

>                 #!/bin/sh
>                 #       \
>                         exec wish "$0" ${1+"$@"}
>
>         to avoid using absolute path of wish after #!.  Simply
>         replace wish by perl doesn't work.

You can try:

#!/usr/bin/env perl

(see man env). However, whether you can put command-line options ("-w"
springs to mind) depends on the platform.

There's also:

# The following line execs perl no matter where it lives.  -*-Perl-*-
eval 'exec perl -n $0  ${1+"$@"}'
        if 0;

(the "magic" that the other respondent mentioned?), but I am not a shell
programmer, so I haven't bothered to lift the cover on this one.


Regards,


Ian




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

Date: 6 Nov 2000 06:31:47 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: atoi for Perl
Message-Id: <8u5j8j$af8$1@charm.magnus.acs.ohio-state.edu>

[A complimentary Cc of this posting was sent to Uri Guttman 
<uri@sysarch.com>],
who wrote in article <x7itq1hgbl.fsf@home.sysarch.com>:
> >>>>> "dd" == dick dijk <ddijk@hetnet.nl> writes:
> 
>   dd> Does anyone know the "atoi()" function (from C) equivalent in Perl?
> 
> yes.
> 
> $x = $x ;

Sorry, but this was atold()...

Ilya


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

Date: Mon, 6 Nov 2000 01:14:39 +0000
From: James Taylor <james@NOSPAM.demon.co.uk>
Subject: Re: beginner need some help
Message-Id: <ant060139345fNdQ@oakseed.demon.co.uk>

In article <8u4bjp$li7$1@nnrp1.deja.com>,
<URL:mailto:metamp@my-deja.com> wrote:
> how to make the script to sent the file directly insted useing
> print "location http://www.site.com/file.zip"
> 
> my problem with this is that the print "location...... shows up in url

Why don't you just output it in the same way you would an HTML document
except with the appropriate content type header?

-- 
James Taylor <james (at) oakseed demon co uk>
PGP key available ID: 3FBE1BF9
Fingerprint: F19D803624ED6FE8 370045159F66FD02



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

Date: Mon, 06 Nov 2000 13:33:10 GMT
From: ozetechnology <watsondk@my-deja.com>
Subject: character replacements ASCII > 127 only
Message-Id: <8u6bum$5j4$1@nnrp1.deja.com>

Hi

I have to read around 9000 html files and replace several known
character codes with internet character enterties, then strip out any
remaining character code > 127

File IO etc is not a problem, the problem is the processing of character
codes other than replacing the known codes is ok, its the greater than
127 thats giving me problems. I am assuming that I can use the
substitution operator like I have for the known replacements. But what
do I use for the match?

my current thoughts are to create a character class with every char
code, which seems like there should be a better way to do it.

can \x be used in character classes, somthing like

[\x7f-\xff]

thought of \w but do not want to match anything below 127

Any suggestions?

--
site: http://www.ozetechnology.com
+++ New Images in the gallery +++


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Mon, 6 Nov 2000 00:23:25 -0600
From: "Dale Emmons" <dale@emmons.dontspamme.com>
Subject: Re: efficiently passing objects
Message-Id: <t0cjht4rd4d9a2@corp.supernews.com>

> > > I'm curious, is code like this efficient? Or is there a better way to
do
> > it?
> >
> > You need to narrow this down to a smaller chunk or smaller chunks of
code
>
> Thanks for your reply. Perhaps this is a bit simpler:
>
> -----------
>
> my $dbh = DBI->connect("dbi:mysql:$settings{dbName}", $settings{dbUser},
> $settings{dbPassword}, {
>     PrintError => 0,
>     RaiseError => 1
> });
>
> do_sth_with_db( dbh => $dbh, something => $something );
>
> $dbh->disconnect;
>
> sub do_sth_with_db {
>
>     my %passed = @_;
>
>     my $something = $passed{dbh}->quote( $passed{something} );
>
>     $passed{dbh}->do(qq{
>         DO SOMETHING
>         WHERE something_else = $something
>     });
>
> }
>
> -----------
>
> What I'm wondering is, is passing the DBI object into do_sth_with_db()
like
> I did the most efficient way to do so? Or is there a better way?

I'm sorry... now that I've read more about references I've learned that I'm
not actually passing the object, I'm only passing a reference to the object.
Doh!

Thanks for putting up with me...
-Dale




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

Date: Mon, 06 Nov 2000 12:31:33 +0100
From: "Philip 'Yes, that's my address' Newton" <nospam.newton@gmx.li>
Subject: Re: embedded variables in a file
Message-Id: <tj5d0t85qmojn6srbp7n75u2gd2d82i4gq@4ax.com>

On Fri, 3 Nov 2000 07:08:02 -0500, tadmc@metronet.com (Tad McClellan)
wrote:

>   See    news.announce.newusers   if you want to look like you
>   know what you are doing while posting to Usenet.

This groups seems, unfortunately, to have gone comatose, nearly dead.

Cheers,
Philip
-- 
Philip Newton <nospam.newton@gmx.li>
If you're not part of the solution, you're part of the precipitate


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

Date: Mon, 6 Nov 2000 22:59:05 +1100
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: embedded variables in a file
Message-Id: <slrn90d789.567.mgjv@martien.heliotrope.home>

On Mon, 06 Nov 2000 12:31:33 +0100,
	Philip 'Yes, that's my address' Newton <nospam.newton@gmx.li> wrote:
> On Fri, 3 Nov 2000 07:08:02 -0500, tadmc@metronet.com (Tad McClellan)
> wrote:
> 
>>   See    news.announce.newusers   if you want to look like you
>>   know what you are doing while posting to Usenet.
> 
> This groups seems, unfortunately, to have gone comatose, nearly dead.

I guess they've finally given up trying to educate new users. Suppose it
has something to do with the fact that none of them can't be bothered.

Martien
-- 
Martien Verbruggen              | 
Interactive Media Division      | In the fight between you and the
Commercial Dynamics Pty. Ltd.   | world, back the world - Franz Kafka
NSW, Australia                  | 


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

Date: Sun, 5 Nov 2000 23:21:38 -0700
From: "Michael Cook" <mikecook@cigarpool.com>
Subject: Re: Flock problem
Message-Id: <66sN5.2307$qz2.482219@news.uswest.net>

Hi Geoff,
    I have done a pretty thorough research of flock & would be happy to
provide you with a script of mine that uses my findings...to answer your
question you need 'use Fcntl qw(:DEFAULT :flock);' in your script to import
the LOCK_xx functions,
        Michael
--
== CigarPool ==
http://www.cigarpool.com

"Geoff Soper" <g.soper@soundhouse.co.uk> wrote in message
news:4a18f0c2a3g.soper@soundhouse.co.uk...
> I'm having a problem with a script using flock()
> The error given is:
> can't lock file: Invalid argument at display.cgi line 168.
>
> Line 168 is:
> flock(EXPIRY, LOCK_EX) || die "can't lock file: $!";
>
> The script is called from
> http://www.soundhouse.co.uk/cgi-bin/news/display.cgi?org=rs
> and can be viewed as text at http://www.soundhouse.co.uk/geoff/display.txt
>
> I've taken my file locking from the perlopentut pages and can't for the
> life of me see what I've done wrong!
>
> Thanks
>
> --
> Geoff Soper
> g.soper@soundhouse.co.uk
> Take a look at the Soundhouse page http://www.soundhouse.co.uk/




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

Date: Mon, 6 Nov 2000 21:35:20 +1100
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: getopt doesn't seem work as expected
Message-Id: <slrn90d2b8.567.mgjv@martien.heliotrope.home>

On Sun, 05 Nov 2000 19:22:00 GMT,
	bwlang <bwlang@usa.net> wrote:
> I'm using Getopt:Long

Getopt::Long.

And why? You're using short names only. Don't be afraid to use the long
names here. You can still use short command line options. You just get
the added benefit of having long ones as well.

> $parsedopts = GetOptions('h' => \$usage,
>                         'd=s' => \$blastdb,
>                         'q' => \$quiet,
>                         'v' => \$verbose);

[snip, and reformat]

> When i call this program with no command line parameters $parsedopts
> comes back with a value of "1".  This does not make sense to me since
> the required argument "-d blastdbname" is required (as designated by
> the d=s bit).  Am I misunderstanding something?

I'm not sure what you expect. The d=s specifier only means that _if_ the
option -d is specified on the command line, that the next argument is
taken to be an argument to this option, and interpreted as a string. It
doesn't mean that the option has to be present. You're responsible for
making sure it is.

die "You HAVE to specify -d\n" unless $blastdb;

I thought all this was pretty clear in the documentation, but I might
just read it differently from you.  The documentation says:

[snip]
       = type [ desttype ]
           The option requires an argument of the given type.
           Supported types are:
[snip]

Oh, I see what you read. it doesn't say that the _program_ requires this
option. It says that this _option_ requires an argument (of specified
type).


Martien
-- 
Martien Verbruggen              | 
Interactive Media Division      | Useful Statistic: 75% of the people
Commercial Dynamics Pty. Ltd.   | make up 3/4 of the population.
NSW, Australia                  | 


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

Date: Mon, 6 Nov 2000 12:02:23 -0000
From: "jp" <jpmcgowan@ireland.com>
Subject: Google module help
Message-Id: <newscache$r7a73g$fvi$1@weblab.ucd.ie>

Hi,
I'm wondering if anyone who has used the Google.pm module has worked out a
way to retrieve more than 100 results from a search? I have tried to set
max_to_retrieve to be > 100 but this seems to have no effect.
I know I could just run the query url, but the module provides a lot of
useful parsing that I need.

By the way, has anyone else had this problem using other search engine
modules, e.g. AltaVista.pm, and solved it ?

Thanks for any help,
JP




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

Date: Mon, 06 Nov 2000 13:31:42 GMT
From: john prokopek <john_prokopek@instinet.com>
Subject: how to access object variables
Message-Id: <8u6bru$5be$1@nnrp1.deja.com>

I am just starting to use objects in perl and have been successful with
method invocations but I cannot seem to access an object's variable.

the following is a part of my code for the object. I would like to
access the state variable via $myboj->state. Is this possible and if so,
how?

thanks, I appreciate the help.

package TestMod;

use strict;
use Carp;
use vars qw($state $VERSION @ISA @EXPORT @EXPORT_OK);

require Exporter;

@ISA = qw(Exporter AutoLoader);
@EXPORT = qw(
	start stop
);
$VERSION = '0.01';

my %fields = (
		state => undef
		);

sub _initialize
{
	$state = "init";
}

sub new
{
	my $self = { %fields };
	bless $self;
	$self->_initialize();
	return $self;
}

# Preloaded methods go here.

sub start
{
	$state = "started";
	$state;
}

sub stop
{
	$state = "stopped";
	$state;
}

1;
__END__
# Below is the stub of documentation for your module. You better edit
it!

=head1 NAME

TestMod - Perl extension for blah blah blah

=head1 SYNOPSIS

  use TestMod;
  blah blah blah

=head1 DESCRIPTION

Stub documentation for TestMod was created by h2xs. It looks like the
author of the extension was negligent enough to leave the stub
unedited.

Blah blah blah.

=head1 AUTHOR

A. U. Thor, a.u.thor@a.galaxy.far.far.away

=head1 SEE ALSO

perl(1).

=cut

--
----------------------------------------------------------------
john prokopek
john_prokopek@instinet.com
Instinet.com


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Sun, 5 Nov 2000 17:18:42 +0000
From: James Taylor <james@NOSPAM.demon.co.uk>
Subject: Re: how to make $ARGV[0] numeric
Message-Id: <ant0517420b0fNdQ@oakseed.demon.co.uk>

In article <u$vQAWzRAHA.283@net003s>, dick dijk
<URL:mailto:ddijk@hetnet.nl> wrote:
> Does anyone know how to make a commandline argument
> (like $ARGV[0]) numeric, so that you can use it in
> "$a = pack("n", $ARGV[0])"?

Works for me:

----------------
#!perl -w
use strict;

my $a = pack("n", $ARGV[0]);
my $b = unpack 'n', $a;
print $b, "\n";
----------------

prompt> testprog 1234
1234

Of course if you don't supply a numeric argument:

prompt> testprog hello
Argument "hello" isn't numeric in pack at testprog line 4.
0

 ...you get a warning, and it is interpreted as zero.

-- 
James Taylor <james (at) oakseed demon co uk>
PGP key available ID: 3FBE1BF9
Fingerprint: F19D803624ED6FE8 370045159F66FD02



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

Date: Mon, 06 Nov 2000 11:56:57 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: i'm new. will someone direct me?
Message-Id: <ag0d0tkoks32njqacqc5d4enk45jm3fadm@4ax.com>

rpark4 wrote:

>I would really really like to break into the whole perl/CGI thing. but i
>don't know anything about where to start.
>
>Does anyone know of a place where i can get a tutorial or any help on how to
>get something started and what i need to start writing scripts and making
>them work.

You have to know that CGI is a protocol, an interface between the web
server and a program on the server machine. That interface is based upon
the HTTP protocol, the means of communication between the web server and
the browser; and that, in turn, is based upon the mechanism behind
simple e-mail: first you have the headers, a number of lines, each
consisting name and value pairs separated by a colon (plus space). Then,
the body. Headers and body are separated by an empty line.

Now, for most part, the web server will simply transmit the headers it
gets back from the CGI script (via STDOUT) to the browser, but it can
also fill in some blanks, things the script left out. Some parts are
vital: if you leave one of those out, the webserver will complain (to
the browser) and say "premature end of scipt headers".

Perl is just one language in which you can implement CGI scripts.

That's the basics. Now, for web oriented tutorials, you might want to
check out WebMonkey, which provides some good intro's for the clueless.
See <http://hotwired.lycos.com/webmonkey/>.

For Perl, reading the Llama book ("Learning Perl", Randal L. Schwartz)
is the easier way. I found the learning curve far too steep if using
only the online docs and/or the Camel book.

For the more advanced cool CGI tricks, check out Randal Schwartz'
(again) Web Techniques columns, which are also available online:
<http://www.stonehenge.com/merlyn/WebTechniques/>.

-- 
	Bart.


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

Date: Mon, 6 Nov 2000 12:52:39 +0100
From: "Dr. Peter Dintelmann" <Peter.Dintelmann@dresdner-bank.com>
Subject: Re: kill on Win32
Message-Id: <8u6632$o3d1@intranews.bank.dresdner.net>

    Hi Bill,

Bill Hess schrieb in Nachricht ...
>I am using Standard Perl I built myself 5.005_03 and am trying to kill
>processes given a process ID
>Below are two simple scripts to demo what I am trying to do - the first
gets
>the process ID and loops forever and the second justs performs the kill
>function in Perl.  I run the first and it tells me what the PID is and
then
>run the other in another shell and supply the PID as the first arg.  I
get
>the following message after running Script 2:
>
>kill process failed!
>
>How can I kill the process from Perl???

    for the details of kill() on Win32 have a look at
    the 'perlport' page.
    The NT resource kit comes with a kill.exe executable
    which you can use together with system() to kill
    processes.

    Best regards,

        Peter Dintelmann






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

Date: Mon, 06 Nov 2000 12:48:08 +0100
From: "Eirik Johansen [netmaking.com]" <eirik@netmaking.com>
Subject: Listing X items on each page
Message-Id: <3A069A78.2D922887@netmaking.com>

Hi,

I have a directory that contains images, named "1.gif", "2.gif"
and so on. I'm constanly adding new images, and have therefore
been thinking about automating the process of displaying these
images on a web page. Here's is what I'm struggeling to find out
how to do:

I want to display the images on one page. However, if there are
more than 8 pages in the directory, I want the next 8 images to
go on the next page, and I want a link that takes me to that page
containing the rest of the images. This continues until there are
no images left. I'm also trying to find out how to make a "back"
link on page 2 and upwards.

I guess this is very similar to search engines displaying for
instance 20 results at a time, only that I need it with pictures.

Is there anyone who would be as kind as to give me a brief
explanation of how the coding for this would be, and perhaps even
gime in an example.

Thanks in advance !

Best Regards,

Eirik Johansen



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

Date: Mon, 06 Nov 2000 06:09:21 GMT
From: <danny@lennon.postino.com>
Subject: Re: network security
Message-Id: <8u5hrk$2mi$1@lennon.postino.com>

smittod@auburn.edu wrote:
> I'm pretty good with perl in general, but I want to get myself ready to
> interview for a job with a company that deals with network security,
> hacking detection and prevention, and things like that. The only job
> requirements were a lot of experience with perl and understanding of
> tcp/ip. Can anyone help me determine what I need to study? I've got the
> perl down, but where do I go to learn how to use perl in conjunction
> with network security and things this company would need? (I don't want
> to ask them because I want to look like I know all about the job). A
> long time ago I bought the book "Teach yourself TCP/IP in 14 days," but
> it doesn't ever talk about scripting, just setting up networks. What
> should I do?

It is pretty hard to guess what they are using perl for. If they
are doing the tcp/ip stuff with perl, you might want to try testing
out some of the Net:: perl modules. Net::Ping, Socket, Telnet , SMTP,
Pop , etc, will give you some experience with these services over IP. 

-- 
Danny Aldham     Providing Certified Internetworking Solutions to Business
www.postino.com  E-Mail, Web Servers, Web Databases, SQL PHP & Perl


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

Date: Mon, 06 Nov 2000 13:37:24 GMT
From: spcman@my-deja.com
Subject: Passing Hash to Perl Module Update
Message-Id: <8u6c6j$5n4$1@nnrp1.deja.com>

What im trying to do is pass the %INFO hash from test.cgi over to
template.pm.  When I try to receive the hash in template.pm, i receive
different values.


################## Code for Test.cgi #######################

#!/usr/local/bin/perl
use template;

$Location = "test.template";
$INFO{'name'} = "Joe Schmoe";
$INFO{'address'} = "123 Lucky Lane";
$INFO{'city'} = "Anytown";
$INFO{'state'} = "XY";
$INFO{'zip'} = "12345";

print "Content-Type: text/html\n\n";

$RunTemplate = New template;
$RunTemplate -> SetVariables(\%INFO);

################# Code for Template.pm ######################
package template;

sub New {
my $class = shift;                  #Not sure what this code
my %baseHtml = ();                  #Does yet, havent reverse
bless \%baseHtml, $class;           #Enginereed it.
return \%baseHtml
}

sub SetVariables {
  my(%hash) = @_;
  foreach $key (keys %hash) {
  print "$key value: $hash{$key}<BR><BR>";    #Look at output below   }
}

1;


#########OUTPUT##########
template=HASH(0x80cb024) value: HASH(0x80bbec4)
#########OUTPUT##########









Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: 6 Nov 2000 06:10:34 GMT
From: ebohlman@omsdev.com (Eric Bohlman)
Subject: Re: Performance/scaleablility question:  Perl/CGI vs. Java Servlets?
Message-Id: <8u5i0q$2ajc$2@news.enteract.com>

David Sisk <davesisk@ipass.net> wrote:
> I'm a Perl newbie, and I'm prototyping a CGI app in Perl.  From everything
> I've read, Perl performs almost as well as C for lots of things (and I'm
> assuming that this applies to CGI apps as well as non-CGI Perl programs).
> I've learned enough to know that if the CGI script is hosted on Apache with
> the mod_perl extension installed, then performance under heavy use (lots of
> concurrent users) should be pretty good.

> A friend keeps telling me that I should be creating this as Java Servlets
> instead of Perl because Java will scale much better for a large number of
> concurrent users.  I've had a Java class, but I wouldn't know where to start
> writing this app in Java.  So, I plan to continue writing it in Perl at the
> moment.  My thought is that Perl has proven itself for server-side Internet
> apps (among many other things), and I'm not convinced that Java has.  Plus
> if the popularity of the app really takes off, then I should have a revenue
> stream available to get help converting it to Java if necessary.  Finally, I
> think it will be much easier to find a hosting provider to run this app
> under Perl as compared to Java.

> Since Perl and Java both "manage memory" for you, is there any objective
> data about which one does it more efficiently for large numbers of
> concurrent users in this particular context?

That question isn't even answerable without a *lot* more detail regarding
the specific application involved.  In some circumstances, mod_perl will
be more efficient; in others, servlets will be more efficient.  If you're
doing something like selling Backstreet Boys tickets where quick
processing is essential, then you'll need to do some very in-depth
analysis.  For more mundane applications, any efficiency differences
between languages/deployment modes are likely to be relatively small, and
the decision should be driven by factors like the availability of
developer expertise; it seems like mod_perl is likely to win in your
situation.



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

Date: Mon, 6 Nov 2000 13:06:25 -0000
From: "Ed Whittaker" <edward_whittaker@bigfoot.com>
Subject: perl gallery script
Message-Id: <8u6acn$ao$1@news.swan.ac.uk>

Hi,

I am looking for a perl script to improve the running of a photo gallery at
www.swan.ac.uk/AU/hiking (see photos).  The ideal script would be free,
generate thumbs (ideal but not essential), be easy to run, annotate images
and be able to sort / search due to the number of images.

Ed.




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

Date: Sun, 05 Nov 2000 23:32:20 -0700
From: Daniel Cuaron <dcuaron@cs.nmsu.edu>
Subject: Problems executing C program through perl via web
Message-Id: <3A065073.44C634C4@cs.nmsu.edu>


Here's a snippet of code I'm having a problem with:

#!/local/perl/bin/perl

 print "Content-type:text/html\n\n";
print "<HTML><BODY> blah ";

$var=`ls`;
print "$var";

$outputcatch = ` ../code/cgitestparse  ../code/input.txt   `;
print "$outputcatch";



$sitedata="output/output.txt";

open(DAT,">$sitedata") || die("Cannot Open File");

print DAT "$outputcatch $outputcatch";

print "test</BODY> </HTML> ";


close(DAT);


On the shell, it runs fine, yet when I run it via Netscape, the output
is blank.

the file permissions for output/output.txt is (chmod 777)

the cgi runs, through chmod 755.

the executable itself is also chmod 755.

Is this a protection from the server that I can't get around?   Are
there servers that can support this (FREE!!)?  Am I a stupid piece of
shit?



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

Date: 06 Nov 2000 11:17:47 GMT
From: enjoyer@aol.com (Enjoyer)
Subject: read last line only...
Message-Id: <20001106061747.10783.00000001@ng-md1.aol.com>

I'm trying to read the last line of a file only, using print, any ideas ?

Thanks,
Diavlo3


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

Date: 6 Nov 2000 05:49:33 -0600
From: logan@cs.utexas.edu (Logan Shaw)
Subject: Re: read last line only...
Message-Id: <8u65sd$14l$1@provolone.cs.utexas.edu>

In article <20001106061747.10783.00000001@ng-md1.aol.com>,
Enjoyer <enjoyer@aol.com> wrote:
>I'm trying to read the last line of a file only, using print, any ideas ?

You're not going to have much reading lines of any kind with print.

However, if you're asking how to print the last line of a file, then
it's fairly easy:

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

	my $last;

	while (<>)
		{ $last = $_; }
	
	if (defined $last)
		{
		chomp $last;
		print "The last line was '$last'.\n";
		}
	else
		{
		print "There doesn't appear to have been any input.\n";
		}

Hope that helps.

  - Logan


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

Date: Mon, 6 Nov 2000 22:55:07 +1100
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: read last line only...
Message-Id: <slrn90d70r.567.mgjv@martien.heliotrope.home>

On 06 Nov 2000 11:17:47 GMT,
	Enjoyer <enjoyer@aol.com> wrote:
> I'm trying to read the last line of a file only, using print, any ideas ?

You don't use print to read a line from a file. You use readline, or the
diamond operator.

If you're on Unix

my $last_line = `tail -1 $file`;

Otherwise:

open(FILE, $file) or die $!;

# If the file is small
my $last_line = (<FILE>)[-1];
# or
my ($last_line) = reverse <FILE>;

# If the file is larger:
my $last_line;
while(<FILE>) { $last_line = $_ }

# If the file is large
use File::ReadBackwards;
my $fbw = File::ReadBackwards->new($file) or die $!;
my $last_line = $fbw->readline;

or you can write stuff with seek and such that does what the
abovementioned module does.

maybe this should be added to the FAQ.

Martien
-- 
Martien Verbruggen              | 
Interactive Media Division      | For heaven's sake, don't TRY to be
Commercial Dynamics Pty. Ltd.   | cynical. It's perfectly easy to be
NSW, Australia                  | cynical.


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

Date: Mon, 6 Nov 2000 00:30:08 -0600
From: "Dale Emmons" <dale@emmons.dontspamme.com>
Subject: Re: Where does a core dump come from?
Message-Id: <t0cjufomhvo253@corp.supernews.com>

> In summary, Unix was TQM when TQM
> wasn't cool.

Just curious... what does TQM mean? Total Quality Managment?

-Dale





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

Date: Mon, 6 Nov 2000 21:41:29 +1100
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: Where to find IO/Pty.pm?
Message-Id: <slrn90d2mp.567.mgjv@martien.heliotrope.home>

[In the future, please, don't crosspost between clp.misc and
clp.modules. If your question is specific enough for clp.modules, it
doesn't belong on clp.misc]
[F'ups to clp.modules only]

On Mon, 06 Nov 2000 11:42:51 +0100,
	Ulrich Ackermann <uackermann@orga.com> wrote:
> Hi all,
> I am trying to install the Crypt-PGP5 module (Version 1.37) I got from
> CPAN. After having installed the required modules Time/HiRes.pm and
> Expect.pm I there is still the IO/Pty.pm module missing. I have not
> found that one on CPAN. Does anybody know where to get it?

# perl -MCPAN -e shell
cpan> i IO::Pty
Module id = IO::Pty
    DESCRIPTION  Methods for pseudo-terminal allocation etc
    CPAN_USERID  GBARR (Graham Barr <gbarr@pobox.com>)
    CPAN_VERSION 0.01
    CPAN_FILE    G/GB/GBARR/IO-Tty-0.04.tar.gz
    DSLI_STATUS  cdpO (pre-alpha,developer,perl,object-oriented)
    MANPAGE      IO::Pty - Pseudo TTY object class
    INST_FILE    /opt/perl/lib/site_perl/5.6.0/i686-linux/IO/Pty.pm
    INST_VERSION 0.01
cpan>

How hard did you look? http://search.cpan.org/ also gives the answer. So
does google.

Martien
-- 
Martien Verbruggen              | 
Interactive Media Division      | For heaven's sake, don't TRY to be
Commercial Dynamics Pty. Ltd.   | cynical. It's perfectly easy to be
NSW, Australia                  | cynical.


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

Date: 6 Nov 2000 12:46:56 +0200
From: harth@rz.uni-frankfurt.de (Alexander Harth)
Subject: win32 net send perl interface?
Message-Id: <3a069a30$1@nntp.server.uni-frankfurt.de>

Hi all,
i did a research in CPAN and DEJA, but didnt find a solution to
my problem. Is there any perl-module or method to do a NET SEND
ind windows NT? Of course i am aware of the possibility to use
system, but i hope to do it on a more direct way.

Yours
Alexander


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

Date: Mon, 06 Nov 2000 07:40:41 -0500
From: H C <carvdawg@patriot.net>
Subject: Re: win32 net send perl interface?
Message-Id: <3A06A6C9.19D70571@patriot.net>

You want either Win32::Message (Dave Roth's site, http://www.roth.net)
or
Win32::Lanman, available on CPAN under Jens Helberg...

Alexander Harth wrote:

> Hi all,
> i did a research in CPAN and DEJA, but didnt find a solution to
> my problem. Is there any perl-module or method to do a NET SEND
> ind windows NT? Of course i am aware of the possibility to use
> system, but i hope to do it on a more direct way.
>
> Yours
> Alexander

--
Q: Why is Batman better than Bill Gates?
A: Batman was able to beat the Penguin.




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

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 V9 Issue 4820
**************************************


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