[25551] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 7795 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Feb 17 18:10:47 2005

Date: Thu, 17 Feb 2005 15:10:39 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Thu, 17 Feb 2005     Volume: 10 Number: 7795

Today's topics:
    Re: Mod_perl: can I share a database connection by putt <nospam@noglory.net>
        Newbie Perl programming help (RSS & IRC) <cmw@tulpje.co.uk>
    Re: Newbie Perl programming help (RSS & IRC) <matternc@comcast.net>
    Re: Newbie Perl programming help (RSS & IRC) <spamtrap@dot-app.org>
        Perl script timeout problem (sipitai)
    Re: Perl script timeout problem <nobull@mail.com>
    Re: Perl script timeout problem <nospam@bigpond.com>
        Reading compressed file and its conversion to numbers. <synthesp@satori.mind.info>
    Re: Reading compressed file and its conversion to numbe <jl_post@hotmail.com>
    Re: Reading compressed file and its conversion to numbe <jl_post@hotmail.com>
    Re: regexp: read ip address <1usa@llenroc.ude.invalid>
    Re: SET Operations in Perl <djberg96@hotmail.com>
        The Perl Review, Spring 2005 <comdog@panix.com>
        use strict; and O_WRONLY <ax178@wp.pl>
    Re: use strict; and O_WRONLY <1usa@llenroc.ude.invalid>
    Re: use strict; and O_WRONLY <nobull@mail.com>
    Re: use strict; and O_WRONLY <noreply@gunnar.cc>
    Re: use strict; and O_WRONLY <spamtrap@dot-app.org>
    Re: use strict; and O_WRONLY (Anno Siegel)
    Re: what is Perl state of the art? <spamtrap@dot-app.org>
    Re: what is Perl state of the art? <mritty@gmail.com>
    Re: what is Perl state of the art? <postmaster@castleamber.com>
    Re: what is Perl state of the art? <matternc@comcast.net>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Thu, 17 Feb 2005 16:48:22 +0100
From: Oliver Green <nospam@noglory.net>
Subject: Re: Mod_perl: can I share a database connection by putting it in the   startup-script?
Message-Id: <4214bc7b$0$28983$e4fe514c@news.xs4all.nl>

Keith Keller wrote:
> 1) Install Apache::DBI for your version of mod_perl, and carefully read
> its documentation.

Thank you all for responding. I've installed Apache::DBI and
performance is sufficient for now. I'll rewrite parts of the
application to make better use of mod_perl, but as said, it
works for now.

Oliver


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

Date: 17 Feb 2005 12:18:21 -0800
From: "Chris" <cmw@tulpje.co.uk>
Subject: Newbie Perl programming help (RSS & IRC)
Message-Id: <1108671501.570109.239560@z14g2000cwz.googlegroups.com>

I am new to perl. and have got stuck on a error that occurs in my
program. The error that i get is the following

~/test]# perl girbot.pl
Global symbol "$latest" requires explicit package name at girbot.pl
line 148.
Global symbol "$rss" requires explicit package name at girbot.pl line
151.
Global symbol "$latest" requires explicit package name at girbot.pl
line 159.
Execution of girbot.pl aborted due to compilation errors.


My program looks like this. The bit that i am having problems with is
the bit that generates the rss file. Also i am not exactly sure if my
regex are corrent. In theory they should search for ed2k:// in $arg and
if it is found, save $arg to the rss file. When I get it working i will
use substr to just pull out the ed2k:// link. But first i have to get
around those nast errors that are above.

can anybody help?

thanks
chris


#!/usr/bin/perl

# Usage: perl girbot.pl <config file, optional>
# <setting>=<value>

use strict;
use Net::IRC;
use XML::RSS;



sub GetSetting
{
  my ($setting,$config_file)=@_;
  open(CFGFILE,"<$config_file")
    or die "Can't open configuration file ($config_file)";
  my @slist=<CFGFILE>;
  foreach my $selem (@slist)
  {
    if (index($selem,"#")==0) { next; }
    my @ln=split("=",$selem);
    if ($ln[0] =~ /$setting/i)
    {
        chomp $ln[1];
        return $ln[1];
    }
  }
  close CFGFILE;
}

# =============
# MAIN BOT CODE
# =============

# Set our configuration file
my $configuration_file = "gir.cfg";
# You can start the bot with a config file as a
# commandline argument.  Without the argument,
# the bot loads its settings from "gir.cfg", in
# the same directory as the bot.
if($#ARGV==0) { $configuration_file=$ARGV[0]; }
# Now, we can load in our script's settings
my $cfg_nick=GetSetting("nick",$configuration_file);
my $cfg_altnick=GetSetting("altnick",$configuration_file);
my $cfg_ident=GetSetting("ident",$configuration_file);
my $cfg_port=GetSetting("port",$configuration_file);
my $cfg_server=GetSetting("server",$configuration_file);
my $cfg_channel=GetSetting("channel", $configuration_file);
# Just about all of the settings are "strings", except
# for the "port".  Let's make sure that that setting
# is numerical, and if not, set it to the most common
# port, 6667:
if($cfg_port=~/\D/) { $cfg_port=6667; }

# Now that all of our settings are loaded in,
# let's create the IRC object
my $irc = new Net::IRC;
print "Creating connection to IRC server...";
my $conn = $irc->newconn(Server   => "$cfg_server",
             Port     => $cfg_port,
             Nick     => "$cfg_nick",
             Ircname  => "$cfg_ident",
             Username => "$cfg_ident")
    or die "Can't connect to IRC server.";
print "done!\n";
$conn->{channel} = '#sonic';
# With that out of the way, let's create
# some subs for our object handlers

# What our bot will do when it finishes
# connecting to the IRC server
sub on_connect {
    my $self = shift;
    print "*** Connected to IRC.\n";
    $conn->join("$cfg_channel");
    print "*** Joined Channel: $cfg_channel.\n";
}
# This sub will print various
# incoming date while we're still
# connecting to IRC
sub on_init {
    my ($self, $event) = @_;
    my (@args) = ($event->args);
    shift (@args);

    print "*** @args\n";
}
# This sub will handle what happens when the
# bot receives public (channel) text.
sub on_public {
    my ($self, $event) = @_;
    my @to = $event->to;
    my ($nick, $mynick) = ($event->nick, $self->nick); # Sender text,
Bot nick
    my $host=$event->host; # Sender's hostname
    my ($arg) = ($event->args); # The message

    # Here's where we want to "parse" channel text
    print "<$nick> $arg\n";

    if ($nick eq "eZebra" && $arg=~m/ed2k:\/\//i)
    {
        if ($latest == 1)
        {
        #&add_ed2k();
        $rss->add_item(
            link		=>	'$arg'
        );
        }
    }

    if ($nick eq "eZebra" && $arg=~m/--- Latest links: ---/i)
    {
        if ($latest != 1)
        {
            my $latest = 1;
            #&start_rss();
            my $rss = new XML::RSS(version => '0.91');
            $rss->channel(
                title		=>	'Test RSS Feed',
                link		=>	'irc://irc.efnet.net/test',
		description	=>	'Toast'
	    );
        }
    }

    if ($nick eq "eZebra" && $arg=~m/------/i)
    {
        #&end_rss();
        my $latest = 0;
        rss->save("~/feed.rss");
    }


}
# This sub will handle what happens when the
# bot receives private message text
sub on_msg {
    my ($self, $event) = @_;
    my ($nick) = $event->nick; # Message Sender
    my ($arg) = ($event->args); # Message Text
    my $host=$event->host;

    # Here's where we want to "parse" message text
    print " - $nick -  $arg\n";

}
# This sub will get triggered if our bot's nick
# is taken, setting it to our alternate nick.
sub on_nick_taken {
    my ($self) = shift;

    $self->nick($cfg_altnick);
}

sub on_join {

	# get our connection object and the event object, which is passed
	# with this event automatically
	my ($conn, $event) = @_;

	# this is the nick that just joined
	my $nick = $event->{nick};
	# say hello to the nick in public
	$conn->privmsg($conn->{channel}, "Hello, $nick!");
	if ($nick = "testuser")
	{
	   $conn->mode('#sonic', '+o', 'testuser');
	   print "*** Modifying $nick Mode to: +o\n";
	}
}

# Now that all of our handler subs are created,
# let's install them
print "Installing local handlers...";
$conn->add_handler('public', \&on_public);
$conn->add_handler('msg',    \&on_msg);
$conn->add_handler('join', \&on_join);
print "done!\nInstalling global handlers...";
$conn->add_global_handler([ 251,252,253,254,302,255 ], \&on_init);
$conn->add_global_handler([376, 422], \&on_connect);
$conn->add_global_handler(433, \&on_nick_taken);

print "done!\n";
# Everything's installed, so there's nothing
# holding up back from starting up!
$irc->start;



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

Date: Thu, 17 Feb 2005 16:11:40 -0500
From: Chris Mattern <matternc@comcast.net>
Subject: Re: Newbie Perl programming help (RSS & IRC)
Message-Id: <pZidnYo29dsTlYjfRVn-qg@comcast.com>

Chris wrote:

> I am new to perl. and have got stuck on a error that occurs in my
> program. The error that i get is the following
> 
> ~/test]# perl girbot.pl
> Global symbol "$latest" requires explicit package name at girbot.pl
> line 148.
> Global symbol "$rss" requires explicit package name at girbot.pl line
> 151.
> Global symbol "$latest" requires explicit package name at girbot.pl
> line 159.
> Execution of girbot.pl aborted due to compilation errors.
> 
A cursory look at your code reveals that you attempt to use $rss and
$latest before you declare them with "my".  Can't do that.  Also remember
that if you declare a variable with my inside a {} block, the variable
does not exist anywhere *outside* of that block.  Oh, and use warnings.

-- 
             Christopher Mattern

"Which one you figure tracked us?"
"The ugly one, sir."
"...Could you be more specific?"


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

Date: Thu, 17 Feb 2005 16:21:45 -0500
From: Sherm Pendley <spamtrap@dot-app.org>
Subject: Re: Newbie Perl programming help (RSS & IRC)
Message-Id: <od6dnXBi_s12l4jfRVn-2w@adelphia.com>

Chris wrote:

> I am new to perl. and have got stuck on a error that occurs in my
> program. The error that i get is the following
> 
> Global symbol "$latest" requires explicit package name at girbot.pl
> line 148.

 ... snip ...

>     if ($nick eq "eZebra" && $arg=~m/ed2k:\/\//i)
>     {
>         if ($latest == 1)

There's no variable named $latest in scope here


>         {
>         #&add_ed2k();

Why do you want to disable prototypes when you call add_ed2k()? (If you
don't understand what prototypes are, or why I asked that question, have a
look at "perldoc perlsub".)

> Global symbol "$rss" requires explicit package name at girbot.pl line
> 151.

>         $rss->add_item(

There's no variable named $rss in scope here

>             link              =>      '$arg'

$arg will not interpolate here, because you've used single quotes. (If
you're thinking of using double quotes instead, have a look at "perldoc -q
always".)

> Global symbol "$latest" requires explicit package name at girbot.pl
> line 159.

>         if ($latest != 1)

Same thing here - there's no $latest variable in scope here. Also...

>         {
>             my $latest = 1;

If there *were* a $latest variable already, this declaration would mask it
by creating one that's visible only within this block.

>             #&start_rss();
>             my $rss = new XML::RSS(version => '0.91');
>             $rss->channel(
>                 title         =>      'Test RSS Feed',
>                 link          =>      'irc://irc.efnet.net/test',
> description   =>      'Toast'
> );
>         }
>     }
> 
>     if ($nick eq "eZebra" && $arg=~m/------/i)
>     {
>         #&end_rss();
>         my $latest = 0;
>         rss->save("~/feed.rss");
>     }

You have the same problem(s) here - the $latest you declare here will mask
any $latest that happens to exist in the enclosing block. And, because
you've declared $rss in a smaller block than the one where it's used, it
won't be visible here.

Variables need to be declared in the smallest scope that allows them to be
visible wherever they're needed - but no smaller. For example, let's
suppose you have a variable $foo, that needs to be visible from within an
entire sub, which has two loops. You'd need to declare it inside the sub,
but *outside* of the two loops, like this:

sub do_something {
    my $foo;
    foreach (@bar) {
        # do something with $foo...
    }
    foreach (@baz) {
        # do something else with $foo
    }
}

You only need to declare each variable once. If you think you need to
re-declare a variable because you're getting "Global symbol requires
package" errors like the above, it could be because the variable has gone
out of scope. For example:

sub do_something {
    foreach (@bar) {
        my $foo = 'bleh';
    }
    foreach (@baz) {
        my $oops = $foo;    # <--- This will cause an error, because
                            #      the $foo created above was valid only
                            #      within that block, and no longer exists
                            #      in this one
    }
}

Simply adding a "my $foo" to declare a new $foo variable inside the second
loop is not the correct solution in this instance. Instead, you need to
move the "my $foo" declaration up to a higher-level block, so that it's
visible to all the code that uses it, like in the first example.

sherm--

-- 
Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org


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

Date: 17 Feb 2005 09:53:00 -0800
From: sipitai@hotmail.com (sipitai)
Subject: Perl script timeout problem
Message-Id: <76360ac4.0502170953.dc13846@posting.google.com>

Hi everyone,

I have written a Perl script that allows a user to download a file,
but only if they have a valid key to download that file.

The idea being that instead of the user just clicking on a link to
download a file (i.e. http://www.domain.com/file.zip), they click on a
link to the script, which contains the file name and the key (i.e.
http://www.domain.com/script.cgi/xxxxx/file.zip with xxxxx being the
key), and if the key is valid, the script sends back the file for them
to download, otherwise it blocks the request.

Which all works fine, the problem im running into is that the file
download is timing out after 300 seconds. More specifically, if the
file takes longer than 300 seconds to download, regardless of how many
KB's have been downloaded, or how many KB/sec it is transferring at,
the file stops downloading and displays "Download Complete".

Its worth noting that the amount of time it takes to timeout is
directly related to the Timeout value in the /etc/apache/httpd.conf
file, for example if I change it to 30 seconds then the file download
times out in 30 seconds, etc.

From what I can tell the server doesnt appear to recognise that the
script is still running, and is closing the connection. But then again
that's just my assumption based on what ive seen so far.

So having said all that, does anyone know how to fix this problem?

Without modifying the /etc/apache/httpd.conf Timeout value that is.

Thanks!


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

Date: Thu, 17 Feb 2005 18:07:06 +0000
From: Brian McCauley <nobull@mail.com>
Subject: Re: Perl script timeout problem
Message-Id: <cv2m61$iqo$1@sun3.bham.ac.uk>



sipitai wrote:
> I have written a Perl script that allows a user to download a file,
> but only if they have a valid key to download that file.
> 
> The idea being that instead of the user just clicking on a link to
> download a file (i.e. http://www.domain.com/file.zip), they click on a
> link to the script, which contains the file name and the key (i.e.
> http://www.domain.com/script.cgi/xxxxx/file.zip with xxxxx being the
> key), and if the key is valid, the script sends back the file for them
> to download, otherwise it blocks the request.
 >
> Which all works fine, the problem im running into is that the file
> download is timing out after 300 seconds. More specifically, if the
> file takes longer than 300 seconds to download, regardless of how many
> KB's have been downloaded, or how many KB/sec it is transferring at,
> the file stops downloading and displays "Download Complete".
> 
> Its worth noting that the amount of time it takes to timeout is
> directly related to the Timeout value in the /etc/apache/httpd.conf
> file, for example if I change it to 30 seconds then the file download
> times out in 30 seconds, etc.
> 
> From what I can tell the server doesnt appear to recognise that the
> script is still running, and is closing the connection. But then again
> that's just my assumption based on what ive seen so far.
> 
> So having said all that, does anyone know how to fix this problem?

I shall assume this is a stealth CGI question.

Also, this does not appear to be a Perl question at all.

Ask yourself this: Would you expect the answer to be any different if 
your CGI script were in python, C, pasacal, bash...?

There are newgroups that deal with CGI, you know.

> Without modifying the /etc/apache/httpd.conf Timeout value that is.

Do not have the script send the file.  Have it perform an internal 
redirect to the file.  You may or may not be able to configure your web 
server to prevent people bypassing the script but even if you can't you 
can just make sure that the directory name is obscure.

This not only will fix your problem but has other benefits that are OT 
in this newsgroup.  However there's usually at least one thread 
discussing this at any given time in the CGI newsgroups.



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

Date: Fri, 18 Feb 2005 05:10:44 +1000
From: Gregory Toomey <nospam@bigpond.com>
Subject: Re: Perl script timeout problem
Message-Id: <37k8hoF5fqtlqU1@individual.net>

sipitai wrote:

> Hi everyone,
> 
> I have written a Perl script that allows a user to download a file,
> but only if they have a valid key to download that file.
> 
> The idea being that instead of the user just clicking on a link to
> download a file (i.e. http://www.domain.com/file.zip), they click on a
> link to the script, which contains the file name and the key (i.e.
> http://www.domain.com/script.cgi/xxxxx/file.zip with xxxxx being the
> key), and if the key is valid, the script sends back the file for them
> to download, otherwise it blocks the request.
> 
> Which all works fine, the problem im running into is that the file
> download is timing out after 300 seconds. More specifically, if the
> file takes longer than 300 seconds to download, regardless of how many
> KB's have been downloaded, or how many KB/sec it is transferring at,
> the file stops downloading and displays "Download Complete".
> 
> Its worth noting that the amount of time it takes to timeout is
> directly related to the Timeout value in the /etc/apache/httpd.conf
> file, for example if I change it to 30 seconds then the file download
> times out in 30 seconds, etc.

So fix httpd.conf  Why bother us.

# Timeout: The number of seconds before receives and sends time out.
Timeout 1800

# KeepAlive: Whether or not to allow persistent connections (more than
# one request per connection). Set to "Off" to deactivate.
KeepAlive On

> From what I can tell the server doesnt appear to recognise that the
> script is still running, and is closing the connection. But then again
> that's just my assumption based on what ive seen so far.
> 
> So having said all that, does anyone know how to fix this problem?
> 
> Without modifying the /etc/apache/httpd.conf Timeout value that is.

Err, why?
gtoomey


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

Date: 17 Feb 2005 15:32:36 -0200
From: Henry Lenzi <synthesp@satori.mind.info>
Subject: Reading compressed file and its conversion to numbers.
Message-Id: <87650rqeh7.fsf@satori.mind.info>


Hi All --

 I have some questions related to text compression and fonts.
 If I use a shell, like this

$ gzip < f1.txt > TEST1

 and the read the file

$ cat TEST1

 It apears like this (ANSI extended charset -hope you can see this):

;Â0D??åð?(?HV,ëàQ*DAqÿSôæÍ\±Ì1|"ßs
AT=yy?¸Ô|Á;®e©¨ÂèØ®°\ æÝTÏ*¹µ¨¯fÊÑhFÖŻܡR$ÚºïÛY½=ãå9ñöa»Û¯«+R      %(Óc NEzýmUl ~{EöÎýñ§É$

 Great! I wanted that! But if I try to use zip with perl:

#!/usr/bin/perl
use warnings;
use strict;


my $source = shift @ARGV;
#my $destination = shift @ARGV;

open IN, $source;
#open OUT, "|gzip  > $destination";
open OUT, "|gzip  > ./TEST";
close IN;
close OUT;

 then I can't cat the file. Nothing appears, because it's compressed.
 I can do it with the shell, but can't do with perl.
 Why is that? What must I do?

2) Regarding the compressed string:

;Â0D??åð?(?HV,ëàQ*DAqÿSôæÍ\±Ì1|"ßs
AT=yy?¸Ô|Á;®e©¨ÂèØ®°\ æÝTÏ*¹µ¨¯fÊÑhFÖŻܡR$ÚºïÛY½=ãå9ñöa»Û¯«+R      %(Óc NEzýmUl ~{EöÎýñ§É$

 Is there a way to read it and obtain the ANSI extended charset hexadecimal _numbers_?
 For instance, the above line would display:

3B C2 4F etc... 

 I have attempted this:

#!/usr/bin/perl
use warnings;
use strict;
use utf8;

my $source = shift @ARGV;
my $destination = shift @ARGV;

open (IN, "< $source");

my @array = unpack("C*", $source);

print "@array,\n";

close IN;

 but the result is that it won't read the _content_ of the file.

$ perl prog.pl TEST1
84 69 83 84 49,

 What is the issue here?
 
 Any help is greatly appreciated.
 
  Henry



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

Date: 17 Feb 2005 11:56:43 -0800
From: "jl_post@hotmail.com" <jl_post@hotmail.com>
Subject: Re: Reading compressed file and its conversion to numbers.
Message-Id: <1108670203.805391.136500@g14g2000cwa.googlegroups.com>

Henry Lenzi wrote:
>
>  But if I try to use zip with perl:
>
> #!/usr/bin/perl
> use warnings;
> use strict;
>
>
> my $source = shift @ARGV;
> #my $destination = shift @ARGV;
>
> open IN, $source;
> #open OUT, "|gzip  > $destination";
> open OUT, "|gzip  > ./TEST";
> close IN;
> close OUT;


Is this your whole program?  If so, you're not sending anything to the
OUT filehandle.  Therefore, I'd be surprised if anything at all gets
written to ./TEST .

Try adding the line "print OUT <IN>;" before your close() statements
and see if that fixes anything.

Another tip:  Try adding " or die $!;" after your open() statements in
case they are the reason your program isn't doing what you'd expect.



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

Date: 17 Feb 2005 15:00:30 -0800
From: "jl_post@hotmail.com" <jl_post@hotmail.com>
Subject: Re: Reading compressed file and its conversion to numbers.
Message-Id: <1108681230.099112.154370@o13g2000cwo.googlegroups.com>

Henry Lenzi wrote:
>
>  Is there a way to read it and obtain the ANSI extended
> charset hexadecimal _numbers_?
> For instance, the above line would display:
>
> 3B C2 4F etc...
>
>  I have attempted this:
>
> #!/usr/bin/perl
> use warnings;
> use strict;
> use utf8;
>
> my $source = shift @ARGV;
> my $destination = shift @ARGV;
>
> open (IN, "< $source");
>
> my @array = unpack("C*", $source);
>
> print "@array,\n";
>
> close IN;
>
>  but the result is that it won't read the _content_ of the file.
>
> $ perl prog.pl TEST1
> 84 69 83 84 49,
>
>  What is the issue here?


Dear Henry,

   Your unpack statement unpacks the text in the variable $source,
which was taken from @ARGV array (so in your case, $source contains
"TEST1").  Therefore, the ASCII values for 'T', 'E', 'S', 'T', and '1'
were printed.

Try changing the following two lines from:

code> my @array = unpack("C*", $source);
code> print "@array,\n";

to:

code> my $fileContents = join('', <IN>);
code> my $hex = unpack("H*", $fileContents);
code> print "$hex\n";

and see if that fixes things.

   Happy Perling!

   -- Jean-Luc



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

Date: Thu, 17 Feb 2005 14:52:25 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: regexp: read ip address
Message-Id: <Xns960064719D0ABasu1cornelledu@127.0.0.1>

vertigo <ax178@wp.pl> wrote in news:cv26h0$7tq$1@atlantis.news.tpi.pl:

> I have line with several words, and on ip address in it. How can i read 
> it ? 

It is not hard, assuming you have good eyesight. You just need to focus on 
the first word and then read each word one after another.

> Could anybody help ?

Well, if you haven't learned how to read in school, I am not sure what we 
can do here.

> Thanx

You are most welcome.

Sinan


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

Date: 17 Feb 2005 06:52:30 -0800
From: "Daniel Berger" <djberg96@hotmail.com>
Subject: Re: SET Operations in Perl
Message-Id: <1108651950.106889.271250@o13g2000cwo.googlegroups.com>


George wrote:
> Hi,
> how can we do SET Operations in perl using two hashes or arrays
> in case it is too easy , please redirect me to some link
> thanks

George,

One option is Set::Array or Set::Hash, available on CPAN.

Regards,

Dan



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

Date: Thu, 17 Feb 2005 12:19:59 -0600
From: brian d foy <comdog@panix.com>
Subject: The Perl Review, Spring 2005
Message-Id: <170220051219590099%comdog@panix.com>

The third print issue of The Perl Review is now on the presses
and will be March 1, so you have time to get your name
on the subscriber list.  TPR is the only print magazine devoted
to Perl.

   http://www.theperlreview.com/

In the upcoming issue ( 1.2, Spring 2005 )

   * Hashes with History -- Alberto Manuel Simões

   * Test::Number::Delta -- David Golden

   * 9-Block Quilt Patterns in Perl -- Daniel Allen

   * Packet Sniffing with Perl -- Gerry Finkel

   plus Perl News, Perl Mongers and Perl Foundation reports, book
   reviews, short notes, and more.

In the last issue ( 1.1, Winter 2004 )

   * Down Translating XML -- Alberto Manuel Simões

   * Module::Release and Beyond -- brian d foy

   * Functional Perl Programming -- Frank Antonsen

   * Faking Stored Procedures -- Zach Thompson

   plus Perl News, Perl Mongers and Perl Foundation reports, book
   reviews, and short notes.

The first print issue ( 1.0 ) is still available to subscribers online
as a PDF file, and some back issues are available.

   * Test Driven Development -- Denis Kosykh

   * Just do{} it -- brian d foy

   * Extending XML::XPath -- Michel Rodriguez

   * Test::More in 20 Seconds -- brian d foy

   * Magick Tile Puzzles -- Grant McLean

Before that, The Perl Review was a digital only version with
eight issues which are still available for free download as
PDF files.

   http://www.theperlreview.com/Issues/

RSS Feeds are available too.

   Subscriber only (current) issues
      http://www.theperlreview.com/RSS/tpr-subscribers.rdf

   Free Issues and articles
      http://www.theperlreview.com/RSS/tpr-free.rdf

   The Perl Review news
      http://www.livejournal.com/users/perl_review/data/rss

   The Perl Review public discussion
      http://www.livejournal.com/community/the_perl_review/data/rss

Want to write for TPR? Send us a note, or submit an idea online

   http://www.theperlreview.com/Authors/submit.html

Prices: $16 in the US, $30 outside the US.  Web only subscriptions
are $16. If we can get enough subscribers in the European Union, we'll
start printing there too and lower the cost. If you like, you can
start your subscription with the Winter 2004 issue and save money
by not having to buy the back issue later.

TPR accepts MasterCard, Visa, American Express, PayPal, Amazon.com
Honors System, and check or money order in US dollars.  Sorry, but we
can only accept advance payment since we're too small to do handle
individual billing.

Samples to Perl user groups, Perl instructors, and other worthy causes
are available.

-- 
brian d foy, comdog@panix.com
Subscribe to The Perl Review: http://www.theperlreview.com


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

Date: Thu, 17 Feb 2005 18:08:26 +0100
From: vertigo <ax178@wp.pl>
Subject: use strict; and O_WRONLY
Message-Id: <cv2j3g$f3s$1@atlantis.news.tpi.pl>

Hello

i have:
use strict;
and i use:
sysopen(FILE,$path,O_WRONLY);

but i receive error:
Bareword "O_WRONLY" not allowed while using "strict subs".

Why ? How can i correct it (while still using strict ?)

Thanx
Michal



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

Date: 17 Feb 2005 17:16:40 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: use strict; and O_WRONLY
Message-Id: <Xns96007CE5DD394asu1cornelledu@132.236.56.8>

vertigo <ax178@wp.pl> wrote in news:cv2j3g$f3s$1@atlantis.news.tpi.pl:

> i have:
> use strict;
> and i use:
> sysopen(FILE,$path,O_WRONLY);
> 
> but i receive error:
> Bareword "O_WRONLY" not allowed while using "strict subs".
> 
> Why ? How can i correct it (while still using strict ?)

C:\> perldoc -f sysopen

 ...

The possible values and flag bits of the MODE parameter are
system-dependent; they are available via the standard module
"Fcntl". 

C:\> perldoc Fcntl

 ...
EXPORTED SYMBOLS
    By default your system's F_* and O_* constants (eg, F_DUPFD and
    O_CREAT) and the FD_CLOEXEC constant are exported into your 
    namespace.

It would have been nicer if you had chosen to read the applicable 
documentation yourself first rather than asking thousands of people to read 
it for you.

Sinan


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

Date: Thu, 17 Feb 2005 17:45:13 +0000
From: Brian McCauley <nobull@mail.com>
Subject: Re: use strict; and O_WRONLY
Message-Id: <cv2kt0$hro$1@sun3.bham.ac.uk>



vertigo wrote:

> use strict;
> and i use:
> sysopen(FILE,$path,O_WRONLY);
> 
> but i receive error:
> Bareword "O_WRONLY" not allowed while using "strict subs".
> 
> Why ? How can i correct it (while still using strict ?)

The way you correct is while still using strict is exactly the same as 
the way you correct it without using strict.

Your problem is that you are trying to use the O_WRONLY function without 
first defining it.   All strict does is make perl tell you about your 
mistake rather than silently treat it as the string 'O_WRONLY' (which 
won't work).

I can't recall off the top of my head which module defines O_WRONLY for 
you but I'd be supprised if it were not mentioned in the documentation 
of the sysopen() function... [ rustle of virtual pages ] ... yep, I was 
right is is mentioned.

The moral of the story is: always look at the reference manual 
description of the functions you are using, at least the first few times 
you use a function.



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

Date: Thu, 17 Feb 2005 20:00:19 +0100
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: use strict; and O_WRONLY
Message-Id: <37k8e5F5c2mrvU1@individual.net>

Brian McCauley wrote:
> Your problem is that you are trying to use the O_WRONLY function without 
> first defining it.

What gets imported from Fcntl is a constant, not a function. :)

> The moral of the story is: always look at the reference manual 
> description of the functions you are using, at least the first few times 
> you use a function.

Of course.

-- 
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl


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

Date: Thu, 17 Feb 2005 16:26:35 -0500
From: Sherm Pendley <spamtrap@dot-app.org>
Subject: Re: use strict; and O_WRONLY
Message-Id: <od6dnXNi_s2WkYjfRVn-2w@adelphia.com>

Gunnar Hjalmarsson wrote:

> Brian McCauley wrote:
>> Your problem is that you are trying to use the O_WRONLY function without
>> first defining it.
> 
> What gets imported from Fcntl is a constant, not a function. :)

Nope. Have a look in Fcntl.pm - it's an autoloaded function.

sherm--

-- 
Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org


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

Date: 17 Feb 2005 22:37:01 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: use strict; and O_WRONLY
Message-Id: <cv36ad$bh6$1@mamenchi.zrz.TU-Berlin.DE>

Sherm Pendley  <spamtrap@dot-app.org> wrote in comp.lang.perl.misc:
> Gunnar Hjalmarsson wrote:
> 
> > Brian McCauley wrote:
> >> Your problem is that you are trying to use the O_WRONLY function without
> >> first defining it.
> > 
> > What gets imported from Fcntl is a constant, not a function. :)
> 
> Nope. Have a look in Fcntl.pm - it's an autoloaded function.

All constants are functions.

Anno


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

Date: Thu, 17 Feb 2005 09:07:29 -0500
From: Sherm Pendley <spamtrap@dot-app.org>
Subject: Re: what is Perl state of the art?
Message-Id: <lbydnco9x5G_OInfRVn-hg@adelphia.com>

warble606@yahoo.com wrote:

> I know that modules were introduced, some of them fairly
> convenient.

Have a look at <http://www.cpan.org> - that's the centralized repository for
modules. Some (me included) would say that CPAN is arguably Perl's best
feature.

> Can Perl hook in with GUIs and such now?

Yep. Several toolkits, actually. Again - have a look on CPAN. (And in
my .sig, if you're using a Mac...)

> Is there object-oriented Perl yet?

Yep - there's even a sequel to "Learning Perl" that covers it, titled
"Learning Perl Objects, References & Modules".

> Incidentally I wanted to answer my own question with
> a trip to the bookstore but I found that technical book
> writers either have an inability to be concise, or have
> perhaps some financial interest in not being concise.

I think they're paid by the pound. ;-)

sherm--

-- 
Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org


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

Date: Thu, 17 Feb 2005 15:51:07 GMT
From: "Paul Lalli" <mritty@gmail.com>
Subject: Re: what is Perl state of the art?
Message-Id: <L33Rd.23406$ya6.3998@trndny01>

<warble606@yahoo.com> wrote in message
news:1108647334.484350.272400@c13g2000cwb.googlegroups.com...
> I encountered Perl several years ago and learned
> the basics in about one day. However I didn't use it
> much since and I was curious what the state of the art is.
> I know that modules were introduced, some of them fairly
> convenient.

Yes.  Check out http://www.cpan.org and read such documentation as
perldoc perlmod
perldoc -f use

> Can Perl hook in with GUIs and such now?

Yes.  Many GUI interfaces exist.  One common one is with the Tk toolkit
originally written for Tcl.  "Perl/Tk", as it's known, is implemented
via the Tk module, available on the CPAN site mentioned above.  See
also:  http://www.perltk.org

> Is there object-oriented Perl yet?

Yes.  Check out
perldoc perlobj


> Incidentally I wanted to answer my own question with
> a trip to the bookstore but I found that technical book
> writers either have an inability to be concise, or have
> perhaps some financial interest in not being concise.

Or perhaps they realize it's better to be precise than concise.  There
are too many details in Perl to be able to make broad generalizations
that would be needed to shorten documentation. [1]  For the brief
introductions to the language, check out
perldoc perlintro
"Learning Perl" by Randal Schwartz
"Perl in a Nutshell" by Stephen Spainhour et al

Paul Lalli

[1] The authors of Learning Perl and Programming Perl make this fact
known via the abundance of footnotes in their works.



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

Date: 17 Feb 2005 18:27:04 GMT
From: John Bokma <postmaster@castleamber.com>
Subject: Re: what is Perl state of the art?
Message-Id: <Xns96007EA8EC9E5castleamber@130.133.1.4>

 wrote:

> I encountered Perl several years ago and learned
> the basics in about one day. However I didn't use it
> much since and I was curious what the state of the art is.
> I know that modules were introduced, some of them fairly
> convenient. Can Perl hook in with GUIs and such now?

Others have mentioned a few. I have been using WxWindows (aka WxWidgets). 
Although the documentation is sparse (amazing for a project around for 10 
(?) years)

> Is there object-oriented Perl yet?

Years :-D.

> Incidentally I wanted to answer my own question with
> a trip to the bookstore but I found that technical book
> writers either have an inability to be concise, or have
> perhaps some financial interest in not being concise.

You probably have been looking at the "unleashed platinum gold deluxe 
complete in 24 hours for dummies" doorstops eh books. Next time look for 
O'Reilly first.

-- 
John                   Small Perl scripts: http://johnbokma.com/perl/
               Perl programmer available:     http://castleamber.com/
            Happy Customers: http://castleamber.com/testimonials.html
                        


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

Date: Thu, 17 Feb 2005 14:28:58 -0500
From: Chris Mattern <matternc@comcast.net>
Subject: Re: what is Perl state of the art?
Message-Id: <k6mdnQH9YM7nbYnfRVn-uA@comcast.com>

John Bokma wrote:

> 
> You probably have been looking at the "unleashed platinum gold deluxe
> complete in 24 hours for dummies" doorstops eh books. Next time look for
> O'Reilly first.
> 
"Programming Perl" makes for a pretty good doorstop as well.  Thing is,
it's useful for learning Perl, too.
-- 
             Christopher Mattern

"Which one you figure tracked us?"
"The ugly one, sir."
"...Could you be more specific?"


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

Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 6 Apr 01)
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: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice. 

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


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