Svend Asmussen

The Phenomenal Danish Fiddler


This site should appear as the creator intended if viewed in Explorer 3.0 or higher.  Netscape should be OK too.  Users of other browsers are up a creek and must paddle as best they can.


Svend Asmussen may be the finest little-known jazz performer in the world.  This page seeks to address the vacuum of information about this remarkable gentleman on the Web today.

A bit of a child prodigy, Asmussen's recording career spans more than 60 years.  As a young man, Svend was something of a novelty performer, beginning to excel on the violin, but also performing on vibes, and other instruments, as well as being a vocalist.

As a more mature performer he explored and recorded in a wide variety of styles, including that of the Indian subcontinent.  Now, as an elder statesman of the instrument, his jazz violin virtuosity takes a back seat to no one, including his contemporary, the much better known Stephane Grappelli.

Perhaps the primary reason that Asmussen is not well known in the United States is that he has preferred to make his native Denmark the headquarters of his operations and has made only infrequent appearances in the U.S., most notably at the 1967 Monterey Jazz Festival "violin summit" with Ray Nance and Jean-Luc Ponty.

The story of Asmussen's life would make a pretty good movie. In the late 1930s, Svend worked in Denmark with touring artists such as Fats Waller, The Mills Brothers, and Josephine Baker.  In 1939 he was quite a hit in London, Hamburg, and Paris.  But the outbreak of war in Europe postponed other proposed tours and projects.

The Nazis hated American Jazz.  At one point Asmussen was arrested and incarcerated in Berlin.  After the war, he became the most popular entertainer in Denmark, if not all of Scandinavia.  At that time, his popularity extended beyond jazz, as he was perceived primarily as a club, vaudeville, and radio performer.  There were also many film appearances and credits, some of the details of which may be found on a separate page.

During the period 1958 to 1961, Asmussen, along with popular Swedish singer Alice Babs and guitarist Ulrik Neumann, formed a trio entitled the "Swe-Danes," a sort of music hall/pop vocalese group.  They were the most popular act of their time in Scandinavia and also toured the United States to acclaim, appearing in venues (Hollywood's Cocoanut Grove, New York's Waldorf-Astoria) from coast to coast.  Their "Scandinavian Shuffle" was nominated for a Grammy in 1960.  Mr. Asmussen's career outside of jazz is mostly beyond the scope of this page, but I couldn't resist including this remarkable picture of the Swe-Danes.  From left to right, that's Svend, Babs, and Ulrik.  Click the image for a larger version.

Asmussen's early influence was Joe Venuti, but it was a visit to Denmark by Stuff Smith that rekindled his interest in jazz.  He certainly had the opportunity to be better known abroad.  On more than one occasion, he turned down invitations from Benny Goodman to join the clarinetist's famous group.  Apparently, he was comfortable to remain a big frog in a little pond.  This is too bad, as it makes one's mouth water to imagine what the fabulous Goodman "small groups" might have produced if Asmussen had been added to the likes of Gene Krupa, Teddy Wilson, and Lionel Hampton.  A suggestion of the possibilities can be heard on an elusive 1978 album featuring a collaboration with Hampton.

OK, so you've read this far and might be interested.  Despite his relative obscurity, there are usually a few Svend Asmussen recordings available for purchase in the United States.  Allow me to be your tour guide to this remarkable artist.


GETTING STARTED

Four CDs, featuring more-or-less straight-ahead jazz performances, represent a good starting point for most new listeners:

  • Signature AK 39150  June Night
  • Phontastic NCD 8804  Svend Asmussen at Slukafter
  • Intim Musik 6  Fiddler Supreme
  • dacapo DCCD 9429  Fit as a Fiddle

June Night is from Sony Music Special Products and may be available in a variety of reissue packaging.  The title tune was a pop hit for Svend back in 1940.  The group on this 1983 recording includes Derek Smith, Bucky Pizzarelli, Oliver Jackson, Jr., and Milt Hinton.  The cuts include such standards as "Just a Gigolo" and "A Pretty Girl is Like a Melody."  Trust me, if you have any interest in violin\fiddle as a jazz instrument, you will like this album.  It has also been packaged together with Stephane Grappelli "Live at Carnegie Hall" on the "Collectables" label.

Svend Asmussen at Slukafter features a 1984 live performance, recorded at a club in Tivoli Gardens, Copenhagen, Denmark.  A couple of Svend's own compositions are mixed in with nine other cuts, including standards such as "Someone to Watch Over Me" and "Things Ain't What They Used To Be."  He is accompanied by well-known Scandinavian sidemen, plus American expatriate drummer Ed Thigpen.

Fiddler Supreme is a 1989 recording that brings together 12 selections including re-workings of some great standards (Limehouse Blues, I Concentrate On You, I've Got Rhythm), the Asmussen original "Desperado," and an instrumental version of "June Night."  Asmussen and his quartet are in fine form on the swinging oldies as well as the more modern stuff such as two Sonny Rollins compositions.  I can recommend this Swedish import if for no other reason than it is actually available from many online CD mail-order stores, possibly in larger local record shops as well.

Fit as a Fiddle is a more recent CD and a nice one too!  Here are 11 numbers recorded "Live In Concert" in 1996 at three different venues in Denmark and Sweden.  Svend and the three young members of his new quartet are in fine form on this collection which includes "Bye, Bye Blackbird," "I Loves You Porgy," and "A Night In Tunisia."  I especially enjoyed the group's version of "Columbine Polka Mazurka" and the exceptional guitar of Jacob Fischer on Duke Ellington's "The Mooche."  I defy you to listen to this record and believe that the lead player is an 80-year old man.  He's just marvelous!   This 1997 release is also available from the online record dealers.

In addition to these four, you certainly can't go wrong with Asmussen's most recent release:

Still Fiddling, recorded in 1999 and released in 2002 (Storyville 101 4252), this 12-song collection demonstrates once again the exceptional taste, talent, and attention to detail, of this remarkable artist.  The selections are a good mix of standards ("It Had To Be You" and "The Best Things In Life Are Free," among others) and unexpected treats("My Yiddish Momme" and an adaptation of my man Edvard Grieg's classical piece "Jeg Elsker Dig").  Maybe I'm just a sentimental old fool, but my favorite is "Sermon For Stuff," an Asmussen composition in tribute to fellow jazz violinist, Stuff Smith, in which Svend glides on the strings in waltz time while tugging the heart strings of the listener.  On the whole, a delightful CD.  The lovely guitar of Jacob Fischer brightens the proceedings throughout.  I confess, another favorite part is where a hitherto low-profile webmaster is quoted in the liner notes.


THE EARLY YEARS

Here is our man in his early twenties in the center of an early group.  There is little doubt that these young gentlemen were having a good time.  Some of Svend's most engaging tunes may be found on two CDs on the Phontastic label from Sweden.


  • Phontastic 9306  Musical Miracle-Vol. 1: 1935-40
  • Phontastic 9310  Phenomenal Fiddler-Vol. 2: 1941-50

Of the two, the second is probably a better introduction to Svend's early work.  A totally delightful album throughout, the 22 cuts include many swing standards familiar to American audiences (Darktown Strutter's Ball, Rhythm is Our Business, etc.).  Indeed, little of Asmussen's work could be regarded as "provincial" and of interest only to European listeners.  The first CD features Svend's very earliest work, including his original 1940 recording of "June Night."  It's great too, but, if you are pinched, the second volume gets the nod.


COMBINATIONS

Asmussen has performed with a remarkably wide variety of other musicians.  He is equally at home with traditional jazz, pop tunes, modern jazz, and even oriental variations.  Following are a few known to have been released on CD.



  • Signature A 26229  Teresa Brewer On The Good Ship Lollipop
  • Atlantic 90533-2  European Encounter
  • Gazell GJCD-1008  Toots & Svend Yesterday and Today
  • Zebra ZEAD-42108  Svingin' With Svend
  • Storyville SLP 4088  Two Of A Kind (w/ Stephane Grappelli)
  • Storyville SLP 4075  Garland Dr. L. Subramaniam - Featuring Svend Asmussen
  • Swedish Society SCD 1025  The Chamber Choir & Eric Ericson Encounter Svend Asmussen

On The Good Ship Lollipop  offers a lesson in marketing and packaging.  When I bought these 1987 performances on LP some years ago, both artists were prominently featured and given equal billing on the cover.  The CD version (1995) is offered as a "Teresa Brewer" recording ("featuring" Svend Asmussen).  This one is not for everyone, but I really like it.  You get the vocal version of "June Night" and the selection of other tunes ("Mean to Me," "More Than You Know," etc.) is a fine one.  Side men include Hank Jones on piano and Bucky Pizzarelli on guitar.

European Encounter  teams Svend with John Lewis, better known as leader of the Modern Jazz Quartet.  Recorded in 1962 and reissued in 1986, this is a thoroughly delightful album, featuring seven cuts, six of which are Lewis compositions.  Listen for the rare tenor violin on "New York 19."

Toots & Svend Yesterday and Today  teams our man with jazz harmonica virtuoso, Toots Thielemans.  This is a great example of how instruments not ordinarily associated with jazz can come together with success.  Svend plays violin, viola, and cello.  The first cut, an exceptional version of Ellington's "Sophisticated Lady" is a highlight.  Seek this one out!

Svingin' With Svend  features a delightful collaboration in which Svend Asmussen sits in with the David Grisman Quintet. This 1988 release is just too good for words, as Svend plays off against the mandolin master Grisman with exceptional results.  Recorded live at Fat Tuesday's in New York, this CD is hard to find, but a must have for true fans.  Indeed, the few seconds of spoken introduction to "Swing Mineur" is worth twice whatever you have to pay for it (not to mention the title, that makes me smile everytime I see it).

Two Of A Kind  serves up Asmussen and Grappelli together with top Scandinavian sidemen.  Three of their own compositions are included along with a couple of standards --"Honeysuckle Rose," "Satin Doll," and "Someone To Watch Over Me."  The two giants of the jazz violin were brought together by Bent Fabric on his popular Danish "Blue Hour" television program in December 1964.  The 1965 recording session followed.

Garland  features 6 compositions, all but one written and arranged by Dr. L. Subramaniam, the Indian violinist, and recorded in Copenhagen in 1978.  I seldom play this LP, but it certainly illustrates the versatility of our man Asmussen, who seems to be at home with just about any form.

The Chamber Choir & Eric Ericson Encounter Svend Asmussen  presents an exceptional mixture of Beethoven, Schumann, and Bach pieces alongside those of John Lewis, Dizzy Gillespie and Duke Ellington!  Toss in folk tunes from Brazil, Japan, and Africa, a live TV-audience, and the famous Swedish Chamber Choir under the direction of Eric Ericson, and the result is something quite extraordinary.  The recordings date to 1972-73.  The CD was reissued in 1988.


ALL THE REST

I have several Asmussen releases on LP which may or may not have been released on CD.  This is by no means a complete list, but the following are worth mentioning and certainly worth picking up from a used record dealer if the chance presents itself.


  • Storyville SLP 415  Danish Jazz, Vol. 6 Svend Asmussen
  • Folklyric 9025  Hot Swing Fiddle Classics
  • Sonet SNTF 779  As Time Goes By
  • Warner Brothers W1408  Danish Imports
  • EMI/Odeon J9-10  Dansk Guldalder Jazz Vol. 1-2
  • EMI/Odeon J11-12  Dansk Guldalder Jazz Vol. 3-4

Danish Jazz, Vol. 6  covers the same period as Phenomenal Fiddler-Vol. 2, but only 4 of the 15 cuts on this album are duplicated on the CD.  Where else can you hear Svend doing the great novelty numbers "The Booglie Wooglie Piggie" and "My Old Man"?  I've had this LP for many years and if this were the kind of world it should be, it would be released on CD as the next order of business.

Hot Swing Fiddle Classics  was my introduction to Svend Asmussen.  Four of the five cuts on this 1979 release are also on Musical Miracle-Vol. 1, but the tracks by other hot fiddlers Stuff Smith and (especially) Emilio Caceres make this an attractive album nonetheless.

As Time Goes By  features a collaboration with Lionel Hampton, recorded in Copenhagen in 1978, with support from Niels Henning Orsted-Pedersen (bass), and Ed Thigpen (drums).  This LP is really tough to track down, but your effort will be rewarded.  Producer Rune Ofwerman plays piano on the title track and the result - - just a hint of what Benny Goodman's small group could have been like.

Danish Imports  is, as the album states "intimate jazz by two of Europe's greatest instrumentalists."  Svend teams with guitarist Ulrik Neumann for a dozen laid back standards that are truly delightful.  Spin this baby on the turntable and all the stress and cares of the day melt away.  Recorded in Hollywood in 1961 during a break in the Swe-Dane's annual US tour.

Dansk Guldalder Jazz Vol. 1-2  is a double-LP covering Danish Jazz releases between 1933 and 1941.  Asmussen's first recording ("Tiger Rag") is included.  Svend appears on about one-quarter of the 28 cuts.  The highlights here, though, are the two songs by "De Tre Rhythm Girls," a terrific vocal trio!

Dansk Guldalder Jazz Vol. 3-4  is another double-LP, these volumes covering the years 1942 to 1949.  This one mainly features Leo Mathisen and others, but there are a couple of Svend offerings of interest, recorded in Stockholm, Sweden, with the late '40s version of his group.

Despite the "All The Rest" heading of this section, there are numerous other albums featuring Svend Asmussen.  These include many non-Jazz recordings, as well as an available-only-in-Europe multiple CD set reissuing virtually all of his earlier popular recordings.  A more complete discography, compiled by Joel Glassman, is available elsewhere.


Those of you with browsers that support certain music players may now click the little black right-pointing arrowhead and listen to Svend Asmussen playing just a taste of his signature tune "June Night."  Some of you heard it when this page first loaded.  [18 seconds -- 205K]


THE MULTIMEDIA PAGE
And ... since this example is so abbreviated, it is my pleasure to also present access to two entire songs in mp3 format.  Assuming your computer supports the playing of such files, the MultiMedia Page awaits you.


Svend Asmussen recordings are not always easy to find, but the Internet's leading retailer usually has them.  Clicking on the Amazon.com image will take you to a page where you can search for them.  And if you buy something, there is a small rebate to yours truly that will help defray the expense of maintaining this site.


SVEND ON VIDEO

Back in 1981 the still-active Benny Goodman made an appearance at a jazz club in the Tivoli Gardens complex in Copenhagen, Denmark.  During the second half of the show Benny called upon his old friend Svend Asmussen to come up from the audience and join in a few unrehearsed numbers.  Fortunately, this concert appearance was filmed and is available on video tape.  The tape is in color and runs for about 50 minutes.  The image shown at left is from this concert tape.  The last time I looked, it was still available from internet sources, though you may have to look around a bit.  The search will be worth the effort and you won't be disappointed.


After a delay of many years, the "Svend Asmussen Quartet" DVD is finally available in the United States.  This is a 42-minute live performance filmed in 1986 at the Club Montmartre in Copenhagen.  The DVD is part of a new "Jazz Legends" series released by Storyville Films.  The accompaniests are all first rate jazz performers:  Kenny Drew (piano), Niels Henning Orsted-Pedersen (bass), and Ed Thigpen (drums).  Although the box says "B&W," the recording is actually in color.  This is a "must have" for any true fan.  Truly, the only faults are that the performance is much too short and the DVD ends a little too abruptly.  The set consists of seven songs, including "It Don't Mean A Thing If It Ain't Got That Swing," "Just A Gigolo," and Svend's signature tune "June Night."  Each of the artists is in fine form and I especially enjoyed seeing our man plucking the strings on several numbers, something that turns up only occasionally in his studio recordings.  The release is Storyville DVD 16030 and you can buy your own copy for a very agreeable price at Amazon.com.



SVEND ASMUSSEN TODAY

An e-mail received from a fan in June 1997 reports that he had just returned from an Asmussen concert in Reykjavik, Iceland

"two hours ago ... and am still swinging.  Since your homepage is the first I've seen on this great artist, I wanted you to know that I was there and loved every moment of it."

A correspondent to this page conducted several hours of interviews with Svend in his Copenhagen home.  The illustrated results have now been published in the Spring 2005 issue of Fiddler magazine.  Looks like the cover image was taken from a photo of our man with Richard and Janet during their first visit in 2001.  Click the image at left for a larger version and see the handsome and amiable Mr. Asmussen as he looks today.

Svend is also featured in a nice illustrated article in the February 2005 issue of the British magazine "The Strad."  In addition a 3-hour Danish television feature, documenting the career of our man, was broadcast in Europe in 2003.  It was seen by over 200,000 viewers in Denmark alone.

And the really big news? (at least for those who read Danish) — in March 2005, Mr. Asmussen's biography "June Nights:  Svend Asmussen's Life In Music," published by Gyldendal, appeared on the shelves of better European book stores.  And, I am told by someone who should know, it is selling very well.  If this treasure ever becomes available in English you will certainly learn about it here.  In addition, an audio-book version is in the works, with actor Jesper Langberg reading the text.



Svend Asmussen celebrated his 92nd birthday on February 28, 2008, and his public performances are now quite limited in number.  His most recent quartet, seen here, includes Jacob Fischer (guitar), Aage Tanggaard (drums), and Jesper Lundgaard (bass).  Ceremonies and events relating to the 90th birthday included an exhibition put together by Revymuseet påå Frederiksberg which opened in the spring of 2006.  Among other items on display were Svend's drawings and sketches of musical partners and others throughout his over 75-year career.

A new set of CDs, reissuing material not otherwise readily available, may be forthcoming from EMI as part of the "Diamond Series."  There is also a new DVD, entitled, "Et Liv I Musik" that includes over 3 hours of interviews, old and recent music, and photos.  It is produced by Universal (Denmark), but so far as I can tell is not yet available outside of Europe.  There is some indication that an English language version may be forthcoming.

And how is the gentleman himself getting along?  I have it on good authority that he and his new wife Ellen are doing very well indeed.  Take a look at this terrific 2007 picture of Svend and Ellen.   Now that's a nice looking couple.





If you would like to support this page and save yourself some money in the process, please consider shopping for your books, CDs, and videos from Amazon.com.


Just click one of these icons and bookmark or make a favorite of the page it takes you to.  Thereafter, your purchases from Amazon will produce a small credit to yours truly.  The eBay icon takes you to a list of items that my alter ego, Otto, is offering at auction this week.

Donations Are Welcome   If you are one of those rare angels who would like to make a modest donation to support my efforts, you may do so by clicking the Pay Pal "Donate" image and filling in the pertinent information that will appear on the next screen.  It's fast and easy and your surprising generosity will be greatly appreciated.

MORE?   Many other areas of the "Popular Culture Excavation Site" await you.  Full descriptions are on the main menu or go directly to the area of your choice by clicking one of these seductive little images.

The Katzenjammer KidsWillie the KOOL penguinMistinguettCarl "Duck Man" BarksSvend AsmussenTim "Kingfish" MooreWestern SwingHazel CourtRhythm and Blues RevuesEuropean Jazz and Close Harmony Vocal GroupsThe Pie Girl DinnerSally RandWLAC Radio: Nashville

Who are these guys?  Just place your cursor on each image to get a clue.

Return to the main menu.


On May 18, 2002, the 5th anniversary of the creation of the main site, hosting of this page was transferred from Yahoo/GeoCities to an independent server.  You are the most recent of the #!/usr/local/bin/perl5 use GD; alarm(600); # cgi-bin access counter program # Version 4.0.7 # # Copyright (C) 1995 George Burgyan # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or (at # your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # A full copy of the GNU General Public License can be retrieved from # http://www.webtools.org/counter/copying.html # # gburgyan@webtools.org # # George Burgyan # 1380 Dill Road # South Euclid, OH 44121 # # For more information look at http://www.webtools.org/counter/ ######################################################################## # # CHANGE THESE TO SUIT YOUR SITE # # The default language option (english, french, swedish) $default_lang = "english"; # The name of the file to use. You should probably give this an absolute path $FileName = "$ENV{'DOCUMENT_ROOT'}/counter/access_count"; # Replace with a list of regular expression IP addresses that we # are supposed to ignore. If you don't know what this means, just use # "\." instead of periods. Comment out entirely to ignore nothing. #@IgnoreIP = ("199\.18\.203\..*", # "199\.18\.159\.1", # ); # Aliases: Set this up so that diffent pages will all yield the same # count. For instance, if you have a link like "index.html -> home.html" # set it up like ("/index.html", "/home.html"). Make sure you give a full # path to it. This will treat "/index.html" as if it were "/home.html". %Aliases = ("/fakename.html", "/realname.html", "/index.html", "/home.html", ); # AUTOMATICALLY SET BY INSTALL!! Modify only if necessary!!! # # BaseName: set to whatever you have counter installed as. This is # used to derive the arguments. No not touch the next comment. ### AUTOMAGIC ### $BaseName = "counter"; # counter or counterbanner or counterfiglet # # Outputs the number of times a specific page has been accessed. # The output depends on which page 'called' it, and what the program # is named: # # The counter can "take arguments" via its name. That is, if you tack # -arg to the end of the program name, -arg is taken to be an argument. # For example, if you call the counter 'counter-ord', '-ord' is considered # an argument, and an ordinal count (1st, 2nd, 3rd, ...) will be printed # instead of (1, 2, 3, ...). Note that counterord does the same thing as # counter-ord for backward compatibility. # # Currently recognized arguments: # # -f=font sets "font" to be the font for figlet # -lang=lang sets the language used to ordinalize to "lang" # -nc no count; don't to write the incremented count back to the file # -nl no link; don't automatically generate a link # -nd no display; don't display anything, just count # -ord make an ordinal count instead of regular # -doc=document override the DOCUMENT_URI environment variable # # Example: counterfiglet-ord-f=bigfont-nc # # This will cause the counter to call figlet as the output routine, printing # in a big font an ordinal count, without updating the access count file. # Note that the order of arguments is irrelevant so long as you spell the # file name correctly. It is generally assumed that the ability to take # different arguments/use different output routines is done with symlinks: # i.e. ln -s counter counterfiglet-ord-f=bigfont-nc # # More complete documentation can be found at # http://www.webtools.org/counter/ # ######################################################################## # # Thing that shouldn't really need changing, but are configurable anyway. # # Maximum number of times to try to lock the file. # Each try is .1 second. Try for 1 second. $MaxTries = 10; # Set this to point to something, or comment it out, and it # won't be a link at all. # $Link = "http://www.webtools.org/counter/"; # Whether or not to use locking. If perl complains that flock is not # defined, change this to 0. Not *really* necessary because we check # to make sure it works properly. $UseLocking = 0; # What version of the counter file format are we using? $FileVersion = "02.000"; # Common names of the counter to install... @CommonExtensions = ("-ord", # Ordinam "figlet", # Figlet'ed "figlet-ord",# Ordinal figlet "banner", # Bannered "banner-ord",# Ordinal banner ); # ######################################################################### # # Misc documents to refer people to in case of errors. # $CreateFile = "[Error Creating Counter File -- Click for more info]"; $AccessRights = "[Error Opening Counter File -- Click for more info]"; $TimeoutLock = "[Timeout locking counter file]"; $BadVersion = "[Version access_count newer than this program. Please upgrade.]"; ######################################################################### # # The actual program! ### Stage 1 ### ### Parse the arguments... (just ignore this part) # Get arguments from program name. Argh...what a horrible way to do it! $prog = $0; $prog =~ s/(\.cgi|\.pl)//; #strip .cgi|.pl name extension $prog =~ s!^(.*/)!!; # separate program name $prog =~ s/\\(.)/sprintf("%%%02x", ord($1))/ge; # quote \c to %xx ($printer, @args) = split(/-/, $prog); # args are separated by dashes $printer =~ s/%(..)/pack("c", hex($1))/ge; # unquote printer function name $printer =~ s/$BaseName/counter/; # Make it cannonical. # This gets path info, which is only applicable if you are using our # ssis script (see above). This makes counter/ord the same as counter-ord push(@args, split("/", $ENV{"PATH_INFO"})) if $ENV{"PATH_INFO"}; # put them in assoc array %arg foreach (@args) # means do this for each element in the array { s/%(..)/pack("c", hex($1))/ge; # unquote %xx /^([^=]*)=?(.*)$/; # extract "=" part, if any $arg{$1} = $2 ? $2 : 1; } if ($ARGV[0] eq '-install') { &CheckPerl; &SetBaseName; &MakeCommon(0); exit(0); } if ($ARGV[0] eq '-installforce') { &CheckPerl; &SetBaseName; &MakeCommon(1); exit(0); } if ($ARGV[0] eq '-unlock') { open(FILE,"$FileName"); &UnlockFile(FILE); exit(0); } undef $Link if $arg{'nl'}; # make link? ### Stage 2 ### ### Print out the header # Print out the header print "Content-type: text/html\n\n"; #print "Debug 1: $ConfName
Debug 2: $FileName"; ### Stage 3 ### ### Open the access_count file for read-write taking all the precautions # Make sure the file exists: if (!(-f $FileName)) { if (!open (COUNT,">$FileName")) { # Can't create the file print $CreateFile; exit 1; } else { # We got the file, print out the version number print COUNT "$FileVersion\n"; $version = 2; } } else { if (!((-r $FileName) && (-w $FileName))) { # Make sure that we can in fact read and write to the file in # question. If not, direct them to the FAQ. print $AccessRights; exit 1; } if (!open (COUNT,"+<$FileName")) { # Now make sure it *really* opens print $AccessRights; # ...just in case... exit 1; } # Try to read in a version number $version = ; if (!($version =~ /^\d+.\d+$/)) { # No version number, assume version 1 and reset the file. $version = 1; seek(COUNT,0,0); } } # This is for the future: the access_count file will have a version number. if ($version > 2) { print $BadVersion; exit 1; } ### Stage 4 ### ### Attempt to lock the file $lockerror = &LockFile(COUNT); # You would figure that $MaxTries would equal 0 if it didn't work. The # post-decrement takes it to -1 when the loop finally exits. if ($lockerror) { print $TimeoutLock; exit(0); } ### Stage 5 ### ### Check if we need to update the file to a newer version if ($version < 2) { &UpdateVersion1; } ### Stage 6 ### ### Convert the information the server gave us into the document ### identifier. # Make sure perl doesn't spit out warnings... if (defined $ENV{'DOCUMENT_URI'}) { $doc_uri = $ENV{'DOCUMENT_URI'}; } else { $doc_uri = ""; } # Campatibility: Version 2 files have the server name in front if and # only if it doesn't have a "~" in it. $old_uri = $doc_uri; # Add the server name in front to support multi-homed hosts if and only if # it doesn't have a "~" in it. (usernames are global in most multi-homed # settings if (defined $ENV{'SERVER_NAME'} && !($doc_uri =~ /~/)) { $doc_uri = $ENV{'SERVER_NAME'} . "/" . $doc_uri; } if (defined $arg{'doc'}) { $doc_uri = $arg{'doc'}; } $doc_uri = $Aliases{$doc_uri} if defined $Aliases{$doc_uri}; ### Stage 7 ### ### Find the relevant place in the file $location = tell COUNT; while ($line = ) { # Read the file line-by-line. if (($uri,$accesses) = ($line =~ /^'(\S*)' (\d\d\d\d\d\d\d\d\d\d)$/)) { # An old line if ($uri eq $old_uri) { &ConvertDocV1($doc_uri,$old_uri,$accesses,$location); last; } } elsif (($uri,$accesses,$flags) = ($line =~ /^'(\S*)' (\d\d\d\d\d\d\d\d\d\d) (\w\w\w\w)$/)) { # A new line if ($uri eq $doc_uri) { $flags = hex($flags); last; } } last if ($uri eq $doc_uri); $location = tell COUNT; #reset the fields $accesses = 0; $flags = 0; } ### Stage 8 ### ### Update the access count of the file $accesses += 1; # *NOT* '++' because we don't want '++'s magic ### Stage 9 ### ### Figure out what to print out # If we have to ordinalize, do it now. if (defined $arg{'ord'}) { if (defined $arg{'lang'}) { $ord = eval("&ordinalize_$arg{lang}($accesses)"); } else { $ord = &ordinalize($accesses); } } else { $ord = ""; } $to_print = $accesses . $ord; # Give it to the printer function to actually produce the output from the # ascii text that we have (to_print) ($count, $nLink) = eval("&output_$printer('$to_print')"); # If the above line gave us an error, default to just the text. if ($@) { ($count, $nLink) = &output_counter($to_print); } ### Stage 10 ### ### Now we actually tell the browser what the count is. if (! $arg{"nd"} ) { # If we print anything # Print out a link to something informative (if we were requested to) $script_name = $ENV{'SCRIPT_NAME'}; print "" if $nLink; if ($script_name =~ /cgi-bin\/count(\w+)/) { $img_dir = $1; } if ($img_dir ne "er") { &give_graphic } else { print $count; print "" if $nLink; } } sub give_graphic { @img_count = split(//,$count); foreach (@img_count) { print ""; }; } sub comment1 { # create a new image print "Content-type: image/gif\n\n"; $im = new GD::Image(100,100); # allocate some colors $white = $im->colorAllocate(255,255,255); $black = $im->colorAllocate(0,0,0); $red = $im->colorAllocate(255,0,0); $blue = $im->colorAllocate(0,0,255); # make the background transparent and interlaced $im->transparent($white); $im->interlaced('true'); # Put a black frame around the picture $im->rectangle(0,0,99,99,$black); # Draw a blue oval $im->arc(50,50,95,75,0,360,$blue); # And fill it with red $im->fill(50,50,$red); # Convert the image to GIF and print it on standard output print $im->gif; } ### Stage 11 ### ### Check if we are supposed to update the count in the file. (ie. we're ### not ignoring the host that just accessed us) # Make sure we are not ignoring the host: $ignore = 0; $ignore = grep($ENV{"REMOTE_ADDR"} =~ /$_/, @IgnoreIP) if defined ($ENV{"REMOTE_ADDR"}); $ignore = $ignore || $arg{"nc"}; ### Stage 12 ### ### Actually write the updated information back to the file if (!$ignore) # If we aren't ignoring this access { # Now update the counter file seek(COUNT, $location, 0); $longaccesses = sprintf("%010.10d", $accesses); $hexflags = sprintf("%04.4x", $flags); print COUNT "'$doc_uri' $longaccesses $hexflags\n"; } &UnlockFile(COUNT); close COUNT; ####################################################################### # # Support functions # # translate_output # # Quote any special characters with HTML quoting. sub translate_output { local($string) = @_; $_ = $string; s/è/è/g; return $_; } sub LockFile { local(*FILE) = @_; local($TrysLeft) = $MaxTries; if ($UseLocking) { # Try to get a lock on the file while ($TrysLeft--) { # Try to use locking, if it doesn't use locking, the eval would # die. Catch that, and don't use locking. # Try to grab the lock with a non-blocking (4) exclusive (2) lock. # (4 | 2 = 6) $lockresult = eval("flock(COUNT,6)"); if ($@) { $UseLocking = 0; last; } if (!$lockresult) { select(undef,undef,undef,0.1); # Wait for 1/10 sec. } else { last; # We have gotten the lock. } } } if ($TrysLeft >= 0) { # Success! return 0; } else { return -1; } } sub UnlockFile { local(*FILE) = @_; if ($UseLocking) { flock(FILE,8); # Unlock the file. } } #################################################################### # # Installation helpers # # SetBaseName # # Change the counter program itself to set the basename sub SetBaseName { local($name) = $0; $name =~ s/^.*\/([^\/]+)$/$1/; # Strip off any of the path if ($name eq $BaseName) { # The way we're set up now!!! return; # Don't need to change a thing. } if (!open(COUNTERFILE, "+<$0")) { print "Can't modify program. Set \$BaseName manually.\n"; return; } print "Configuring \$BaseName variable...\n"; local($oldsep) = $/; undef($/); local($program) = ; # The next line does all the magic. $program =~ s/\#\#\# AUTOMAGIC \#\#\#\n\$BaseName = \"[^\"]+\";\n/\#\#\# AUTOMAGIC \#\#\#\n\$BaseName = \"$name\";\n/; seek(COUNTERFILE,0,0) || return; truncate(COUNTERFILE,0); print COUNTERFILE $program; close COUNTERFILE; } # CheckPerl # # Make sure that the "#! /[path]/perl" points to something real... sub CheckPerl { if (!open(COUNTERFILE, "<$0")) { print "Can't check to make sure Perl is in the right place.\n"; return; } print "Checking to make sure Perl is found properly...\n"; $firstline = ; ($command) = ($firstline =~ /^\#! *([^\s]+) *$/); close(COUNTERFILE); if (! -x $command) { print "The location of Perl is misconfigured. Please edit the\n"; print "first line of this program to point to the locally installed\n"; print "copy of perl.\n\n"; print "Currently, it is configured to be \"$command\", however,\n"; print "that file either does not exist or is not a program.\n\n"; print "Some common locations for Perl are:\n"; print " /usr/bin/perl\n"; print " /usr/local/bin/perl\n"; print " /bin/perl\n"; print " /opt/gnu/bin/perl\n\n"; exit; } } # MakeCommon # # Make some common links to the counter sub MakeCommon { local($force) = @_; local($ext); print "Installing the counter...\n"; print " ...making counter executable\n"; chmod(0755,$0); local($path, $name, $cgi); $name = $0; if ($name =~ /^(.*\/)([^\/]+)$/) { $path = $1; $name = $2; } if ($name =~ /^(.*)(\.cgi)$/) { $name = $1, $cgi = $2; } foreach $ext (@CommonExtensions) { print " ...making link from $path$name$cgi to $path$name$ext$cgi\n"; if (!&MakeLink("$path$name$cgi","$path$name$ext$cgi",$force)) { # An error occured while making the link. :-( print " *** An error occured while making the link.\n"; } } if ($symlink_exists == 0 && $link_exists == 0) { print "* NOTE * Your system does not support symbolic or hard links,\n"; print " copies made instead. If you modify the counter, you must\n"; print " run counter -install again to recopy it to the other files.\n"; } print "...done!\n"; } # MakeLink # # Actually create the link. sub MakeLink { local($oldname,$newname,$force) = @_; # Check to see if we can make symbolic links instead of hard links if (!defined $symlink_exists) { $symlink_exists = (eval 'symlink("","");', $@ eq ''); } # Check to see if we can make a link if we can't make a symlink if (!symlink_exists) { $link_exists = (eval 'link("","");', $2 eq ''); } if ($force) { # Check to see if the file exists if (-e $newname) { if (!unlink ($newname)) { return 0; } } } if ($symlink_exists) { return symlink($oldname, $newname); } elsif ($link_exists) { return link($oldname, $newname); } else { # Copy it the old-fashioned way... *sigh* open(OLDFILE, $oldname) || die "Can't open $oldname for copy"; open(NEWFILE, ">$newname") || die "Can't open $newname for write"; while() { print NEWFILE $_; } close(NEWFILE); close(OLDFILE); } } #################################################################### # # Ordinalizing functions # # ordinalize # # Call the appropriate ordinalize function for the default language sub ordinalize { local($count) = @_; if (defined $arg{'lang'}) { return eval("&ordinalize_$arg{lang}($count)"); } else { return eval("&ordinalize_$default_lang($count)"); } } # ordinalize_english # # Figure out what suffix (st, nd, rd, th) a number would have in ordinal # form and return that extension. sub ordinalize_english { local($count) = @_; local($last, $last2); $last2 = $count % 100; $last = $count % 10; if ($last2 < 10 || $last2 > 13) { return "st" if $last == 1; return "nd" if $last == 2; return "rd" if $last == 3; } return "th"; # Catch "eleventh, twelveth, thirteenth" etc. } # ordinalize_french # # Trivial... Return the extension for french. The only exception is 1. # Thank you Chris Polewczuk sub ordinalize_french { local ($count) = @_; if ($count == 1) { return "'ière"; } else { return "ième"; } } # ordinalize_swedish # # A function to ordinalize in Swedish. Thanks go to Johan Linde # for the code! sub ordinalize_swedish { local($count) = @_; local($last, $last2); $last2 = $count % 100; $last = $count % 10; if ($last2 < 10 || $last2 > 12) { return ":a" if ($last == 1 || $last == 2); } return ":e"; } ######################################################################## # # Output functions # # The following are the routines that actually convert the number # of accesses into something that we print out. # # The name of each function is "output_" followed by the program's name. # For instance, is the program is called "counter" then "output_counter" # will be called; a program called "counterbanner" will call # "output_counterbanner" to get the output. # # If the function is not defined, then "output_counter" will be called. # # output_counter # # The simplest function: just returns the number of accesses and the link. sub output_counter { local($count) = @_; return &translate_output($count), $Link; # we return the count and the link } # output_counterord # # Return the number of accesses as an ordinal number. (ie. 1st, 2nd, 3rd, 4th) sub output_counterord { local($count) = @_; return &translate_output($count . &ordinalize($count)), $Link; } # output_counterbanner # # A somewhat silly one that uses the "banner" command to print out the # count. :) You might need to change the path to make it work. sub output_counterbanner { local($count) = @_; $banner = `banner $count`; return "

$banner
"; # return no link here (it would be annoying) } # output_counterfiglet # # An even sillier one than counterbanner. :) sub output_counterfiglet { local($count) = @_; $fig = "echo $count | /usr/games/figlet"; # setup command line $fig .= " -f $arg{'f'}" if $arg{"f"}; # use a different font? $fig = `$fig`; $fig =~ s!&!&!g; $fig =~ s!
" . $fig . "
"; # note no link here, either } ######################################################################### # # Conversion functions # # UpdateVersion # # Convert a version 1file into a version 2 file. sub UpdateVersion1 { local ($contents,$dummy); local ($oldsep) = $/; $/ = ""; seek(COUNT,0,0); # Go to the beginning of the file $contents = ; seek(COUNT,0,0); print COUNT "$FileVersion\n"; print COUNT $contents; seek(COUNT,0,0); $/ = $oldsep; $dummy = ; # Skip the new line } # ConvertDocV1 # # Convert the a version 1 line into a version 2 line sub ConvertDocV1 { local ($doc_uri,$old_uri,$accesses,$location) = @_; local ($contents,$dummy,$oldsep); $oldsep = $/; seek (COUNT,$location,0); # Skip the line in question $dummy = ; $/ = ""; # Read in the whole file $contents = ; seek (COUNT,$location,0); local ($longaccesses,$hexflags); $longaccesses = sprintf("%010.10d", $accesses); $hexflags = sprintf("%04.4x", $flags); # Print out the new stuff print COUNT "'$doc_uri' $longaccesses $hexflags\n"; print COUNT $contents; $/ = $oldsep; } cognoscenti who have ventured to this page since that date.


This page created and maintained by Jim Lowe
First appearance: May 18, 1997
Last updated: April 16, 2008

© 1997, 1998, and 2002, by James R. Lowe, who reserves all rights to the content of this page not successfully claimed by others.