How to tie with YAML but also have flock support?


Which modules support flock with tie to YAML Is there a way Tie::YAML supports flock...
Posted On: Sunday 25th of November 2012 10:51:14 PM Total Views:  141
View Complete with Replies

RELATED TOPICS OF Perl PROGRAMMING LANGUAGE




HTML::Entities & UTF8

, consider my CGI program: #======================= use HTML::Entities; use utf8; print STDERR encode_entities( $q->param("q") ), "\n"; #======================= The incoming page was set to UTF8 and the parameter is Chinese UTF8 characters, but the output of the above codes give me: ä¸å\t人277 I have already used utf8 and don't know what else I missed. Any idea
VIEWS ON THIS POST

68

Posted on:

Wednesday 3rd October 2012
View Replies!

Help: How can I parse this properties file?

dear all perl users: Recently I need read in a proerties file, its format is key=value, and it uses \ to escape. for example: expression means: key value a=b=c a b=c a\=b=c a=b c a\\=b=c a\ b=c a\\\=b=c a\=b c How can I parse this file I think it should use regex. but my knowledage in Regular expression is poor. any help is greatly appreciated. , On Nov 5, 12:28pm, Ted Zlatanov wrote: > I was thinking of a similar solution, but adding 256 (or some other > large number) to each escaped character (in case there's a '&backslash;' > in the data). As long as it's valid Unicode and the original data > doesn't contain Unicode characters it should be a clean translation. I find absolutely nothing wrong with Tad's solution. The fact that it ^might^ be a little more verbose than necessary I regard as a mark in its favor, not a mark against. I might consider the string '\' rather than '&backslash;' but that's a simple quibble. Now, what about a one liner CC
VIEWS ON THIS POST

96

Posted on:

Wednesday 3rd October 2012
View Replies!

Help: How can I parse this properties file?

dear all perl users: Recently I need read in a proerties file, its format is key=value, and it uses \ to escape. for example: expression means: key value a=b=c a b=c a\=b=c a=b c a\\=b=c a\ b=c a\\\=b=c a\=b c How can I parse this file I think it should use regex. but my knowledage in Regular expression is poor. any help is greatly appreciated. , On Nov 5, 12:28pm, Ted Zlatanov wrote: > I was thinking of a similar solution, but adding 256 (or some other > large number) to each escaped character (in case there's a '&backslash;' > in the data). As long as it's valid Unicode and the original data > doesn't contain Unicode characters it should be a clean translation. I find absolutely nothing wrong with Tad's solution. The fact that it ^might^ be a little more verbose than necessary I regard as a mark in its favor, not a mark against. I might consider the string '\' rather than '&backslash;' but that's a simple quibble. Now, what about a one liner CC
VIEWS ON THIS POST

181

Posted on:

Tuesday 16th October 2012
View Replies!

Perl CGI utilities?

I have been doing Perl for years, but only as local programming. That is to say, I never had any reason to build web pages or other 'Net' stuff. Lately I have been playing with CGI on our local network as a way to deliver applications without worrying about the OS on the other end. A vendor can show up in our mostly Linux shop with a Mac, connect to the inhouse server and never know the difference. It works well enough that we will be moving a lot of our utilities to CGI. So it comes back to the fact that I am not a web programmer, yet. My question, for Perl programmers who are, is what do you use as the programming environment Writing raw CGI into your Perl is great for learning, but there is probably a more productive way. I know that there isn't a "Perl on Rails" all-in-one type of suite yet, but there must be productivity enhancing utilities available. Perl-CGI seems to be the most popular, but opinions will be welcome. My search is just starting.
VIEWS ON THIS POST

51

Posted on:

Tuesday 16th October 2012
View Replies!

How to send email from perl-script with different priorities : normalor high

, I'm trying to send email from my perl-script with different priorities : normal or high. For some reasons, I'm not going to use any perl-module like MIME::Lite. $email = "my.email\@isp.com"; $priority = 'high'; $html = "MIME-Version: 1.0\nContent-Type: text/html\; charset=us-ascii \n"; $html .= "Subject: FYI-- $date\n"; $html .= "Priority: $priority\n\n"; # ---> here I'm trying to change email priority $html .= ""; $html .= "FYI -- $date\n"; $html .= ""; open ( MAIL, "|/usr/bin/mail $email") or die; print MAIL $html; close ( MAIL); Thank you in advance, --Simon
VIEWS ON THIS POST

108

Posted on:

Wednesday 17th October 2012
View Replies!

Re: impatient DBI query

-----Original Message----- >From: Beginner >Sent: Oct 31, 2007 9:20 PM >To: beginners@perl.org, beginners@perl.org >Subject: impatient DBI query > > > >I have ordered my Perl DBI book (is that a leopard) but I am >impatient and want to know how I could do a select/like statement a >bit like this: > >SELECT foo FROM bar WHERE foo like 'baz%' > >the % being the wildcard operator. > try something like this: my $dbh = DBI->connect(...); my $str = 'select foo from bar where foo like '; my $sth = $dbh->prepare($str); $sth->execute('baz%') or die $dbh->errstr; my @results = $sth->fetchrow_array; $sth->finish;
VIEWS ON THIS POST

51

Posted on:

Wednesday 17th October 2012
View Replies!

Tkx perl~tcl tied variables question

# This kind of thing works: # -textvariable => \$LABEL # But this kind of thing, in a listbox, doesn't work: # -listvariable => \@LIST # (If I had access to the Tkx $interp, # I could write maybe # tie @PerlArray, Tcl::Var, $interp, "tclList", $flags; # or something like that. ) # ------------------------------------------------------------------------ # The following (in the approved Tkx style) # shows what I mean. # (note: -justify doesn't work either.) use strict; use warnings; use Tkx qw(MainLoop); my $mw = Tkx::widget->new("."); my $LABEL = "this is a label"; my $Label = $mw->new_label(-textvariable => \$LABEL); my @LIST = ('this','is','a', 'list'); my $Listbox = $mw->new_listbox( -borderwidth =>0, -relief =>'flat', -height => 10, #-justify => 'right', -listvariable => \@LIST, ); $Listbox->insert('end','THIS'); $Listbox->insert('end','IS'); $Listbox->insert('end','A'); $Listbox->insert('end','LIST'); $Label->g_pack(); $Listbox->g_pack(); MainLoop
VIEWS ON THIS POST

80

Posted on:

Saturday 20th October 2012
View Replies!

FAQ 4.62 Why don't my tied hashes make the defined/exists distinction?

This is an excerpt from the latest version perlfaq4.pod, which comes with the standard Perl distribution. These postings aim to reduce the number of repeated questions as well as allow the community to review and update the answers. The latest version of the complete perlfaq is at http://faq.perl.org . -------------------------------------------------------------------- 4.62: Why don't my tied hashes make the defined/exists distinction This depends on the tied hash's implementation of EXISTS(). For example, there isn't the concept of undef with hashes that are tied to DBM* files. It also means that exists() and defined() do the same thing with a DBM* file, and what they end up doing is not what they do with ordinary hashes. -------------------------------------------------------------------- The perlfaq-workers, a group of volunteers, maintain the perlfaq. They are not necessarily experts in every domain where Perl might show up, so please include as much information as possible and relevant in any corrections. The perlfaq-workers also don't have access to every operating system or platform, so please include relevant details for corrections to examples that do not work on particular platforms. Working code is greatly appreciated. If you'd like to help maintain the perlfaq, see the details in perlfaq.pod. -- Posted via a free Usenet account from http://www.teranews.com
VIEWS ON THIS POST

169

Posted on:

Monday 22nd October 2012
View Replies!

help with module naming: filehandle-tie for size-limited/rotating logfile

I'm about to upload a module, the filehandle-tie for size-limited logs. I did not find existing module in cpan, so I wrote one. Please help me to select the right module name. I am thinking about name Tie::SizeLimitedLog or Tie::RotatingLog. The closest relative is the existing Tie::LogFile (except that Tie::LogFile does not have the size-limiting (rotating) functionality). Which name shall I choose
VIEWS ON THIS POST

130

Posted on:

Friday 26th October 2012
View Replies!

beginner question on use of Frontier::Client

I'm attempting to write one of my first perl programs. It is to interact with an internal web service. I'm having something basic going wrong: use Frontier::Client ; # Parameter: # login_id # # Output: # login_id of manager my @supervisor_info; $server = Frontier::Client->new('url' => 'http://serverort/' ); foreach my $empno (@ARGV) { @supervisor_info = Frontier::Client->call('GetInfoByEmpNo', $empno); if ( $#supervisor_info != 0 ) { print "found $empno\n"; } else { print "Unable to locate supervisor for $empno\n"; } ; } As you can see, I'm not trying to do anything with the data yet - in fact, not even looking at the data yet. Just trying to get the basic skeleton working, so that I know, moving on, that the basics are working. Of course, I have a real server and port URL in the new call. And the method name comes from the documentation that the web service have provided. The error I get is: Can't use string ("Frontier::Client") as a HASH ref while "strict refs" in use at /usr/local/perl5/lib/site_perl/5.8.4/Frontier/Client.pm line 53. (where that is the path to the pm file). I appear to be missing something obvious. Given that I have not written many perl programs, it is probably something embarassingly simple. I was wondering if anyone could provide me a kind nudge in the right direction
VIEWS ON THIS POST

237

Posted on:

Friday 26th October 2012
View Replies!

Namespace Recommendation for Abuse Reporting Utilities Module

, I've been working on a module for one of my own projects and a few friends suggested that it would be useful for other projects as well. I'm not quite sure where it should fit in namespace wise though. Some of the functions already implemented in the module: get_asn_info - takes an IP, returns a list containing following info about the BGP announcement for the address: ASN, Network, CIDR netmask get_soa_contact - takes an IP, returns the SOA contact email address for the /24 reverse zone the address is in get_ipwi_contacts - takes an IP, returns a list of unique email addresses found in the whois information for the IP get_dnsbl_listing - takes an IP and an DNSBL zone, returns the listing text if the IP is listed or undef get_abusenet_contact - takes a domain, returns the Abuse.net listed contact address(es) Plus a few other more trivial functions. I also have a few functions yet to implement. My purpose for this module is a spam reporting script I'm working on so I've named it SpamUtils. In CPAN this would probably be Mail::SpamUtils but this module would be useful for other forms of abuse as well so perhaps something along the lines of Net::AbuseUtils There is a Net::Abuse but it's purpose is the automated processing of inbound abuse reports. I would appreciate any feedback you may have on namespace as well as features you would be interested in having in such a module. Michael
VIEWS ON THIS POST

106

Posted on:

Friday 26th October 2012
View Replies!

Global symbol "%Properties" requires explicit package name

* mike wrote in comp.lang.perl.misc: >I have declared my %Properties but I get the following when I execute: > >Global symbol "%Properties" requires explicit package name at test.pl >line 62. >Do I have to make some declaration within the sub When checking whether your variables have been declared prior to their use, perl checks how they occur in the source code, it ignores how the program would be executed. You have to declare %Properties before any use of it can be seen in the source code. -- Bjrn Hhrmann mailto:bjoern@hoehrmann.de http://bjoern.hoehrmann.de Weinh. Str. 22 Telefon: +49(0)621/4309674 http://www.bjoernsworld.de 68309 Mannheim PGP Pub. KeyID: 0xA4357E78 http://www.websitedev.de/
VIEWS ON THIS POST

129

Posted on:

Sunday 4th November 2012
View Replies!

FAQ 4.62 Why don't my tied hashes make the defined/exists distinction?

This is an excerpt from the latest version perlfaq4.pod, which comes with the standard Perl distribution. These postings aim to reduce the number of repeated questions as well as allow the community to review and update the answers. The latest version of the complete perlfaq is at http://faq.perl.org . -------------------------------------------------------------------- 4.62: Why don't my tied hashes make the defined/exists distinction This depends on the tied hash's implementation of EXISTS(). For example, there isn't the concept of undef with hashes that are tied to DBM* files. It also means that exists() and defined() do the same thing with a DBM* file, and what they end up doing is not what they do with ordinary hashes. -------------------------------------------------------------------- The perlfaq-workers, a group of volunteers, maintain the perlfaq. They are not necessarily experts in every domain where Perl might show up, so please include as much information as possible and relevant in any corrections. The perlfaq-workers also don't have access to every operating system or platform, so please include relevant details for corrections to examples that do not work on particular platforms. Working code is greatly appreciated. If you'd like to help maintain the perlfaq, see the details in perlfaq.pod.
VIEWS ON THIS POST

126

Posted on:

Sunday 4th November 2012
View Replies!

2 issues with "tie"

I seem to be running into some issues with tie in perl 5.8.8 with the defined-or patch from the FreeBSD ports. I use : use NDBM_File; use Fcntl; I open up my file as : tie (%fdb,'NDBM_File',"file.victims",O_RDWR|O_CREAT,0777) ||die $!; I write to it as $fdb{$_}="TUC"; I close it as : untie %fdb; Seems pretty basic. But I've got 2 issues. 1) If $_="Fred", and the program iterates and does $fdb{'Fred'}="TUC"; , if I immediately start another program up to read "Fred" from the file, it claims it doesn't exist. As if it hasn't sync'd. As soon as I do the "untie %fdb;", then the data becomes available. Is there a way that as soon as I $fdb{'Fred'}="TUC"; it becomes accessible 2) I also have the issue that if I'm running my program, and I hit CNTRL-C to stop it, none of the values I've $fdb{$_}="TUC"; end up getting and staying set. So the next time the program runs, and checks to see if its already in the data store, it says its not and re- executes the command. Is there some way that once its set its "committed" per se
VIEWS ON THIS POST

90

Posted on:

Sunday 4th November 2012
View Replies!

funzy.com http://geocities.com/it_super_manager/

funzy.com http://geocities.com/it_super_manager/
VIEWS ON THIS POST

119

Posted on:

Sunday 4th November 2012
View Replies!

FAQ 4.62 Why don't my tied hashes make the defined/exists distinction?

This is an excerpt from the latest version perlfaq4.pod, which comes with the standard Perl distribution. These postings aim to reduce the number of repeated questions as well as allow the community to review and update the answers. The latest version of the complete perlfaq is at http://faq.perl.org . -------------------------------------------------------------------- 4.62: Why don't my tied hashes make the defined/exists distinction This depends on the tied hash's implementation of EXISTS(). For example, there isn't the concept of undef with hashes that are tied to DBM* files. It also means that exists() and defined() do the same thing with a DBM* file, and what they end up doing is not what they do with ordinary hashes. -------------------------------------------------------------------- The perlfaq-workers, a group of volunteers, maintain the perlfaq. They are not necessarily experts in every domain where Perl might show up, so please include as much information as possible and relevant in any corrections. The perlfaq-workers also don't have access to every operating system or platform, so please include relevant details for corrections to examples that do not work on particular platforms. Working code is greatly appreciated. If you'd like to help maintain the perlfaq, see the details in perlfaq.pod.
VIEWS ON THIS POST

126

Posted on:

Wednesday 7th November 2012
View Replies!

Odd DBM::Deep behavior "cannot store tied value" using literal key name

Hi all, I am trying to create a test script for some work I'm trying to do with Data::Compare using DBM:eep, but the test code is acting flaky and I'm not sure why. In a previous (and working) script, I have a DBM:eep hash keyed using IP addresses. Inside the hash is an array that contains several values including an array reference and a hash reference. This works fine. The test script is a different story. Here's the code: ------------------------------- #!/perl/bin/perl use strict; use warnings; use Data::Compare; use DBM:eep; my $database = &OpenDB("test.db"); my %testhash = ( 'bob' => 23, 'alice' => 20 ); my @old = ("00-99-48-AF-46-43", "W117", 1, 1197390385, \%testhash); my @same = ("00-99-48-AF-46-43", "W117", 1, 1197390385, \%testhash); my %newhash = ( 'bob' => 23, 'alice' => 24 ); my @new = ("00-99-48-AF-46-43", "W117", 1, 1197390385, \%newhash); my $ip1 = "144.1"; my $ip2 = "145.2"; my $ip3 = "146.3"; $database->{$ip1} = \@old; # Uncomment the line directly below to generate error # $database->{$ip2} = \@same; # $database->{$ip3} = \@new; my @test_old = @{$database->{$ip1}}; # my @test_same = @{$database->{$ip2}}; # my @test_new = @{$database->{$ip3}}; sub OpenDB { # Argument(s): A string containing the database filename to be used. # Returned: A scalar reference holding the database object. # Globals: None. my ($filename) = @_; my $db = DBM:eep->new( file => $filename, locking => 1, autoflush => 1 ); # Test: see if removing this increases speed return($db); } ------------------------------- The above code works as-is, but if I uncomment the line(s) above (marked with a comment), I get the error: DBM:eep: Cannot store a tied value. Why is that
VIEWS ON THIS POST

113

Posted on:

Wednesday 7th November 2012
View Replies!

a newbie encounters difficulties in using module

I'm testing the codes obtained from internet: use Imager; use Imager::Plot; $plot = Imager::Plot->new(Width => 550, Height => 350, GlobalFont => 'ImUgly.ttf'); my @X = 0..100; my @Y = map { sin($_/10) } @X; my @Z = map { 1+cos($_/10) ...
VIEWS ON THIS POST

138

Posted on:

Sunday 11th November 2012
View Replies!

$$$$$$$www.200836.com , September 2000, Sydney -- Information meetingbetween the IOC and the Candidate Cities.

$$$$$$$$$ www.200836.com--- why we buy Peking 2008 Olympic Games-- souvenirs 1 low price 2 best quality-- licensed products by Peking Organizing Committee 3 many products to choose 4 most precious--limited circulation 1 our website www.200836 was aimed at that all ...
VIEWS ON THIS POST

119

Posted on:

Thursday 15th November 2012
View Replies!

how do i tie a reference to a hash

I'm trying to tie a hash that is returned from a DBI method called fetchrow_hashref. I want to do is override the FETCH method to validate my key names. But fetchrow_hashref returns a reference to a hash, not ...
VIEWS ON THIS POST

108

Posted on:

Thursday 15th November 2012
View Replies!